Skip to content

Commit d7c0805

Browse files
fruffyvbnogueira
andauthored
Update p4tc's iproute2 to v17-rc8 (#5172)
Signed-off-by: Victor Nogueira <[email protected]> Co-authored-by: Victor Nogueira <[email protected]>
1 parent 6ad7c9a commit d7c0805

File tree

4 files changed

+30
-57
lines changed

4 files changed

+30
-57
lines changed

.github/workflows/ci-ubuntu-p4tc-stf.yml

+1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ jobs:
2121
ENABLE_GTESTS: ${{ matrix.gtest }}
2222
CMAKE_UNITY_BUILD: ${{ matrix.unity }}
2323
BUILD_GENERATOR: Ninja
24+
INSTALL_STF_P4TC_DEPENDENCIES: ON
2425
steps:
2526
- uses: actions/checkout@v4
2627
with:

backends/tc/CMakeLists.txt

-43
Original file line numberDiff line numberDiff line change
@@ -14,49 +14,6 @@
1414
# and limitations under the License.
1515
#*****************************************************************************/
1616

17-
if(NOT APPLE)
18-
# Fetch and declare the libbpf library. Print out download state while setting up libbpf.
19-
set(FETCHCONTENT_QUIET_PREV ${FETCHCONTENT_QUIET})
20-
set(FETCHCONTENT_QUIET OFF)
21-
fetchcontent_declare(
22-
p4cbpfrepo
23-
URL https://github.com/libbpf/libbpf/archive/refs/tags/v1.5.0.tar.gz
24-
URL_HASH SHA256=53492aff6dd47e4da04ef5e672d753b9743848bdb38e9d90eafbe190b7983c44
25-
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/runtime/libbpf
26-
USES_TERMINAL_DOWNLOAD TRUE
27-
GIT_PROGRESS TRUE
28-
DOWNLOAD_EXTRACT_TIMESTAMP TRUE
29-
)
30-
fetchcontent_makeavailable(p4cbpfrepo)
31-
set(FETCHCONTENT_QUIET ${FETCHCONTENT_QUIET_PREV})
32-
message("Building libbpf...")
33-
execute_process(
34-
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/runtime/build-libbpf
35-
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
36-
COMMAND_ECHO STDOUT
37-
)
38-
message("Done with setting up libbpf for P4C.")
39-
40-
fetchcontent_declare(
41-
iproute2repo
42-
URL https://github.com/p4tc-dev/iproute2-p4tc-pub/archive/refs/tags/release-v17-rc6.tar.gz
43-
URL_HASH SHA256=624c32a571f9f30d1070d9b23e96121ac79f9273df9ff6db4ee6d034ab983c5d
44-
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/runtime/iproute2-p4tc-pub
45-
USES_TERMINAL_DOWNLOAD TRUE
46-
GIT_PROGRESS TRUE
47-
DOWNLOAD_EXTRACT_TIMESTAMP TRUE
48-
)
49-
fetchcontent_makeavailable(iproute2repo)
50-
set(FETCHCONTENT_QUIET ${FETCHCONTENT_QUIET_PREV})
51-
message("Building iproute2...")
52-
execute_process(
53-
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/runtime/build-iproute2 ${CMAKE_CURRENT_SOURCE_DIR}/runtime
54-
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
55-
COMMAND_ECHO STDOUT
56-
)
57-
message("Done with setting up iproute2 for P4C.")
58-
endif()
59-
6017
set(P4TC_BACKEND_SOURCES
6118
backend.cpp
6219
ebpfCodeGen.cpp

tools/ci-build.sh

+27-14
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ P4C_DIR=$(readlink -f ${THIS_DIR}/..)
5252
: "${ENABLE_EBPF:=ON}"
5353
# P4TC is enabled by default.
5454
: "${ENABLE_P4TC:=ON}"
55+
# P4TC STF is only enabled when running p4tc tagged PRs.
56+
: "${INSTALL_STF_P4TC_DEPENDENCIES:=OFF}"
5557
# This is the list of back ends that can be enabled.
5658
# Back ends can be enabled from the command line with "ENABLE_[backend]=TRUE/FALSE"
5759
ENABLE_BACKENDS=("TOFINO" "BMV2" "EBPF" "UBPF" "DPDK"
@@ -216,6 +218,24 @@ fi
216218
# ! ------ END EBPF -----------------------------------------------
217219

218220
# ! ------ BEGIN P4TC -----------------------------------------------
221+
function install_stf_p4tc_test_deps() (
222+
P4C_STF_P4TC_PACKAGES=" libmnl-dev \
223+
bridge-utils \
224+
python3-venv \
225+
qemu qemu-system-x86"
226+
sudo apt-get install -y --no-install-recommends ${P4C_STF_P4TC_PACKAGES}
227+
git clone https://github.com/p4tc-dev/iproute2-p4tc-pub -b master-v17-rc8 ${P4C_DIR}/backends/tc/runtime/iproute2-p4tc-pub
228+
${P4C_DIR}/backends/tc/runtime/build-iproute2 ${P4C_DIR}/backends/tc/runtime
229+
git clone --recurse-submodules https://github.com/arighi/virtme-ng.git ${P4C_DIR}/backends/tc/runtime/virtme-ng
230+
pushd ${P4C_DIR}/backends/tc/runtime/virtme-ng
231+
git checkout v1.19
232+
python3 -m venv ${P4C_DIR}/backends/tc/runtime/virtme-ng
233+
source ${P4C_DIR}/backends/tc/runtime/virtme-ng/bin/activate
234+
pip install --upgrade pip
235+
pip install .
236+
deactivate
237+
)
238+
219239
function build_p4tc() {
220240
P4TC_DEPS="libpcap-dev \
221241
libelf-dev \
@@ -224,16 +244,12 @@ function build_p4tc() {
224244
net-tools \
225245
flex \
226246
libelf-dev \
227-
libmnl-dev \
228247
pkg-config \
229248
xtables-addons-source \
230-
bridge-utils \
231249
python3 \
232250
python3-pip \
233-
python3-venv \
234-
python3-argcomplete \
235251
wget \
236-
qemu qemu-system-x86"
252+
python3-argcomplete"
237253

238254
sudo apt-get install -y --no-install-recommends ${P4TC_DEPS}
239255

@@ -242,15 +258,12 @@ function build_p4tc() {
242258
sudo ./llvm.sh 15
243259
rm llvm.sh
244260

245-
git clone --recurse-submodules https://github.com/arighi/virtme-ng.git ${P4C_DIR}/backends/tc/runtime/virtme-ng
246-
pushd ${P4C_DIR}/backends/tc/runtime/virtme-ng
247-
git checkout v1.19
248-
python3 -m venv ${P4C_DIR}/backends/tc/runtime/virtme-ng
249-
source ${P4C_DIR}/backends/tc/runtime/virtme-ng/bin/activate
250-
pip install --upgrade pip
251-
pip install .
252-
deactivate
253-
popd
261+
git clone https://github.com/libbpf/libbpf/ -b v1.5.0 ${P4C_DIR}/backends/tc/runtime/libbpf
262+
${P4C_DIR}/backends/tc/runtime/build-libbpf
263+
264+
if [[ "${INSTALL_STF_P4TC_DEPENDENCIES}" == "ON" ]] ; then
265+
install_stf_p4tc_test_deps
266+
fi
254267
}
255268
if [[ "${ENABLE_P4TC}" == "ON" ]] ; then
256269
build_p4tc

tools/install_fedora_deps.sh

+2
Original file line numberDiff line numberDiff line change
@@ -88,5 +88,7 @@ make -j$((`nproc`+1))
8888
make -j$((`nproc`+1)) install-strip
8989
popd
9090

91+
git clone https://github.com/libbpf/libbpf/ -b v1.5.0 ${P4C_DIR}/backends/tc/runtime/libbpf
92+
${P4C_DIR}/backends/tc/runtime/build-libbpf
9193

9294
rm -rf "${tmp_dir}"

0 commit comments

Comments
 (0)