[ovs-dev] [PATCH 1/2] netdev-dpdk: Move to DPDK 1.7.0

Daniele Di Proietto ddiproietto at vmware.com
Fri Aug 15 21:53:51 UTC 2014



On 8/15/14, 2:13 PM, "Gurucharan Shetty" <shettyg at nicira.com> wrote:

>On Tue, Aug 12, 2014 at 5:39 PM, Pravin Shelar <pshelar at nicira.com> wrote:
>> On Tue, Aug 12, 2014 at 10:43 AM, Daniele Di Proietto
>> <ddiproietto at vmware.com> wrote:
>>> With this commit we move our DPDK support to 1.7.0.
>>> DPDK binaries (starting with dpdk 1.7.0) should be linked with
>>>--whole-archive
>>> to include pmd drivers
>>>
>> I updated INSTALL.DPDK file and pushed patch to master.
>>
>>> Signed-off-by: Daniele Di Proietto <ddiproietto at vmware.com>
>>> ---
>>>  INSTALL.DPDK                  | 12 ++++++------
>>>  acinclude.m4                  | 13 ++++++++++++-
>>>  lib/netdev-dpdk.c             | 12 ++++--------
>>>  tests/ovs_client/ovs_client.c |  4 ++--
>>>  4 files changed, 24 insertions(+), 17 deletions(-)
>>>
>>> diff --git a/INSTALL.DPDK b/INSTALL.DPDK
>>> index c74fa5c..3d062e5 100644
>>> --- a/INSTALL.DPDK
>>> +++ b/INSTALL.DPDK
>>> @@ -14,12 +14,12 @@ and "make".
>>>  Building and Installing:
>>>  ------------------------
>>>
>>> -Recommended to use DPDK 1.6.
>>> +Recommended to use DPDK 1.7.
>>>
>>>  DPDK:
>>> -Set dir i.g.:   export DPDK_DIR=/usr/src/dpdk-1.6.0r2
>>> +Set dir i.g.:   export DPDK_DIR=/usr/src/dpdk-1.7.0
>>>  cd $DPDK_DIR
>>> -update config/defconfig_x86_64-default-linuxapp-gcc so that dpdk
>>>generate single lib file.
>>> +update config/common_linuxapp so that dpdk generate single lib file.
>>>  CONFIG_RTE_BUILD_COMBINE_LIBS=y
>>>
>>>  make install T=x86_64-default-linuxapp-gcc
>>> @@ -32,7 +32,7 @@ DPDK kernel requirement.
>>>  OVS:
>>>  cd $(OVS_DIR)/openvswitch
>>>  ./boot.sh
>>> -export DPDK_BUILD=/usr/src/dpdk-1.6.0r2/x86_64-default-linuxapp-gcc
>>> +export DPDK_BUILD=/usr/src/dpdk-1.7.0/x86_64-default-linuxapp-gcc
>>>  ./configure --with-dpdk=$DPDK_BUILD
>>>  make
>>>
>>> @@ -50,8 +50,8 @@ First setup DPDK devices:
>>>      e.g. modprobe uio
>>>    - insert igb_uio.ko
>>>      e.g. insmod DPDK/x86_64-default-linuxapp-gcc/kmod/igb_uio.ko
>>> -  - Bind network device to ibg_uio.
>>> -    e.g. DPDK/tools/pci_unbind.py --bind=igb_uio eth1
>>> +  - Bind network device to igb_uio.
>>> +    e.g. DPDK/tools/dpdk_nic_bind.py --bind=igb_uio eth1
>>>      Alternate binding method:
>>>       Find target Ethernet devices
>>>        lspci -nn|grep Ethernet
>>> diff --git a/acinclude.m4 b/acinclude.m4
>>> index aa9ffcd..e6a6a88 100644
>>> --- a/acinclude.m4
>>> +++ b/acinclude.m4
>>> @@ -170,6 +170,7 @@ AC_DEFUN([OVS_CHECK_DPDK], [
>>>
>>>      DPDK_INCLUDE=$RTE_SDK/include
>>>      DPDK_LIB_DIR=$RTE_SDK/lib
>>> +    DPDK_LIB=-lintel_dpdk
>>>
>>>      LDFLAGS="$LDFLAGS -L$DPDK_LIB_DIR"
>>>      CFLAGS="$CFLAGS -I$DPDK_INCLUDE"
>>> @@ -184,7 +185,7 @@ AC_DEFUN([OVS_CHECK_DPDK], [
>>>      found=false
>>>      save_LIBS=$LIBS
>>>      for extras in "" "-ldl"; do
>>> -        LIBS="-lintel_dpdk $extras $save_LIBS"
>>> +        LIBS="$DPDK_LIB $extras $save_LIBS"
>>>          AC_LINK_IFELSE(
>>>             [AC_LANG_PROGRAM([#include <rte_config.h>
>>>                               #include <rte_eal.h>],
>>> @@ -199,6 +200,16 @@ AC_DEFUN([OVS_CHECK_DPDK], [
>>>          AC_MSG_ERROR([cannot link with dpdk])
>>>      fi
>>>
>>> +    # DPDK 1.7.0 pmd drivers are not linked unless --whole-archive is
>>>used.
>>> +    #
>>> +    # 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.
>>> +    
>>>vswitchd_ovs_vswitchd_LDFLAGS=-Wl,--whole-archive,$DPDK_LIB,--no-whole-a
>>>rchive
>
>It looks like the introduction of 'vswitchd_ovs_vswitchd_LDFLAGS'
>variable causes ovs-vswitchd binary to no longer use $AM_LDFLAGS.
>This causes builds to fail for non-dpdk cases (In my case, Windows
>build with external SSL libraries).
>
>The following patch fixes the problem for me.
>
>diff --git a/vswitchd/automake.mk b/vswitchd/automake.mk
>index a09605f..3299ff5 100644
>--- a/vswitchd/automake.mk
>+++ b/vswitchd/automake.mk
>@@ -3,6 +3,8 @@ man_MANS += vswitchd/ovs-vswitchd.8
> DISTCLEANFILES += \
>        vswitchd/ovs-vswitchd.8
>
>+vswitchd_ovs_vswitchd_LDFLAGS += $(AM_LDFLAGS)
>+
> vswitchd_ovs_vswitchd_SOURCES = \
>        vswitchd/bridge.c \
>        vswitchd/bridge.h \
>
>
>Does it work okay with DPDK?

I can confirm that it works fine with DPDK 1.7.0.

>
>>> +    AC_SUBST([vswitchd_ovs_vswitchd_LDFLAGS])
>>>      AC_DEFINE([DPDK_NETDEV], [1], [System uses the DPDK module.])
>>>    else
>>>      RTE_SDK=
>>> diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c
>>> index 6ee9803..f2202b4 100644
>>> --- a/lib/netdev-dpdk.c
>>> +++ b/lib/netdev-dpdk.c
>>> @@ -1199,12 +1199,6 @@ dpdk_class_init(void)
>>>  {
>>>      int result;
>>>
>>> -    result = rte_pmd_init_all();
>>> -    if (result) {
>>> -        VLOG_ERR("Cannot init PMD");
>>> -        return -result;
>>> -    }
>>> -
>>>      result = rte_eal_pci_probe();
>>>      if (result) {
>>>          VLOG_ERR("Cannot probe PCI");
>>> @@ -1253,7 +1247,9 @@ dpdk_ring_create(const char dev_name[], unsigned
>>>int port_no,
>>>          return ENOMEM;
>>>      }
>>>
>>> -    err = rte_eth_from_rings(&ivshmem->cring_rx, 1,
>>>&ivshmem->cring_tx, 1, SOCKET0);
>>> +    err = rte_eth_from_rings(dev_name, &ivshmem->cring_rx, 1,
>>> +                             &ivshmem->cring_tx, 1, SOCKET0);
>>> +
>>>      if (err < 0) {
>>>          rte_free(ivshmem);
>>>          return ENODEV;
>>> @@ -1400,7 +1396,7 @@ dpdk_init(int argc, char **argv)
>>>          ovs_abort(result, "Cannot init EAL\n");
>>>      }
>>>
>>> -    rte_memzone_dump();
>>> +    rte_memzone_dump(stdout);
>>>      rte_eal_init_ret = 0;
>>>
>>>      if (argc > result) {
>>> diff --git a/tests/ovs_client/ovs_client.c
>>>b/tests/ovs_client/ovs_client.c
>>> index bfc425e..6387624 100644
>>> --- a/tests/ovs_client/ovs_client.c
>>> +++ b/tests/ovs_client/ovs_client.c
>>> @@ -72,7 +72,7 @@ get_rx_queue_name(unsigned id)
>>>       */
>>>      static char buffer[sizeof(MP_CLIENT_RXQ_NAME) + 2];
>>>
>>> -    rte_snprintf(buffer, sizeof(buffer) - 1, MP_CLIENT_RXQ_NAME, id);
>>> +    snprintf(buffer, sizeof(buffer) - 1, MP_CLIENT_RXQ_NAME, id);
>>>      return buffer;
>>>  }
>>>
>>> @@ -87,7 +87,7 @@ get_tx_queue_name(unsigned id)
>>>       */
>>>      static char buffer[sizeof(MP_CLIENT_TXQ_NAME) + 2];
>>>
>>> -    rte_snprintf(buffer, sizeof(buffer) - 1, MP_CLIENT_TXQ_NAME, id);
>>> +    snprintf(buffer, sizeof(buffer) - 1, MP_CLIENT_TXQ_NAME, id);
>>>      return buffer;
>>>  }
>>>
>>> --
>>> 2.0.1
>>>
>>> _______________________________________________
>>> dev mailing list
>>> dev at openvswitch.org
>>> 
>>>https://urldefense.proofpoint.com/v1/url?u=http://openvswitch.org/mailma
>>>n/listinfo/dev&k=oIvRg1%2BdGAgOoM1BIlLLqw%3D%3D%0A&r=MV9BdLjtFIdhBDBaw5z
>>>%2BU6SSA2gAfY4L%2F1HCy3VjlKU%3D%0A&m=RR%2F8J6s3iq7utCuzEkzD4ps1RXbmrd5xO
>>>xB4cBF1lQ8%3D%0A&s=48d23e2ccbbe69377596b01d0c46884738cc0b997d194b8139655
>>>ff44537e8c7
>> _______________________________________________
>> dev mailing list
>> dev at openvswitch.org
>> 
>>https://urldefense.proofpoint.com/v1/url?u=http://openvswitch.org/mailman
>>/listinfo/dev&k=oIvRg1%2BdGAgOoM1BIlLLqw%3D%3D%0A&r=MV9BdLjtFIdhBDBaw5z%2
>>BU6SSA2gAfY4L%2F1HCy3VjlKU%3D%0A&m=RR%2F8J6s3iq7utCuzEkzD4ps1RXbmrd5xOxB4
>>cBF1lQ8%3D%0A&s=48d23e2ccbbe69377596b01d0c46884738cc0b997d194b8139655ff44
>>537e8c7




More information about the dev mailing list