From d731058395cbdff5b335bca1c9c7e6c1a221104e Mon Sep 17 00:00:00 2001 From: Daniele Di Proietto Date: Tue, 12 Aug 2014 10:43:35 -0700 Subject: [PATCH] netdev-dpdk: Move to DPDK 1.7.0 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 Signed-off-by: Daniele Di Proietto Acked-by: Pravin B Shelar --- INSTALL.DPDK | 16 ++++++++-------- acinclude.m4 | 13 ++++++++++++- lib/netdev-dpdk.c | 12 ++++-------- tests/ovs_client/ovs_client.c | 4 ++-- 4 files changed, 26 insertions(+), 19 deletions(-) diff --git a/INSTALL.DPDK b/INSTALL.DPDK index 4551f4cd9..ff729e34c 100644 --- a/INSTALL.DPDK +++ b/INSTALL.DPDK @@ -14,15 +14,15 @@ and "make". Building and Installing: ------------------------ -Recommended to use DPDK 1.6. +Required 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 +make install T=x86_64-native-linuxapp-gcc For details refer to http://dpdk.org/ Linux kernel: @@ -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=$DPDK_DIR/x86_64-native-linuxapp-gcc/ ./configure --with-dpdk=$DPDK_BUILD make @@ -49,9 +49,9 @@ First setup DPDK devices: - insert uio.ko 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 + e.g. insmod $DPDK_BUILD/kmod/igb_uio.ko + - Bind network device to igb_uio. + e.g. $DPDK_DIR/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 aa9ffcd1b..e6a6a88dc 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 #include ], @@ -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-archive + 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 6ee9803be..f2202b460 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 bfc425e4f..638762438 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.20.1