patches for DPDK stable branches
 help / color / mirror / Atom feed
From: Kevin Traynor <ktraynor@redhat.com>
To: Shahaf Shuler <shahafs@mellanox.com>
Cc: dpdk stable <stable@dpdk.org>
Subject: [dpdk-stable] patch 'net/mlx5: support missing counter in extended statistics' has been queued to stable release 18.08.1
Date: Wed, 21 Nov 2018 16:48:14 +0000	[thread overview]
Message-ID: <20181121164828.32249-60-ktraynor@redhat.com> (raw)
In-Reply-To: <20181121164828.32249-1-ktraynor@redhat.com>

Hi,

FYI, your patch has been queued to stable release 18.08.1

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 11/27/18. So please
shout if anyone has objections.

Also note that after the patch there's a diff of the upstream commit vs the patch applied
to the branch. If the code is different (ie: not only metadata diffs), due for example to
a change in context or macro names, please double check it.

Thanks.

Kevin Traynor

---
>From 866f2720a1735d213f08108fc8092fa13d7154bc Mon Sep 17 00:00:00 2001
From: Shahaf Shuler <shahafs@mellanox.com>
Date: Mon, 17 Sep 2018 12:46:34 +0300
Subject: [PATCH] net/mlx5: support missing counter in extended statistics

[ upstream commit 1a611fdaf6ec3d860d7b0f39cdd8b754ef51ebc3 ]

The current code would fail if one of the counters DPDK counters was not
found on the device counters.

As representors and PF port has different counters the both cannot work
together.

Addressing this issue by making the counter init more flexible to
contain all the counter found and skipping the error.

Signed-off-by: Shahaf Shuler <shahafs@mellanox.com>
---
 drivers/net/mlx5/mlx5.h       | 11 ++++++
 drivers/net/mlx5/mlx5_stats.c | 67 +++++++++++++++--------------------
 2 files changed, 40 insertions(+), 38 deletions(-)

