From patchwork Thu Dec 2 21:16:15 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Marchand X-Patchwork-Id: 1563002 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=Z0SXswBP; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=140.211.166.133; helo=smtp2.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Received: from smtp2.osuosl.org (smtp2.osuosl.org [140.211.166.133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4J4pfx6pFzz9s3q for ; Fri, 3 Dec 2021 08:16:41 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id 2079A40A9E; Thu, 2 Dec 2021 21:16:40 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id V6ampq4yyigc; Thu, 2 Dec 2021 21:16:38 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [IPv6:2605:bc80:3010:104::8cd3:938]) by smtp2.osuosl.org (Postfix) with ESMTPS id A1DDC401B6; Thu, 2 Dec 2021 21:16:37 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 71BCFC001C; Thu, 2 Dec 2021 21:16:37 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp1.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by lists.linuxfoundation.org (Postfix) with ESMTP id C4C4EC000A for ; Thu, 2 Dec 2021 21:16:36 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id A0B6583FAE for ; Thu, 2 Dec 2021 21:16:36 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Authentication-Results: smtp1.osuosl.org (amavisd-new); dkim=pass (1024-bit key) header.d=redhat.com Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id pJToZEvHhLNi for ; Thu, 2 Dec 2021 21:16:35 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by smtp1.osuosl.org (Postfix) with ESMTPS id 47B2283FAD for ; Thu, 2 Dec 2021 21:16:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1638479794; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=maXvNI+Y+8sje33NmAVF5HZB2jhGAECh2spl5bdLGHA=; b=Z0SXswBPSVIi2QBa4fQyn36q6xFWM9KDPAH+1oZevmGz8S6ukiccTKTNF7nnbmQHE2+FOQ zYhfMETJklukm1R/3Q+x4HShb2VR8OPQA9OU/YdIyJIYYrDiUgA9ItZgt5JjzeEeQdsIY4 Tc/NfTFKZI7qorCwQXyCXwG5WX5F17Q= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-519-8_Z2zXYYMymWHaYxJ-ba5A-1; Thu, 02 Dec 2021 16:16:31 -0500 X-MC-Unique: 8_Z2zXYYMymWHaYxJ-ba5A-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 31AA364A7C; Thu, 2 Dec 2021 21:16:30 +0000 (UTC) Received: from dmarchan.remote.csb (unknown [10.40.193.103]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2A18C5F4E7; Thu, 2 Dec 2021 21:16:24 +0000 (UTC) From: David Marchand To: dev@openvswitch.org Date: Thu, 2 Dec 2021 22:16:15 +0100 Message-Id: <20211202211616.10726-1-david.marchand@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=david.marchand@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Cc: maxime.coquelin@redhat.com, i.maximets@ovn.org Subject: [ovs-dev] [PATCH 1/2] netdev-dpdk: Fix statistics when changing Rx/Tx queues count. X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" When changing number of Rx or Tx queues, per queue basic stats can be renumbered in DPDK ethdev layer [1]. OVS maintains an internal xstats IDs cache that was refreshed when a cached id was not valid anymore (in netdev_dpdk_get_custom_stats) or if a new DPDK port was created. This did not handle changes of Rx/Tx queues count. For example, with a mlx5 port: $ ovs-vsctl set interface dpdk0 options:n_rxq=2 $ ovs-vsctl get interface dpdk0 statistics | sed -e 's#[{}]##g' -e 's#, #\n#g' | grep rx_q._errors rx_q0_errors=0 Move the cache filling after reconfiguring and starting the port. There is no need to flush the cache in netdev_dpdk_get_custom_stats. While at it, the xstats code can be cleaned up: - remove wrong or Lapalissade comments, - don't check x*alloc return value, - expect that consecutive calls to xstats API return the same number of elements, - only write to dev-> when all DPDK calls succeeded, - add missing lock annotations to netdev_dpdk_clear_xstats and netdev_dpdk_get_xstat_name, 1: https://git.dpdk.org/dpdk/tree/lib/librte_ethdev/rte_ethdev.c?h=v20.11#n2696 Reported-at: https://mail.openvswitch.org/pipermail/ovs-dev/2021-November/389456.html Signed-off-by: David Marchand Acked-by: Kevin Traynor --- lib/netdev-dpdk.c | 160 ++++++++++++++++++---------------------------- 1 file changed, 62 insertions(+), 98 deletions(-) diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c index ca92c947a2..51bb41551b 100644 --- a/lib/netdev-dpdk.c +++ b/lib/netdev-dpdk.c @@ -540,6 +540,7 @@ static void netdev_dpdk_vhost_destruct(struct netdev *netdev); static int netdev_dpdk_get_sw_custom_stats(const struct netdev *, struct netdev_custom_stats *); +static void netdev_dpdk_configure_xstats(struct netdev_dpdk *dev); static void netdev_dpdk_clear_xstats(struct netdev_dpdk *dev); int netdev_dpdk_get_vid(const struct netdev_dpdk *dev); @@ -1161,6 +1162,8 @@ dpdk_eth_dev_init(struct netdev_dpdk *dev) } dev->started = true; + netdev_dpdk_configure_xstats(dev); + rte_eth_promiscuous_enable(dev->port_id); rte_eth_allmulticast_enable(dev->port_id); @@ -1559,23 +1562,19 @@ netdev_dpdk_dealloc(struct netdev *netdev) static void netdev_dpdk_clear_xstats(struct netdev_dpdk *dev) + OVS_REQUIRES(dev->mutex) { - /* If statistics are already allocated, we have to - * reconfigure, as port_id could have been changed. */ - if (dev->rte_xstats_names) { - free(dev->rte_xstats_names); - dev->rte_xstats_names = NULL; - dev->rte_xstats_names_size = 0; - } - if (dev->rte_xstats_ids) { - free(dev->rte_xstats_ids); - dev->rte_xstats_ids = NULL; - dev->rte_xstats_ids_size = 0; - } + free(dev->rte_xstats_names); + dev->rte_xstats_names = NULL; + dev->rte_xstats_names_size = 0; + free(dev->rte_xstats_ids); + dev->rte_xstats_ids = NULL; + dev->rte_xstats_ids_size = 0; } -static const char* +static const char * netdev_dpdk_get_xstat_name(struct netdev_dpdk *dev, uint64_t id) + OVS_REQUIRES(dev->mutex) { if (id >= dev->rte_xstats_names_size) { return "UNKNOWN"; @@ -1583,101 +1582,70 @@ netdev_dpdk_get_xstat_name(struct netdev_dpdk *dev, uint64_t id) return dev->rte_xstats_names[id].name; } -static bool +static void netdev_dpdk_configure_xstats(struct netdev_dpdk *dev) OVS_REQUIRES(dev->mutex) { + struct rte_eth_xstat_name *rte_xstats_names = NULL; + struct rte_eth_xstat *rte_xstats = NULL; + int rte_xstats_names_size; int rte_xstats_len; - bool ret; - struct rte_eth_xstat *rte_xstats; - uint64_t id; - int xstats_no; const char *name; + uint64_t id; - /* Retrieving all XSTATS names. If something will go wrong - * or amount of counters will be equal 0, rte_xstats_names - * buffer will be marked as NULL, and any further xstats - * query won't be performed (e.g. during netdev_dpdk_get_stats - * execution). */ + netdev_dpdk_clear_xstats(dev); - ret = false; - rte_xstats = NULL; + rte_xstats_names_size = rte_eth_xstats_get_names(dev->port_id, NULL, 0); + if (rte_xstats_names_size < 0) { + VLOG_WARN("Cannot get XSTATS names for port: "DPDK_PORT_ID_FMT, + dev->port_id); + goto out; + } - if (dev->rte_xstats_names == NULL || dev->rte_xstats_ids == NULL) { - dev->rte_xstats_names_size = - rte_eth_xstats_get_names(dev->port_id, NULL, 0); + rte_xstats_names = xcalloc(rte_xstats_names_size, + sizeof *rte_xstats_names); + rte_xstats_len = rte_eth_xstats_get_names(dev->port_id, + rte_xstats_names, + rte_xstats_names_size); + if (rte_xstats_len < 0 || rte_xstats_len != rte_xstats_names_size) { + VLOG_WARN("Cannot get XSTATS names for port: "DPDK_PORT_ID_FMT, + dev->port_id); + goto out; + } - if (dev->rte_xstats_names_size < 0) { - VLOG_WARN("Cannot get XSTATS for port: "DPDK_PORT_ID_FMT, - dev->port_id); - dev->rte_xstats_names_size = 0; - } else { - /* Reserve memory for xstats names and values */ - dev->rte_xstats_names = xcalloc(dev->rte_xstats_names_size, - sizeof *dev->rte_xstats_names); - - if (dev->rte_xstats_names) { - /* Retreive xstats names */ - rte_xstats_len = - rte_eth_xstats_get_names(dev->port_id, - dev->rte_xstats_names, - dev->rte_xstats_names_size); - - if (rte_xstats_len < 0) { - VLOG_WARN("Cannot get XSTATS names for port: " - DPDK_PORT_ID_FMT, dev->port_id); - goto out; - } else if (rte_xstats_len != dev->rte_xstats_names_size) { - VLOG_WARN("XSTATS size doesn't match for port: " - DPDK_PORT_ID_FMT, dev->port_id); - goto out; - } + rte_xstats = xcalloc(rte_xstats_names_size, sizeof *rte_xstats); + rte_xstats_len = rte_eth_xstats_get(dev->port_id, rte_xstats, + rte_xstats_names_size); + if (rte_xstats_len < 0 || rte_xstats_len != rte_xstats_names_size) { + VLOG_WARN("Cannot get XSTATS for port: "DPDK_PORT_ID_FMT, + dev->port_id); + goto out; + } - dev->rte_xstats_ids = xcalloc(dev->rte_xstats_names_size, - sizeof(uint64_t)); - - /* We have to calculate number of counters */ - rte_xstats = xmalloc(rte_xstats_len * sizeof *rte_xstats); - memset(rte_xstats, 0xff, sizeof *rte_xstats * rte_xstats_len); - - /* Retreive xstats values */ - if (rte_eth_xstats_get(dev->port_id, rte_xstats, - rte_xstats_len) > 0) { - dev->rte_xstats_ids_size = 0; - xstats_no = 0; - for (uint32_t i = 0; i < rte_xstats_len; i++) { - id = rte_xstats[i].id; - name = netdev_dpdk_get_xstat_name(dev, id); - /* We need to filter out everything except - * dropped, error and management counters */ - if (string_ends_with(name, "_errors") || - strstr(name, "_management_") || - string_ends_with(name, "_dropped")) { - - dev->rte_xstats_ids[xstats_no] = id; - xstats_no++; - } - } - dev->rte_xstats_ids_size = xstats_no; - ret = true; - } else { - VLOG_WARN("Can't get XSTATS IDs for port: " - DPDK_PORT_ID_FMT, dev->port_id); - } + dev->rte_xstats_names = rte_xstats_names; + rte_xstats_names = NULL; + dev->rte_xstats_names_size = rte_xstats_names_size; - free(rte_xstats); - } + dev->rte_xstats_ids = xcalloc(rte_xstats_names_size, + sizeof *dev->rte_xstats_ids); + for (unsigned int i = 0; i < rte_xstats_names_size; i++) { + id = rte_xstats[i].id; + name = netdev_dpdk_get_xstat_name(dev, id); + + /* We need to filter out everything except dropped, error and + * management counters. */ + if (string_ends_with(name, "_errors") || + strstr(name, "_management_") || + string_ends_with(name, "_dropped")) { + + dev->rte_xstats_ids[dev->rte_xstats_ids_size] = id; + dev->rte_xstats_ids_size++; } - } else { - /* Already configured */ - ret = true; } out: - if (!ret) { - netdev_dpdk_clear_xstats(dev); - } - return ret; + free(rte_xstats); + free(rte_xstats_names); } static bool @@ -1963,7 +1931,6 @@ netdev_dpdk_set_config(struct netdev *netdev, const struct smap *args, dev->devargs = xstrdup(new_devargs); dev->port_id = new_port_id; netdev_request_reconfigure(&dev->up); - netdev_dpdk_clear_xstats(dev); err = 0; } } @@ -3196,7 +3163,7 @@ netdev_dpdk_get_custom_stats(const struct netdev *netdev, ovs_mutex_lock(&dev->mutex); - if (netdev_dpdk_configure_xstats(dev)) { + if (dev->rte_xstats_ids_size > 0) { uint64_t *values = xcalloc(dev->rte_xstats_ids_size, sizeof(uint64_t)); @@ -3223,9 +3190,6 @@ netdev_dpdk_get_custom_stats(const struct netdev *netdev, } else { VLOG_WARN("Cannot get XSTATS values for port: "DPDK_PORT_ID_FMT, dev->port_id); - /* Let's clear statistics cache, so it will be - * reconfigured */ - netdev_dpdk_clear_xstats(dev); } free(values); From patchwork Thu Dec 2 21:16:16 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Marchand X-Patchwork-Id: 1563003 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=AmnlG8Do; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=140.211.166.138; helo=smtp1.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Received: from smtp1.osuosl.org (smtp1.osuosl.org [140.211.166.138]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4J4pg23jfqz9s3q for ; Fri, 3 Dec 2021 08:16:46 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id CF7D383FB9; Thu, 2 Dec 2021 21:16:44 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 3k9ANagZXyHe; Thu, 2 Dec 2021 21:16:44 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by smtp1.osuosl.org (Postfix) with ESMTPS id 2CE3B83FB0; Thu, 2 Dec 2021 21:16:43 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 0EC13C002E; Thu, 2 Dec 2021 21:16:43 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp1.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by lists.linuxfoundation.org (Postfix) with ESMTP id B23E2C000A for ; Thu, 2 Dec 2021 21:16:41 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id 9ED3783FB0 for ; Thu, 2 Dec 2021 21:16:41 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id pNf6h28ywSCe for ; Thu, 2 Dec 2021 21:16:41 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by smtp1.osuosl.org (Postfix) with ESMTPS id E4D6E83FAD for ; Thu, 2 Dec 2021 21:16:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1638479799; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=bL3HrNj5vG2qRg+YARVsBIvGArMI2uoyYaVn2AzHWtI=; b=AmnlG8DoABevsedvABgMqzvZ/kBhuq7tX16KnHrhYMnS+nM8jP6ljh75SXp2afx9gPNrji JBV4nIEpvxUcyFLqYzp1/y2xJYVyqTBjNaoV1Ow/m9kljm3uMYiJIQTopESDXkG3dxMw6E kV60FiczX2HMLQaxe5eTtO9TrT22RKw= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-510-dDST92sLPwmNSXFT6WqD9w-1; Thu, 02 Dec 2021 16:16:36 -0500 X-MC-Unique: dDST92sLPwmNSXFT6WqD9w-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 58D2E835B47; Thu, 2 Dec 2021 21:16:35 +0000 (UTC) Received: from dmarchan.remote.csb (unknown [10.40.193.103]) by smtp.corp.redhat.com (Postfix) with ESMTP id BD2225F4E1; Thu, 2 Dec 2021 21:16:33 +0000 (UTC) From: David Marchand To: dev@openvswitch.org Date: Thu, 2 Dec 2021 22:16:16 +0100 Message-Id: <20211202211616.10726-2-david.marchand@redhat.com> In-Reply-To: <20211202211616.10726-1-david.marchand@redhat.com> References: <20211202211616.10726-1-david.marchand@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=david.marchand@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Cc: maxime.coquelin@redhat.com, i.maximets@ovn.org Subject: [ovs-dev] [PATCH 2/2] netdev-dpdk: Expose per rxq/txq basic statistics. X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" 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). OVS only filters DPDK statistics, there is nothing to request in DPDK API. So the only change is to extend the filter on xstats. 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 Reviewed-by: Maxime Coquelin Acked-by: Kevin Traynor --- Changes since RFC: - dropped regex and used simpler string manipulations, --- lib/netdev-dpdk.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c index 51bb41551b..1e6079d544 100644 --- a/lib/netdev-dpdk.c +++ b/lib/netdev-dpdk.c @@ -1582,6 +1582,16 @@ netdev_dpdk_get_xstat_name(struct netdev_dpdk *dev, uint64_t id) return dev->rte_xstats_names[id].name; } +static bool +is_queue_stat(const char *s) +{ + uint16_t tmp; + + return (s[0] == 'r' || s[0] == 't') && + (ovs_scan(s + 1, "x_q%"SCNu16"_packets", &tmp) || + ovs_scan(s + 1, "x_q%"SCNu16"_bytes", &tmp)); +} + static void netdev_dpdk_configure_xstats(struct netdev_dpdk *dev) OVS_REQUIRES(dev->mutex) @@ -1632,9 +1642,10 @@ netdev_dpdk_configure_xstats(struct netdev_dpdk *dev) id = rte_xstats[i].id; name = netdev_dpdk_get_xstat_name(dev, id); - /* We need to filter out everything except dropped, error and - * management counters. */ - if (string_ends_with(name, "_errors") || + /* For custom stats, we filter out everything except per rxq/txq basic + * stats, and dropped, error and management counters. */ + if (is_queue_stat(name) || + string_ends_with(name, "_errors") || strstr(name, "_management_") || string_ends_with(name, "_dropped")) {