Message ID | 1607977825-30877-1-git-send-email-ian.stokes@intel.com |
---|---|
State | Changes Requested |
Headers | show |
Series | [ovs-dev,v3,1/1] dpdk: Update to use DPDK v20.11. | expand |
On 12/14/20 9:30 PM, Ian Stokes wrote: > This commit adds support for DPDK v20.11, it includes the following > changes. > > 1. travis: Remove explicit DPDK kmods configuration. > 2. sparse: Fix build with 20.05 DPDK tracepoints. > 3. netdev-dpdk: Remove experimental API flag. > > http://patchwork.ozlabs.org/project/openvswitch/list/?series=173216&state=* > > 4. sparse: Update to DPDK 20.05 trace point header. > > http://patchwork.ozlabs.org/project/openvswitch/list/?series=179604&state=* > > 5. sparse: Fix build with DPDK 20.08. > > http://patchwork.ozlabs.org/project/openvswitch/list/?series=200181&state=* > > 6. build: Add support for DPDK meson build. > > http://patchwork.ozlabs.org/project/openvswitch/list/?series=199138&state=* > > 7. netdev-dpdk: Remove usage of RTE_ETH_DEV_CLOSE_REMOVE flag. > > http://patchwork.ozlabs.org/project/openvswitch/list/?series=207850&state=* > > 8. netdev-dpdk: Fix build with 20.11-rc1. > > http://patchwork.ozlabs.org/project/openvswitch/list/?series=209006&state=* > > 9. sparse: Fix __ATOMIC_* redefinition errors > > http://patchwork.ozlabs.org/project/openvswitch/list/?series=209452&state=* > > 10. build: Remove DPDK make build references. > > http://patchwork.ozlabs.org/project/openvswitch/list/?series=216682&state=* > > For credit all authors of the original commits to 'dpdk-latest' with the > above changes have been added as co-authors for this commit. > > Signed-off-by: David Marchand <david.marchand@redhat.com> > Co-authored-by: David Marchand <david.marchand@redhat.com> > Signed-off-by: Sunil Pai G <sunil.pai.g@intel.com> > Co-authored-by: Sunil Pai G <sunil.pai.g@intel.com> > Signed-off-by: Eli Britstein <elibr@nvidia.com> > Co-authored-by: Eli Britstein <elibr@nvidia.com> > Tested-by: Harry van Haaren <harry.van.haaren@intel.com> > Tested-by: Govindharajan, Hariprasad <hariprasad.govindharajan@intel.com> > Signed-off-by: Ian Stokes <ian.stokes@intel.com> > > --- > v2 -> v3 > * Remove GHA others write removal. > * Strip march from pkg-config h=which is forced by DPDK. Thanks. Beside the pkg-config version checking issue from the separate thread, few minor comments inline. > > RFC v1 -> v2 > * Removed RFC tag. > * Rebased to head of master. > * Modified GHA build scripts to install required python packages. > * Modified URLs to use versioned 20.11 links. > * Removed unrequired reformat in travis.yml. > * Modified GHA worflow buil-and-test.yml to remove others write > permission to $HOME in prepare step. > --- > .ci/linux-build.sh | 48 ++++++++++++------- > .ci/linux-prepare.sh | 1 + > .github/workflows/build-and-test.yml | 5 +- > .travis.yml | 3 ++ > Documentation/intro/install/afxdp.rst | 2 +- > Documentation/intro/install/dpdk.rst | 64 ++++++++++++++----------- > Documentation/topics/dpdk/phy.rst | 18 ++++--- > Documentation/topics/dpdk/vhost-user.rst | 20 +------- > Documentation/topics/testing.rst | 2 +- > NEWS | 1 + > acinclude.m4 | 82 ++++++++++++++------------------ > include/sparse/automake.mk | 2 + > include/sparse/rte_mbuf.h | 29 +++++++++++ > include/sparse/rte_trace_point.h | 28 +++++++++++ > lib/dpdk.c | 2 +- > lib/netdev-dpdk.c | 20 ++------ > 16 files changed, 190 insertions(+), 137 deletions(-) > create mode 100644 include/sparse/rte_mbuf.h > create mode 100644 include/sparse/rte_trace_point.h > > diff --git a/.ci/linux-build.sh b/.ci/linux-build.sh > index 16102ac94..3e5136fd4 100755 > --- a/.ci/linux-build.sh > +++ b/.ci/linux-build.sh > @@ -87,17 +87,29 @@ function install_dpdk() > { > local DPDK_VER=$1 > local VERSION_FILE="dpdk-dir/travis-dpdk-cache-version" > + local DPDK_OPTS="" > + local DPDK_LIB="" > > if [ -z "$TRAVIS_ARCH" ] || > [ "$TRAVIS_ARCH" == "amd64" ]; then > - TARGET="x86_64-native-linuxapp-gcc" > + DPDK_LIB=$(pwd)/dpdk-dir/build/lib/x86_64-linux-gnu > elif [ "$TRAVIS_ARCH" == "aarch64" ]; then > - TARGET="arm64-armv8a-linuxapp-gcc" > + DPDK_LIB=$(pwd)/dpdk-dir/build/lib/aarch64-linux-gnu > else > echo "Target is unknown" > exit 1 > fi > > + if [ "$DPDK_SHARED" ]; then > + EXTRA_OPTS="$EXTRA_OPTS --with-dpdk=shared" > + export LD_LIBRARY_PATH=$DPDK_LIB/:$LD_LIBRARY_PATH > + else > + EXTRA_OPTS="$EXTRA_OPTS --with-dpdk=static" > + fi > + > + # Export the following path for pkg-config to find the .pc file. > + export PKG_CONFIG_PATH=$DPDK_LIB/pkgconfig/:$PKG_CONFIG_PATH > + > if [ "${DPDK_VER##refs/*/}" != "${DPDK_VER}" ]; then > # Avoid using cache for git tree build. > rm -rf dpdk-dir > @@ -110,7 +122,8 @@ function install_dpdk() > if [ -f "${VERSION_FILE}" ]; then > VER=$(cat ${VERSION_FILE}) > if [ "${VER}" = "${DPDK_VER}" ]; then > - EXTRA_OPTS="${EXTRA_OPTS} --with-dpdk=$(pwd)/dpdk-dir/build" > + # Update the library paths. > + sudo ldconfig > echo "Found cached DPDK ${VER} build in $(pwd)/dpdk-dir" > return > fi > @@ -124,23 +137,24 @@ function install_dpdk() > pushd dpdk-dir > fi > > - make config CC=gcc T=$TARGET > + # Switching to 'default' machine to make dpdk-dir cache usable on > + # different CPUs. We can't be sure that all CI machines are exactly same. > + DPDK_OPTS="$DPDK_OPTS -Dmachine=default" > > - if [ "$DPDK_SHARED" ]; then > - sed -i '/CONFIG_RTE_BUILD_SHARED_LIB=n/s/=n/=y/' build/.config > - export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$(pwd)/$TARGET/lib > - fi > + # Disable building DPDK unit tests. Not needed for OVS build or tests. > + DPDK_OPTS="$DPDK_OPTS -Dtests=false" > + > + # Install DPDK using prefix. > + DPDK_OPTS="$DPDK_OPTS --prefix=$(pwd)/build" > + > + CC=gcc meson $DPDK_OPTS build > + ninja -C build > + ninja -C build install > > - # Disable building DPDK kernel modules. Not needed for OVS build or tests. > - sed -i '/CONFIG_RTE_EAL_IGB_UIO=y/s/=y/=n/' build/.config > - sed -i '/CONFIG_RTE_KNI_KMOD=y/s/=y/=n/' build/.config > + # Update the library paths. > + sudo ldconfig > > - # Switching to 'default' machine to make dpdk-dir cache usable on different > - # CPUs. We can't be sure that all CI machines are exactly same. > - sed -i '/CONFIG_RTE_MACHINE="native"/s/="native"/="default"/' build/.config > > - make -j4 CC=gcc EXTRA_CFLAGS='-fPIC' > - EXTRA_OPTS="$EXTRA_OPTS --with-dpdk=$(pwd)/build" > echo "Installed DPDK source in $(pwd)" > popd > echo "${DPDK_VER}" > ${VERSION_FILE} > @@ -187,7 +201,7 @@ fi > > if [ "$DPDK" ] || [ "$DPDK_SHARED" ]; then > if [ -z "$DPDK_VER" ]; then > - DPDK_VER="19.11.2" > + DPDK_VER="20.11" > fi > install_dpdk $DPDK_VER > if [ "$CC" = "clang" ]; then > diff --git a/.ci/linux-prepare.sh b/.ci/linux-prepare.sh > index fea905a83..69a40011f 100755 > --- a/.ci/linux-prepare.sh > +++ b/.ci/linux-prepare.sh > @@ -22,6 +22,7 @@ cd .. > > pip3 install --disable-pip-version-check --user flake8 hacking > pip3 install --user --upgrade docutils > +pip3 install --user 'meson==0.47.1' > > if [ "$M32" ]; then > # Installing 32-bit libraries. > diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml > index 847fd3150..c83066138 100644 > --- a/.github/workflows/build-and-test.yml > +++ b/.github/workflows/build-and-test.yml > @@ -8,7 +8,8 @@ jobs: > dependencies: | > automake libtool gcc bc libjemalloc1 libjemalloc-dev \ > libssl-dev llvm-dev libelf-dev libnuma-dev libpcap-dev \ > - python3-openssl python3-pip python3-sphinx \ > + ninja-build python3-openssl python3-pip \ > + python3-setuptools python3-sphinx python3-wheel \ > selinux-policy-dev > deb_dependencies: | > linux-headers-$(uname -r) build-essential fakeroot devscripts equivs > @@ -146,7 +147,7 @@ jobs: > run: ./.ci/linux-prepare.sh > > - name: build > - run: PATH="$PATH:$HOME/bin" ./.ci/linux-build.sh > + run: PATH="$PATH:$HOME/bin:$HOME/.local/bin" ./.ci/linux-build.sh > > - name: upload deb packages > if: matrix.deb_package != '' > diff --git a/.travis.yml b/.travis.yml > index acf3c10fb..51d051108 100644 > --- a/.travis.yml > +++ b/.travis.yml > @@ -24,6 +24,9 @@ addons: > - selinux-policy-dev > - libunbound-dev > - libunwind-dev > + - python3-setuptools > + - python3-wheel > + - ninja-build > > before_install: ./.ci/${TRAVIS_OS_NAME}-prepare.sh > > diff --git a/Documentation/intro/install/afxdp.rst b/Documentation/intro/install/afxdp.rst > index 3c8f78825..aad0aeebe 100644 > --- a/Documentation/intro/install/afxdp.rst > +++ b/Documentation/intro/install/afxdp.rst > @@ -396,7 +396,7 @@ PVP using vhostuser device > -------------------------- > First, build OVS with DPDK and AFXDP:: > > - ./configure --enable-afxdp --with-dpdk=<dpdk path> > + ./configure --enable-afxdp --with-dpdk=shared|static > make -j4 && make install > > Create a vhost-user port from OVS:: > diff --git a/Documentation/intro/install/dpdk.rst b/Documentation/intro/install/dpdk.rst > index fe11571d2..4f0c10082 100644 > --- a/Documentation/intro/install/dpdk.rst > +++ b/Documentation/intro/install/dpdk.rst > @@ -42,7 +42,7 @@ Build requirements > In addition to the requirements described in :doc:`general`, building Open > vSwitch with DPDK will require the following: > > -- DPDK 19.11.2 > +- DPDK 20.11 > > - A `DPDK supported NIC`_ > > @@ -62,6 +62,8 @@ Detailed system requirements can be found at `DPDK requirements`_. > .. _DPDK supported NIC: http://dpdk.org/doc/nics > .. _DPDK requirements: http://dpdk.org/doc/guides/linux_gsg/sys_reqs.html These links should be versioned. I see that they wasn't before, but they should. Could be done as a separate change later, though. > > +.. _dpdk-install: > + > Installing > ---------- > > @@ -71,38 +73,44 @@ Install DPDK > #. Download the `DPDK sources`_, extract the file and set ``DPDK_DIR``:: > > $ cd /usr/src/ > - $ wget https://fast.dpdk.org/rel/dpdk-19.11.2.tar.xz > - $ tar xf dpdk-19.11.2.tar.xz > - $ export DPDK_DIR=/usr/src/dpdk-stable-19.11.2 > + $ wget https://fast.dpdk.org/rel/dpdk-20.11.tar.xz > + $ tar xf dpdk-20.11.tar.xz > + $ export DPDK_DIR=/usr/src/dpdk-20.11 > $ cd $DPDK_DIR > > -#. (Optional) Configure DPDK as a shared library > +#. Configure and install DPDK using Meson > > - DPDK can be built as either a static library or a shared library. By > - default, it is configured for the former. If you wish to use the latter, set > - ``CONFIG_RTE_BUILD_SHARED_LIB=y`` in ``$DPDK_DIR/config/common_base``. > + Build and install the DPDK library:: > > - .. note:: > + $ export DPDK_BUILD=$DPDK_DIR/build > + $ meson build > + $ ninja -C build > + $ sudo ninja -C build install > + $ sudo ldconfig > > - Minor performance loss is expected when using OVS with a shared DPDK > - library compared to a static DPDK library. > + Detailed information can be found at `DPDK documentation`_. > > -#. Configure and install DPDK > +#. (Optional) Configure and export the DPDK shared library location > > - Build and install the DPDK library:: > + Since DPDK is built both as static and shared library by default, no extra > + configuration is required for the build. > > - $ export DPDK_TARGET=x86_64-native-linuxapp-gcc > - $ export DPDK_BUILD=$DPDK_DIR/$DPDK_TARGET > - $ make install T=$DPDK_TARGET DESTDIR=install > + Exporting the path to library is not necessary if the DPDK libraries are > + system installed. For libraries installed using a prefix, export the path > + to this library and also update the $PKG_CONFIG_PATH for use > + before building OVS:: > > -#. (Optional) Export the DPDK shared library location > + $ export LD_LIBRARY_PATH=/path/to/installed/DPDK/libraries > + $ export PKG_CONFIG_PATH=/path/to/installed/".pc" file/for/DPDK > > - If DPDK was built as a shared library, export the path to this library for > - use when building OVS:: > + .. note:: > > - $ export LD_LIBRARY_PATH=$DPDK_DIR/x86_64-native-linuxapp-gcc/lib > + Minor performance loss is expected when using OVS with a shared DPDK > + library compared to a static DPDK library. > > .. _DPDK sources: http://dpdk.org/rel > +.. _DPDK documentation: > + https://doc.dpdk.org/guides-20.08/linux_gsg/build_dpdk.html s/20.08/20.11/ > > Install OVS > ~~~~~~~~~~~ > @@ -121,16 +129,16 @@ has to be configured to build against the DPDK library (``--with-dpdk``). > > #. Bootstrap, if required, as described in :ref:`general-bootstrapping` > > -#. Configure the package using the ``--with-dpdk`` flag:: > +#. Configure the package using the ``--with-dpdk`` flag: > + > + If OVS must consume DPDK static libraries > + (also equivalent to ``--with-dpdk=yes`` ):: > > - $ ./configure --with-dpdk=$DPDK_BUILD > + $ ./configure --with-dpdk=static > > - where ``DPDK_BUILD`` is the path to the built DPDK library. This can be > - skipped if DPDK library is installed in its default location. > + If OVS must consume DPDK shared libraries:: > > - If no path is provided to ``--with-dpdk``, but a pkg-config configuration > - for libdpdk is available the include paths will be generated via an > - equivalent ``pkg-config --cflags libdpdk``. > + $ ./configure --with-dpdk=shared > > .. note:: > While ``--with-dpdk`` is required, you can pass any other configuration > @@ -703,7 +711,7 @@ Limitations > release notes`_. > > .. _DPDK release notes: > - https://doc.dpdk.org/guides-19.11/rel_notes/release_19_11.html > + https://doc.dpdk.org/guides-20.11/rel_notes/release_20_11.html > > - Upper bound MTU: DPDK device drivers differ in how the L2 frame for a > given MTU value is calculated e.g. i40e driver includes 2 x vlan headers in > diff --git a/Documentation/topics/dpdk/phy.rst b/Documentation/topics/dpdk/phy.rst > index 7ee3eacff..d21ecc915 100644 > --- a/Documentation/topics/dpdk/phy.rst > +++ b/Documentation/topics/dpdk/phy.rst > @@ -218,18 +218,24 @@ If the log is not seen then the port can be detached like so:: > Hotplugging with IGB_UIO > ~~~~~~~~~~~~~~~~~~~~~~~~ > > -As of DPDK 19.11, default igb_uio hotplugging behavior changes from > +.. important:: > + > + As of DPDK v20.11 IGB_UIO has been deprecated and is no longer built as > + part of the default DPDK library. Below is intended for those who wish > + to use IGB_UIO outside of the standard DPDK build from v20.11 onwards. > + > +As of DPDK v19.11, default igb_uio hotplugging behavior changed from > previous DPDK versions. > > -With DPDK 19.11, if no device is bound to igb_uio when OVS is launched then > -the IOVA mode may be set to virtual addressing for DPDK. This is incompatible > -for hotplugging with igb_uio. > +From DPDK v19.11 onwards, if no device is bound to igb_uio when OVS is > +launched then the IOVA mode may be set to virtual addressing for DPDK. > +This is incompatible for hotplugging with igb_uio. > > To hotplug a port with igb_uio in this case, DPDK must be configured to use > physical addressing for IOVA mode. For more information regarding IOVA modes > in DPDK please refer to the `DPDK IOVA Mode Detection`__. > > -__ https://doc.dpdk.org/guides-19.11/prog_guide/env_abstraction_layer.html#iova-mode-detection > +__ https://doc.dpdk.org/guides-20.11/prog_guide/env_abstraction_layer.html#iova-mode-detection > > To configure OVS DPDK to use physical addressing for IOVA:: > > @@ -261,7 +267,7 @@ Representors are multi devices created on top of one PF. > > For more information, refer to the `DPDK documentation`__. > > -__ https://doc.dpdk.org/guides-19.11/prog_guide/switch_representation.html > +__ https://doc.dpdk.org/guides-20.11/prog_guide/switch_representation.html > > Prior to port representors there was a one-to-one relationship between the PF > and the eth device. With port representors the relationship becomes one PF to > diff --git a/Documentation/topics/dpdk/vhost-user.rst b/Documentation/topics/dpdk/vhost-user.rst > index 75d3fc958..bcd51e65c 100644 > --- a/Documentation/topics/dpdk/vhost-user.rst > +++ b/Documentation/topics/dpdk/vhost-user.rst > @@ -389,23 +389,7 @@ application in the VM. > > To begin, instantiate a guest as described in :ref:`dpdk-vhost-user` or > :ref:`dpdk-vhost-user-client`. Once started, connect to the VM, download the > -DPDK sources to VM and build DPDK:: > - > - $ cd /root/dpdk/ > - $ wget https://fast.dpdk.org/rel/dpdk-19.11.2.tar.xz > - $ tar xf dpdk-19.11.2.tar.xz > - $ export DPDK_DIR=/root/dpdk/dpdk-stable-19.11.2 > - $ export DPDK_TARGET=x86_64-native-linuxapp-gcc > - $ export DPDK_BUILD=$DPDK_DIR/$DPDK_TARGET > - $ cd $DPDK_DIR > - $ make install T=$DPDK_TARGET DESTDIR=install > - > -Build the test-pmd application:: > - > - $ cd app/test-pmd > - $ export RTE_SDK=$DPDK_DIR > - $ export RTE_TARGET=$DPDK_TARGET > - $ make > +DPDK sources to VM and build DPDK as described in :ref:`dpdk-install`. > > Setup huge pages and DPDK devices using UIO:: > > @@ -555,4 +539,4 @@ shown with:: > > Further information can be found in the > `DPDK documentation > -<https://doc.dpdk.org/guides-19.11/prog_guide/vhost_lib.html>`__ > +<https://doc.dpdk.org/guides-20.11/prog_guide/vhost_lib.html>`__ > diff --git a/Documentation/topics/testing.rst b/Documentation/topics/testing.rst > index b9fa94dda..951fe9e85 100644 > --- a/Documentation/topics/testing.rst > +++ b/Documentation/topics/testing.rst > @@ -353,7 +353,7 @@ All tests are skipped if no hugepages are configured. User must look into the DP > manual to figure out how to `Configure hugepages`_. > The phy test will skip if no compatible physical device is available. > > -.. _Configure hugepages: https://doc.dpdk.org/guides-19.11/linux_gsg/sys_reqs.html > +.. _Configure hugepages: https://doc.dpdk.org/guides-20.11/linux_gsg/sys_reqs.html > > All the features documented under `Unit Tests`_ are available for the DPDK > datapath testsuite. > diff --git a/NEWS b/NEWS > index 7e291a180..1a39cc661 100644 > --- a/NEWS > +++ b/NEWS > @@ -11,6 +11,7 @@ Post-v2.14.0 > Use the 'cluster/set-backlog-threshold' command to change limits. > - DPDK: > * Removed support for vhost-user dequeue zero-copy. > + * Add support for DPDK 20.11. > - Userspace datapath: > * Add the 'pmd' option to "ovs-appctl dpctl/dump-flows", which > restricts a flow dump to a single PMD thread if set. > diff --git a/acinclude.m4 b/acinclude.m4 > index ddf4b71e1..3df496666 100644 > --- a/acinclude.m4 > +++ b/acinclude.m4 > @@ -334,8 +334,9 @@ dnl > dnl Configure DPDK source tree > AC_DEFUN([OVS_CHECK_DPDK], [ > AC_ARG_WITH([dpdk], > - [AC_HELP_STRING([--with-dpdk=/path/to/dpdk], > - [Specify the DPDK build directory])], > + [AC_HELP_STRING([--with-dpdk=static|shared|yes], > + [Specify "static" or "shared" depending on the > + DPDK libraries to use])], > [have_dpdk=true]) > > AC_MSG_CHECKING([whether dpdk is enabled]) > @@ -345,35 +346,25 @@ AC_DEFUN([OVS_CHECK_DPDK], [ > else > AC_MSG_RESULT([yes]) > case "$with_dpdk" in > - yes) > - DPDK_AUTO_DISCOVER="true" > - PKG_CHECK_MODULES_STATIC([DPDK], [libdpdk], [ > - DPDK_INCLUDE="$DPDK_CFLAGS" > - DPDK_LIB="$DPDK_LIBS"], [ > - DPDK_INCLUDE="-I/usr/local/include/dpdk -I/usr/include/dpdk" > - DPDK_LIB="-ldpdk"]) > - ;; > - *) > - DPDK_AUTO_DISCOVER="false" > - DPDK_INCLUDE_PATH="$with_dpdk/include" > - # If 'with_dpdk' is passed install directory, point to headers > - # installed in $DESTDIR/$prefix/include/dpdk > - if test -e "$DPDK_INCLUDE_PATH/rte_config.h"; then > - DPDK_INCLUDE="-I$DPDK_INCLUDE_PATH" > - elif test -e "$DPDK_INCLUDE_PATH/dpdk/rte_config.h"; then > - DPDK_INCLUDE="-I$DPDK_INCLUDE_PATH/dpdk" > - fi > - DPDK_LIB_DIR="$with_dpdk/lib" > - DPDK_LIB="-ldpdk" > - ;; > + "shared") > + PKG_CHECK_MODULES([DPDK], [libdpdk], [ > + DPDK_INCLUDE="$DPDK_CFLAGS" > + DPDK_LIB="$DPDK_LIBS"], [ > + DPDK_INCLUDE="-I/usr/local/include/dpdk -I/usr/include/dpdk" > + DPDK_LIB="-ldpdk"]) > + ;; > + "static" | "yes") > + PKG_CHECK_MODULES_STATIC([DPDK], [libdpdk], [ > + DPDK_INCLUDE="$DPDK_CFLAGS" > + DPDK_LIB="$DPDK_LIBS"], [ > + DPDK_INCLUDE="-I/usr/local/include/dpdk -I/usr/include/dpdk" > + DPDK_LIB="-ldpdk"]) > + ;; > esac > > ovs_save_CFLAGS="$CFLAGS" > ovs_save_LDFLAGS="$LDFLAGS" > CFLAGS="$CFLAGS $DPDK_INCLUDE" > - if test "$DPDK_AUTO_DISCOVER" = "false"; then > - LDFLAGS="$LDFLAGS -L${DPDK_LIB_DIR}" > - fi > > AC_CHECK_HEADERS([rte_config.h], [], [ > AC_MSG_ERROR([unable to find rte_config.h in $with_dpdk]) > @@ -422,20 +413,18 @@ AC_DEFUN([OVS_CHECK_DPDK], [ > [AC_MSG_RESULT([yes]) > DPDKLIB_FOUND=true], > [AC_MSG_RESULT([no]) > - if test "$DPDK_AUTO_DISCOVER" = "true"; then > - AC_MSG_ERROR(m4_normalize([ > - Could not find DPDK library in default search path, Use --with-dpdk > - to specify the DPDK library installed in non-standard location])) > - else > - AC_MSG_ERROR([Could not find DPDK libraries in $DPDK_LIB_DIR]) > - fi > + AC_MSG_ERROR(m4_normalize([ > + Could not find DPDK library in default search path, update > + PKG_CONFIG_PATH for pkg-config to find the .pc file in > + non-standard location])) > ]) > > CFLAGS="$ovs_save_CFLAGS" > LDFLAGS="$ovs_save_LDFLAGS" > - if test "$DPDK_AUTO_DISCOVER" = "false"; then > - OVS_LDFLAGS="$OVS_LDFLAGS -L$DPDK_LIB_DIR" > - fi > + # Stripping out possible instruction set specific configuration that DPDK > + # forces in pkg-config since this could override user-specified options. > + # It's enough to have -mssse3 to build with DPDK headers. > + DPDK_INCLUDE=$(echo "$DPDK_INCLUDE" | sed 's/-march=[[a-z0-9]]*//g') > OVS_CFLAGS="$OVS_CFLAGS $DPDK_INCLUDE" > OVS_ENABLE_OPTION([-mssse3]) > > @@ -444,17 +433,16 @@ AC_DEFUN([OVS_CHECK_DPDK], [ > # This happens because the rest of the DPDK code doesn't use any symbol in > # the pmd driver objects, and the drivers register themselves using an > # __attribute__((constructor)) function. > - # > - # These options are specified inside a single -Wl directive to prevent > - # autotools from reordering them. > - # > - # OTOH newer versions of dpdk pkg-config (generated with Meson) > - # will already have flagged just the right set of libs with > - # --whole-archive - in those cases do not wrap it once more. > - case "$DPDK_LIB" in > - *whole-archive*) DPDK_vswitchd_LDFLAGS=$DPDK_LIB;; > - *) DPDK_vswitchd_LDFLAGS=-Wl,--whole-archive,$DPDK_LIB,--no-whole-archive > - esac > + > + # Wrap the DPDK libraries inside a single -Wl directive > + # after comma separation to prevent autotools from reordering them. > + DPDK_vswitchd_LDFLAGS=$(echo "$DPDK_LIB"| tr -s ' ' ',' | sed 's/-Wl,//g') > + # Replace -pthread with -lpthread for LD and remove the last extra comma. > + DPDK_vswitchd_LDFLAGS=$(echo "$DPDK_vswitchd_LDFLAGS"| sed 's/,$//' | \ > + sed 's/-pthread/-lpthread/g') > + # Prepend "-Wl,". > + DPDK_vswitchd_LDFLAGS="-Wl,$DPDK_vswitchd_LDFLAGS" > + > AC_SUBST([DPDK_vswitchd_LDFLAGS]) > AC_DEFINE([DPDK_NETDEV], [1], [System uses the DPDK module.]) > fi > diff --git a/include/sparse/automake.mk b/include/sparse/automake.mk > index 974ad3fe5..e96637119 100644 > --- a/include/sparse/automake.mk > +++ b/include/sparse/automake.mk > @@ -11,7 +11,9 @@ noinst_HEADERS += \ > include/sparse/netpacket/packet.h \ > include/sparse/pthread.h \ > include/sparse/rte_atomic.h \ > + include/sparse/rte_mbuf.h \ > include/sparse/rte_memcpy.h \ > + include/sparse/rte_trace_point.h \ > include/sparse/sys/socket.h \ > include/sparse/sys/sysmacros.h \ > include/sparse/sys/types.h \ > diff --git a/include/sparse/rte_mbuf.h b/include/sparse/rte_mbuf.h > new file mode 100644 > index 000000000..981cdb441 > --- /dev/null > +++ b/include/sparse/rte_mbuf.h > @@ -0,0 +1,29 @@ > +/* Copyright (c) 2020 Intel, Inc. > + * > + * Licensed under the Apache License, Version 2.0 (the "License"); > + * you may not use this file except in compliance with the License. > + * You may obtain a copy of the License at: > + * > + * http://www.apache.org/licenses/LICENSE-2.0 > + * > + * Unless required by applicable law or agreed to in writing, software > + * distributed under the License is distributed on an "AS IS" BASIS, > + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. > + * See the License for the specific language governing permissions and > + * limitations under the License. > + */ > + > +#ifndef __CHECKER__ > +#error "Use this header only with sparse. It is not a correct implementation." > +#endif > + > +/* sparse doesn't know about gcc atomic builtins. */ > +#ifndef __ATOMIC_ACQ_REL > +#define __ATOMIC_ACQ_REL 0 > +#define __ATOMIC_RELAXED 1 > +#define __atomic_add_fetch(p, val, memorder) (*(p) = *(p) + (val)) > +#define __atomic_store_n(p, val, memorder) (*(p) = (val)) > +#endif > + > +/* Get actual <rte_mbuf.h> definitions for us to annotate and build on. */ > +#include_next <rte_mbuf.h> > diff --git a/include/sparse/rte_trace_point.h b/include/sparse/rte_trace_point.h > new file mode 100644 > index 000000000..803923275 > --- /dev/null > +++ b/include/sparse/rte_trace_point.h > @@ -0,0 +1,28 @@ > +/* Copyright 2020, Red Hat, Inc. > + * > + * Licensed under the Apache License, Version 2.0 (the "License"); > + * you may not use this file except in compliance with the License. > + * You may obtain a copy of the License at: > + * > + * http://www.apache.org/licenses/LICENSE-2.0 > + * > + * Unless required by applicable law or agreed to in writing, software > + * distributed under the License is distributed on an "AS IS" BASIS, > + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. > + * See the License for the specific language governing permissions and > + * limitations under the License. > + */ > + > +#ifndef __CHECKER__ > +#error "Use this header only with sparse. It is not a correct implementation." > +#endif > + > +/* sparse doesn't know about gcc atomic builtins. */ > +#ifndef __ATOMIC_ACQUIRE > +#define __ATOMIC_ACQUIRE 0 > +#define __atomic_load_n(p, memorder) *(p) > +#endif > + > +/* Get actual <rte_trace_point.h> definitions for us to annotate and > + * build on. */ > +#include_next <rte_trace_point.h> > diff --git a/lib/dpdk.c b/lib/dpdk.c > index 2f235a742..319540394 100644 > --- a/lib/dpdk.c > +++ b/lib/dpdk.c > @@ -443,7 +443,7 @@ dpdk_init__(const struct smap *ovs_other_config) > > /** > * NOTE: This is an unsophisticated mechanism for determining the DPDK > - * lcore for the DPDK Master. > + * main core. > */ > if (auto_determine) { > const struct ovs_numa_info_core *core; > diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c > index 75dffefb8..2640a421a 100644 > --- a/lib/netdev-dpdk.c > +++ b/lib/netdev-dpdk.c > @@ -26,12 +26,6 @@ > #include <sys/socket.h> > #include <linux/if.h> > > -/* Include rte_compat.h first to allow experimental API's needed for the > - * rte_meter.h rfc4115 functions. Once they are no longer marked as > - * experimental the #define and rte_compat.h include can be removed. > - */ > -#define ALLOW_EXPERIMENTAL_API > -#include <rte_compat.h> > #include <rte_bus_pci.h> > #include <rte_config.h> > #include <rte_cycles.h> > @@ -1312,7 +1306,7 @@ static int > vhost_common_construct(struct netdev *netdev) > OVS_REQUIRES(dpdk_mutex) > { > - int socket_id = rte_lcore_to_socket_id(rte_get_master_lcore()); > + int socket_id = rte_lcore_to_socket_id(rte_get_main_lcore()); > struct netdev_dpdk *dev = netdev_dpdk_cast(netdev); > > dev->vhost_rxq_enabled = dpdk_rte_mzalloc(OVS_VHOST_MAX_QUEUE_NUM * > @@ -1463,7 +1457,6 @@ netdev_dpdk_destruct(struct netdev *netdev) > struct netdev_dpdk *dev = netdev_dpdk_cast(netdev); > struct rte_device *rte_dev; > struct rte_eth_dev *eth_dev; > - bool remove_on_close; > > ovs_mutex_lock(&dpdk_mutex); > > @@ -1475,20 +1468,15 @@ netdev_dpdk_destruct(struct netdev *netdev) > * FIXME: avoid direct access to DPDK internal array rte_eth_devices. > */ > eth_dev = &rte_eth_devices[dev->port_id]; > - remove_on_close = > - eth_dev->data && > - (eth_dev->data->dev_flags & RTE_ETH_DEV_CLOSE_REMOVE); > rte_dev = eth_dev->device; > > /* Remove the eth device. */ > rte_eth_dev_close(dev->port_id); > > - /* Remove this rte device and all its eth devices if flag > - * RTE_ETH_DEV_CLOSE_REMOVE is not supported (which means representors > - * are not supported), or if all the eth devices belonging to the rte > - * device are closed. > + /* Remove this rte device and all its eth devices if all the eth > + * devices belonging to the rte device are closed. > */ > - if (!remove_on_close || !netdev_dpdk_get_num_ports(rte_dev)) { > + if (!netdev_dpdk_get_num_ports(rte_dev)) { > int ret = rte_dev_remove(rte_dev); > > if (ret < 0) { >
On 12/15/2020 12:42 PM, Ilya Maximets wrote: > External email: Use caution opening links or attachments > > > On 12/14/20 9:30 PM, Ian Stokes wrote: >> This commit adds support for DPDK v20.11, it includes the following >> changes. >> >> 1. travis: Remove explicit DPDK kmods configuration. >> 2. sparse: Fix build with 20.05 DPDK tracepoints. >> 3. netdev-dpdk: Remove experimental API flag. >> >> https://nam11.safelinks.protection.outlook.com/?url=http%3A%2F%2Fpatchwork.ozlabs.org%2Fproject%2Fopenvswitch%2Flist%2F%3Fseries%3D173216%26state%3D*&data=04%7C01%7Celibr%40nvidia.com%7Cf93e5cb9a1144f590bb908d8a0e614eb%7C43083d15727340c1b7db39efd9ccc17a%7C0%7C0%7C637436257353614513%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=E49FCxMvjRC3MDdN%2BBpaPndTBu7I2aJgrMX42kWqZbk%3D&reserved=0 >> >> 4. sparse: Update to DPDK 20.05 trace point header. >> >> https://nam11.safelinks.protection.outlook.com/?url=http%3A%2F%2Fpatchwork.ozlabs.org%2Fproject%2Fopenvswitch%2Flist%2F%3Fseries%3D179604%26state%3D*&data=04%7C01%7Celibr%40nvidia.com%7Cf93e5cb9a1144f590bb908d8a0e614eb%7C43083d15727340c1b7db39efd9ccc17a%7C0%7C0%7C637436257353614513%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=otTJJrSW8Orq91iMcEAnC%2FOpCzOqA7TDIGE0N0kCq94%3D&reserved=0 >> >> 5. sparse: Fix build with DPDK 20.08. >> >> https://nam11.safelinks.protection.outlook.com/?url=http%3A%2F%2Fpatchwork.ozlabs.org%2Fproject%2Fopenvswitch%2Flist%2F%3Fseries%3D200181%26state%3D*&data=04%7C01%7Celibr%40nvidia.com%7Cf93e5cb9a1144f590bb908d8a0e614eb%7C43083d15727340c1b7db39efd9ccc17a%7C0%7C0%7C637436257353614513%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=dyPYVQc%2FfDPx3vl0DP9TGRtvM64lW%2FFZzR7YbXGbeJ8%3D&reserved=0 >> >> 6. build: Add support for DPDK meson build. >> >> https://nam11.safelinks.protection.outlook.com/?url=http%3A%2F%2Fpatchwork.ozlabs.org%2Fproject%2Fopenvswitch%2Flist%2F%3Fseries%3D199138%26state%3D*&data=04%7C01%7Celibr%40nvidia.com%7Cf93e5cb9a1144f590bb908d8a0e614eb%7C43083d15727340c1b7db39efd9ccc17a%7C0%7C0%7C637436257353614513%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=9eq55QPFxgeUiyMBfMYJfjcqbxOJDCMHWv%2Fx9e0lIdE%3D&reserved=0 >> >> 7. netdev-dpdk: Remove usage of RTE_ETH_DEV_CLOSE_REMOVE flag. >> >> https://nam11.safelinks.protection.outlook.com/?url=http%3A%2F%2Fpatchwork.ozlabs.org%2Fproject%2Fopenvswitch%2Flist%2F%3Fseries%3D207850%26state%3D*&data=04%7C01%7Celibr%40nvidia.com%7Cf93e5cb9a1144f590bb908d8a0e614eb%7C43083d15727340c1b7db39efd9ccc17a%7C0%7C0%7C637436257353614513%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=2JDs4MSuJqLdfAZu95wY%2B9mCjZJDbpf6vpyALg793Cw%3D&reserved=0 >> >> 8. netdev-dpdk: Fix build with 20.11-rc1. >> >> https://nam11.safelinks.protection.outlook.com/?url=http%3A%2F%2Fpatchwork.ozlabs.org%2Fproject%2Fopenvswitch%2Flist%2F%3Fseries%3D209006%26state%3D*&data=04%7C01%7Celibr%40nvidia.com%7Cf93e5cb9a1144f590bb908d8a0e614eb%7C43083d15727340c1b7db39efd9ccc17a%7C0%7C0%7C637436257353614513%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=CkbmxfIrjwHGhStZ6%2BnNvZR3IHN%2F77z13kN7%2BBCTNKM%3D&reserved=0 >> >> 9. sparse: Fix __ATOMIC_* redefinition errors >> >> https://nam11.safelinks.protection.outlook.com/?url=http%3A%2F%2Fpatchwork.ozlabs.org%2Fproject%2Fopenvswitch%2Flist%2F%3Fseries%3D209452%26state%3D*&data=04%7C01%7Celibr%40nvidia.com%7Cf93e5cb9a1144f590bb908d8a0e614eb%7C43083d15727340c1b7db39efd9ccc17a%7C0%7C0%7C637436257353614513%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=sZqoeyQzMOmpEnaDhMF8Qlq9k%2FCgzmQ2OAY%2BIsWMYhc%3D&reserved=0 >> >> 10. build: Remove DPDK make build references. >> >> https://nam11.safelinks.protection.outlook.com/?url=http%3A%2F%2Fpatchwork.ozlabs.org%2Fproject%2Fopenvswitch%2Flist%2F%3Fseries%3D216682%26state%3D*&data=04%7C01%7Celibr%40nvidia.com%7Cf93e5cb9a1144f590bb908d8a0e614eb%7C43083d15727340c1b7db39efd9ccc17a%7C0%7C0%7C637436257353614513%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=PzFEEqK%2BWCVMxLygtW0p9iRIzSZ7OMwbUOjRp775SXY%3D&reserved=0 >> >> For credit all authors of the original commits to 'dpdk-latest' with the >> above changes have been added as co-authors for this commit. >> >> Signed-off-by: David Marchand <david.marchand@redhat.com> >> Co-authored-by: David Marchand <david.marchand@redhat.com> >> Signed-off-by: Sunil Pai G <sunil.pai.g@intel.com> >> Co-authored-by: Sunil Pai G <sunil.pai.g@intel.com> >> Signed-off-by: Eli Britstein <elibr@nvidia.com> >> Co-authored-by: Eli Britstein <elibr@nvidia.com> >> Tested-by: Harry van Haaren <harry.van.haaren@intel.com> >> Tested-by: Govindharajan, Hariprasad <hariprasad.govindharajan@intel.com> >> Signed-off-by: Ian Stokes <ian.stokes@intel.com> >> >> --- >> v2 -> v3 >> * Remove GHA others write removal. >> * Strip march from pkg-config h=which is forced by DPDK. > Thanks. Beside the pkg-config version checking issue from the separate > thread, few minor comments inline. I probably missed the pkg-config version checking. Could you please point me to it? We saw that for pkg-config version 0.27.1 (that is provided with RH 7.7 for example), with static compilation, compilation passes but the DPDK PMDs are not registered upon init. We manually upgrade pkg-config in the build machines. A note was added in DPDK docs for that: https://mails.dpdk.org/archives/dev/2020-November/191602.html Is there such checking in OVS? > >> RFC v1 -> v2 >> * Removed RFC tag. >> * Rebased to head of master. >> * Modified GHA build scripts to install required python packages. >> * Modified URLs to use versioned 20.11 links. >> * Removed unrequired reformat in travis.yml. >> * Modified GHA worflow buil-and-test.yml to remove others write >> permission to $HOME in prepare step. >> --- >> .ci/linux-build.sh | 48 ++++++++++++------- >> .ci/linux-prepare.sh | 1 + >> .github/workflows/build-and-test.yml | 5 +- >> .travis.yml | 3 ++ >> Documentation/intro/install/afxdp.rst | 2 +- >> Documentation/intro/install/dpdk.rst | 64 ++++++++++++++----------- >> Documentation/topics/dpdk/phy.rst | 18 ++++--- >> Documentation/topics/dpdk/vhost-user.rst | 20 +------- >> Documentation/topics/testing.rst | 2 +- >> NEWS | 1 + >> acinclude.m4 | 82 ++++++++++++++------------------ >> include/sparse/automake.mk | 2 + >> include/sparse/rte_mbuf.h | 29 +++++++++++ >> include/sparse/rte_trace_point.h | 28 +++++++++++ >> lib/dpdk.c | 2 +- >> lib/netdev-dpdk.c | 20 ++------ >> 16 files changed, 190 insertions(+), 137 deletions(-) >> create mode 100644 include/sparse/rte_mbuf.h >> create mode 100644 include/sparse/rte_trace_point.h >> >> diff --git a/.ci/linux-build.sh b/.ci/linux-build.sh >> index 16102ac94..3e5136fd4 100755 >> --- a/.ci/linux-build.sh >> +++ b/.ci/linux-build.sh >> @@ -87,17 +87,29 @@ function install_dpdk() >> { >> local DPDK_VER=$1 >> local VERSION_FILE="dpdk-dir/travis-dpdk-cache-version" >> + local DPDK_OPTS="" >> + local DPDK_LIB="" >> >> if [ -z "$TRAVIS_ARCH" ] || >> [ "$TRAVIS_ARCH" == "amd64" ]; then >> - TARGET="x86_64-native-linuxapp-gcc" >> + DPDK_LIB=$(pwd)/dpdk-dir/build/lib/x86_64-linux-gnu >> elif [ "$TRAVIS_ARCH" == "aarch64" ]; then >> - TARGET="arm64-armv8a-linuxapp-gcc" >> + DPDK_LIB=$(pwd)/dpdk-dir/build/lib/aarch64-linux-gnu >> else >> echo "Target is unknown" >> exit 1 >> fi >> >> + if [ "$DPDK_SHARED" ]; then >> + EXTRA_OPTS="$EXTRA_OPTS --with-dpdk=shared" >> + export LD_LIBRARY_PATH=$DPDK_LIB/:$LD_LIBRARY_PATH >> + else >> + EXTRA_OPTS="$EXTRA_OPTS --with-dpdk=static" >> + fi >> + >> + # Export the following path for pkg-config to find the .pc file. >> + export PKG_CONFIG_PATH=$DPDK_LIB/pkgconfig/:$PKG_CONFIG_PATH >> + >> if [ "${DPDK_VER##refs/*/}" != "${DPDK_VER}" ]; then >> # Avoid using cache for git tree build. >> rm -rf dpdk-dir >> @@ -110,7 +122,8 @@ function install_dpdk() >> if [ -f "${VERSION_FILE}" ]; then >> VER=$(cat ${VERSION_FILE}) >> if [ "${VER}" = "${DPDK_VER}" ]; then >> - EXTRA_OPTS="${EXTRA_OPTS} --with-dpdk=$(pwd)/dpdk-dir/build" >> + # Update the library paths. >> + sudo ldconfig >> echo "Found cached DPDK ${VER} build in $(pwd)/dpdk-dir" >> return >> fi >> @@ -124,23 +137,24 @@ function install_dpdk() >> pushd dpdk-dir >> fi >> >> - make config CC=gcc T=$TARGET >> + # Switching to 'default' machine to make dpdk-dir cache usable on >> + # different CPUs. We can't be sure that all CI machines are exactly same. >> + DPDK_OPTS="$DPDK_OPTS -Dmachine=default" >> >> - if [ "$DPDK_SHARED" ]; then >> - sed -i '/CONFIG_RTE_BUILD_SHARED_LIB=n/s/=n/=y/' build/.config >> - export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$(pwd)/$TARGET/lib >> - fi >> + # Disable building DPDK unit tests. Not needed for OVS build or tests. >> + DPDK_OPTS="$DPDK_OPTS -Dtests=false" >> + >> + # Install DPDK using prefix. >> + DPDK_OPTS="$DPDK_OPTS --prefix=$(pwd)/build" >> + >> + CC=gcc meson $DPDK_OPTS build >> + ninja -C build >> + ninja -C build install >> >> - # Disable building DPDK kernel modules. Not needed for OVS build or tests. >> - sed -i '/CONFIG_RTE_EAL_IGB_UIO=y/s/=y/=n/' build/.config >> - sed -i '/CONFIG_RTE_KNI_KMOD=y/s/=y/=n/' build/.config >> + # Update the library paths. >> + sudo ldconfig >> >> - # Switching to 'default' machine to make dpdk-dir cache usable on different >> - # CPUs. We can't be sure that all CI machines are exactly same. >> - sed -i '/CONFIG_RTE_MACHINE="native"/s/="native"/="default"/' build/.config >> >> - make -j4 CC=gcc EXTRA_CFLAGS='-fPIC' >> - EXTRA_OPTS="$EXTRA_OPTS --with-dpdk=$(pwd)/build" >> echo "Installed DPDK source in $(pwd)" >> popd >> echo "${DPDK_VER}" > ${VERSION_FILE} >> @@ -187,7 +201,7 @@ fi >> >> if [ "$DPDK" ] || [ "$DPDK_SHARED" ]; then >> if [ -z "$DPDK_VER" ]; then >> - DPDK_VER="19.11.2" >> + DPDK_VER="20.11" >> fi >> install_dpdk $DPDK_VER >> if [ "$CC" = "clang" ]; then >> diff --git a/.ci/linux-prepare.sh b/.ci/linux-prepare.sh >> index fea905a83..69a40011f 100755 >> --- a/.ci/linux-prepare.sh >> +++ b/.ci/linux-prepare.sh >> @@ -22,6 +22,7 @@ cd .. >> >> pip3 install --disable-pip-version-check --user flake8 hacking >> pip3 install --user --upgrade docutils >> +pip3 install --user 'meson==0.47.1' >> >> if [ "$M32" ]; then >> # Installing 32-bit libraries. >> diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml >> index 847fd3150..c83066138 100644 >> --- a/.github/workflows/build-and-test.yml >> +++ b/.github/workflows/build-and-test.yml >> @@ -8,7 +8,8 @@ jobs: >> dependencies: | >> automake libtool gcc bc libjemalloc1 libjemalloc-dev \ >> libssl-dev llvm-dev libelf-dev libnuma-dev libpcap-dev \ >> - python3-openssl python3-pip python3-sphinx \ >> + ninja-build python3-openssl python3-pip \ >> + python3-setuptools python3-sphinx python3-wheel \ >> selinux-policy-dev >> deb_dependencies: | >> linux-headers-$(uname -r) build-essential fakeroot devscripts equivs >> @@ -146,7 +147,7 @@ jobs: >> run: ./.ci/linux-prepare.sh >> >> - name: build >> - run: PATH="$PATH:$HOME/bin" ./.ci/linux-build.sh >> + run: PATH="$PATH:$HOME/bin:$HOME/.local/bin" ./.ci/linux-build.sh >> >> - name: upload deb packages >> if: matrix.deb_package != '' >> diff --git a/.travis.yml b/.travis.yml >> index acf3c10fb..51d051108 100644 >> --- a/.travis.yml >> +++ b/.travis.yml >> @@ -24,6 +24,9 @@ addons: >> - selinux-policy-dev >> - libunbound-dev >> - libunwind-dev >> + - python3-setuptools >> + - python3-wheel >> + - ninja-build >> >> before_install: ./.ci/${TRAVIS_OS_NAME}-prepare.sh >> >> diff --git a/Documentation/intro/install/afxdp.rst b/Documentation/intro/install/afxdp.rst >> index 3c8f78825..aad0aeebe 100644 >> --- a/Documentation/intro/install/afxdp.rst >> +++ b/Documentation/intro/install/afxdp.rst >> @@ -396,7 +396,7 @@ PVP using vhostuser device >> -------------------------- >> First, build OVS with DPDK and AFXDP:: >> >> - ./configure --enable-afxdp --with-dpdk=<dpdk path> >> + ./configure --enable-afxdp --with-dpdk=shared|static >> make -j4 && make install >> >> Create a vhost-user port from OVS:: >> diff --git a/Documentation/intro/install/dpdk.rst b/Documentation/intro/install/dpdk.rst >> index fe11571d2..4f0c10082 100644 >> --- a/Documentation/intro/install/dpdk.rst >> +++ b/Documentation/intro/install/dpdk.rst >> @@ -42,7 +42,7 @@ Build requirements >> In addition to the requirements described in :doc:`general`, building Open >> vSwitch with DPDK will require the following: >> >> -- DPDK 19.11.2 >> +- DPDK 20.11 >> >> - A `DPDK supported NIC`_ >> >> @@ -62,6 +62,8 @@ Detailed system requirements can be found at `DPDK requirements`_. >> .. _DPDK supported NIC: https://nam11.safelinks.protection.outlook.com/?url=http%3A%2F%2Fdpdk.org%2Fdoc%2Fnics&data=04%7C01%7Celibr%40nvidia.com%7Cf93e5cb9a1144f590bb908d8a0e614eb%7C43083d15727340c1b7db39efd9ccc17a%7C0%7C0%7C637436257353614513%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=UDW5CVFivmWkwHHq6tEjW%2FqFv6jCHoddBszfXwU9ZpY%3D&reserved=0 >> .. _DPDK requirements: https://nam11.safelinks.protection.outlook.com/?url=http%3A%2F%2Fdpdk.org%2Fdoc%2Fguides%2Flinux_gsg%2Fsys_reqs.html&data=04%7C01%7Celibr%40nvidia.com%7Cf93e5cb9a1144f590bb908d8a0e614eb%7C43083d15727340c1b7db39efd9ccc17a%7C0%7C0%7C637436257353614513%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=%2FAAvhfxTlQRtIb8CckocceUanmob2knj8dKE4llod0w%3D&reserved=0 > These links should be versioned. I see that they wasn't before, but they > should. Could be done as a separate change later, though. > >> +.. _dpdk-install: >> + >> Installing >> ---------- >> >> @@ -71,38 +73,44 @@ Install DPDK >> #. Download the `DPDK sources`_, extract the file and set ``DPDK_DIR``:: >> >> $ cd /usr/src/ >> - $ wget https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Ffast.dpdk.org%2Frel%2Fdpdk-19.11.2.tar.xz&data=04%7C01%7Celibr%40nvidia.com%7Cf93e5cb9a1144f590bb908d8a0e614eb%7C43083d15727340c1b7db39efd9ccc17a%7C0%7C0%7C637436257353614513%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=acpO1qDiKs9xJDkSQJftr2%2BL1wh4wokTe6f9DZuC8DE%3D&reserved=0 >> - $ tar xf dpdk-19.11.2.tar.xz >> - $ export DPDK_DIR=/usr/src/dpdk-stable-19.11.2 >> + $ wget https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Ffast.dpdk.org%2Frel%2Fdpdk-20.11.tar.xz&data=04%7C01%7Celibr%40nvidia.com%7Cf93e5cb9a1144f590bb908d8a0e614eb%7C43083d15727340c1b7db39efd9ccc17a%7C0%7C0%7C637436257353624502%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=Xz8JUnSE1RLxVtXFX0pn8R7aKb%2BaHwXRWcfeFODLGHE%3D&reserved=0 >> + $ tar xf dpdk-20.11.tar.xz >> + $ export DPDK_DIR=/usr/src/dpdk-20.11 >> $ cd $DPDK_DIR >> >> -#. (Optional) Configure DPDK as a shared library >> +#. Configure and install DPDK using Meson >> >> - DPDK can be built as either a static library or a shared library. By >> - default, it is configured for the former. If you wish to use the latter, set >> - ``CONFIG_RTE_BUILD_SHARED_LIB=y`` in ``$DPDK_DIR/config/common_base``. >> + Build and install the DPDK library:: >> >> - .. note:: >> + $ export DPDK_BUILD=$DPDK_DIR/build >> + $ meson build >> + $ ninja -C build >> + $ sudo ninja -C build install >> + $ sudo ldconfig >> >> - Minor performance loss is expected when using OVS with a shared DPDK >> - library compared to a static DPDK library. >> + Detailed information can be found at `DPDK documentation`_. >> >> -#. Configure and install DPDK >> +#. (Optional) Configure and export the DPDK shared library location >> >> - Build and install the DPDK library:: >> + Since DPDK is built both as static and shared library by default, no extra >> + configuration is required for the build. >> >> - $ export DPDK_TARGET=x86_64-native-linuxapp-gcc >> - $ export DPDK_BUILD=$DPDK_DIR/$DPDK_TARGET >> - $ make install T=$DPDK_TARGET DESTDIR=install >> + Exporting the path to library is not necessary if the DPDK libraries are >> + system installed. For libraries installed using a prefix, export the path >> + to this library and also update the $PKG_CONFIG_PATH for use >> + before building OVS:: >> >> -#. (Optional) Export the DPDK shared library location >> + $ export LD_LIBRARY_PATH=/path/to/installed/DPDK/libraries >> + $ export PKG_CONFIG_PATH=/path/to/installed/".pc" file/for/DPDK >> >> - If DPDK was built as a shared library, export the path to this library for >> - use when building OVS:: >> + .. note:: >> >> - $ export LD_LIBRARY_PATH=$DPDK_DIR/x86_64-native-linuxapp-gcc/lib >> + Minor performance loss is expected when using OVS with a shared DPDK >> + library compared to a static DPDK library. >> >> .. _DPDK sources: https://nam11.safelinks.protection.outlook.com/?url=http%3A%2F%2Fdpdk.org%2Frel&data=04%7C01%7Celibr%40nvidia.com%7Cf93e5cb9a1144f590bb908d8a0e614eb%7C43083d15727340c1b7db39efd9ccc17a%7C0%7C0%7C637436257353624502%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=z5jUAKtaW%2F7VaAHhtpO71Oa2vmt%2F%2Fm0tITO6ZCL%2FqjY%3D&reserved=0 >> +.. _DPDK documentation: >> + https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdoc.dpdk.org%2Fguides-20.08%2Flinux_gsg%2Fbuild_dpdk.html&data=04%7C01%7Celibr%40nvidia.com%7Cf93e5cb9a1144f590bb908d8a0e614eb%7C43083d15727340c1b7db39efd9ccc17a%7C0%7C0%7C637436257353624502%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=S4YFOVUvowLzWWViPc64ZKouLeQzuHkUn02UHn6iO2w%3D&reserved=0 > s/20.08/20.11/ > >> Install OVS >> ~~~~~~~~~~~ >> @@ -121,16 +129,16 @@ has to be configured to build against the DPDK library (``--with-dpdk``). >> >> #. Bootstrap, if required, as described in :ref:`general-bootstrapping` >> >> -#. Configure the package using the ``--with-dpdk`` flag:: >> +#. Configure the package using the ``--with-dpdk`` flag: >> + >> + If OVS must consume DPDK static libraries >> + (also equivalent to ``--with-dpdk=yes`` ):: >> >> - $ ./configure --with-dpdk=$DPDK_BUILD >> + $ ./configure --with-dpdk=static >> >> - where ``DPDK_BUILD`` is the path to the built DPDK library. This can be >> - skipped if DPDK library is installed in its default location. >> + If OVS must consume DPDK shared libraries:: >> >> - If no path is provided to ``--with-dpdk``, but a pkg-config configuration >> - for libdpdk is available the include paths will be generated via an >> - equivalent ``pkg-config --cflags libdpdk``. >> + $ ./configure --with-dpdk=shared >> >> .. note:: >> While ``--with-dpdk`` is required, you can pass any other configuration >> @@ -703,7 +711,7 @@ Limitations >> release notes`_. >> >> .. _DPDK release notes: >> - https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdoc.dpdk.org%2Fguides-19.11%2Frel_notes%2Frelease_19_11.html&data=04%7C01%7Celibr%40nvidia.com%7Cf93e5cb9a1144f590bb908d8a0e614eb%7C43083d15727340c1b7db39efd9ccc17a%7C0%7C0%7C637436257353624502%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=FS4w3hHmkoJec2o5alztT83y8q63xvpOMzBzl2T6Pxg%3D&reserved=0 >> + https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdoc.dpdk.org%2Fguides-20.11%2Frel_notes%2Frelease_20_11.html&data=04%7C01%7Celibr%40nvidia.com%7Cf93e5cb9a1144f590bb908d8a0e614eb%7C43083d15727340c1b7db39efd9ccc17a%7C0%7C0%7C637436257353624502%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=vH4RWsb5shrqzDQXDnj6JqUazNNcGb7H7zNvGarFI%2FQ%3D&reserved=0 >> >> - Upper bound MTU: DPDK device drivers differ in how the L2 frame for a >> given MTU value is calculated e.g. i40e driver includes 2 x vlan headers in >> diff --git a/Documentation/topics/dpdk/phy.rst b/Documentation/topics/dpdk/phy.rst >> index 7ee3eacff..d21ecc915 100644 >> --- a/Documentation/topics/dpdk/phy.rst >> +++ b/Documentation/topics/dpdk/phy.rst >> @@ -218,18 +218,24 @@ If the log is not seen then the port can be detached like so:: >> Hotplugging with IGB_UIO >> ~~~~~~~~~~~~~~~~~~~~~~~~ >> >> -As of DPDK 19.11, default igb_uio hotplugging behavior changes from >> +.. important:: >> + >> + As of DPDK v20.11 IGB_UIO has been deprecated and is no longer built as >> + part of the default DPDK library. Below is intended for those who wish >> + to use IGB_UIO outside of the standard DPDK build from v20.11 onwards. >> + >> +As of DPDK v19.11, default igb_uio hotplugging behavior changed from >> previous DPDK versions. >> >> -With DPDK 19.11, if no device is bound to igb_uio when OVS is launched then >> -the IOVA mode may be set to virtual addressing for DPDK. This is incompatible >> -for hotplugging with igb_uio. >> +From DPDK v19.11 onwards, if no device is bound to igb_uio when OVS is >> +launched then the IOVA mode may be set to virtual addressing for DPDK. >> +This is incompatible for hotplugging with igb_uio. >> >> To hotplug a port with igb_uio in this case, DPDK must be configured to use >> physical addressing for IOVA mode. For more information regarding IOVA modes >> in DPDK please refer to the `DPDK IOVA Mode Detection`__. >> >> -__ https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdoc.dpdk.org%2Fguides-19.11%2Fprog_guide%2Fenv_abstraction_layer.html%23iova-mode-detection&data=04%7C01%7Celibr%40nvidia.com%7Cf93e5cb9a1144f590bb908d8a0e614eb%7C43083d15727340c1b7db39efd9ccc17a%7C0%7C0%7C637436257353624502%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=rdfr9tkaAZBGSzX1Y8W4VO7i3bRiq3d%2BJHmgoi%2BrBIs%3D&reserved=0 >> +__ https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdoc.dpdk.org%2Fguides-20.11%2Fprog_guide%2Fenv_abstraction_layer.html%23iova-mode-detection&data=04%7C01%7Celibr%40nvidia.com%7Cf93e5cb9a1144f590bb908d8a0e614eb%7C43083d15727340c1b7db39efd9ccc17a%7C0%7C0%7C637436257353624502%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=8OCbAF8m6CEaxXvMGrKzlIhMP44OHiFJEsVa9Q0U0Ms%3D&reserved=0 >> >> To configure OVS DPDK to use physical addressing for IOVA:: >> >> @@ -261,7 +267,7 @@ Representors are multi devices created on top of one PF. >> >> For more information, refer to the `DPDK documentation`__. >> >> -__ https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdoc.dpdk.org%2Fguides-19.11%2Fprog_guide%2Fswitch_representation.html&data=04%7C01%7Celibr%40nvidia.com%7Cf93e5cb9a1144f590bb908d8a0e614eb%7C43083d15727340c1b7db39efd9ccc17a%7C0%7C0%7C637436257353624502%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=xpM%2B0j3kfVcFe9fLyq8wV9ZPavog4bPlXyGOdNmm8jc%3D&reserved=0 >> +__ https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdoc.dpdk.org%2Fguides-20.11%2Fprog_guide%2Fswitch_representation.html&data=04%7C01%7Celibr%40nvidia.com%7Cf93e5cb9a1144f590bb908d8a0e614eb%7C43083d15727340c1b7db39efd9ccc17a%7C0%7C0%7C637436257353624502%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=cL1M%2Fut8eO33l1DGgMuS08Np%2FscRAnwVzRPcdzbDNrg%3D&reserved=0 >> >> Prior to port representors there was a one-to-one relationship between the PF >> and the eth device. With port representors the relationship becomes one PF to >> diff --git a/Documentation/topics/dpdk/vhost-user.rst b/Documentation/topics/dpdk/vhost-user.rst >> index 75d3fc958..bcd51e65c 100644 >> --- a/Documentation/topics/dpdk/vhost-user.rst >> +++ b/Documentation/topics/dpdk/vhost-user.rst >> @@ -389,23 +389,7 @@ application in the VM. >> >> To begin, instantiate a guest as described in :ref:`dpdk-vhost-user` or >> :ref:`dpdk-vhost-user-client`. Once started, connect to the VM, download the >> -DPDK sources to VM and build DPDK:: >> - >> - $ cd /root/dpdk/ >> - $ wget https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Ffast.dpdk.org%2Frel%2Fdpdk-19.11.2.tar.xz&data=04%7C01%7Celibr%40nvidia.com%7Cf93e5cb9a1144f590bb908d8a0e614eb%7C43083d15727340c1b7db39efd9ccc17a%7C0%7C0%7C637436257353624502%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=AqMY5oxvSJNRoYZWyKxeuMmhHMXySgWz7B84OpOmG7Q%3D&reserved=0 >> - $ tar xf dpdk-19.11.2.tar.xz >> - $ export DPDK_DIR=/root/dpdk/dpdk-stable-19.11.2 >> - $ export DPDK_TARGET=x86_64-native-linuxapp-gcc >> - $ export DPDK_BUILD=$DPDK_DIR/$DPDK_TARGET >> - $ cd $DPDK_DIR >> - $ make install T=$DPDK_TARGET DESTDIR=install >> - >> -Build the test-pmd application:: >> - >> - $ cd app/test-pmd >> - $ export RTE_SDK=$DPDK_DIR >> - $ export RTE_TARGET=$DPDK_TARGET >> - $ make >> +DPDK sources to VM and build DPDK as described in :ref:`dpdk-install`. >> >> Setup huge pages and DPDK devices using UIO:: >> >> @@ -555,4 +539,4 @@ shown with:: >> >> Further information can be found in the >> `DPDK documentation >> -<https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdoc.dpdk.org%2Fguides-19.11%2Fprog_guide%2Fvhost_lib.html&data=04%7C01%7Celibr%40nvidia.com%7Cf93e5cb9a1144f590bb908d8a0e614eb%7C43083d15727340c1b7db39efd9ccc17a%7C0%7C0%7C637436257353624502%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=yS5OV1a4FKTTUoUsKidO5Av30B%2FRLm8pUBVcuErS0Uw%3D&reserved=0>`__ >> +<https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdoc.dpdk.org%2Fguides-20.11%2Fprog_guide%2Fvhost_lib.html&data=04%7C01%7Celibr%40nvidia.com%7Cf93e5cb9a1144f590bb908d8a0e614eb%7C43083d15727340c1b7db39efd9ccc17a%7C0%7C0%7C637436257353624502%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=YO8Dbh9q%2FoYmXUKOuXZ7kbEpX9aWqg3sh3A3jgTywIM%3D&reserved=0>`__ >> diff --git a/Documentation/topics/testing.rst b/Documentation/topics/testing.rst >> index b9fa94dda..951fe9e85 100644 >> --- a/Documentation/topics/testing.rst >> +++ b/Documentation/topics/testing.rst >> @@ -353,7 +353,7 @@ All tests are skipped if no hugepages are configured. User must look into the DP >> manual to figure out how to `Configure hugepages`_. >> The phy test will skip if no compatible physical device is available. >> >> -.. _Configure hugepages: https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdoc.dpdk.org%2Fguides-19.11%2Flinux_gsg%2Fsys_reqs.html&data=04%7C01%7Celibr%40nvidia.com%7Cf93e5cb9a1144f590bb908d8a0e614eb%7C43083d15727340c1b7db39efd9ccc17a%7C0%7C0%7C637436257353624502%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=PPR6Ko%2BDp9VcZqSt6mFIWI2rhFqcG24PuoXMc0%2B%2FJj4%3D&reserved=0 >> +.. _Configure hugepages: https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdoc.dpdk.org%2Fguides-20.11%2Flinux_gsg%2Fsys_reqs.html&data=04%7C01%7Celibr%40nvidia.com%7Cf93e5cb9a1144f590bb908d8a0e614eb%7C43083d15727340c1b7db39efd9ccc17a%7C0%7C0%7C637436257353624502%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=KwJMiShm9DUJCJeTKPONkgpWSLtRdSJx7msQiDXyxH4%3D&reserved=0 >> >> All the features documented under `Unit Tests`_ are available for the DPDK >> datapath testsuite. >> diff --git a/NEWS b/NEWS >> index 7e291a180..1a39cc661 100644 >> --- a/NEWS >> +++ b/NEWS >> @@ -11,6 +11,7 @@ Post-v2.14.0 >> Use the 'cluster/set-backlog-threshold' command to change limits. >> - DPDK: >> * Removed support for vhost-user dequeue zero-copy. >> + * Add support for DPDK 20.11. >> - Userspace datapath: >> * Add the 'pmd' option to "ovs-appctl dpctl/dump-flows", which >> restricts a flow dump to a single PMD thread if set. >> diff --git a/acinclude.m4 b/acinclude.m4 >> index ddf4b71e1..3df496666 100644 >> --- a/acinclude.m4 >> +++ b/acinclude.m4 >> @@ -334,8 +334,9 @@ dnl >> dnl Configure DPDK source tree >> AC_DEFUN([OVS_CHECK_DPDK], [ >> AC_ARG_WITH([dpdk], >> - [AC_HELP_STRING([--with-dpdk=/path/to/dpdk], >> - [Specify the DPDK build directory])], >> + [AC_HELP_STRING([--with-dpdk=static|shared|yes], >> + [Specify "static" or "shared" depending on the >> + DPDK libraries to use])], >> [have_dpdk=true]) >> >> AC_MSG_CHECKING([whether dpdk is enabled]) >> @@ -345,35 +346,25 @@ AC_DEFUN([OVS_CHECK_DPDK], [ >> else >> AC_MSG_RESULT([yes]) >> case "$with_dpdk" in >> - yes) >> - DPDK_AUTO_DISCOVER="true" >> - PKG_CHECK_MODULES_STATIC([DPDK], [libdpdk], [ >> - DPDK_INCLUDE="$DPDK_CFLAGS" >> - DPDK_LIB="$DPDK_LIBS"], [ >> - DPDK_INCLUDE="-I/usr/local/include/dpdk -I/usr/include/dpdk" >> - DPDK_LIB="-ldpdk"]) >> - ;; >> - *) >> - DPDK_AUTO_DISCOVER="false" >> - DPDK_INCLUDE_PATH="$with_dpdk/include" >> - # If 'with_dpdk' is passed install directory, point to headers >> - # installed in $DESTDIR/$prefix/include/dpdk >> - if test -e "$DPDK_INCLUDE_PATH/rte_config.h"; then >> - DPDK_INCLUDE="-I$DPDK_INCLUDE_PATH" >> - elif test -e "$DPDK_INCLUDE_PATH/dpdk/rte_config.h"; then >> - DPDK_INCLUDE="-I$DPDK_INCLUDE_PATH/dpdk" >> - fi >> - DPDK_LIB_DIR="$with_dpdk/lib" >> - DPDK_LIB="-ldpdk" >> - ;; >> + "shared") >> + PKG_CHECK_MODULES([DPDK], [libdpdk], [ >> + DPDK_INCLUDE="$DPDK_CFLAGS" >> + DPDK_LIB="$DPDK_LIBS"], [ >> + DPDK_INCLUDE="-I/usr/local/include/dpdk -I/usr/include/dpdk" >> + DPDK_LIB="-ldpdk"]) >> + ;; >> + "static" | "yes") >> + PKG_CHECK_MODULES_STATIC([DPDK], [libdpdk], [ >> + DPDK_INCLUDE="$DPDK_CFLAGS" >> + DPDK_LIB="$DPDK_LIBS"], [ >> + DPDK_INCLUDE="-I/usr/local/include/dpdk -I/usr/include/dpdk" >> + DPDK_LIB="-ldpdk"]) >> + ;; >> esac >> >> ovs_save_CFLAGS="$CFLAGS" >> ovs_save_LDFLAGS="$LDFLAGS" >> CFLAGS="$CFLAGS $DPDK_INCLUDE" >> - if test "$DPDK_AUTO_DISCOVER" = "false"; then >> - LDFLAGS="$LDFLAGS -L${DPDK_LIB_DIR}" >> - fi >> >> AC_CHECK_HEADERS([rte_config.h], [], [ >> AC_MSG_ERROR([unable to find rte_config.h in $with_dpdk]) >> @@ -422,20 +413,18 @@ AC_DEFUN([OVS_CHECK_DPDK], [ >> [AC_MSG_RESULT([yes]) >> DPDKLIB_FOUND=true], >> [AC_MSG_RESULT([no]) >> - if test "$DPDK_AUTO_DISCOVER" = "true"; then >> - AC_MSG_ERROR(m4_normalize([ >> - Could not find DPDK library in default search path, Use --with-dpdk >> - to specify the DPDK library installed in non-standard location])) >> - else >> - AC_MSG_ERROR([Could not find DPDK libraries in $DPDK_LIB_DIR]) >> - fi >> + AC_MSG_ERROR(m4_normalize([ >> + Could not find DPDK library in default search path, update >> + PKG_CONFIG_PATH for pkg-config to find the .pc file in >> + non-standard location])) >> ]) >> >> CFLAGS="$ovs_save_CFLAGS" >> LDFLAGS="$ovs_save_LDFLAGS" >> - if test "$DPDK_AUTO_DISCOVER" = "false"; then >> - OVS_LDFLAGS="$OVS_LDFLAGS -L$DPDK_LIB_DIR" >> - fi >> + # Stripping out possible instruction set specific configuration that DPDK >> + # forces in pkg-config since this could override user-specified options. >> + # It's enough to have -mssse3 to build with DPDK headers. >> + DPDK_INCLUDE=$(echo "$DPDK_INCLUDE" | sed 's/-march=[[a-z0-9]]*//g') >> OVS_CFLAGS="$OVS_CFLAGS $DPDK_INCLUDE" >> OVS_ENABLE_OPTION([-mssse3]) >> >> @@ -444,17 +433,16 @@ AC_DEFUN([OVS_CHECK_DPDK], [ >> # This happens because the rest of the DPDK code doesn't use any symbol in >> # the pmd driver objects, and the drivers register themselves using an >> # __attribute__((constructor)) function. >> - # >> - # These options are specified inside a single -Wl directive to prevent >> - # autotools from reordering them. >> - # >> - # OTOH newer versions of dpdk pkg-config (generated with Meson) >> - # will already have flagged just the right set of libs with >> - # --whole-archive - in those cases do not wrap it once more. >> - case "$DPDK_LIB" in >> - *whole-archive*) DPDK_vswitchd_LDFLAGS=$DPDK_LIB;; >> - *) DPDK_vswitchd_LDFLAGS=-Wl,--whole-archive,$DPDK_LIB,--no-whole-archive >> - esac >> + >> + # Wrap the DPDK libraries inside a single -Wl directive >> + # after comma separation to prevent autotools from reordering them. >> + DPDK_vswitchd_LDFLAGS=$(echo "$DPDK_LIB"| tr -s ' ' ',' | sed 's/-Wl,//g') >> + # Replace -pthread with -lpthread for LD and remove the last extra comma. >> + DPDK_vswitchd_LDFLAGS=$(echo "$DPDK_vswitchd_LDFLAGS"| sed 's/,$//' | \ >> + sed 's/-pthread/-lpthread/g') >> + # Prepend "-Wl,". >> + DPDK_vswitchd_LDFLAGS="-Wl,$DPDK_vswitchd_LDFLAGS" >> + >> AC_SUBST([DPDK_vswitchd_LDFLAGS]) >> AC_DEFINE([DPDK_NETDEV], [1], [System uses the DPDK module.]) >> fi >> diff --git a/include/sparse/automake.mk b/include/sparse/automake.mk >> index 974ad3fe5..e96637119 100644 >> --- a/include/sparse/automake.mk >> +++ b/include/sparse/automake.mk >> @@ -11,7 +11,9 @@ noinst_HEADERS += \ >> include/sparse/netpacket/packet.h \ >> include/sparse/pthread.h \ >> include/sparse/rte_atomic.h \ >> + include/sparse/rte_mbuf.h \ >> include/sparse/rte_memcpy.h \ >> + include/sparse/rte_trace_point.h \ >> include/sparse/sys/socket.h \ >> include/sparse/sys/sysmacros.h \ >> include/sparse/sys/types.h \ >> diff --git a/include/sparse/rte_mbuf.h b/include/sparse/rte_mbuf.h >> new file mode 100644 >> index 000000000..981cdb441 >> --- /dev/null >> +++ b/include/sparse/rte_mbuf.h >> @@ -0,0 +1,29 @@ >> +/* Copyright (c) 2020 Intel, Inc. >> + * >> + * Licensed under the Apache License, Version 2.0 (the "License"); >> + * you may not use this file except in compliance with the License. >> + * You may obtain a copy of the License at: >> + * >> + * https://nam11.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.apache.org%2Flicenses%2FLICENSE-2.0&data=04%7C01%7Celibr%40nvidia.com%7Cf93e5cb9a1144f590bb908d8a0e614eb%7C43083d15727340c1b7db39efd9ccc17a%7C0%7C0%7C637436257353634501%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=GAgi2FLbEZAMnR3zj%2BrXTxFOQqZpKYVFNidHAg8oN1o%3D&reserved=0 >> + * >> + * Unless required by applicable law or agreed to in writing, software >> + * distributed under the License is distributed on an "AS IS" BASIS, >> + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. >> + * See the License for the specific language governing permissions and >> + * limitations under the License. >> + */ >> + >> +#ifndef __CHECKER__ >> +#error "Use this header only with sparse. It is not a correct implementation." >> +#endif >> + >> +/* sparse doesn't know about gcc atomic builtins. */ >> +#ifndef __ATOMIC_ACQ_REL >> +#define __ATOMIC_ACQ_REL 0 >> +#define __ATOMIC_RELAXED 1 >> +#define __atomic_add_fetch(p, val, memorder) (*(p) = *(p) + (val)) >> +#define __atomic_store_n(p, val, memorder) (*(p) = (val)) >> +#endif >> + >> +/* Get actual <rte_mbuf.h> definitions for us to annotate and build on. */ >> +#include_next <rte_mbuf.h> >> diff --git a/include/sparse/rte_trace_point.h b/include/sparse/rte_trace_point.h >> new file mode 100644 >> index 000000000..803923275 >> --- /dev/null >> +++ b/include/sparse/rte_trace_point.h >> @@ -0,0 +1,28 @@ >> +/* Copyright 2020, Red Hat, Inc. >> + * >> + * Licensed under the Apache License, Version 2.0 (the "License"); >> + * you may not use this file except in compliance with the License. >> + * You may obtain a copy of the License at: >> + * >> + * https://nam11.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.apache.org%2Flicenses%2FLICENSE-2.0&data=04%7C01%7Celibr%40nvidia.com%7Cf93e5cb9a1144f590bb908d8a0e614eb%7C43083d15727340c1b7db39efd9ccc17a%7C0%7C0%7C637436257353634501%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=GAgi2FLbEZAMnR3zj%2BrXTxFOQqZpKYVFNidHAg8oN1o%3D&reserved=0 >> + * >> + * Unless required by applicable law or agreed to in writing, software >> + * distributed under the License is distributed on an "AS IS" BASIS, >> + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. >> + * See the License for the specific language governing permissions and >> + * limitations under the License. >> + */ >> + >> +#ifndef __CHECKER__ >> +#error "Use this header only with sparse. It is not a correct implementation." >> +#endif >> + >> +/* sparse doesn't know about gcc atomic builtins. */ >> +#ifndef __ATOMIC_ACQUIRE >> +#define __ATOMIC_ACQUIRE 0 >> +#define __atomic_load_n(p, memorder) *(p) >> +#endif >> + >> +/* Get actual <rte_trace_point.h> definitions for us to annotate and >> + * build on. */ >> +#include_next <rte_trace_point.h> >> diff --git a/lib/dpdk.c b/lib/dpdk.c >> index 2f235a742..319540394 100644 >> --- a/lib/dpdk.c >> +++ b/lib/dpdk.c >> @@ -443,7 +443,7 @@ dpdk_init__(const struct smap *ovs_other_config) >> >> /** >> * NOTE: This is an unsophisticated mechanism for determining the DPDK >> - * lcore for the DPDK Master. >> + * main core. >> */ >> if (auto_determine) { >> const struct ovs_numa_info_core *core; >> diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c >> index 75dffefb8..2640a421a 100644 >> --- a/lib/netdev-dpdk.c >> +++ b/lib/netdev-dpdk.c >> @@ -26,12 +26,6 @@ >> #include <sys/socket.h> >> #include <linux/if.h> >> >> -/* Include rte_compat.h first to allow experimental API's needed for the >> - * rte_meter.h rfc4115 functions. Once they are no longer marked as >> - * experimental the #define and rte_compat.h include can be removed. >> - */ >> -#define ALLOW_EXPERIMENTAL_API >> -#include <rte_compat.h> >> #include <rte_bus_pci.h> >> #include <rte_config.h> >> #include <rte_cycles.h> >> @@ -1312,7 +1306,7 @@ static int >> vhost_common_construct(struct netdev *netdev) >> OVS_REQUIRES(dpdk_mutex) >> { >> - int socket_id = rte_lcore_to_socket_id(rte_get_master_lcore()); >> + int socket_id = rte_lcore_to_socket_id(rte_get_main_lcore()); >> struct netdev_dpdk *dev = netdev_dpdk_cast(netdev); >> >> dev->vhost_rxq_enabled = dpdk_rte_mzalloc(OVS_VHOST_MAX_QUEUE_NUM * >> @@ -1463,7 +1457,6 @@ netdev_dpdk_destruct(struct netdev *netdev) >> struct netdev_dpdk *dev = netdev_dpdk_cast(netdev); >> struct rte_device *rte_dev; >> struct rte_eth_dev *eth_dev; >> - bool remove_on_close; >> >> ovs_mutex_lock(&dpdk_mutex); >> >> @@ -1475,20 +1468,15 @@ netdev_dpdk_destruct(struct netdev *netdev) >> * FIXME: avoid direct access to DPDK internal array rte_eth_devices. >> */ >> eth_dev = &rte_eth_devices[dev->port_id]; >> - remove_on_close = >> - eth_dev->data && >> - (eth_dev->data->dev_flags & RTE_ETH_DEV_CLOSE_REMOVE); >> rte_dev = eth_dev->device; >> >> /* Remove the eth device. */ >> rte_eth_dev_close(dev->port_id); >> >> - /* Remove this rte device and all its eth devices if flag >> - * RTE_ETH_DEV_CLOSE_REMOVE is not supported (which means representors >> - * are not supported), or if all the eth devices belonging to the rte >> - * device are closed. >> + /* Remove this rte device and all its eth devices if all the eth >> + * devices belonging to the rte device are closed. >> */ >> - if (!remove_on_close || !netdev_dpdk_get_num_ports(rte_dev)) { >> + if (!netdev_dpdk_get_num_ports(rte_dev)) { >> int ret = rte_dev_remove(rte_dev); >> >> if (ret < 0) { >>
On 12/15/20 12:06 PM, Eli Britstein wrote: > > On 12/15/2020 12:42 PM, Ilya Maximets wrote: >> External email: Use caution opening links or attachments >> >> >> On 12/14/20 9:30 PM, Ian Stokes wrote: >>> This commit adds support for DPDK v20.11, it includes the following >>> changes. >>> >>> 1. travis: Remove explicit DPDK kmods configuration. >>> 2. sparse: Fix build with 20.05 DPDK tracepoints. >>> 3. netdev-dpdk: Remove experimental API flag. >>> >>>    https://nam11.safelinks.protection.outlook.com/?url=http%3A%2F%2Fpatchwork.ozlabs.org%2Fproject%2Fopenvswitch%2Flist%2F%3Fseries%3D173216%26state%3D*&data=04%7C01%7Celibr%40nvidia.com%7Cf93e5cb9a1144f590bb908d8a0e614eb%7C43083d15727340c1b7db39efd9ccc17a%7C0%7C0%7C637436257353614513%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=E49FCxMvjRC3MDdN%2BBpaPndTBu7I2aJgrMX42kWqZbk%3D&reserved=0 >>> >>> 4. sparse: Update to DPDK 20.05 trace point header. >>> >>>    https://nam11.safelinks.protection.outlook.com/?url=http%3A%2F%2Fpatchwork.ozlabs.org%2Fproject%2Fopenvswitch%2Flist%2F%3Fseries%3D179604%26state%3D*&data=04%7C01%7Celibr%40nvidia.com%7Cf93e5cb9a1144f590bb908d8a0e614eb%7C43083d15727340c1b7db39efd9ccc17a%7C0%7C0%7C637436257353614513%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=otTJJrSW8Orq91iMcEAnC%2FOpCzOqA7TDIGE0N0kCq94%3D&reserved=0 >>> >>> 5. sparse: Fix build with DPDK 20.08. >>> >>>    https://nam11.safelinks.protection.outlook.com/?url=http%3A%2F%2Fpatchwork.ozlabs.org%2Fproject%2Fopenvswitch%2Flist%2F%3Fseries%3D200181%26state%3D*&data=04%7C01%7Celibr%40nvidia.com%7Cf93e5cb9a1144f590bb908d8a0e614eb%7C43083d15727340c1b7db39efd9ccc17a%7C0%7C0%7C637436257353614513%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=dyPYVQc%2FfDPx3vl0DP9TGRtvM64lW%2FFZzR7YbXGbeJ8%3D&reserved=0 >>> >>> 6. build: Add support for DPDK meson build. >>> >>>    https://nam11.safelinks.protection.outlook.com/?url=http%3A%2F%2Fpatchwork.ozlabs.org%2Fproject%2Fopenvswitch%2Flist%2F%3Fseries%3D199138%26state%3D*&data=04%7C01%7Celibr%40nvidia.com%7Cf93e5cb9a1144f590bb908d8a0e614eb%7C43083d15727340c1b7db39efd9ccc17a%7C0%7C0%7C637436257353614513%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=9eq55QPFxgeUiyMBfMYJfjcqbxOJDCMHWv%2Fx9e0lIdE%3D&reserved=0 >>> >>> 7. netdev-dpdk: Remove usage of RTE_ETH_DEV_CLOSE_REMOVE flag. >>> >>>    https://nam11.safelinks.protection.outlook.com/?url=http%3A%2F%2Fpatchwork.ozlabs.org%2Fproject%2Fopenvswitch%2Flist%2F%3Fseries%3D207850%26state%3D*&data=04%7C01%7Celibr%40nvidia.com%7Cf93e5cb9a1144f590bb908d8a0e614eb%7C43083d15727340c1b7db39efd9ccc17a%7C0%7C0%7C637436257353614513%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=2JDs4MSuJqLdfAZu95wY%2B9mCjZJDbpf6vpyALg793Cw%3D&reserved=0 >>> >>> 8. netdev-dpdk: Fix build with 20.11-rc1. >>> >>>    https://nam11.safelinks.protection.outlook.com/?url=http%3A%2F%2Fpatchwork.ozlabs.org%2Fproject%2Fopenvswitch%2Flist%2F%3Fseries%3D209006%26state%3D*&data=04%7C01%7Celibr%40nvidia.com%7Cf93e5cb9a1144f590bb908d8a0e614eb%7C43083d15727340c1b7db39efd9ccc17a%7C0%7C0%7C637436257353614513%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=CkbmxfIrjwHGhStZ6%2BnNvZR3IHN%2F77z13kN7%2BBCTNKM%3D&reserved=0 >>> >>> 9. sparse: Fix __ATOMIC_* redefinition errors >>> >>>    https://nam11.safelinks.protection.outlook.com/?url=http%3A%2F%2Fpatchwork.ozlabs.org%2Fproject%2Fopenvswitch%2Flist%2F%3Fseries%3D209452%26state%3D*&data=04%7C01%7Celibr%40nvidia.com%7Cf93e5cb9a1144f590bb908d8a0e614eb%7C43083d15727340c1b7db39efd9ccc17a%7C0%7C0%7C637436257353614513%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=sZqoeyQzMOmpEnaDhMF8Qlq9k%2FCgzmQ2OAY%2BIsWMYhc%3D&reserved=0 >>> >>> 10. build: Remove DPDK make build references. >>> >>>    https://nam11.safelinks.protection.outlook.com/?url=http%3A%2F%2Fpatchwork.ozlabs.org%2Fproject%2Fopenvswitch%2Flist%2F%3Fseries%3D216682%26state%3D*&data=04%7C01%7Celibr%40nvidia.com%7Cf93e5cb9a1144f590bb908d8a0e614eb%7C43083d15727340c1b7db39efd9ccc17a%7C0%7C0%7C637436257353614513%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=PzFEEqK%2BWCVMxLygtW0p9iRIzSZ7OMwbUOjRp775SXY%3D&reserved=0 >>> >>> For credit all authors of the original commits to 'dpdk-latest' with the >>> above changes have been added as co-authors for this commit. >>> >>> Signed-off-by: David Marchand <david.marchand@redhat.com> >>> Co-authored-by: David Marchand <david.marchand@redhat.com> >>> Signed-off-by: Sunil Pai G <sunil.pai.g@intel.com> >>> Co-authored-by: Sunil Pai G <sunil.pai.g@intel.com> >>> Signed-off-by: Eli Britstein <elibr@nvidia.com> >>> Co-authored-by: Eli Britstein <elibr@nvidia.com> >>> Tested-by: Harry van Haaren <harry.van.haaren@intel.com> >>> Tested-by: Govindharajan, Hariprasad <hariprasad.govindharajan@intel.com> >>> Signed-off-by: Ian Stokes <ian.stokes@intel.com> >>> >>> --- >>> v2 -> v3 >>> * Remove GHA others write removal. >>> * Strip march from pkg-config h=which is forced by DPDK. >> Thanks. Beside the pkg-config version checking issue from the separate >> thread, few minor comments inline. > > I probably missed the pkg-config version checking. Could you please point me to it? > > We saw that for pkg-config version 0.27.1 (that is provided with RH 7.7 for example), with static compilation, compilation passes but the DPDK PMDs are not registered upon init. We manually upgrade pkg-config in the build machines. > > A note was added in DPDK docs for that: > > https://mails.dpdk.org/archives/dev/2020-November/191602.html > > Is there such checking in OVS? Not yet. See the following thread: https://mail.openvswitch.org/pipermail/ovs-dev/2020-December/378684.html Best regards, Ilya Maximets.
On 12/14/20 9:30 PM, Ian Stokes wrote: > This commit adds support for DPDK v20.11, it includes the following > changes. > > 1. travis: Remove explicit DPDK kmods configuration. > 2. sparse: Fix build with 20.05 DPDK tracepoints. > 3. netdev-dpdk: Remove experimental API flag. > > http://patchwork.ozlabs.org/project/openvswitch/list/?series=173216&state=* > > 4. sparse: Update to DPDK 20.05 trace point header. > > http://patchwork.ozlabs.org/project/openvswitch/list/?series=179604&state=* > > 5. sparse: Fix build with DPDK 20.08. > > http://patchwork.ozlabs.org/project/openvswitch/list/?series=200181&state=* > > 6. build: Add support for DPDK meson build. > > http://patchwork.ozlabs.org/project/openvswitch/list/?series=199138&state=* > > 7. netdev-dpdk: Remove usage of RTE_ETH_DEV_CLOSE_REMOVE flag. > > http://patchwork.ozlabs.org/project/openvswitch/list/?series=207850&state=* > > 8. netdev-dpdk: Fix build with 20.11-rc1. > > http://patchwork.ozlabs.org/project/openvswitch/list/?series=209006&state=* > > 9. sparse: Fix __ATOMIC_* redefinition errors > > http://patchwork.ozlabs.org/project/openvswitch/list/?series=209452&state=* > > 10. build: Remove DPDK make build references. > > http://patchwork.ozlabs.org/project/openvswitch/list/?series=216682&state=* > > For credit all authors of the original commits to 'dpdk-latest' with the > above changes have been added as co-authors for this commit. > > Signed-off-by: David Marchand <david.marchand@redhat.com> > Co-authored-by: David Marchand <david.marchand@redhat.com> > Signed-off-by: Sunil Pai G <sunil.pai.g@intel.com> > Co-authored-by: Sunil Pai G <sunil.pai.g@intel.com> > Signed-off-by: Eli Britstein <elibr@nvidia.com> > Co-authored-by: Eli Britstein <elibr@nvidia.com> > Tested-by: Harry van Haaren <harry.van.haaren@intel.com> > Tested-by: Govindharajan, Hariprasad <hariprasad.govindharajan@intel.com> > Signed-off-by: Ian Stokes <ian.stokes@intel.com> > > --- > v2 -> v3 > * Remove GHA others write removal. > * Strip march from pkg-config h=which is forced by DPDK. > > RFC v1 -> v2 > * Removed RFC tag. > * Rebased to head of master. > * Modified GHA build scripts to install required python packages. > * Modified URLs to use versioned 20.11 links. > * Removed unrequired reformat in travis.yml. > * Modified GHA worflow buil-and-test.yml to remove others write > permission to $HOME in prepare step. > --- > .ci/linux-build.sh | 48 ++++++++++++------- > .ci/linux-prepare.sh | 1 + > .github/workflows/build-and-test.yml | 5 +- > .travis.yml | 3 ++ > Documentation/intro/install/afxdp.rst | 2 +- > Documentation/intro/install/dpdk.rst | 64 ++++++++++++++----------- > Documentation/topics/dpdk/phy.rst | 18 ++++--- > Documentation/topics/dpdk/vhost-user.rst | 20 +------- > Documentation/topics/testing.rst | 2 +- > NEWS | 1 + > acinclude.m4 | 82 ++++++++++++++------------------ > include/sparse/automake.mk | 2 + > include/sparse/rte_mbuf.h | 29 +++++++++++ > include/sparse/rte_trace_point.h | 28 +++++++++++ > lib/dpdk.c | 2 +- > lib/netdev-dpdk.c | 20 ++------ > 16 files changed, 190 insertions(+), 137 deletions(-) > create mode 100644 include/sparse/rte_mbuf.h > create mode 100644 include/sparse/rte_trace_point.h > > diff --git a/.ci/linux-build.sh b/.ci/linux-build.sh > index 16102ac94..3e5136fd4 100755 > --- a/.ci/linux-build.sh > +++ b/.ci/linux-build.sh > @@ -87,17 +87,29 @@ function install_dpdk() > { > local DPDK_VER=$1 > local VERSION_FILE="dpdk-dir/travis-dpdk-cache-version" > + local DPDK_OPTS="" > + local DPDK_LIB="" > > if [ -z "$TRAVIS_ARCH" ] || > [ "$TRAVIS_ARCH" == "amd64" ]; then > - TARGET="x86_64-native-linuxapp-gcc" > + DPDK_LIB=$(pwd)/dpdk-dir/build/lib/x86_64-linux-gnu > elif [ "$TRAVIS_ARCH" == "aarch64" ]; then > - TARGET="arm64-armv8a-linuxapp-gcc" > + DPDK_LIB=$(pwd)/dpdk-dir/build/lib/aarch64-linux-gnu > else > echo "Target is unknown" > exit 1 > fi > > + if [ "$DPDK_SHARED" ]; then > + EXTRA_OPTS="$EXTRA_OPTS --with-dpdk=shared" > + export LD_LIBRARY_PATH=$DPDK_LIB/:$LD_LIBRARY_PATH > + else > + EXTRA_OPTS="$EXTRA_OPTS --with-dpdk=static" > + fi > + > + # Export the following path for pkg-config to find the .pc file. > + export PKG_CONFIG_PATH=$DPDK_LIB/pkgconfig/:$PKG_CONFIG_PATH > + > if [ "${DPDK_VER##refs/*/}" != "${DPDK_VER}" ]; then > # Avoid using cache for git tree build. > rm -rf dpdk-dir > @@ -110,7 +122,8 @@ function install_dpdk() > if [ -f "${VERSION_FILE}" ]; then > VER=$(cat ${VERSION_FILE}) > if [ "${VER}" = "${DPDK_VER}" ]; then > - EXTRA_OPTS="${EXTRA_OPTS} --with-dpdk=$(pwd)/dpdk-dir/build" > + # Update the library paths. > + sudo ldconfig > echo "Found cached DPDK ${VER} build in $(pwd)/dpdk-dir" > return > fi > @@ -124,23 +137,24 @@ function install_dpdk() > pushd dpdk-dir > fi > > - make config CC=gcc T=$TARGET > + # Switching to 'default' machine to make dpdk-dir cache usable on > + # different CPUs. We can't be sure that all CI machines are exactly same. > + DPDK_OPTS="$DPDK_OPTS -Dmachine=default" > > - if [ "$DPDK_SHARED" ]; then > - sed -i '/CONFIG_RTE_BUILD_SHARED_LIB=n/s/=n/=y/' build/.config > - export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$(pwd)/$TARGET/lib > - fi > + # Disable building DPDK unit tests. Not needed for OVS build or tests. > + DPDK_OPTS="$DPDK_OPTS -Dtests=false" > + > + # Install DPDK using prefix. > + DPDK_OPTS="$DPDK_OPTS --prefix=$(pwd)/build" > + > + CC=gcc meson $DPDK_OPTS build > + ninja -C build > + ninja -C build install > > - # Disable building DPDK kernel modules. Not needed for OVS build or tests. > - sed -i '/CONFIG_RTE_EAL_IGB_UIO=y/s/=y/=n/' build/.config > - sed -i '/CONFIG_RTE_KNI_KMOD=y/s/=y/=n/' build/.config > + # Update the library paths. > + sudo ldconfig > > - # Switching to 'default' machine to make dpdk-dir cache usable on different > - # CPUs. We can't be sure that all CI machines are exactly same. > - sed -i '/CONFIG_RTE_MACHINE="native"/s/="native"/="default"/' build/.config > > - make -j4 CC=gcc EXTRA_CFLAGS='-fPIC' > - EXTRA_OPTS="$EXTRA_OPTS --with-dpdk=$(pwd)/build" > echo "Installed DPDK source in $(pwd)" > popd > echo "${DPDK_VER}" > ${VERSION_FILE} > @@ -187,7 +201,7 @@ fi > > if [ "$DPDK" ] || [ "$DPDK_SHARED" ]; then > if [ -z "$DPDK_VER" ]; then > - DPDK_VER="19.11.2" > + DPDK_VER="20.11" > fi > install_dpdk $DPDK_VER > if [ "$CC" = "clang" ]; then > diff --git a/.ci/linux-prepare.sh b/.ci/linux-prepare.sh > index fea905a83..69a40011f 100755 > --- a/.ci/linux-prepare.sh > +++ b/.ci/linux-prepare.sh > @@ -22,6 +22,7 @@ cd .. > > pip3 install --disable-pip-version-check --user flake8 hacking > pip3 install --user --upgrade docutils > +pip3 install --user 'meson==0.47.1' > > if [ "$M32" ]; then > # Installing 32-bit libraries. > diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml > index 847fd3150..c83066138 100644 > --- a/.github/workflows/build-and-test.yml > +++ b/.github/workflows/build-and-test.yml > @@ -8,7 +8,8 @@ jobs: > dependencies: | > automake libtool gcc bc libjemalloc1 libjemalloc-dev \ > libssl-dev llvm-dev libelf-dev libnuma-dev libpcap-dev \ > - python3-openssl python3-pip python3-sphinx \ > + ninja-build python3-openssl python3-pip \ > + python3-setuptools python3-sphinx python3-wheel \ > selinux-policy-dev > deb_dependencies: | > linux-headers-$(uname -r) build-essential fakeroot devscripts equivs > @@ -146,7 +147,7 @@ jobs: > run: ./.ci/linux-prepare.sh > > - name: build > - run: PATH="$PATH:$HOME/bin" ./.ci/linux-build.sh > + run: PATH="$PATH:$HOME/bin:$HOME/.local/bin" ./.ci/linux-build.sh > > - name: upload deb packages > if: matrix.deb_package != '' > diff --git a/.travis.yml b/.travis.yml > index acf3c10fb..51d051108 100644 > --- a/.travis.yml > +++ b/.travis.yml > @@ -24,6 +24,9 @@ addons: > - selinux-policy-dev > - libunbound-dev > - libunwind-dev > + - python3-setuptools > + - python3-wheel > + - ninja-build > > before_install: ./.ci/${TRAVIS_OS_NAME}-prepare.sh > > diff --git a/Documentation/intro/install/afxdp.rst b/Documentation/intro/install/afxdp.rst > index 3c8f78825..aad0aeebe 100644 > --- a/Documentation/intro/install/afxdp.rst > +++ b/Documentation/intro/install/afxdp.rst > @@ -396,7 +396,7 @@ PVP using vhostuser device > -------------------------- > First, build OVS with DPDK and AFXDP:: > > - ./configure --enable-afxdp --with-dpdk=<dpdk path> > + ./configure --enable-afxdp --with-dpdk=shared|static > make -j4 && make install > > Create a vhost-user port from OVS:: > diff --git a/Documentation/intro/install/dpdk.rst b/Documentation/intro/install/dpdk.rst > index fe11571d2..4f0c10082 100644 > --- a/Documentation/intro/install/dpdk.rst > +++ b/Documentation/intro/install/dpdk.rst > @@ -42,7 +42,7 @@ Build requirements > In addition to the requirements described in :doc:`general`, building Open > vSwitch with DPDK will require the following: > > -- DPDK 19.11.2 > +- DPDK 20.11 > > - A `DPDK supported NIC`_ > > @@ -62,6 +62,8 @@ Detailed system requirements can be found at `DPDK requirements`_. > .. _DPDK supported NIC: http://dpdk.org/doc/nics > .. _DPDK requirements: http://dpdk.org/doc/guides/linux_gsg/sys_reqs.html > > +.. _dpdk-install: > + > Installing > ---------- > > @@ -71,38 +73,44 @@ Install DPDK > #. Download the `DPDK sources`_, extract the file and set ``DPDK_DIR``:: > > $ cd /usr/src/ > - $ wget https://fast.dpdk.org/rel/dpdk-19.11.2.tar.xz > - $ tar xf dpdk-19.11.2.tar.xz > - $ export DPDK_DIR=/usr/src/dpdk-stable-19.11.2 > + $ wget https://fast.dpdk.org/rel/dpdk-20.11.tar.xz > + $ tar xf dpdk-20.11.tar.xz > + $ export DPDK_DIR=/usr/src/dpdk-20.11 > $ cd $DPDK_DIR > > -#. (Optional) Configure DPDK as a shared library > +#. Configure and install DPDK using Meson > > - DPDK can be built as either a static library or a shared library. By > - default, it is configured for the former. If you wish to use the latter, set > - ``CONFIG_RTE_BUILD_SHARED_LIB=y`` in ``$DPDK_DIR/config/common_base``. > + Build and install the DPDK library:: > > - .. note:: > + $ export DPDK_BUILD=$DPDK_DIR/build > + $ meson build > + $ ninja -C build > + $ sudo ninja -C build install > + $ sudo ldconfig > > - Minor performance loss is expected when using OVS with a shared DPDK > - library compared to a static DPDK library. > + Detailed information can be found at `DPDK documentation`_. > > -#. Configure and install DPDK > +#. (Optional) Configure and export the DPDK shared library location > > - Build and install the DPDK library:: > + Since DPDK is built both as static and shared library by default, no extra > + configuration is required for the build. > > - $ export DPDK_TARGET=x86_64-native-linuxapp-gcc > - $ export DPDK_BUILD=$DPDK_DIR/$DPDK_TARGET > - $ make install T=$DPDK_TARGET DESTDIR=install > + Exporting the path to library is not necessary if the DPDK libraries are > + system installed. For libraries installed using a prefix, export the path > + to this library and also update the $PKG_CONFIG_PATH for use > + before building OVS:: > > -#. (Optional) Export the DPDK shared library location > + $ export LD_LIBRARY_PATH=/path/to/installed/DPDK/libraries > + $ export PKG_CONFIG_PATH=/path/to/installed/".pc" file/for/DPDK > > - If DPDK was built as a shared library, export the path to this library for > - use when building OVS:: > + .. note:: > > - $ export LD_LIBRARY_PATH=$DPDK_DIR/x86_64-native-linuxapp-gcc/lib > + Minor performance loss is expected when using OVS with a shared DPDK > + library compared to a static DPDK library. > > .. _DPDK sources: http://dpdk.org/rel > +.. _DPDK documentation: > + https://doc.dpdk.org/guides-20.08/linux_gsg/build_dpdk.html > > Install OVS > ~~~~~~~~~~~ > @@ -121,16 +129,16 @@ has to be configured to build against the DPDK library (``--with-dpdk``). > > #. Bootstrap, if required, as described in :ref:`general-bootstrapping` > > -#. Configure the package using the ``--with-dpdk`` flag:: > +#. Configure the package using the ``--with-dpdk`` flag: > + > + If OVS must consume DPDK static libraries > + (also equivalent to ``--with-dpdk=yes`` ):: > > - $ ./configure --with-dpdk=$DPDK_BUILD > + $ ./configure --with-dpdk=static > > - where ``DPDK_BUILD`` is the path to the built DPDK library. This can be > - skipped if DPDK library is installed in its default location. > + If OVS must consume DPDK shared libraries:: > > - If no path is provided to ``--with-dpdk``, but a pkg-config configuration > - for libdpdk is available the include paths will be generated via an > - equivalent ``pkg-config --cflags libdpdk``. > + $ ./configure --with-dpdk=shared > > .. note:: > While ``--with-dpdk`` is required, you can pass any other configuration > @@ -703,7 +711,7 @@ Limitations > release notes`_. > > .. _DPDK release notes: > - https://doc.dpdk.org/guides-19.11/rel_notes/release_19_11.html > + https://doc.dpdk.org/guides-20.11/rel_notes/release_20_11.html > > - Upper bound MTU: DPDK device drivers differ in how the L2 frame for a > given MTU value is calculated e.g. i40e driver includes 2 x vlan headers in > diff --git a/Documentation/topics/dpdk/phy.rst b/Documentation/topics/dpdk/phy.rst > index 7ee3eacff..d21ecc915 100644 > --- a/Documentation/topics/dpdk/phy.rst > +++ b/Documentation/topics/dpdk/phy.rst > @@ -218,18 +218,24 @@ If the log is not seen then the port can be detached like so:: > Hotplugging with IGB_UIO > ~~~~~~~~~~~~~~~~~~~~~~~~ > > -As of DPDK 19.11, default igb_uio hotplugging behavior changes from > +.. important:: > + > + As of DPDK v20.11 IGB_UIO has been deprecated and is no longer built as > + part of the default DPDK library. Below is intended for those who wish > + to use IGB_UIO outside of the standard DPDK build from v20.11 onwards. > + > +As of DPDK v19.11, default igb_uio hotplugging behavior changed from > previous DPDK versions. > > -With DPDK 19.11, if no device is bound to igb_uio when OVS is launched then > -the IOVA mode may be set to virtual addressing for DPDK. This is incompatible > -for hotplugging with igb_uio. > +From DPDK v19.11 onwards, if no device is bound to igb_uio when OVS is > +launched then the IOVA mode may be set to virtual addressing for DPDK. > +This is incompatible for hotplugging with igb_uio. > > To hotplug a port with igb_uio in this case, DPDK must be configured to use > physical addressing for IOVA mode. For more information regarding IOVA modes > in DPDK please refer to the `DPDK IOVA Mode Detection`__. > > -__ https://doc.dpdk.org/guides-19.11/prog_guide/env_abstraction_layer.html#iova-mode-detection > +__ https://doc.dpdk.org/guides-20.11/prog_guide/env_abstraction_layer.html#iova-mode-detection > > To configure OVS DPDK to use physical addressing for IOVA:: > > @@ -261,7 +267,7 @@ Representors are multi devices created on top of one PF. > > For more information, refer to the `DPDK documentation`__. > > -__ https://doc.dpdk.org/guides-19.11/prog_guide/switch_representation.html > +__ https://doc.dpdk.org/guides-20.11/prog_guide/switch_representation.html > > Prior to port representors there was a one-to-one relationship between the PF > and the eth device. With port representors the relationship becomes one PF to > diff --git a/Documentation/topics/dpdk/vhost-user.rst b/Documentation/topics/dpdk/vhost-user.rst > index 75d3fc958..bcd51e65c 100644 > --- a/Documentation/topics/dpdk/vhost-user.rst > +++ b/Documentation/topics/dpdk/vhost-user.rst > @@ -389,23 +389,7 @@ application in the VM. > > To begin, instantiate a guest as described in :ref:`dpdk-vhost-user` or > :ref:`dpdk-vhost-user-client`. Once started, connect to the VM, download the > -DPDK sources to VM and build DPDK:: > - > - $ cd /root/dpdk/ > - $ wget https://fast.dpdk.org/rel/dpdk-19.11.2.tar.xz > - $ tar xf dpdk-19.11.2.tar.xz > - $ export DPDK_DIR=/root/dpdk/dpdk-stable-19.11.2 > - $ export DPDK_TARGET=x86_64-native-linuxapp-gcc > - $ export DPDK_BUILD=$DPDK_DIR/$DPDK_TARGET > - $ cd $DPDK_DIR > - $ make install T=$DPDK_TARGET DESTDIR=install > - > -Build the test-pmd application:: > - > - $ cd app/test-pmd > - $ export RTE_SDK=$DPDK_DIR > - $ export RTE_TARGET=$DPDK_TARGET > - $ make > +DPDK sources to VM and build DPDK as described in :ref:`dpdk-install`. > > Setup huge pages and DPDK devices using UIO:: > > @@ -555,4 +539,4 @@ shown with:: > > Further information can be found in the > `DPDK documentation > -<https://doc.dpdk.org/guides-19.11/prog_guide/vhost_lib.html>`__ > +<https://doc.dpdk.org/guides-20.11/prog_guide/vhost_lib.html>`__ > diff --git a/Documentation/topics/testing.rst b/Documentation/topics/testing.rst > index b9fa94dda..951fe9e85 100644 > --- a/Documentation/topics/testing.rst > +++ b/Documentation/topics/testing.rst > @@ -353,7 +353,7 @@ All tests are skipped if no hugepages are configured. User must look into the DP > manual to figure out how to `Configure hugepages`_. > The phy test will skip if no compatible physical device is available. > > -.. _Configure hugepages: https://doc.dpdk.org/guides-19.11/linux_gsg/sys_reqs.html > +.. _Configure hugepages: https://doc.dpdk.org/guides-20.11/linux_gsg/sys_reqs.html > > All the features documented under `Unit Tests`_ are available for the DPDK > datapath testsuite. > diff --git a/NEWS b/NEWS > index 7e291a180..1a39cc661 100644 > --- a/NEWS > +++ b/NEWS > @@ -11,6 +11,7 @@ Post-v2.14.0 > Use the 'cluster/set-backlog-threshold' command to change limits. > - DPDK: > * Removed support for vhost-user dequeue zero-copy. > + * Add support for DPDK 20.11. > - Userspace datapath: > * Add the 'pmd' option to "ovs-appctl dpctl/dump-flows", which > restricts a flow dump to a single PMD thread if set. > diff --git a/acinclude.m4 b/acinclude.m4 > index ddf4b71e1..3df496666 100644 > --- a/acinclude.m4 > +++ b/acinclude.m4 > @@ -334,8 +334,9 @@ dnl > dnl Configure DPDK source tree > AC_DEFUN([OVS_CHECK_DPDK], [ > AC_ARG_WITH([dpdk], > - [AC_HELP_STRING([--with-dpdk=/path/to/dpdk], > - [Specify the DPDK build directory])], > + [AC_HELP_STRING([--with-dpdk=static|shared|yes], > + [Specify "static" or "shared" depending on the > + DPDK libraries to use])], > [have_dpdk=true]) > > AC_MSG_CHECKING([whether dpdk is enabled]) > @@ -345,35 +346,25 @@ AC_DEFUN([OVS_CHECK_DPDK], [ > else > AC_MSG_RESULT([yes]) > case "$with_dpdk" in > - yes) > - DPDK_AUTO_DISCOVER="true" > - PKG_CHECK_MODULES_STATIC([DPDK], [libdpdk], [ > - DPDK_INCLUDE="$DPDK_CFLAGS" > - DPDK_LIB="$DPDK_LIBS"], [ > - DPDK_INCLUDE="-I/usr/local/include/dpdk -I/usr/include/dpdk" > - DPDK_LIB="-ldpdk"]) > - ;; > - *) > - DPDK_AUTO_DISCOVER="false" > - DPDK_INCLUDE_PATH="$with_dpdk/include" > - # If 'with_dpdk' is passed install directory, point to headers > - # installed in $DESTDIR/$prefix/include/dpdk > - if test -e "$DPDK_INCLUDE_PATH/rte_config.h"; then > - DPDK_INCLUDE="-I$DPDK_INCLUDE_PATH" > - elif test -e "$DPDK_INCLUDE_PATH/dpdk/rte_config.h"; then > - DPDK_INCLUDE="-I$DPDK_INCLUDE_PATH/dpdk" > - fi > - DPDK_LIB_DIR="$with_dpdk/lib" > - DPDK_LIB="-ldpdk" > - ;; > + "shared") > + PKG_CHECK_MODULES([DPDK], [libdpdk], [ > + DPDK_INCLUDE="$DPDK_CFLAGS" > + DPDK_LIB="$DPDK_LIBS"], [ > + DPDK_INCLUDE="-I/usr/local/include/dpdk -I/usr/include/dpdk" > + DPDK_LIB="-ldpdk"]) > + ;; > + "static" | "yes") > + PKG_CHECK_MODULES_STATIC([DPDK], [libdpdk], [ > + DPDK_INCLUDE="$DPDK_CFLAGS" > + DPDK_LIB="$DPDK_LIBS"], [ > + DPDK_INCLUDE="-I/usr/local/include/dpdk -I/usr/include/dpdk" > + DPDK_LIB="-ldpdk"]) > + ;; > esac > > ovs_save_CFLAGS="$CFLAGS" > ovs_save_LDFLAGS="$LDFLAGS" > CFLAGS="$CFLAGS $DPDK_INCLUDE" > - if test "$DPDK_AUTO_DISCOVER" = "false"; then > - LDFLAGS="$LDFLAGS -L${DPDK_LIB_DIR}" > - fi > > AC_CHECK_HEADERS([rte_config.h], [], [ > AC_MSG_ERROR([unable to find rte_config.h in $with_dpdk]) > @@ -422,20 +413,18 @@ AC_DEFUN([OVS_CHECK_DPDK], [ > [AC_MSG_RESULT([yes]) > DPDKLIB_FOUND=true], > [AC_MSG_RESULT([no]) > - if test "$DPDK_AUTO_DISCOVER" = "true"; then > - AC_MSG_ERROR(m4_normalize([ > - Could not find DPDK library in default search path, Use --with-dpdk > - to specify the DPDK library installed in non-standard location])) > - else > - AC_MSG_ERROR([Could not find DPDK libraries in $DPDK_LIB_DIR]) > - fi > + AC_MSG_ERROR(m4_normalize([ > + Could not find DPDK library in default search path, update > + PKG_CONFIG_PATH for pkg-config to find the .pc file in > + non-standard location])) > ]) > > CFLAGS="$ovs_save_CFLAGS" > LDFLAGS="$ovs_save_LDFLAGS" > - if test "$DPDK_AUTO_DISCOVER" = "false"; then > - OVS_LDFLAGS="$OVS_LDFLAGS -L$DPDK_LIB_DIR" > - fi > + # Stripping out possible instruction set specific configuration that DPDK > + # forces in pkg-config since this could override user-specified options. > + # It's enough to have -mssse3 to build with DPDK headers. > + DPDK_INCLUDE=$(echo "$DPDK_INCLUDE" | sed 's/-march=[[a-z0-9]]*//g') This regexp doesn't cover arm default case: -march=armv8-a+crc Need a better one. Travis catched this: https://travis-ci.com/github/ovsrobot/ovs/jobs/459786050#L5768 Probably, sed 's/-march=[[^ ]]*//g' Best regards, Ilya Maximets.
Hi folks, You can find the v4 here: http://patchwork.ozlabs.org/project/openvswitch/patch/20201215164128.13153-1-sunil.pai.g@intel.com/ > > + # Stripping out possible instruction set specific configuration that DPDK > > + # forces in pkg-config since this could override user-specified options. > > + # It's enough to have -mssse3 to build with DPDK headers. > > + DPDK_INCLUDE=$(echo "$DPDK_INCLUDE" | sed > > + 's/-march=[[a-z0-9]]*//g') > > This regexp doesn't cover arm default case: -march=armv8-a+crc Need a > better one. Travis catched this: > https://travis-ci.com/github/ovsrobot/ovs/jobs/459786050#L5768 > > Probably, sed 's/-march=[[^ ]]*//g' > > Best regards, Ilya Maximets. Included this change in v4 Ilya :) https://travis-ci.org/github/Sunil-Pai-G/ovs/jobs/749839568 Thank and regards, Sunil
diff --git a/.ci/linux-build.sh b/.ci/linux-build.sh index 16102ac94..3e5136fd4 100755 --- a/.ci/linux-build.sh +++ b/.ci/linux-build.sh @@ -87,17 +87,29 @@ function install_dpdk() { local DPDK_VER=$1 local VERSION_FILE="dpdk-dir/travis-dpdk-cache-version" + local DPDK_OPTS="" + local DPDK_LIB="" if [ -z "$TRAVIS_ARCH" ] || [ "$TRAVIS_ARCH" == "amd64" ]; then - TARGET="x86_64-native-linuxapp-gcc" + DPDK_LIB=$(pwd)/dpdk-dir/build/lib/x86_64-linux-gnu elif [ "$TRAVIS_ARCH" == "aarch64" ]; then - TARGET="arm64-armv8a-linuxapp-gcc" + DPDK_LIB=$(pwd)/dpdk-dir/build/lib/aarch64-linux-gnu else echo "Target is unknown" exit 1 fi + if [ "$DPDK_SHARED" ]; then + EXTRA_OPTS="$EXTRA_OPTS --with-dpdk=shared" + export LD_LIBRARY_PATH=$DPDK_LIB/:$LD_LIBRARY_PATH + else + EXTRA_OPTS="$EXTRA_OPTS --with-dpdk=static" + fi + + # Export the following path for pkg-config to find the .pc file. + export PKG_CONFIG_PATH=$DPDK_LIB/pkgconfig/:$PKG_CONFIG_PATH + if [ "${DPDK_VER##refs/*/}" != "${DPDK_VER}" ]; then # Avoid using cache for git tree build. rm -rf dpdk-dir @@ -110,7 +122,8 @@ function install_dpdk() if [ -f "${VERSION_FILE}" ]; then VER=$(cat ${VERSION_FILE}) if [ "${VER}" = "${DPDK_VER}" ]; then - EXTRA_OPTS="${EXTRA_OPTS} --with-dpdk=$(pwd)/dpdk-dir/build" + # Update the library paths. + sudo ldconfig echo "Found cached DPDK ${VER} build in $(pwd)/dpdk-dir" return fi @@ -124,23 +137,24 @@ function install_dpdk() pushd dpdk-dir fi - make config CC=gcc T=$TARGET + # Switching to 'default' machine to make dpdk-dir cache usable on + # different CPUs. We can't be sure that all CI machines are exactly same. + DPDK_OPTS="$DPDK_OPTS -Dmachine=default" - if [ "$DPDK_SHARED" ]; then - sed -i '/CONFIG_RTE_BUILD_SHARED_LIB=n/s/=n/=y/' build/.config - export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$(pwd)/$TARGET/lib - fi + # Disable building DPDK unit tests. Not needed for OVS build or tests. + DPDK_OPTS="$DPDK_OPTS -Dtests=false" + + # Install DPDK using prefix. + DPDK_OPTS="$DPDK_OPTS --prefix=$(pwd)/build" + + CC=gcc meson $DPDK_OPTS build + ninja -C build + ninja -C build install - # Disable building DPDK kernel modules. Not needed for OVS build or tests. - sed -i '/CONFIG_RTE_EAL_IGB_UIO=y/s/=y/=n/' build/.config - sed -i '/CONFIG_RTE_KNI_KMOD=y/s/=y/=n/' build/.config + # Update the library paths. + sudo ldconfig - # Switching to 'default' machine to make dpdk-dir cache usable on different - # CPUs. We can't be sure that all CI machines are exactly same. - sed -i '/CONFIG_RTE_MACHINE="native"/s/="native"/="default"/' build/.config - make -j4 CC=gcc EXTRA_CFLAGS='-fPIC' - EXTRA_OPTS="$EXTRA_OPTS --with-dpdk=$(pwd)/build" echo "Installed DPDK source in $(pwd)" popd echo "${DPDK_VER}" > ${VERSION_FILE} @@ -187,7 +201,7 @@ fi if [ "$DPDK" ] || [ "$DPDK_SHARED" ]; then if [ -z "$DPDK_VER" ]; then - DPDK_VER="19.11.2" + DPDK_VER="20.11" fi install_dpdk $DPDK_VER if [ "$CC" = "clang" ]; then diff --git a/.ci/linux-prepare.sh b/.ci/linux-prepare.sh index fea905a83..69a40011f 100755 --- a/.ci/linux-prepare.sh +++ b/.ci/linux-prepare.sh @@ -22,6 +22,7 @@ cd .. pip3 install --disable-pip-version-check --user flake8 hacking pip3 install --user --upgrade docutils +pip3 install --user 'meson==0.47.1' if [ "$M32" ]; then # Installing 32-bit libraries. diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index 847fd3150..c83066138 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -8,7 +8,8 @@ jobs: dependencies: | automake libtool gcc bc libjemalloc1 libjemalloc-dev \ libssl-dev llvm-dev libelf-dev libnuma-dev libpcap-dev \ - python3-openssl python3-pip python3-sphinx \ + ninja-build python3-openssl python3-pip \ + python3-setuptools python3-sphinx python3-wheel \ selinux-policy-dev deb_dependencies: | linux-headers-$(uname -r) build-essential fakeroot devscripts equivs @@ -146,7 +147,7 @@ jobs: run: ./.ci/linux-prepare.sh - name: build - run: PATH="$PATH:$HOME/bin" ./.ci/linux-build.sh + run: PATH="$PATH:$HOME/bin:$HOME/.local/bin" ./.ci/linux-build.sh - name: upload deb packages if: matrix.deb_package != '' diff --git a/.travis.yml b/.travis.yml index acf3c10fb..51d051108 100644 --- a/.travis.yml +++ b/.travis.yml @@ -24,6 +24,9 @@ addons: - selinux-policy-dev - libunbound-dev - libunwind-dev + - python3-setuptools + - python3-wheel + - ninja-build before_install: ./.ci/${TRAVIS_OS_NAME}-prepare.sh diff --git a/Documentation/intro/install/afxdp.rst b/Documentation/intro/install/afxdp.rst index 3c8f78825..aad0aeebe 100644 --- a/Documentation/intro/install/afxdp.rst +++ b/Documentation/intro/install/afxdp.rst @@ -396,7 +396,7 @@ PVP using vhostuser device -------------------------- First, build OVS with DPDK and AFXDP:: - ./configure --enable-afxdp --with-dpdk=<dpdk path> + ./configure --enable-afxdp --with-dpdk=shared|static make -j4 && make install Create a vhost-user port from OVS:: diff --git a/Documentation/intro/install/dpdk.rst b/Documentation/intro/install/dpdk.rst index fe11571d2..4f0c10082 100644 --- a/Documentation/intro/install/dpdk.rst +++ b/Documentation/intro/install/dpdk.rst @@ -42,7 +42,7 @@ Build requirements In addition to the requirements described in :doc:`general`, building Open vSwitch with DPDK will require the following: -- DPDK 19.11.2 +- DPDK 20.11 - A `DPDK supported NIC`_ @@ -62,6 +62,8 @@ Detailed system requirements can be found at `DPDK requirements`_. .. _DPDK supported NIC: http://dpdk.org/doc/nics .. _DPDK requirements: http://dpdk.org/doc/guides/linux_gsg/sys_reqs.html +.. _dpdk-install: + Installing ---------- @@ -71,38 +73,44 @@ Install DPDK #. Download the `DPDK sources`_, extract the file and set ``DPDK_DIR``:: $ cd /usr/src/ - $ wget https://fast.dpdk.org/rel/dpdk-19.11.2.tar.xz - $ tar xf dpdk-19.11.2.tar.xz - $ export DPDK_DIR=/usr/src/dpdk-stable-19.11.2 + $ wget https://fast.dpdk.org/rel/dpdk-20.11.tar.xz + $ tar xf dpdk-20.11.tar.xz + $ export DPDK_DIR=/usr/src/dpdk-20.11 $ cd $DPDK_DIR -#. (Optional) Configure DPDK as a shared library +#. Configure and install DPDK using Meson - DPDK can be built as either a static library or a shared library. By - default, it is configured for the former. If you wish to use the latter, set - ``CONFIG_RTE_BUILD_SHARED_LIB=y`` in ``$DPDK_DIR/config/common_base``. + Build and install the DPDK library:: - .. note:: + $ export DPDK_BUILD=$DPDK_DIR/build + $ meson build + $ ninja -C build + $ sudo ninja -C build install + $ sudo ldconfig - Minor performance loss is expected when using OVS with a shared DPDK - library compared to a static DPDK library. + Detailed information can be found at `DPDK documentation`_. -#. Configure and install DPDK +#. (Optional) Configure and export the DPDK shared library location - Build and install the DPDK library:: + Since DPDK is built both as static and shared library by default, no extra + configuration is required for the build. - $ export DPDK_TARGET=x86_64-native-linuxapp-gcc - $ export DPDK_BUILD=$DPDK_DIR/$DPDK_TARGET - $ make install T=$DPDK_TARGET DESTDIR=install + Exporting the path to library is not necessary if the DPDK libraries are + system installed. For libraries installed using a prefix, export the path + to this library and also update the $PKG_CONFIG_PATH for use + before building OVS:: -#. (Optional) Export the DPDK shared library location + $ export LD_LIBRARY_PATH=/path/to/installed/DPDK/libraries + $ export PKG_CONFIG_PATH=/path/to/installed/".pc" file/for/DPDK - If DPDK was built as a shared library, export the path to this library for - use when building OVS:: + .. note:: - $ export LD_LIBRARY_PATH=$DPDK_DIR/x86_64-native-linuxapp-gcc/lib + Minor performance loss is expected when using OVS with a shared DPDK + library compared to a static DPDK library. .. _DPDK sources: http://dpdk.org/rel +.. _DPDK documentation: + https://doc.dpdk.org/guides-20.08/linux_gsg/build_dpdk.html Install OVS ~~~~~~~~~~~ @@ -121,16 +129,16 @@ has to be configured to build against the DPDK library (``--with-dpdk``). #. Bootstrap, if required, as described in :ref:`general-bootstrapping` -#. Configure the package using the ``--with-dpdk`` flag:: +#. Configure the package using the ``--with-dpdk`` flag: + + If OVS must consume DPDK static libraries + (also equivalent to ``--with-dpdk=yes`` ):: - $ ./configure --with-dpdk=$DPDK_BUILD + $ ./configure --with-dpdk=static - where ``DPDK_BUILD`` is the path to the built DPDK library. This can be - skipped if DPDK library is installed in its default location. + If OVS must consume DPDK shared libraries:: - If no path is provided to ``--with-dpdk``, but a pkg-config configuration - for libdpdk is available the include paths will be generated via an - equivalent ``pkg-config --cflags libdpdk``. + $ ./configure --with-dpdk=shared .. note:: While ``--with-dpdk`` is required, you can pass any other configuration @@ -703,7 +711,7 @@ Limitations release notes`_. .. _DPDK release notes: - https://doc.dpdk.org/guides-19.11/rel_notes/release_19_11.html + https://doc.dpdk.org/guides-20.11/rel_notes/release_20_11.html - Upper bound MTU: DPDK device drivers differ in how the L2 frame for a given MTU value is calculated e.g. i40e driver includes 2 x vlan headers in diff --git a/Documentation/topics/dpdk/phy.rst b/Documentation/topics/dpdk/phy.rst index 7ee3eacff..d21ecc915 100644 --- a/Documentation/topics/dpdk/phy.rst +++ b/Documentation/topics/dpdk/phy.rst @@ -218,18 +218,24 @@ If the log is not seen then the port can be detached like so:: Hotplugging with IGB_UIO ~~~~~~~~~~~~~~~~~~~~~~~~ -As of DPDK 19.11, default igb_uio hotplugging behavior changes from +.. important:: + + As of DPDK v20.11 IGB_UIO has been deprecated and is no longer built as + part of the default DPDK library. Below is intended for those who wish + to use IGB_UIO outside of the standard DPDK build from v20.11 onwards. + +As of DPDK v19.11, default igb_uio hotplugging behavior changed from previous DPDK versions. -With DPDK 19.11, if no device is bound to igb_uio when OVS is launched then -the IOVA mode may be set to virtual addressing for DPDK. This is incompatible -for hotplugging with igb_uio. +From DPDK v19.11 onwards, if no device is bound to igb_uio when OVS is +launched then the IOVA mode may be set to virtual addressing for DPDK. +This is incompatible for hotplugging with igb_uio. To hotplug a port with igb_uio in this case, DPDK must be configured to use physical addressing for IOVA mode. For more information regarding IOVA modes in DPDK please refer to the `DPDK IOVA Mode Detection`__. -__ https://doc.dpdk.org/guides-19.11/prog_guide/env_abstraction_layer.html#iova-mode-detection +__ https://doc.dpdk.org/guides-20.11/prog_guide/env_abstraction_layer.html#iova-mode-detection To configure OVS DPDK to use physical addressing for IOVA:: @@ -261,7 +267,7 @@ Representors are multi devices created on top of one PF. For more information, refer to the `DPDK documentation`__. -__ https://doc.dpdk.org/guides-19.11/prog_guide/switch_representation.html +__ https://doc.dpdk.org/guides-20.11/prog_guide/switch_representation.html Prior to port representors there was a one-to-one relationship between the PF and the eth device. With port representors the relationship becomes one PF to diff --git a/Documentation/topics/dpdk/vhost-user.rst b/Documentation/topics/dpdk/vhost-user.rst index 75d3fc958..bcd51e65c 100644 --- a/Documentation/topics/dpdk/vhost-user.rst +++ b/Documentation/topics/dpdk/vhost-user.rst @@ -389,23 +389,7 @@ application in the VM. To begin, instantiate a guest as described in :ref:`dpdk-vhost-user` or :ref:`dpdk-vhost-user-client`. Once started, connect to the VM, download the -DPDK sources to VM and build DPDK:: - - $ cd /root/dpdk/ - $ wget https://fast.dpdk.org/rel/dpdk-19.11.2.tar.xz - $ tar xf dpdk-19.11.2.tar.xz - $ export DPDK_DIR=/root/dpdk/dpdk-stable-19.11.2 - $ export DPDK_TARGET=x86_64-native-linuxapp-gcc - $ export DPDK_BUILD=$DPDK_DIR/$DPDK_TARGET - $ cd $DPDK_DIR - $ make install T=$DPDK_TARGET DESTDIR=install - -Build the test-pmd application:: - - $ cd app/test-pmd - $ export RTE_SDK=$DPDK_DIR - $ export RTE_TARGET=$DPDK_TARGET - $ make +DPDK sources to VM and build DPDK as described in :ref:`dpdk-install`. Setup huge pages and DPDK devices using UIO:: @@ -555,4 +539,4 @@ shown with:: Further information can be found in the `DPDK documentation -<https://doc.dpdk.org/guides-19.11/prog_guide/vhost_lib.html>`__ +<https://doc.dpdk.org/guides-20.11/prog_guide/vhost_lib.html>`__ diff --git a/Documentation/topics/testing.rst b/Documentation/topics/testing.rst index b9fa94dda..951fe9e85 100644 --- a/Documentation/topics/testing.rst +++ b/Documentation/topics/testing.rst @@ -353,7 +353,7 @@ All tests are skipped if no hugepages are configured. User must look into the DP manual to figure out how to `Configure hugepages`_. The phy test will skip if no compatible physical device is available. -.. _Configure hugepages: https://doc.dpdk.org/guides-19.11/linux_gsg/sys_reqs.html +.. _Configure hugepages: https://doc.dpdk.org/guides-20.11/linux_gsg/sys_reqs.html All the features documented under `Unit Tests`_ are available for the DPDK datapath testsuite. diff --git a/NEWS b/NEWS index 7e291a180..1a39cc661 100644 --- a/NEWS +++ b/NEWS @@ -11,6 +11,7 @@ Post-v2.14.0 Use the 'cluster/set-backlog-threshold' command to change limits. - DPDK: * Removed support for vhost-user dequeue zero-copy. + * Add support for DPDK 20.11. - Userspace datapath: * Add the 'pmd' option to "ovs-appctl dpctl/dump-flows", which restricts a flow dump to a single PMD thread if set. diff --git a/acinclude.m4 b/acinclude.m4 index ddf4b71e1..3df496666 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -334,8 +334,9 @@ dnl dnl Configure DPDK source tree AC_DEFUN([OVS_CHECK_DPDK], [ AC_ARG_WITH([dpdk], - [AC_HELP_STRING([--with-dpdk=/path/to/dpdk], - [Specify the DPDK build directory])], + [AC_HELP_STRING([--with-dpdk=static|shared|yes], + [Specify "static" or "shared" depending on the + DPDK libraries to use])], [have_dpdk=true]) AC_MSG_CHECKING([whether dpdk is enabled]) @@ -345,35 +346,25 @@ AC_DEFUN([OVS_CHECK_DPDK], [ else AC_MSG_RESULT([yes]) case "$with_dpdk" in - yes) - DPDK_AUTO_DISCOVER="true" - PKG_CHECK_MODULES_STATIC([DPDK], [libdpdk], [ - DPDK_INCLUDE="$DPDK_CFLAGS" - DPDK_LIB="$DPDK_LIBS"], [ - DPDK_INCLUDE="-I/usr/local/include/dpdk -I/usr/include/dpdk" - DPDK_LIB="-ldpdk"]) - ;; - *) - DPDK_AUTO_DISCOVER="false" - DPDK_INCLUDE_PATH="$with_dpdk/include" - # If 'with_dpdk' is passed install directory, point to headers - # installed in $DESTDIR/$prefix/include/dpdk - if test -e "$DPDK_INCLUDE_PATH/rte_config.h"; then - DPDK_INCLUDE="-I$DPDK_INCLUDE_PATH" - elif test -e "$DPDK_INCLUDE_PATH/dpdk/rte_config.h"; then - DPDK_INCLUDE="-I$DPDK_INCLUDE_PATH/dpdk" - fi - DPDK_LIB_DIR="$with_dpdk/lib" - DPDK_LIB="-ldpdk" - ;; + "shared") + PKG_CHECK_MODULES([DPDK], [libdpdk], [ + DPDK_INCLUDE="$DPDK_CFLAGS" + DPDK_LIB="$DPDK_LIBS"], [ + DPDK_INCLUDE="-I/usr/local/include/dpdk -I/usr/include/dpdk" + DPDK_LIB="-ldpdk"]) + ;; + "static" | "yes") + PKG_CHECK_MODULES_STATIC([DPDK], [libdpdk], [ + DPDK_INCLUDE="$DPDK_CFLAGS" + DPDK_LIB="$DPDK_LIBS"], [ + DPDK_INCLUDE="-I/usr/local/include/dpdk -I/usr/include/dpdk" + DPDK_LIB="-ldpdk"]) + ;; esac ovs_save_CFLAGS="$CFLAGS" ovs_save_LDFLAGS="$LDFLAGS" CFLAGS="$CFLAGS $DPDK_INCLUDE" - if test "$DPDK_AUTO_DISCOVER" = "false"; then - LDFLAGS="$LDFLAGS -L${DPDK_LIB_DIR}" - fi AC_CHECK_HEADERS([rte_config.h], [], [ AC_MSG_ERROR([unable to find rte_config.h in $with_dpdk]) @@ -422,20 +413,18 @@ AC_DEFUN([OVS_CHECK_DPDK], [ [AC_MSG_RESULT([yes]) DPDKLIB_FOUND=true], [AC_MSG_RESULT([no]) - if test "$DPDK_AUTO_DISCOVER" = "true"; then - AC_MSG_ERROR(m4_normalize([ - Could not find DPDK library in default search path, Use --with-dpdk - to specify the DPDK library installed in non-standard location])) - else - AC_MSG_ERROR([Could not find DPDK libraries in $DPDK_LIB_DIR]) - fi + AC_MSG_ERROR(m4_normalize([ + Could not find DPDK library in default search path, update + PKG_CONFIG_PATH for pkg-config to find the .pc file in + non-standard location])) ]) CFLAGS="$ovs_save_CFLAGS" LDFLAGS="$ovs_save_LDFLAGS" - if test "$DPDK_AUTO_DISCOVER" = "false"; then - OVS_LDFLAGS="$OVS_LDFLAGS -L$DPDK_LIB_DIR" - fi + # Stripping out possible instruction set specific configuration that DPDK + # forces in pkg-config since this could override user-specified options. + # It's enough to have -mssse3 to build with DPDK headers. + DPDK_INCLUDE=$(echo "$DPDK_INCLUDE" | sed 's/-march=[[a-z0-9]]*//g') OVS_CFLAGS="$OVS_CFLAGS $DPDK_INCLUDE" OVS_ENABLE_OPTION([-mssse3]) @@ -444,17 +433,16 @@ AC_DEFUN([OVS_CHECK_DPDK], [ # This happens because the rest of the DPDK code doesn't use any symbol in # the pmd driver objects, and the drivers register themselves using an # __attribute__((constructor)) function. - # - # These options are specified inside a single -Wl directive to prevent - # autotools from reordering them. - # - # OTOH newer versions of dpdk pkg-config (generated with Meson) - # will already have flagged just the right set of libs with - # --whole-archive - in those cases do not wrap it once more. - case "$DPDK_LIB" in - *whole-archive*) DPDK_vswitchd_LDFLAGS=$DPDK_LIB;; - *) DPDK_vswitchd_LDFLAGS=-Wl,--whole-archive,$DPDK_LIB,--no-whole-archive - esac + + # Wrap the DPDK libraries inside a single -Wl directive + # after comma separation to prevent autotools from reordering them. + DPDK_vswitchd_LDFLAGS=$(echo "$DPDK_LIB"| tr -s ' ' ',' | sed 's/-Wl,//g') + # Replace -pthread with -lpthread for LD and remove the last extra comma. + DPDK_vswitchd_LDFLAGS=$(echo "$DPDK_vswitchd_LDFLAGS"| sed 's/,$//' | \ + sed 's/-pthread/-lpthread/g') + # Prepend "-Wl,". + DPDK_vswitchd_LDFLAGS="-Wl,$DPDK_vswitchd_LDFLAGS" + AC_SUBST([DPDK_vswitchd_LDFLAGS]) AC_DEFINE([DPDK_NETDEV], [1], [System uses the DPDK module.]) fi diff --git a/include/sparse/automake.mk b/include/sparse/automake.mk index 974ad3fe5..e96637119 100644 --- a/include/sparse/automake.mk +++ b/include/sparse/automake.mk @@ -11,7 +11,9 @@ noinst_HEADERS += \ include/sparse/netpacket/packet.h \ include/sparse/pthread.h \ include/sparse/rte_atomic.h \ + include/sparse/rte_mbuf.h \ include/sparse/rte_memcpy.h \ + include/sparse/rte_trace_point.h \ include/sparse/sys/socket.h \ include/sparse/sys/sysmacros.h \ include/sparse/sys/types.h \ diff --git a/include/sparse/rte_mbuf.h b/include/sparse/rte_mbuf.h new file mode 100644 index 000000000..981cdb441 --- /dev/null +++ b/include/sparse/rte_mbuf.h @@ -0,0 +1,29 @@ +/* Copyright (c) 2020 Intel, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at: + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef __CHECKER__ +#error "Use this header only with sparse. It is not a correct implementation." +#endif + +/* sparse doesn't know about gcc atomic builtins. */ +#ifndef __ATOMIC_ACQ_REL +#define __ATOMIC_ACQ_REL 0 +#define __ATOMIC_RELAXED 1 +#define __atomic_add_fetch(p, val, memorder) (*(p) = *(p) + (val)) +#define __atomic_store_n(p, val, memorder) (*(p) = (val)) +#endif + +/* Get actual <rte_mbuf.h> definitions for us to annotate and build on. */ +#include_next <rte_mbuf.h> diff --git a/include/sparse/rte_trace_point.h b/include/sparse/rte_trace_point.h new file mode 100644 index 000000000..803923275 --- /dev/null +++ b/include/sparse/rte_trace_point.h @@ -0,0 +1,28 @@ +/* Copyright 2020, Red Hat, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at: + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef __CHECKER__ +#error "Use this header only with sparse. It is not a correct implementation." +#endif + +/* sparse doesn't know about gcc atomic builtins. */ +#ifndef __ATOMIC_ACQUIRE +#define __ATOMIC_ACQUIRE 0 +#define __atomic_load_n(p, memorder) *(p) +#endif + +/* Get actual <rte_trace_point.h> definitions for us to annotate and + * build on. */ +#include_next <rte_trace_point.h> diff --git a/lib/dpdk.c b/lib/dpdk.c index 2f235a742..319540394 100644 --- a/lib/dpdk.c +++ b/lib/dpdk.c @@ -443,7 +443,7 @@ dpdk_init__(const struct smap *ovs_other_config) /** * NOTE: This is an unsophisticated mechanism for determining the DPDK - * lcore for the DPDK Master. + * main core. */ if (auto_determine) { const struct ovs_numa_info_core *core; diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c index 75dffefb8..2640a421a 100644 --- a/lib/netdev-dpdk.c +++ b/lib/netdev-dpdk.c @@ -26,12 +26,6 @@ #include <sys/socket.h> #include <linux/if.h> -/* Include rte_compat.h first to allow experimental API's needed for the - * rte_meter.h rfc4115 functions. Once they are no longer marked as - * experimental the #define and rte_compat.h include can be removed. - */ -#define ALLOW_EXPERIMENTAL_API -#include <rte_compat.h> #include <rte_bus_pci.h> #include <rte_config.h> #include <rte_cycles.h> @@ -1312,7 +1306,7 @@ static int vhost_common_construct(struct netdev *netdev) OVS_REQUIRES(dpdk_mutex) { - int socket_id = rte_lcore_to_socket_id(rte_get_master_lcore()); + int socket_id = rte_lcore_to_socket_id(rte_get_main_lcore()); struct netdev_dpdk *dev = netdev_dpdk_cast(netdev); dev->vhost_rxq_enabled = dpdk_rte_mzalloc(OVS_VHOST_MAX_QUEUE_NUM * @@ -1463,7 +1457,6 @@ netdev_dpdk_destruct(struct netdev *netdev) struct netdev_dpdk *dev = netdev_dpdk_cast(netdev); struct rte_device *rte_dev; struct rte_eth_dev *eth_dev; - bool remove_on_close; ovs_mutex_lock(&dpdk_mutex); @@ -1475,20 +1468,15 @@ netdev_dpdk_destruct(struct netdev *netdev) * FIXME: avoid direct access to DPDK internal array rte_eth_devices. */ eth_dev = &rte_eth_devices[dev->port_id]; - remove_on_close = - eth_dev->data && - (eth_dev->data->dev_flags & RTE_ETH_DEV_CLOSE_REMOVE); rte_dev = eth_dev->device; /* Remove the eth device. */ rte_eth_dev_close(dev->port_id); - /* Remove this rte device and all its eth devices if flag - * RTE_ETH_DEV_CLOSE_REMOVE is not supported (which means representors - * are not supported), or if all the eth devices belonging to the rte - * device are closed. + /* Remove this rte device and all its eth devices if all the eth + * devices belonging to the rte device are closed. */ - if (!remove_on_close || !netdev_dpdk_get_num_ports(rte_dev)) { + if (!netdev_dpdk_get_num_ports(rte_dev)) { int ret = rte_dev_remove(rte_dev); if (ret < 0) {