diff --git a/drivers/net/mlx5/mlx5.h b/drivers/net/mlx5/mlx5.h
index 35a196e76..b4ba147ab 100644
--- a/drivers/net/mlx5/mlx5.h
+++ b/drivers/net/mlx5/mlx5.h
@@ -72,10 +72,21 @@ struct mlx5_shared_data {
 extern struct mlx5_shared_data *mlx5_shared_data;
 
+struct mlx5_counter_ctrl {
+	/* Name of the counter. */
+	char dpdk_name[RTE_ETH_XSTATS_NAME_SIZE];
+	/* Name of the counter on the device table. */
+	char ctr_name[RTE_ETH_XSTATS_NAME_SIZE];
+	uint32_t ib:1; /**< Nonzero for IB counters. */
+};
+
 struct mlx5_xstats_ctrl {
 	/* Number of device stats. */
 	uint16_t stats_n;
+	/* Number of device stats identified by PMD. */
+	uint16_t  mlx5_stats_n;
 	/* Index in the device counters table. */
 	uint16_t dev_table_idx[MLX5_MAX_XSTATS];
 	uint64_t base[MLX5_MAX_XSTATS];
+	struct mlx5_counter_ctrl info[MLX5_MAX_XSTATS];
 };
 
diff --git a/drivers/net/mlx5/mlx5_stats.c b/drivers/net/mlx5/mlx5_stats.c
index ed5b51bb2..9b89b9bfd 100644
--- a/drivers/net/mlx5/mlx5_stats.c
+++ b/drivers/net/mlx5/mlx5_stats.c
@@ -18,12 +18,4 @@
 #include "mlx5_defs.h"
 
-struct mlx5_counter_ctrl {
-	/* Name of the counter. */
-	char dpdk_name[RTE_ETH_XSTATS_NAME_SIZE];
-	/* Name of the counter on the device table. */
-	char ctr_name[RTE_ETH_XSTATS_NAME_SIZE];
-	uint32_t ib:1; /**< Nonzero for IB counters. */
-};
-
 static const struct mlx5_counter_ctrl mlx5_counters_init[] = {
 	{
@@ -154,10 +146,10 @@ mlx5_read_dev_counters(struct rte_eth_dev *dev, uint64_t *stats)
 		return ret;
 	}
-	for (i = 0; i != xstats_n; ++i) {
-		if (mlx5_counters_init[i].ib) {
+	for (i = 0; i != xstats_ctrl->mlx5_stats_n; ++i) {
+		if (xstats_ctrl->info[i].ib) {
 			FILE *file;
 			MKSTR(path, "%s/ports/1/hw_counters/%s",
 			      priv->ibdev_path,
-			      mlx5_counters_init[i].ctr_name);
+			      xstats_ctrl->info[i].ctr_name);
 
 			file = fopen(path, "rb");
@@ -223,4 +215,6 @@ mlx5_xstats_init(struct rte_eth_dev *dev)
 	int ret;
 
+	/* So that it won't aggregate for each init. */
+	xstats_ctrl->mlx5_stats_n = 0;
 	ret = mlx5_ethtool_get_stats_n(dev);
 	if (ret < 0) {
@@ -250,6 +244,4 @@ mlx5_xstats_init(struct rte_eth_dev *dev)
 		goto free;
 	}
-	for (j = 0; j != xstats_n; ++j)
-		xstats_ctrl->dev_table_idx[j] = dev_stats_n;
 	for (i = 0; i != dev_stats_n; ++i) {
 		const char *curr_string = (const char *)
@@ -259,23 +251,23 @@ mlx5_xstats_init(struct rte_eth_dev *dev)
 			if (!strcmp(mlx5_counters_init[j].ctr_name,
 				    curr_string)) {
-				xstats_ctrl->dev_table_idx[j] = i;
+				unsigned int idx = xstats_ctrl->mlx5_stats_n++;
+
+				xstats_ctrl->dev_table_idx[idx] = i;
+				xstats_ctrl->info[idx] = mlx5_counters_init[j];
 				break;
 			}
 		}
 	}
-	for (j = 0; j != xstats_n; ++j) {
-		if (mlx5_counters_init[j].ib)
-			continue;
-		if (xstats_ctrl->dev_table_idx[j] >= dev_stats_n) {
-			DRV_LOG(WARNING,
-				"port %u counter \"%s\" is not recognized",
-				dev->data->port_id,
-				mlx5_counters_init[j].dpdk_name);
-			goto free;
+	/* Add IB counters. */
+	for (i = 0; i != xstats_n; ++i) {
+		if (mlx5_counters_init[i].ib) {
+			unsigned int idx = xstats_ctrl->mlx5_stats_n++;
+
+			xstats_ctrl->info[idx] = mlx5_counters_init[i];
 		}
 	}
+	assert(xstats_ctrl->mlx5_stats_n <= MLX5_MAX_XSTATS);
 	xstats_ctrl->stats_n = dev_stats_n;
 	/* Copy to base at first time. */
-	assert(xstats_n <= MLX5_MAX_XSTATS);
 	ret = mlx5_read_dev_counters(dev, xstats_ctrl->base);
 	if (ret)
@@ -307,9 +299,8 @@ mlx5_xstats_get(struct rte_eth_dev *dev, struct rte_eth_xstat *stats,
 	unsigned int i;
 	uint64_t counters[n];
+	struct mlx5_xstats_ctrl *xstats_ctrl = &priv->xstats_ctrl;
+	uint16_t mlx5_stats_n = xstats_ctrl->mlx5_stats_n;
 
-	if (!priv->xstats_ctrl.stats_n)
-		return 0;
-	if (n >= xstats_n && stats) {
-		struct mlx5_xstats_ctrl *xstats_ctrl = &priv->xstats_ctrl;
+	if (n >= mlx5_stats_n && stats) {
 		int stats_n;
 		int ret;
@@ -323,10 +314,10 @@ mlx5_xstats_get(struct rte_eth_dev *dev, struct rte_eth_xstat *stats,
 		if (ret)
 			return ret;
-		for (i = 0; i != xstats_n; ++i) {
+		for (i = 0; i != mlx5_stats_n; ++i) {
 			stats[i].id = i;
 			stats[i].value = (counters[i] - xstats_ctrl->base[i]);
 		}
 	}
-	return xstats_n;
+	return mlx5_stats_n;
 }
 
@@ -444,5 +435,5 @@ mlx5_xstats_reset(struct rte_eth_dev *dev)
 	int stats_n;
 	unsigned int i;
-	unsigned int n = xstats_n;
+	unsigned int n = xstats_ctrl->mlx5_stats_n;
 	uint64_t counters[n];
 	int ret;
@@ -483,17 +474,17 @@ mlx5_xstats_get_names(struct rte_eth_dev *dev __rte_unused,
 		      struct rte_eth_xstat_name *xstats_names, unsigned int n)
 {
-	struct priv *priv = dev->data->dev_private;
 	unsigned int i;
+	struct priv *priv = dev->data->dev_private;
+	struct mlx5_xstats_ctrl *xstats_ctrl = &priv->xstats_ctrl;
+	unsigned int mlx5_xstats_n = xstats_ctrl->mlx5_stats_n;
 
-	if (!priv->xstats_ctrl.stats_n)
-		return 0;
-	if (n >= xstats_n && xstats_names) {
-		for (i = 0; i != xstats_n; ++i) {
+	if (n >= mlx5_xstats_n && xstats_names) {
+		for (i = 0; i != mlx5_xstats_n; ++i) {
 			strncpy(xstats_names[i].name,
-				mlx5_counters_init[i].dpdk_name,
+				xstats_ctrl->info[i].dpdk_name,
 				RTE_ETH_XSTATS_NAME_SIZE);
 			xstats_names[i].name[RTE_ETH_XSTATS_NAME_SIZE - 1] = 0;
 		}
 	}
-	return xstats_n;
+	return mlx5_xstats_n;
 }
-- 
2.19.0

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2018-11-21 16:44:32.596694936 +0000
+++ 0060-net-mlx5-support-missing-counter-in-extended-statist.patch	2018-11-21 16:44:30.000000000 +0000
@@ -1,8 +1,10 @@
-From 1a611fdaf6ec3d860d7b0f39cdd8b754ef51ebc3 Mon Sep 17 00:00:00 2001
+From 866f2720a1735d213f08108fc8092fa13d7154bc Mon Sep 17 00:00:00 2001
 From: Shahaf Shuler <shahafs@mellanox.com>
 Date: Mon, 17 Sep 2018 12:46:34 +0300
 Subject: [PATCH] net/mlx5: support missing counter in extended statistics
 
+[ upstream commit 1a611fdaf6ec3d860d7b0f39cdd8b754ef51ebc3 ]
+
 The current code would fail if one of the counters DPDK counters was not
 found on the device counters.
 
@@ -12,8 +14,6 @@
 Addressing this issue by making the counter init more flexible to
 contain all the counter found and skipping the error.
 
-Cc: stable@dpdk.org
-
 Signed-off-by: Shahaf Shuler <shahafs@mellanox.com>
 ---
  drivers/net/mlx5/mlx5.h       | 11 ++++++
@@ -21,10 +21,10 @@
  2 files changed, 40 insertions(+), 38 deletions(-)
 
 diff --git a/drivers/net/mlx5/mlx5.h b/drivers/net/mlx5/mlx5.h
-index 4122e546c..ab242980a 100644
+index 35a196e76..b4ba147ab 100644
 --- a/drivers/net/mlx5/mlx5.h
 +++ b/drivers/net/mlx5/mlx5.h
-@@ -73,10 +73,21 @@ struct mlx5_shared_data {
+@@ -72,10 +72,21 @@ struct mlx5_shared_data {
  extern struct mlx5_shared_data *mlx5_shared_data;
  
 +struct mlx5_counter_ctrl {

  parent reply	other threads:[~2018-11-21 16:50 UTC|newest]

Thread overview: 74+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-21 16:47 [dpdk-stable] patch 'doc: fix eventdev shared library version' " Kevin Traynor
2018-11-21 16:47 ` [dpdk-stable] patch 'event/dpaa2: fix mbuf assignment in atomic processing' " Kevin Traynor
2018-11-21 16:47 ` [dpdk-stable] patch 'eventdev: fix eth Rx adapter hotplug incompatibility' " Kevin Traynor
2018-11-21 16:47 ` [dpdk-stable] patch 'test/event: remove eth Rx adapter vdev workaround' " Kevin Traynor
2018-11-21 16:47 ` [dpdk-stable] patch 'event/sw: fix cq index check for unlink usecases' " Kevin Traynor
2018-11-21 16:47 ` [dpdk-stable] patch 'test/event: check burst mode capability' " Kevin Traynor
2018-11-21 16:47 ` [dpdk-stable] patch 'test/event: fix build for timer adapter' " Kevin Traynor
2018-11-21 16:47 ` [dpdk-stable] patch 'test/event: fix RSS config for eth Rx " Kevin Traynor
2018-11-21 16:47 ` [dpdk-stable] patch 'app/eventdev: fix minor typos' " Kevin Traynor
2018-11-21 16:47 ` [dpdk-stable] patch 'test/event: fix eth Rx adapter test for skeleton PMD' " Kevin Traynor
2018-11-21 16:47 ` [dpdk-stable] patch 'test/event: fix Rx adapter intr " Kevin Traynor
2018-11-21 16:47 ` [dpdk-stable] patch 'mem: fix undefined behavior in NUMA-aware mapping' " Kevin Traynor
2018-11-21 16:47 ` [dpdk-stable] patch 'mem: fix --huge-unlink option' " Kevin Traynor
2018-11-21 16:47 ` [dpdk-stable] patch 'igb_uio: fix refcount if open returns error' " Kevin Traynor
2018-11-21 16:47 ` [dpdk-stable] patch 'net/i40e: fix send admin queue command before init' " Kevin Traynor
2018-11-21 16:47 ` [dpdk-stable] patch 'net/i40e/base: fix partition id calculation for X722' " Kevin Traynor
2018-11-21 16:47 ` [dpdk-stable] patch 'net/i40e/base: improve the polling mechanism' " Kevin Traynor
2018-11-21 16:47 ` [dpdk-stable] patch 'net/i40e/base: read LLDP config area with correct endianness' " Kevin Traynor
2018-11-21 16:47 ` [dpdk-stable] patch 'net/i40e/base: properly clean resources' " Kevin Traynor
2018-11-21 16:47 ` [dpdk-stable] patch 'net/i40e/base: gracefully clean the " Kevin Traynor
2018-11-21 16:47 ` [dpdk-stable] patch 'net/i40e/base: correct global reset timeout calculation' " Kevin Traynor
2018-11-21 16:47 ` [dpdk-stable] patch 'net/ixgbe: wait longer for link after fiber MAC setup' " Kevin Traynor
2018-11-21 16:47 ` [dpdk-stable] patch 'net/enic: do not use non-standard integer types' " Kevin Traynor
2018-11-21 16:47 ` [dpdk-stable] patch 'net/enic: set Rx VLAN offload flag for non-stripped packets' " Kevin Traynor
2018-11-21 16:47 ` [dpdk-stable] patch 'net/enic: explicitly disable overlay offload' " Kevin Traynor
2018-11-21 16:47 ` [dpdk-stable] patch 'net/failsafe: report actual device capabilities' " Kevin Traynor
2018-11-21 16:47 ` [dpdk-stable] patch 'net/nfp: fix RSS' " Kevin Traynor
2018-11-21 16:47 ` [dpdk-stable] patch 'net/bnx2x: fix logging to include device name' " Kevin Traynor
2018-11-21 16:47 ` [dpdk-stable] patch 'net/bnx2x: fix to disable further interrupts' " Kevin Traynor
2018-11-21 16:47 ` [dpdk-stable] patch 'net/bnx2x: fix call to link handling periodic function' " Kevin Traynor
2018-11-21 16:47 ` [dpdk-stable] patch 'net/bnx2x: fix to add PHY lock' " Kevin Traynor
2018-11-21 16:47 ` [dpdk-stable] patch 'net/enic: fix flow API memory leak' " Kevin Traynor
2018-11-21 16:47 ` [dpdk-stable] patch 'net/bnxt: get rid of ff pools and use VNIC info array' " Kevin Traynor
2018-11-21 16:47 ` [dpdk-stable] patch 'net/bnxt: fix uninitialized pointer access in Tx' " Kevin Traynor
2018-11-21 16:47 ` [dpdk-stable] patch 'net/bnxt: fix MTU setting' " Kevin Traynor
2018-11-21 16:47 ` [dpdk-stable] patch 'net/bnxt: fix registration of VF async event completion ring' " Kevin Traynor
2018-11-21 16:47 ` [dpdk-stable] patch 'net/bnxt: set MAC filtering as outer for non tunnel frames' " Kevin Traynor
2018-11-21 16:47 ` [dpdk-stable] patch 'net/bnxt: set a VNIC as default only once' " Kevin Traynor
2018-11-21 16:47 ` [dpdk-stable] patch 'net/bnxt: set VLAN strip mode before default VNIC cfg' " Kevin Traynor
2018-11-21 16:47 ` [dpdk-stable] patch 'net/bnxt: remove excess log messages' " Kevin Traynor
2018-11-21 16:47 ` [dpdk-stable] patch 'net/bnxt: reduce polling interval for valid bit' " Kevin Traynor
2018-11-21 16:47 ` [dpdk-stable] patch 'app/testpmd: check Rx VLAN offload flag to print VLAN TCI' " Kevin Traynor
2018-11-21 16:47 ` [dpdk-stable] patch 'app/testpmd: fix csum parse-tunnel command invocation' " Kevin Traynor
2018-11-21 16:47 ` [dpdk-stable] patch 'doc: fix typos in the flow API guide' " Kevin Traynor
2018-11-21 16:47 ` [dpdk-stable] patch 'net/sfc: receive prepared packets even in Rx exception case' " Kevin Traynor
2018-11-21 16:48 ` [dpdk-stable] patch 'mbuf: fix Tx offload mask' " Kevin Traynor
2018-11-21 16:48 ` [dpdk-stable] patch 'net/mlx5: fix representor port link status' " Kevin Traynor
2018-11-21 16:48 ` [dpdk-stable] patch 'net/mlx5: fix representor port xstats' " Kevin Traynor
2018-11-21 16:48 ` [dpdk-stable] patch 'net/mlx4: support externally allocated static memory' " Kevin Traynor
2018-11-21 16:48 ` [dpdk-stable] patch 'net/mlx5: " Kevin Traynor
2018-11-21 16:48 ` [dpdk-stable] patch 'app/testpmd: fix displaying RSS hash functions' " Kevin Traynor
2018-11-21 16:48 ` [dpdk-stable] patch 'doc: clarify L3 Tx checksum prerequisite' " Kevin Traynor
2018-11-21 16:48 ` [dpdk-stable] patch 'doc: clarify L4 " Kevin Traynor
2018-11-21 16:48 ` [dpdk-stable] patch 'net/failsafe: use prefix for function' " Kevin Traynor
2018-11-21 16:48 ` [dpdk-stable] patch 'net/mlx5: fix errno values for flow engine' " Kevin Traynor
2018-11-21 16:48 ` [dpdk-stable] patch 'doc: add VFIO in ENA guide' " Kevin Traynor
2018-11-21 16:48 ` [dpdk-stable] patch 'drivers/net: fix log type string' " Kevin Traynor
2018-11-21 16:48 ` [dpdk-stable] patch 'app/testpmd: fix printf format in event callback' " Kevin Traynor
2018-11-21 16:48 ` [dpdk-stable] patch 'app/testpmd: fix duplicate exit' " Kevin Traynor
2018-11-21 16:48 ` Kevin Traynor [this message]
2018-11-21 16:48 ` [dpdk-stable] patch 'net/mlx5: add representor specific statistics' " Kevin Traynor
2018-11-21 16:48 ` [dpdk-stable] patch 'net/mlx5: always use representor ifindex for ioctl' " Kevin Traynor
2018-11-21 16:48 ` [dpdk-stable] patch 'net/e1000: do not error out if Rx drop enable is set' " Kevin Traynor
2018-11-21 16:48 ` [dpdk-stable] patch 'net/ifc: fix address translation function name' " Kevin Traynor
2018-11-21 16:48 ` [dpdk-stable] patch 'net/sfc: do not skip RSS configuration step on reconfigure' " Kevin Traynor
2018-11-21 16:48 ` [dpdk-stable] patch 'net/sfc: allow to query RSS key and HF in isolated mode' " Kevin Traynor
2018-11-21 16:48 ` [dpdk-stable] patch 'net/sfc: allow to query RSS key and HF when RSS is disabled' " Kevin Traynor
2018-11-21 16:48 ` [dpdk-stable] patch 'eal: use correct data type for bitmap slab operations' " Kevin Traynor
2018-11-21 16:48 ` [dpdk-stable] patch 'app/testpmd: fix metering and policing commands' " Kevin Traynor
2018-11-21 16:48 ` [dpdk-stable] patch 'examples/ip_pipeline: fix IPv6 endianness' " Kevin Traynor
2018-11-21 16:48 ` [dpdk-stable] patch 'net/softnic: " Kevin Traynor
2018-11-21 16:48 ` [dpdk-stable] patch 'bus/fslmc: fix physical addressing check' " Kevin Traynor
2018-11-21 16:48 ` [dpdk-stable] patch 'net/dpaa2: fix IOVA conversion for congestion memory' " Kevin Traynor
2018-11-21 16:48 ` [dpdk-stable] patch 'net/dpaa2: fix VLAN filter enablement' " Kevin Traynor

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181121164828.32249-60-ktraynor@redhat.com \
    --to=ktraynor@redhat.com \
    --cc=shahafs@mellanox.com \
    --cc=stable@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).