Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update p4tc's iproute2 to v17-rc8 #5172

Merged
merged 1 commit into from
Mar 10, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/ci-ubuntu-p4tc-stf.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ jobs:
ENABLE_GTESTS: ${{ matrix.gtest }}
CMAKE_UNITY_BUILD: ${{ matrix.unity }}
BUILD_GENERATOR: Ninja
INSTALL_STF_P4TC_DEPENDENCIES: ON
steps:
- uses: actions/checkout@v4
with:
Expand Down
43 changes: 0 additions & 43 deletions backends/tc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,49 +14,6 @@
# and limitations under the License.
#*****************************************************************************/

if(NOT APPLE)
# Fetch and declare the libbpf library. Print out download state while setting up libbpf.
set(FETCHCONTENT_QUIET_PREV ${FETCHCONTENT_QUIET})
set(FETCHCONTENT_QUIET OFF)
fetchcontent_declare(
p4cbpfrepo
URL https://github.com/libbpf/libbpf/archive/refs/tags/v1.5.0.tar.gz
URL_HASH SHA256=53492aff6dd47e4da04ef5e672d753b9743848bdb38e9d90eafbe190b7983c44
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/runtime/libbpf
USES_TERMINAL_DOWNLOAD TRUE
GIT_PROGRESS TRUE
DOWNLOAD_EXTRACT_TIMESTAMP TRUE
)
fetchcontent_makeavailable(p4cbpfrepo)
set(FETCHCONTENT_QUIET ${FETCHCONTENT_QUIET_PREV})
message("Building libbpf...")
execute_process(
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/runtime/build-libbpf
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
COMMAND_ECHO STDOUT
)
message("Done with setting up libbpf for P4C.")

fetchcontent_declare(
iproute2repo
URL https://github.com/p4tc-dev/iproute2-p4tc-pub/archive/refs/tags/release-v17-rc6.tar.gz
URL_HASH SHA256=624c32a571f9f30d1070d9b23e96121ac79f9273df9ff6db4ee6d034ab983c5d
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/runtime/iproute2-p4tc-pub
USES_TERMINAL_DOWNLOAD TRUE
GIT_PROGRESS TRUE
DOWNLOAD_EXTRACT_TIMESTAMP TRUE
)
fetchcontent_makeavailable(iproute2repo)
set(FETCHCONTENT_QUIET ${FETCHCONTENT_QUIET_PREV})
message("Building iproute2...")
execute_process(
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/runtime/build-iproute2 ${CMAKE_CURRENT_SOURCE_DIR}/runtime
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
COMMAND_ECHO STDOUT
)
message("Done with setting up iproute2 for P4C.")
endif()

set(P4TC_BACKEND_SOURCES
backend.cpp
ebpfCodeGen.cpp
Expand Down
41 changes: 27 additions & 14 deletions tools/ci-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ P4C_DIR=$(readlink -f ${THIS_DIR}/..)
: "${ENABLE_EBPF:=ON}"
# P4TC is enabled by default.
: "${ENABLE_P4TC:=ON}"
# P4TC STF is only enabled when running p4tc tagged PRs.
: "${INSTALL_STF_P4TC_DEPENDENCIES:=OFF}"
# This is the list of back ends that can be enabled.
# Back ends can be enabled from the command line with "ENABLE_[backend]=TRUE/FALSE"
ENABLE_BACKENDS=("TOFINO" "BMV2" "EBPF" "UBPF" "DPDK"
Expand Down Expand Up @@ -216,6 +218,24 @@ fi
# ! ------ END EBPF -----------------------------------------------

# ! ------ BEGIN P4TC -----------------------------------------------
function install_stf_p4tc_test_deps() (
P4C_STF_P4TC_PACKAGES=" libmnl-dev \
bridge-utils \
python3-venv \
qemu qemu-system-x86"
sudo apt-get install -y --no-install-recommends ${P4C_STF_P4TC_PACKAGES}
git clone https://github.com/p4tc-dev/iproute2-p4tc-pub -b master-v17-rc8 ${P4C_DIR}/backends/tc/runtime/iproute2-p4tc-pub
${P4C_DIR}/backends/tc/runtime/build-iproute2 ${P4C_DIR}/backends/tc/runtime
git clone --recurse-submodules https://github.com/arighi/virtme-ng.git ${P4C_DIR}/backends/tc/runtime/virtme-ng
pushd ${P4C_DIR}/backends/tc/runtime/virtme-ng
git checkout v1.19
python3 -m venv ${P4C_DIR}/backends/tc/runtime/virtme-ng
source ${P4C_DIR}/backends/tc/runtime/virtme-ng/bin/activate
pip install --upgrade pip
pip install .
deactivate
)

function build_p4tc() {
P4TC_DEPS="libpcap-dev \
libelf-dev \
Expand All @@ -224,16 +244,12 @@ function build_p4tc() {
net-tools \
flex \
libelf-dev \
libmnl-dev \
pkg-config \
xtables-addons-source \
bridge-utils \
python3 \
python3-pip \
python3-venv \
python3-argcomplete \
wget \
qemu qemu-system-x86"
python3-argcomplete"

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

Expand All @@ -242,15 +258,12 @@ function build_p4tc() {
sudo ./llvm.sh 15
rm llvm.sh

git clone --recurse-submodules https://github.com/arighi/virtme-ng.git ${P4C_DIR}/backends/tc/runtime/virtme-ng
pushd ${P4C_DIR}/backends/tc/runtime/virtme-ng
git checkout v1.19
python3 -m venv ${P4C_DIR}/backends/tc/runtime/virtme-ng
source ${P4C_DIR}/backends/tc/runtime/virtme-ng/bin/activate
pip install --upgrade pip
pip install .
deactivate
popd
git clone https://github.com/libbpf/libbpf/ -b v1.5.0 ${P4C_DIR}/backends/tc/runtime/libbpf
${P4C_DIR}/backends/tc/runtime/build-libbpf

if [[ "${INSTALL_STF_P4TC_DEPENDENCIES}" == "ON" ]] ; then
install_stf_p4tc_test_deps
fi
}
if [[ "${ENABLE_P4TC}" == "ON" ]] ; then
build_p4tc
Expand Down
2 changes: 2 additions & 0 deletions tools/install_fedora_deps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -88,5 +88,7 @@ make -j$((`nproc`+1))
make -j$((`nproc`+1)) install-strip
popd

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

rm -rf "${tmp_dir}"
Loading