[ovs-dev] [RFC PATCH] netdev-dpdk: Expose per rxq/txq basic statistics.

Ilya Maximets i.maximets at ovn.org
Mon Nov 29 17:48:38 UTC 2021


On 10/15/21 17:04, David Marchand wrote:
> When troubleshooting multiqueue setups, having per queue statistics helps
> checking packets repartition in rx and tx queues.
> 
> Per queue statistics are exported by most DPDK drivers (with capability
> RTE_ETH_DEV_AUTOFILL_QUEUE_XSTATS). But since OVS only filters statistics
> it exposes, there is nothing to request in DPDK API.
> 
> Extend existing filter with a regular expression.
> string_ends_with() helper is not used anymore, and removed as a
> consequence.
> 
> Querying statistics with
> $ ovs-vsctl get interface dpdk0 statistics | \
>   sed -e 's#[{}]##g' -e 's#, #\n#g'
> 
> and comparing gives:
> @@ -13,7 +13,12 @@
>  rx_phy_crc_errors=0
>  rx_phy_in_range_len_errors=0
>  rx_phy_symbol_errors=0
> +rx_q0_bytes=0
>  rx_q0_errors=0
> +rx_q0_packets=0
> +rx_q1_bytes=0
> +rx_q1_errors=0
> +rx_q1_packets=0
>  rx_wqe_errors=0
>  tx_broadcast_packets=0
>  tx_bytes=0
> @@ -27,3 +32,13 @@
>  tx_pp_rearm_queue_errors=0
>  tx_pp_timestamp_future_errors=0
>  tx_pp_timestamp_past_errors=0
> +tx_q0_bytes=0
> +tx_q0_packets=0
> +tx_q1_bytes=0
> +tx_q1_packets=0
> +tx_q2_bytes=0
> +tx_q2_packets=0
> +tx_q3_bytes=0
> +tx_q3_packets=0
> +tx_q4_bytes=0
> +tx_q4_packets=0
> 
> Signed-off-by: David Marchand <david.marchand at redhat.com>
> ---
> Sending this as a RFC for feedback.
> vhost user ports are left untouched for now, but could be added in the
> future.
> 
> ---
>  lib/netdev-dpdk.c | 32 ++++++++++++++++++++++++++------
>  lib/util.c        | 13 -------------
>  lib/util.h        |  2 --
>  3 files changed, 26 insertions(+), 21 deletions(-)
> 
> diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c
> index ca92c947a2..12447cc4b2 100644
> --- a/lib/netdev-dpdk.c
> +++ b/lib/netdev-dpdk.c
> @@ -18,6 +18,7 @@
>  #include "netdev-dpdk.h"
>  
>  #include <errno.h>
> +#include <regex.h>
>  #include <signal.h>
>  #include <stdlib.h>
>  #include <string.h>
> @@ -1583,6 +1584,13 @@ netdev_dpdk_get_xstat_name(struct netdev_dpdk *dev, uint64_t id)
>      return dev->rte_xstats_names[id].name;
>  }
>  
> +/* We filter out everything except per rxq/txq basic stats, and dropped,
> + * error and management counters.
> + * Note: rx_qX_errors is handled by the _errors$ pattern.
> + */
> +#define DPDK_STATS_REGEX_FILTER \
> +    "(^(rx_q|tx_q)[0-9]*_(packets|bytes)$|_errors$|_dropped$|_management_)"
> +

Hi, David.  The idea seems OK to me, but I'm a bit concerned about
using the regex.  It seems that not every libc implements this API
and it might become a problem with attempts to enable OVS with DPDK
on Windows, AFAICT.  Can we replace this regex with a usual string
checking function?  For example, we could keep the current checks
and add something like this:

static bool
is_queue_stat(const char *s)
{
  return (s[0] == 'r' || s[1] == 't')
         && (ovs_scan(s + 1, "x_q%"SCNu16"_packets", &tmp)
             || ovs_scan(s + 1, "x_q%"SCNu16"_bytes", &tmp));
}

Should be equal to your regex, if I didn't mess up something.
What do you think?

Best regards, Ilya Maximets.


More information about the dev mailing list