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
The pdump feature is optional. Should you wish to use it, pcap libraries must to be installed on the system and the CONFIG_RTE_LIBRTE_PMD_PCAP=y and CONFIG_RTE_LIBRTE_PDUMP=y options set in DPDK. Additionally you must set the 'dpdk-pdump' ovs other_config DB value to 'true'. Signed-off-by: Ciara Loftus <ciara.lof...@intel.com> --- INSTALL.DPDK-ADVANCED.md | 30 ++++++++++++++++++++++++++++-- NEWS | 1 + acinclude.m4 | 23 +++++++++++++++++++++++ lib/netdev-dpdk.c | 19 +++++++++++++++++++ vswitchd/vswitch.xml | 12 ++++++++++++ 5 files changed, 83 insertions(+), 2 deletions(-) diff --git a/INSTALL.DPDK-ADVANCED.md b/INSTALL.DPDK-ADVANCED.md index c8d69ae..877824b 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 @@ -862,7 +863,32 @@ 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. And finally, the following database +value must be set before launching the switch, like so: + +`ovs-vsctl set Open_vSwitch . other_config:dpdk-pdump=true` + +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/rx.pcap'` + +The above command captures traffic received on queue 0 of port 0 and stores +it in /tmp/rx.pcap. Other combinations of port numbers, queues numbers and +pcap locations are of course also available to use. 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 + +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 f02166d..b8f1850 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -211,6 +211,29 @@ AC_DEFUN([OVS_CHECK_DPDK], [ AC_SEARCH_LIBS([get_mempolicy],[numa],[],[AC_MSG_ERROR([unable to find libnuma, install the dependency package])]) + 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 aaac0d1..9e4abd9 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); @@ -3242,6 +3245,7 @@ dpdk_init__(const struct smap *ovs_other_config) #ifndef VHOST_CUSE char *sock_dir_subcomponent; #endif + bool set_pdump = false; if (!smap_get_bool(ovs_other_config, "dpdk-init", false)) { VLOG_INFO("DPDK Disabled - to change this requires a restart.\n"); @@ -3382,6 +3386,21 @@ dpdk_init__(const struct smap *ovs_other_config) dpdk_vhost_class_init(); + set_pdump = smap_get_bool(ovs_other_config, "dpdk-pdump", false); + + if (set_pdump) { +#ifdef DPDK_PDUMP + VLOG_INFO("DPDK pdump packet capture enabled"); + err = rte_pdump_init(NULL); + if (err != 0) { + VLOG_INFO("Error initialising DPDK pdump"); + } +#else + VLOG_INFO("Cannot initialise DPDK pdump packet capture - option not " + "enabled in the DPDK build"); +#endif + } + /* Finally, register the dpdk classes */ netdev_dpdk_register(); } diff --git a/vswitchd/vswitch.xml b/vswitchd/vswitch.xml index 65acdc7..a80b82a 100644 --- a/vswitchd/vswitch.xml +++ b/vswitchd/vswitch.xml @@ -311,6 +311,18 @@ </p> </column> + <column name="other_config" key="dpdk-pdump" + type='{"type": "boolean"}'> + <p> + Set this value to <code>true</code> to enable DPDK pdump packet + capture capability on DPDK port types. + </p> + <p> + The default value is <code>false</code>. Changing this value requires + restarting the daemon. + </p> + </column> + <column name="other_config" key="n-handler-threads" type='{"type": "integer", "minInteger": 1}'> <p> -- 2.4.3 _______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev