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

Tonghao Zhang xiangxia.m.yue at gmail.com
Tue Dec 15 04:02:22 UTC 2020


On Thu, Sep 3, 2020 at 2:06 AM Sunil Pai G <sunil.pai.g at intel.com> wrote:
>
> 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.
>
> Tested-at: https://travis-ci.org/github/Sunil-Pai-G/ovs-copy/builds/723510063
> Signed-off-by: Sunil Pai G <sunil.pai.g at intel.com>
> ---
> v3->v4:
> - Fix checkpatch errors
>
> v2->v3:
> - Update Documentation for vhost-user
>
> v1->v2:
> - Update Documentation
> - Simplify the pkg-config parsing script
> - Rename and move the pkg-config parsing script to python dir
> - Update travis to:
>    - install DPDK to cached dir
>    - disable DPDK tests
>    - removed fPIC flag for DPDK
>    - removed cross compilation for aarch64
> ---
>  .travis.yml                              |  3 ++
>  .travis/linux-build.sh                   | 39 ++++++++++-----
>  .travis/linux-prepare.sh                 |  1 +
>  Documentation/intro/install/afxdp.rst    |  2 +-
>  Documentation/intro/install/dpdk.rst     | 63 ++++++++++++++++++++----
>  Documentation/topics/dpdk/vhost-user.rst | 18 +------
>  acinclude.m4                             | 44 +++++++++++------
>  python/automake.mk                       |  3 +-
>  python/build/pkgcfg.py                   | 30 +++++++++++
>  9 files changed, 149 insertions(+), 54 deletions(-)
>  create mode 100644 python/build/pkgcfg.py
>
> diff --git a/.travis.yml b/.travis.yml
> index 3dd5d1d23..a8f9a4d79 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 817bf24aa..14ef833c9 100755
> --- a/.travis/linux-build.sh
> +++ b/.travis/linux-build.sh
> @@ -85,17 +85,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
> @@ -108,7 +120,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
> @@ -122,16 +135,20 @@ function install_dpdk()
>          pushd dpdk-dir
>      fi
>
> -    make config CC=gcc T=$TARGET
> +    # Disable building DPDK unit tests. Not needed for OVS build or tests.
> +    DPDK_OPTS="$DPDK_OPTS -Dtests=false"
>
> -    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
> +    # Install DPDK using prefix.
> +    DPDK_OPTS="$DPDK_OPTS --prefix=$(pwd)/build"
> +
> +    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 71eb347e8..1baa11641 100755
> --- a/.travis/linux-prepare.sh
> +++ b/.travis/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/Documentation/intro/install/afxdp.rst b/Documentation/intro/install/afxdp.rst
> index 3c8f78825..327f2b3df 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|<dpdk path>
>    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 39544f835..cd7e51c75 100644
> --- a/Documentation/intro/install/dpdk.rst
> +++ b/Documentation/intro/install/dpdk.rst
> @@ -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
>  ----------
>
> @@ -76,10 +78,31 @@ Install DPDK
>         $ export DPDK_DIR=/usr/src/dpdk-stable-19.11.2
>         $ cd $DPDK_DIR
>
> +#. Configure and install DPDK using Meson
> +
> +   Meson is the preferred tool to build recent DPDK releases
> +   as Make support is deprecated and will be removed from DPDK 20.11.
> +   OVS supports DPDK Meson builds from DPDK 19.11 onwards.
> +
> +   Build and install the DPDK library::
> +
> +       $ export DPDK_TARGET=x86_64-native-linuxapp-gcc
> +       $ export DPDK_BUILD=$DPDK_DIR/$DPDK_TARGET
> +       $ meson $DPDK_TARGET
> +       $ ninja -C $DPDK_TARGET
> +       $ sudo ninja -C $DPDK_TARGET install
> +       $ sudo ldconfig
> +
> +   Detailed information can be found at `DPDK documentation`_.
> +
>  #. (Optional) Configure DPDK as a shared library
>
> -   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
> +   When using Meson, DPDK is built both as static and shared library.
> +   So no extra configuration is required in this case.
> +
> +   In case of Make, 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``.
>
>     .. note::
> @@ -87,7 +110,7 @@ Install DPDK
>        Minor performance loss is expected when using OVS with a shared DPDK
>        library compared to a static DPDK library.
>
> -#. Configure and install DPDK
> +#. Configure and install DPDK using Make
>
>     Build and install the DPDK library::
>
> @@ -97,12 +120,22 @@ Install DPDK
>
>  #. (Optional) Export the DPDK shared library location
>
> -   If DPDK was built as a shared library, export the path to this library for
> -   use when building OVS::
> +   If DPDK was built as a shared library using Make, export the path to this
> +   library for use when building OVS::
>
>         $ export LD_LIBRARY_PATH=$DPDK_DIR/x86_64-native-linuxapp-gcc/lib
>
> +   In case of Meson, exporting the path to library is not necessary if
> +   the DPDK libraries are system installed. For libraries installed using
> +   a prefix(assuming $DPDK_INSTALL in the below case), export the path to this
> +   library and also update the $PKG_CONFIG_PATH for use before building OVS::
> +
> +      $ export $DPDK_LIB=$DPDK_INSTALL/lib/x86_64-linux-gnu
> +      $ export LD_LIBRARY_PATH=$DPDK_LIB/:$LD_LIBRARY_PATH
> +      $ export PKG_CONFIG_PATH=$DPDK_LIB/pkgconfig/:$PKG_CONFIG_PATH
> +
>  .. _DPDK sources: http://dpdk.org/rel
> +.. _DPDK documentation: https://doc.dpdk.org/guides/linux_gsg/build_dpdk.html
>
>  Install OVS
>  ~~~~~~~~~~~
> @@ -121,17 +154,27 @@ 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:
> +
> +   Depending on the tool used to build DPDK and the type of
> +   DPDK library to use, one can configure OVS as follows:
> +
> +   When DPDK is built using Meson, and OVS must consume DPDK shared libraries
> +   (also equivalent to leaving --with-dpdk option empty)::
> +
> +       $ ./configure --with-dpdk=shared
Hi all
when I build ovs with --with-dpdk=shared, Compilation is fine, but we
I launch the ovs:

