This looks like a nice useablity feature to add.
Two questions inline 
Regards sean.

> -----Original Message-----
> From: dev [mailto:dev-boun...@openvswitch.org] On Behalf Of Ciara Loftus
> Sent: Friday, July 29, 2016 10:58 AM
> To: dev@openvswitch.org
> Subject: [ovs-dev] [PATCH RFC 1/1] netdev-dpdk: add DPDK pdump capability
> 
> 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 | 27 +++++++++++++++++++++++++--
>  NEWS                     |  1 +
>  acinclude.m4             | 23 +++++++++++++++++++++++
>  lib/netdev-dpdk.c        | 19 +++++++++++++++++++
>  vswitchd/vswitch.xml     | 12 ++++++++++++
>  5 files changed, 80 insertions(+), 2 deletions(-)
> 
> diff --git a/INSTALL.DPDK-ADVANCED.md b/INSTALL.DPDK-ADVANCED.md index
> ec1de29..0ffafa3 100644
> --- a/INSTALL.DPDK-ADVANCED.md
> +++ b/INSTALL.DPDK-ADVANCED.md
> @@ -11,7 +11,8 @@ OVS DPDK ADVANCED INSTALL GUIDE  6. [Vhost
> Walkthrough](#vhost)  7. [QOS](#qos)  8. [Rate Limiting](#rl) -9.
> [Vsperf](#vsperf)
> +9. [Pdump](#pdump)
> +10. [Vsperf](#vsperf)
> 
>  ## <a name="overview"></a> 1. Overview
> 
> @@ -827,7 +828,29 @@ To clear the ingress policer configuration from the port
> use the following:
> 
>  For more details regarding ingress-policer see the vswitch.xml.
> 
> -## <a name="vsperf"></a> 9. Vsperf
> +## <a name="pdump"></a> 9. 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'`
[Mooney, Sean K] can the dpdk_pdump utility dump non dpdk physical ports such as
Vhost-user ports or dump all queues on a port at the same time? 
Am I correct in saying that Port=0 in this case indicate the first index in the 
dpdk port
list which is dpdk0 from an ovs perspective or is this the port id as shown in 
ovs-appctl dpctl/show?
> +
> +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.
> +
> +A small performance decrease is seen when dpdk-pdump=true. This
> +decrease is larger when using a monitoring application like the DPDK pdump
> app.
> +
> +## <a name="vsperf"></a> 10. 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 32975b0..f59b3b0 100644
> --- a/NEWS
> +++ b/NEWS
> @@ -64,6 +64,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 faf79eb..0c1dafd 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 f21ddcc..e52ad6f 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);
> @@ -3193,6 +3196,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"); 
> @@ -
> 3333,6 +3337,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 
> f0e1381..7cf38fe
> 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
_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

Reply via email to