]> git.proxmox.com Git - mirror_ovs.git/commitdiff
travis: Test build with afxdp.
authorIlya Maximets <i.maximets@ovn.org>
Mon, 21 Oct 2019 13:33:04 +0000 (15:33 +0200)
committerIlya Maximets <i.maximets@ovn.org>
Mon, 21 Oct 2019 20:07:00 +0000 (22:07 +0200)
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@ovn.org>
Acked-by: Ben Pfaff <blp@ovn.org>
Acked-by: Aaron Conole <aconole@redhat.com>
.travis.yml
.travis/linux-build.sh

index eabbad92d6e146f5fb327848e03e162093d163b7..5676d9748fca72f9517f738618c15a2d836eafc8 100644 (file)
@@ -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
index 758c8235c06cd09df5cc94e9425babb546749a82..889c7d2fe2b51dd25f633d428d84bf5f3d78abd6 100755 (executable)
@@ -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