41 2020-12-14T10:42:22.964Z|00018|dpdk|INFO|EAL ARGS: ovs-vswitchd -a
0000:82:00.0,dv_flow_en=1,dv_esw_en=1,l3_vxlan_en=1,dv_xmeta_en=2,representor=[0-6]
-c 0xe --huge-dir /dev/hugepages --socket    -mem 1024,1024
--socket-limit 1024,1024.
42 2020-12-14T10:42:22.969Z|00019|dpdk|INFO|EAL: Detected 56 lcore(s)
43 2020-12-14T10:42:22.969Z|00020|dpdk|INFO|EAL: Detected 2 NUMA nodes
44 2020-12-14T10:42:22.969Z|00021|dpdk|ERR|EAL: failed to parse device
"0000:82:00.0"
45 2020-12-14T10:42:22.969Z|00022|dpdk|ERR|EAL: Unable to parse device
'0000:82:00.0,dv_flow_en=1,dv_esw_en=1,l3_vxlan_en=1,dv_xmeta_en=2,representor=[0-6]'
46 2020-12-14T10:42:22.969Z|00023|dpdk|EMER|Unable to initialize DPDK:
No such device

In dpdk:
eal_plugins_init
rte_pci_scan
rte_bus_register
eal_option_device_parse -- no pci bus

pkg-config is pkgconf-1.4.2
> +   When DPDK is built using Meson, and OVS must consume DPDK static libraries::
> +
> +       $ ./configure --with-dpdk=static
Only one issue, if we use the pkgconfig-0.27
The ovs log:
2020-12-14T11:58:22.622Z|00018|dpdk|INFO|EAL ARGS: ovs-vswitchd -a
0000:82:00.0,dv_flow_en=1,dv_esw_en=1,l3_vxlan_en=1,dv_xmeta_en=2,representor=[0-6]
-c 0xe --huge-dir /dev/hugepages --socket-mem 1024,1024 --socket-limit
1024,1024.
2020-12-14T11:58:22.627Z|00019|dpdk|INFO|EAL: Detected 56 lcore(s)
2020-12-14T11:58:22.627Z|00020|dpdk|INFO|EAL: Detected 2 NUMA nodes
2020-12-14T11:58:22.627Z|00021|dpdk|ERR|EAL: failed to parse device
"0000:82:00.0"
2020-12-14T11:58:22.627Z|00022|dpdk|ERR|EAL: Unable to parse device
'0000:82:00.0,dv_flow_en=1,dv_esw_en=1,l3_vxlan_en=1,dv_xmeta_en=2,representor=[0-6]'
2020-12-14T11:58:22.627Z|00023|dpdk|EMER|Unable to initialize DPDK: No
such device

