[ovs-dev] [PATCH RFC dpdk-latest] build: Add support for DPDK meson build.

Richardson, Bruce bruce.richardson at intel.com
Thu Jul 2 13:58:55 UTC 2020



> -----Original Message-----
> From: Pai G, Sunil <sunil.pai.g at intel.com>
> Sent: Thursday, July 2, 2020 2:14 PM
> To: dev at openvswitch.org
> Cc: Stokes, Ian <ian.stokes at intel.com>; i.maximets at ovn.org;
> david.marchand at redhat.com; Richardson, Bruce <bruce.richardson at intel.com>;
> Pai G, Sunil <sunil.pai.g at intel.com>; Tummala, Sivaprasad
> <sivaprasad.tummala at intel.com>
> Subject: [PATCH RFC dpdk-latest] build: Add support for DPDK meson build.
> 
> Make based build is deprecated in DPDK. Meson based build to be used for
> future DPDK releases.
> 
> This updates travis, configure script and documentation for using DPDK
> Meson with OVS.
> 
> Signed-off-by: Sunil Pai G <sunil.pai.g at intel.com>

Thanks for this, a couple of comments from the DPDK build side inline below.

Regards,
/Bruce

> ---
>  .travis.yml                           |  3 ++
>  .travis/linux-build.sh                | 37 +++++++++-------
>  .travis/linux-prepare.sh              |  1 +
>  Documentation/intro/install/afxdp.rst |  2 +-
> Documentation/intro/install/dpdk.rst  | 56 ++++++++++++++++++++----
>  Makefile.am                           |  3 +-
>  acinclude.m4                          | 42 ++++++++++++------
>  parse_pkg_cfg.py                      | 62 +++++++++++++++++++++++++++
>  8 files changed, 167 insertions(+), 39 deletions(-)  create mode 100644
> parse_pkg_cfg.py
> 
> diff --git a/.travis.yml b/.travis.yml
> index 97249c1ce..46d7ad9bb 100644
> --- a/.travis.yml
> +++ b/.travis.yml
> @@ -27,6 +27,9 @@ addons:
>        - selinux-policy-dev
>        - libunbound-dev
>        - libunwind-dev
> +      - python3-setuptools
> +      - python3-wheel
> +      - ninja-build
> 
>  before_install: ./.travis/${TRAVIS_OS_NAME}-prepare.sh
> 
> diff --git a/.travis/linux-build.sh b/.travis/linux-build.sh index
> 33b359a61..7fa7e738c 100755
> --- a/.travis/linux-build.sh
> +++ b/.travis/linux-build.sh
> @@ -85,17 +85,21 @@ function install_dpdk()  {
>      local DPDK_VER=$1
>      local VERSION_FILE="dpdk-dir/travis-dpdk-cache-version"
> +    local DPDK_OPTS=""
> 
> -    if [ -z "$TRAVIS_ARCH" ] ||
> -       [ "$TRAVIS_ARCH" == "amd64" ]; then
> -        TARGET="x86_64-native-linuxapp-gcc"
> -    elif [ "$TRAVIS_ARCH" == "aarch64" ]; then
> -        TARGET="arm64-armv8a-linuxapp-gcc"
> -    else
> +    if [ "$TRAVIS_ARCH" == "aarch64" ]; then
> +        DPDK_OPTS="$DPDK_OPTS --cross-file
> config/arm/arm64_armv8_linux_gcc"
> +    elif [ "$TRAVIS_ARCH" != "amd64" ] && [ -n "$TRAVIS_ARCH" ]; then
>          echo "Target is unknown"
>          exit 1
>      fi
> 
> +    if [ "$DPDK_SHARED" ]; then
> +        EXTRA_OPTS="$EXTRA_OPTS --with-dpdk=shared"
> +    else
> +        EXTRA_OPTS="$EXTRA_OPTS --with-dpdk=static"
> +    fi
> +
>      if [ "${DPDK_VER##refs/*/}" != "${DPDK_VER}" ]; then
>          # Avoid using cache for git tree build.
>          rm -rf dpdk-dir
> @@ -108,7 +112,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"
> +                sudo ninja -C $(pwd)/dpdk-dir/build install
> +                sudo ldconfig
>                  echo "Found cached DPDK ${VER} build in $(pwd)/dpdk-dir"
>                  return
>              fi
> @@ -122,16 +127,18 @@ function install_dpdk()
>          pushd dpdk-dir
>      fi
> 
> -    make config CC=gcc T=$TARGET
> +    # Disable building DPDK kernel modules. Not needed for OVS build or
> tests.
> +    DPDK_OPTS="$DPDK_OPTS -Denable_kmods=false"
> 

NOTE: enable_kmods=false is the default in DPDK, so should not need to be
specified, unless you want to be doubly sure they are not build, or for
clarity.

> -    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
> +    DPDK_OPTS="$DPDK_OPTS -Dc_args=-fPIC"

Since meson build for DPDK always links the objects into both static and
shared libs, all objects are already built with -fPIC, so this should not
be necessary.

> +    CC=gcc meson $DPDK_OPTS build
> +    ninja -C build
> +    sudo ninja -C build install
> +
> +    # Update the library paths.
> +    sudo ldconfig
> 
> -    make -j4 CC=gcc EXTRA_CFLAGS='-fPIC'
> -    EXTRA_OPTS="$EXTRA_OPTS --with-dpdk=$(pwd)/build"
> -    echo "Installed DPDK source in $(pwd)"
> +    echo "Installed DPDK source"
>      popd
>      echo "${DPDK_VER}" > ${VERSION_FILE}  } diff --git a/.travis/linux-
> prepare.sh b/.travis/linux-prepare.sh index 8cbbd5623..682f6234b 100755
> --- a/.travis/linux-prepare.sh
> +++ b/.travis/linux-prepare.sh
> @@ -16,6 +16,7 @@ cd ..
> 
>  pip3 install --disable-pip-version-check --user flake8 hacking
>  pip3 install --user --upgrade docutils
> +pip3 install --user  'meson==0.47.1'
> 

Is there a reason for forcing this to the oldest supported  version?

>  if [ "$M32" ]; then
>      # Installing 32-bit libraries.
<snip for brevity>


More information about the dev mailing list