Skip to content

Commit

Permalink
netdev-dpdk: Move to DPDK 1.7.0
Browse files Browse the repository at this point in the history
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 <[email protected]>
Acked-by: Pravin B Shelar <[email protected]>
  • Loading branch information
ddiproietto authored and Pravin B Shelar committed Aug 13, 2014
1 parent ed79f89 commit d731058
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 19 deletions.
16 changes: 8 additions & 8 deletions INSTALL.DPDK
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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

Expand All @@ -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
Expand Down
13 changes: 12 additions & 1 deletion acinclude.m4
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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>],
Expand All @@ -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=
Expand Down
12 changes: 4 additions & 8 deletions lib/netdev-dpdk.c
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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) {
Expand Down
4 changes: 2 additions & 2 deletions tests/ovs_client/ovs_client.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand All @@ -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;
}

Expand Down

0 comments on commit d731058

Please sign in to comment.