Because  /bin/pkg-config --static --libs libdpdk
pkg_cv_DPDK_LIBS='-Wl,--whole-archive -Wl,--no-whole-archive
-Wl,--as-needed -pthread -L/root/local/dpdk-next-net/lib64
-l:librte_common_cpt.a -l:librte_common_dpaax.a
-l:librte_common_iavf.a -l:librte_common_octeontx.a
-l:librte_common_octeontx2.a -l:librte_common_sfc_efx.a
-l:librte_bus_dpaa.a -l:librte_bus_fslmc.a -l:librte_bus_ifpga.a
-l:librte_bus_pci.a -l:librte_bus_vdev.a -l:librte_bus_vmbus.a
-l:librte_common_mlx5.a -l:librte_common_qat.a
-l:librte_mempool_bucket.a -l:librte_mempool_dpaa.a
-l:librte_mempool_dpaa2.a -l:librte_mempool_octeontx.a
-l:librte_mempool_octeontx2.a -l:librte_mempool_ring.a
-l:librte_mempool_stack.a -l:librte_net_af_packet.a
-l:librte_net_ark.a -l:librte_net_atlantic.a -l:librte_net_avp.a
-l:librte_net_axgbe.a -l:librte_net_bond.a -l:librte_net_bnxt.a
-l:librte_net_cxgbe.a -l:librte_net_dpaa.a -l:librte_net_dpaa2.a
-l:librte_net_e1000.a -l:librte_net_ena.a -l:librte_net_enetc.a
-l:librte_net_enic.a -l:librte_net_failsafe.a -l:librte_net_fm10k.a
-l:librte_net_i40e.a -l:librte_net_hinic.a -l:librte_net_hns3.a
-l:librte_net_iavf.a -l:librte_net_ice.a -l:librte_net_igc.a
-l:librte_net_ixgbe.a -l:librte_net_kni.a -l:librte_net_liquidio.a
-l:librte_net_memif.a -l:librte_net_mlx5.a -l:librte_net_netvsc.a
-l:librte_net_nfp.a -l:librte_net_null.a -l:librte_net_octeontx.a
-l:librte_net_octeontx2.a -l:librte_net_pcap.a -l:librte_net_pfe.a
-l:librte_net_qede.a -l:librte_net_ring.a -l:librte_net_sfc.a
-l:librte_net_softnic.a -l:librte_net_thunderx.a -l:librte_net_txgbe.a
-l:librte_net_vdev_netvsc.a -l:librte_net_vhost.a
-l:librte_net_virtio.a -l:librte_net_vmxnet3.a
-l:librte_raw_dpaa2_cmdif.a -l:librte_raw_dpaa2_qdma.a
-l:librte_raw_ioat.a -l:librte_raw_ntb.a -l:librte_raw_octeontx2_dma.a
-l:librte_raw_octeontx2_ep.a -l:librte_raw_skeleton.a
-l:librte_compress_octeontx.a -l:librte_regex_mlx5.a
-l:librte_regex_octeontx2.a -l:librte_vdpa_ifc.a -l:librte_vdpa_mlx5.a
-l:librte_baseband_null.a -l:librte_baseband_turbo_sw.a
-l:librte_baseband_fpga_lte_fec.a -l:librte_baseband_fpga_5gnr_fec.a
-l:librte_baseband_acc100.a -l:librte_node.a -l:librte_graph.a
-l:librte_bpf.a -l:librte_flow_classify.a -l:librte_pipeline.a
-l:librte_table.a -l:librte_port.a -l:librte_fib.a -l:librte_ipsec.a
-l:librte_vhost.a -l:librte_stack.a -l:librte_security.a
-l:librte_sched.a -l:librte_reorder.a -l:librte_rib.a
-l:librte_regexdev.a -l:librte_rawdev.a -l:librte_pdump.a
-l:librte_power.a -l:librte_member.a -l:librte_lpm.a
-l:librte_latencystats.a -l:librte_kni.a -l:librte_jobstats.a
-l:librte_ip_frag.a -l:librte_gso.a -l:librte_gro.a
-l:librte_eventdev.a -l:librte_efd.a -l:librte_distributor.a
-l:librte_cryptodev.a -l:librte_compressdev.a -l:librte_cfgfile.a
-l:librte_bitratestats.a -l:librte_bbdev.a -l:librte_acl.a
-l:librte_timer.a -l:librte_hash.a -l:librte_metrics.a
-l:librte_cmdline.a -l:librte_pci.a -l:librte_ethdev.a
-l:librte_meter.a -l:librte_net.a -l:librte_mbuf.a -l:librte_mempool.a
-l:librte_rcu.a -l:librte_ring.a -l:librte_eal.a -l:librte_telemetry.a
-l:librte_kvargs.a -lmlx5 -libverbs -lrte_node -lrte_graph -lrte_bpf
-lrte_flow_classify -lrte_pipeline -lrte_table -lrte_port -lrte_fib
-lrte_ipsec -lrte_vhost -lrte_stack -lrte_security -lrte_sched
-lrte_reorder -lrte_rib -lrte_regexdev -lrte_rawdev -lrte_pdump
-lrte_power -lrte_member -lrte_lpm -lrte_latencystats -lrte_kni
-lrte_jobstats -lrte_ip_frag -lrte_gso -lrte_gro -lrte_eventdev
-lrte_efd -lrte_distributor -lrte_cryptodev -lrte_compressdev
-lrte_cfgfile -lrte_bitratestats -lrte_bbdev -lrte_acl -lrte_timer
-lrte_hash -lrte_metrics -lrte_cmdline -lrte_pci -lrte_ethdev
-lrte_meter -lrte_net -lrte_mbuf -lrte_mempool -lrte_rcu -lrte_ring
-lrte_eal -lrte_telemetry -lrte_kvargs -lm -ldl -lnuma -lpcap  '

