This commit provides the ability to 'listen' on DPDK ports and save packets to a pcap file with a DPDK app that uses the librte_pdump library. One such app is the 'pdump' app that can be found in the DPDK 'app' directory. Instructions on how to use this can be found in INSTALL.DPDK-ADVANCED.md
Pdump capability in OVS with DPDK will only be initialised if the CONFIG_RTE_LIBRTE_PMD_PCAP=y and CONFIG_RTE_LIBRTE_PDUMP=y options are set in DPDK. libpcap is required if the above configuration is used. Signed-off-by: Ciara Loftus <ciara.lof...@intel.com> --- v2: - specify ovs_rundir in rte_pdump_init - update documentation - remove dpdk-pdump DB value & associated mentions in the docs - added call to rte_pdump_uninit() on failure - remove pdump_server_socket on exit --- INSTALL.DPDK-ADVANCED.md | 38 ++++++++++++++++++++++++++++++++++++-- NEWS | 1 + acinclude.m4 | 23 +++++++++++++++++++++++ lib/netdev-dpdk.c | 18 ++++++++++++++++++ 4 files changed, 78 insertions(+), 2 deletions(-) diff --git a/INSTALL.DPDK-ADVANCED.md b/INSTALL.DPDK-ADVANCED.md index 8279556..11b603a 100755 --- a/INSTALL.DPDK-ADVANCED.md +++ b/INSTALL.DPDK-ADVANCED.md @@ -12,7 +12,8 @@ OVS DPDK ADVANCED INSTALL GUIDE 7. [QOS](#qos) 8. [Rate Limiting](#rl) 9. [Flow Control](#fc) -10. [Vsperf](#vsperf) +10. [Pdump](#pdump) +11. [Vsperf](#vsperf) ## <a name="overview"></a> 1. Overview @@ -947,7 +948,40 @@ respective parameter. To disable the flow control at tx side, `ovs-vsctl set Interface dpdk0 options:tx-flow-ctrl=false` -## <a name="vsperf"></a> 10. Vsperf +## <a name="pdump"></a> 10. Pdump + +Pdump allows you to listen on DPDK ports and view the traffic that is +passing on them. To use this utility, one must have libpcap installed +on the system. Furthermore, DPDK must be built with CONFIG_RTE_LIBRTE_PDUMP=y +and CONFIG_RTE_LIBRTE_PMD_PCAP=y. + +To use pdump, simply launch OVS as usual. Then, navigate to the 'app/pdump' +directory in DPDK, 'make' the application and run like so: + +``` +sudo ./build/app/dpdk_pdump -- +--pdump port=0,queue=0,rx-dev=/tmp/pkts.pcap +--server-socket-path=/usr/local/var/run/openvswitch +``` + +The above command captures traffic received on queue 0 of port 0 and stores +it in /tmp/pkts.pcap. Other combinations of port numbers, queues numbers and +pcap locations are of course also available to use. 'server-socket-path' must +be set to the value of ovs_rundir() which typically resolves to +'/usr/local/var/run/openvswitch'. +More information on the pdump app and its usage can be found in the below link. + +http://dpdk.org/doc/guides/sample_app_ug/pdump.html + +Many tools are available to view the contents of the pcap file. Once example is +tcpdump. Issue the following command to view the contents of 'pkts.pcap': + +`tcpdump -r pkts.pcap` + +A performance decrease is expected when using a monitoring application like +the DPDK pdump app. + +## <a name="vsperf"></a> 11. Vsperf Vsperf project goal is to develop vSwitch test framework that can be used to validate the suitability of different vSwitch implementations in a Telco deployment diff --git a/NEWS b/NEWS index c2ed71d..3f40e23 100644 --- a/NEWS +++ b/NEWS @@ -69,6 +69,7 @@ Post-v2.5.0 * Basic connection tracking for the userspace datapath (no ALG, fragmentation or NAT support yet) * Support for DPDK 16.07 + * Optional support for DPDK pdump enabled. - Increase number of registers to 16. - ovs-benchmark: This utility has been removed due to lack of use and bitrot. diff --git a/acinclude.m4 b/acinclude.m4 index bbbad23..5548213 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -221,6 +221,29 @@ AC_DEFUN([OVS_CHECK_DPDK], [ [AC_SEARCH_LIBS([get_mempolicy],[numa],[],[AC_MSG_ERROR([unable to find libnuma, install the dependency package])]) DPDK_EXTRA_LIB="-lnuma"]) + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM( + [ + #include <rte_config.h> +#if RTE_LIBRTE_PMD_PCAP +#error +#endif + ], []) + ], [], + [AC_SEARCH_LIBS([pcap_dump],[pcap],[],[AC_MSG_ERROR([unable to find libpcap, install the dependency package])]) + DPDK_EXTRA_LIB="-lpcap" + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM( + [ + #include <rte_config.h> +#if RTE_LIBRTE_PDUMP +#error +#endif + ], []) + ], [], + [AC_DEFINE([DPDK_PDUMP], [1], [DPDK pdump enabled in OVS.])]) + ]) + # On some systems we have to add -ldl to link with dpdk # # This code, at first, tries to link without -ldl (""), diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c index 0e6db26..9de5bb3 100644 --- a/lib/netdev-dpdk.c +++ b/lib/netdev-dpdk.c @@ -57,6 +57,9 @@ #include "rte_config.h" #include "rte_mbuf.h" #include "rte_meter.h" +#ifdef DPDK_PDUMP +#include "rte_pdump.h" +#endif #include "rte_virtio_net.h" VLOG_DEFINE_THIS_MODULE(dpdk); @@ -3418,6 +3421,21 @@ dpdk_init__(const struct smap *ovs_other_config) dpdk_vhost_class_init(); +#ifdef DPDK_PDUMP + VLOG_INFO("DPDK pdump packet capture enabled"); + err = rte_pdump_init(ovs_rundir()); + if (err) { + VLOG_INFO("Error initialising DPDK pdump"); + rte_pdump_uninit(); + } else { + char server_socket_path[PATH_MAX]; + + snprintf(server_socket_path, sizeof(server_socket_path), "%s/%s", + ovs_rundir(), "pdump_server_socket"); + fatal_signal_add_file_to_unlink(server_socket_path); + } +#endif + /* Finally, register the dpdk classes */ netdev_dpdk_register(); } -- 2.4.3 _______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev