[ovs-dev] [PATCH] travis: Test build with afxdp.

Ilya Maximets i.maximets at ovn.org
Mon Oct 21 18:11:14 UTC 2019


We can't easily update the kernel on TravisCI to run system tests
with AF_XDP, but we could run build tests with libbpf and headers
from newer kernels.

Signed-off-by: Ilya Maximets <i.maximets at ovn.org>
---
 .travis.yml            |  1 +
 .travis/linux-build.sh | 34 ++++++++++++++++++++++++++++------
 2 files changed, 29 insertions(+), 6 deletions(-)

diff --git a/.travis.yml b/.travis.yml
index eabbad92d..5676d9748 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -39,6 +39,7 @@ env:
   - TESTSUITE=1 LIBS=-ljemalloc
   - KERNEL_LIST="5.0  4.20 4.19 4.18 4.17 4.16"
   - KERNEL_LIST="4.15 4.14 4.9  4.4  3.19 3.16"
+  - AFXDP=1 KERNEL=5.3
   - M32=1 OPTS="--disable-ssl"
   - DPDK=1 OPTS="--enable-shared"
   - DPDK_SHARED=1
diff --git a/.travis/linux-build.sh b/.travis/linux-build.sh
index 758c8235c..ff4b8fa39 100755
--- a/.travis/linux-build.sh
+++ b/.travis/linux-build.sh
@@ -38,7 +38,7 @@ function install_kernel()
     wget ${url} || wget ${url} || wget ${url/cdn/www}
 
     tar xvf linux-${version}.tar.xz > /dev/null
-    cd linux-${version}
+    pushd linux-${version}
     make allmodconfig
 
     # Cannot use CONFIG_KCOV: -fsanitize-coverage=trace-pc is not supported by compiler
@@ -60,9 +60,26 @@ function install_kernel()
         make net/bridge/
     fi
 
-    EXTRA_OPTS="${EXTRA_OPTS} --with-linux=$(pwd)"
-    echo "Installed kernel source in $(pwd)"
-    cd ..
+    if [ "$AFXDP" ]; then
+        sudo make headers_install INSTALL_HDR_PATH=/usr
+        pushd tools/lib/bpf/
+        # Bulding with gcc because there are some issues in make files
+        # that breaks building libbpf with clang on Travis.
+        CC=gcc sudo make install
+        CC=gcc sudo make install_headers
+        sudo ldconfig
+        popd
+        # The Linux kernel defines __always_inline in stddef.h (283d7573), and
+        # sys/cdefs.h tries to re-define it.  Older libc-dev package in xenial
+        # doesn't have a fix for this issue.  Applying it manually.
+        sudo sed -i '/^# define __always_inline .*/i # undef __always_inline' \
+                    /usr/include/x86_64-linux-gnu/sys/cdefs.h || true
+        EXTRA_OPTS="${EXTRA_OPTS} --enable-afxdp"
+    else
+        EXTRA_OPTS="${EXTRA_OPTS} --with-linux=$(pwd)"
+        echo "Installed kernel source in $(pwd)"
+    fi
+    popd
 }
 
 function install_dpdk()
@@ -127,8 +144,9 @@ function build_ovs()
     configure_ovs $OPTS
     make selinux-policy
 
-    # Only build datapath if we are testing kernel w/o running testsuite
-    if [ "${KERNEL}" ]; then
+    # Only build datapath if we are testing kernel w/o running testsuite and
+    # AF_XDP support.
+    if [ "${KERNEL}" ] && ! [ "$AFXDP" ]; then
         pushd datapath
         make -j4
         popd
@@ -161,6 +179,10 @@ elif [ "$M32" ]; then
     export CC="$CC -m32"
 else
     OPTS="--enable-sparse"
+    if [ "$AFXDP" ]; then
+        # netdev-afxdp uses memset for 64M for umem initialization.
+        SPARSE_FLAGS="${SPARSE_FLAGS} -Wno-memcpy-max-count"
+    fi
     CFLAGS_FOR_OVS="${CFLAGS_FOR_OVS} ${SPARSE_FLAGS}"
 fi
 
-- 
2.17.1



More information about the dev mailing list