Note that:
-Wl,--whole-archive -Wl,--no-whole-archive (RTE_INIT in dpdk doesn't work.)
I guess we dont hope that, It should be:
-Wl,--whole-archive ...(other -lxxx)...  -Wl,--no-whole-archive

update pkg-config to pkgconf-1.4.2
/bin/pkg-config --static --libs libdpdk
pkg_cv_DPDK_LIBS='-Wl,--whole-archive
-L/root/local/dpdk-next-net/lib64 -l:librte_common_cpt.a
-l:librte_common_dpaax.a -l:librte_common_iavf.a
-l:librte_common_octeontx.a -l:librte_common_octeontx2.a
-l:librte_common_sfc_efx.a -l:librte_bus_dpaa.a -l:librte_bus_fslmc.a
-l:librte_bus_ifpga.a -l:librte_bus_pci.a -l:librte_bus_vdev.a
-l:librte_bus_vmbus.a -l:librte_common_mlx5.a -l:librte_common_qat.a
-l:librte_mempool_bucket.a -l:librte_mempool_dpaa.a
-l:librte_mempool_dpaa2.a -l:librte_mempool_octeontx.a
-l:librte_mempool_octeontx2.a -l:librte_mempool_ring.a
-l:librte_mempool_stack.a -l:librte_net_af_packet.a
-l:librte_net_ark.a -l:librte_net_atlantic.a -l:librte_net_avp.a
-l:librte_net_axgbe.a -l:librte_net_bond.a -l:librte_net_bnxt.a
-l:librte_net_cxgbe.a -l:librte_net_dpaa.a -l:librte_net_dpaa2.a
-l:librte_net_e1000.a -l:librte_net_ena.a -l:librte_net_enetc.a
-l:librte_net_enic.a -l:librte_net_failsafe.a -l:librte_net_fm10k.a
-l:librte_net_i40e.a -l:librte_net_hinic.a -l:librte_net_hns3.a
-l:librte_net_iavf.a -l:librte_net_ice.a -l:librte_net_igc.a
-l:librte_net_ixgbe.a -l:librte_net_kni.a -l:librte_net_liquidio.a
-l:librte_net_memif.a -l:librte_net_mlx5.a -l:librte_net_netvsc.a
-l:librte_net_nfp.a -l:librte_net_null.a -l:librte_net_octeontx.a
-l:librte_net_octeontx2.a -l:librte_net_pcap.a -l:librte_net_pfe.a
-l:librte_net_qede.a -l:librte_net_ring.a -l:librte_net_sfc.a
-l:librte_net_softnic.a -l:librte_net_thunderx.a -l:librte_net_txgbe.a
-l:librte_net_vdev_netvsc.a -l:librte_net_vhost.a
-l:librte_net_virtio.a -l:librte_net_vmxnet3.a
-l:librte_raw_dpaa2_cmdif.a -l:librte_raw_dpaa2_qdma.a
-l:librte_raw_ioat.a -l:librte_raw_ntb.a -l:librte_raw_octeontx2_dma.a
-l:librte_raw_octeontx2_ep.a -l:librte_raw_skeleton.a
-l:librte_compress_octeontx.a -l:librte_regex_mlx5.a
-l:librte_regex_octeontx2.a -l:librte_vdpa_ifc.a -l:librte_vdpa_mlx5.a
-l:librte_baseband_null.a -l:librte_baseband_turbo_sw.a
-l:librte_baseband_fpga_lte_fec.a -l:librte_baseband_fpga_5gnr_fec.a
-l:librte_baseband_acc100.a -l:librte_node.a -l:librte_graph.a
-l:librte_bpf.a -l:librte_flow_classify.a -l:librte_pipeline.a
-l:librte_table.a -l:librte_port.a -l:librte_fib.a -l:librte_ipsec.a
-l:librte_vhost.a -l:librte_stack.a -l:librte_security.a
-l:librte_sched.a -l:librte_reorder.a -l:librte_rib.a
-l:librte_regexdev.a -l:librte_rawdev.a -l:librte_pdump.a
-l:librte_power.a -l:librte_member.a -l:librte_lpm.a
-l:librte_latencystats.a -l:librte_kni.a -l:librte_jobstats.a
-l:librte_ip_frag.a -l:librte_gso.a -l:librte_gro.a
-l:librte_eventdev.a -l:librte_efd.a -l:librte_distributor.a
-l:librte_cryptodev.a -l:librte_compressdev.a -l:librte_cfgfile.a
-l:librte_bitratestats.a -l:librte_bbdev.a -l:librte_acl.a
-l:librte_timer.a -l:librte_hash.a -l:librte_metrics.a
-l:librte_cmdline.a -l:librte_pci.a -l:librte_ethdev.a
-l:librte_meter.a -l:librte_net.a -l:librte_mbuf.a -l:librte_mempool.a
-l:librte_rcu.a -l:librte_ring.a -l:librte_eal.a -l:librte_telemetry.a
-l:librte_kvargs.a -Wl,--no-whole-archive -lpcap -lmlx5 -libverbs
-Wl,--as-needed -lrte_node -lrte_graph -lrte_bpf -lrte_flow_classify
-lrte_pipeline -lrte_table -lrte_port -lrte_fib -lrte_ipsec
-lrte_vhost -lrte_stack -lrte_security -lrte_sched -lrte_reorder
-lrte_rib -lrte_regexdev -lrte_rawdev -lrte_pdump -lrte_power
-lrte_member -lrte_lpm -lrte_latencystats -lrte_kni -lrte_jobstats
-lrte_ip_frag -lrte_gso -lrte_gro -lrte_eventdev -lrte_efd
-lrte_distributor -lrte_cryptodev -lrte_compressdev -lrte_cfgfile
-lrte_bitratestats -lrte_bbdev -lrte_acl -lrte_timer -lrte_hash
-lrte_metrics -lrte_cmdline -lrte_pci -lrte_ethdev -lrte_meter
-lrte_net -lrte_mbuf -lrte_mempool -lrte_rcu -lrte_ring -lrte_eal
-lrte_telemetry -lrte_kvargs -pthread -lm -ldl -lnuma -lpcap '

ovs works fine.
> +   When DPDK is built using Make(for shared or static)::
>
>         $ ./configure --with-dpdk=$DPDK_BUILD
>
>     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 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``.
> -
>     .. note::
>       While ``--with-dpdk`` is required, you can pass any other configuration
>       option described in :ref:`general-configuring`.
> diff --git a/Documentation/topics/dpdk/vhost-user.rst b/Documentation/topics/dpdk/vhost-user.rst
> index 4af738d11..da3c4c9fa 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::
>
> diff --git a/acinclude.m4 b/acinclude.m4
> index 84f344da0..412b2dd55 100644
> --- a/acinclude.m4
> +++ b/acinclude.m4
> @@ -334,8 +334,10 @@ 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|/path/to/dpdk],
> +                              [Specify "static" or "shared" depending on the
> +                              DPDK libraries to use only if built using Meson
> +                              OR the DPDK build directory in case of Make])],
>                [have_dpdk=true])
>
>    AC_MSG_CHECKING([whether dpdk is enabled])
> @@ -345,13 +347,24 @@ AC_DEFUN([OVS_CHECK_DPDK], [
>    else
>      AC_MSG_RESULT([yes])
>      case "$with_dpdk" in
> -      yes)
> +      "shared" | "static" | "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"])
> +        case "$with_dpdk" in
> +          "shared" | "yes")
> +             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")
> +             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
>          ;;
>        *)
>          DPDK_AUTO_DISCOVER="false"
> @@ -424,8 +437,9 @@ AC_DEFUN([OVS_CHECK_DPDK], [
>        [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]))
> +            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]))
>         else
>           AC_MSG_ERROR([Could not find DPDK libraries in $DPDK_LIB_DIR])
>         fi
> @@ -451,10 +465,12 @@ AC_DEFUN([OVS_CHECK_DPDK], [
>      # 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
> +    if [[ "$pkg_failed" != "no" ]];then
> +      DPDK_vswitchd_LDFLAGS=-Wl,--whole-archive,$DPDK_LIB,--no-whole-archive
> +    else
> +      DPDK_vswitchd_LDFLAGS=`python3 ${srcdir}/python/build/pkgcfg.py $DPDK_LIB`
> +    fi
> +
>      AC_SUBST([DPDK_vswitchd_LDFLAGS])
>      AC_DEFINE([DPDK_NETDEV], [1], [System uses the DPDK module.])
>    fi
> diff --git a/python/automake.mk b/python/automake.mk
> index 2f08c7701..69d9800f9 100644
> --- a/python/automake.mk
> +++ b/python/automake.mk
> @@ -47,7 +47,8 @@ ovs_pyfiles = \
>  EXTRA_DIST += \
>         python/build/__init__.py \
>         python/build/nroff.py \
> -       python/build/soutil.py
> +       python/build/soutil.py \
> +       python/build/pkgcfg.py
>
>  # PyPI support.
>  EXTRA_DIST += \
> diff --git a/python/build/pkgcfg.py b/python/build/pkgcfg.py
> new file mode 100644
> index 000000000..7cee3cb03
> --- /dev/null
> +++ b/python/build/pkgcfg.py
> @@ -0,0 +1,30 @@
> +# 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.
> +
> +# The purpose of this script is to parse the libraries
> +# From pkg-config in case of DPDK Meson builds.
> +
> +import sys
> +def parse_pkg_cfg_libs(arg):
> +    linker_prefix = "-Wl,"
> +    # Libtool expects libraries to be comma separated
> +    # And -Wl must appear only once.
> +    final_string = ','.join(map(str.strip,arg[1:])).replace('-Wl,','')
> +    final_string = arg[0]+" "+linker_prefix+final_string
> +    # Ld only understands -lpthread.
> +    final_string = final_string.replace('-pthread','-lpthread')
> +    return final_string
> +
> +if __name__ == "__main__":
> +    print(parse_pkg_cfg_libs(sys.argv[1:]))
> --
> 2.17.1
>
> _______________________________________________
> dev mailing list
> dev at openvswitch.org
> https://mail.openvswitch.org/mailman/listinfo/ovs-dev



-- 
Best regards, Tonghao


More information about the dev mailing list