All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hemant Agrawal <hemant.agrawal@nxp.com>
To: ferruh.yigit@intel.com
Cc: dev@dpdk.org, shreyansh.jain@nxp.com
Subject: [PATCH 7/8] net/dpaa2: fix the implementation of xstats
Date: Thu,  5 Apr 2018 14:24:23 +0530	[thread overview]
Message-ID: <1522918464-4586-7-git-send-email-hemant.agrawal@nxp.com> (raw)
In-Reply-To: <1522918464-4586-1-git-send-email-hemant.agrawal@nxp.com>

Fixes: 1d6329b2fc1f ("net/dpaa2: support extra stats")
Cc: stable@dpdk.org

Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 drivers/net/dpaa2/dpaa2_ethdev.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/drivers/net/dpaa2/dpaa2_ethdev.c b/drivers/net/dpaa2/dpaa2_ethdev.c
index 281483d..eed6dc9 100644
--- a/drivers/net/dpaa2/dpaa2_ethdev.c
+++ b/drivers/net/dpaa2/dpaa2_ethdev.c
@@ -1115,12 +1115,12 @@ dpaa2_dev_xstats_get(struct rte_eth_dev *dev, struct rte_eth_xstat *xstats,
 	union dpni_statistics value[3] = {};
 	unsigned int i = 0, num = RTE_DIM(dpaa2_xstats_strings);
 
-	if (xstats == NULL)
-		return 0;
-
 	if (n < num)
 		return num;
 
+	if (xstats == NULL)
+		return 0;
+
 	/* Get Counters from page_0*/
 	retcode = dpni_get_statistics(dpni, CMD_PRI_LOW, priv->token,
 				      0, 0, &value[0]);
@@ -1153,10 +1153,13 @@ dpaa2_dev_xstats_get(struct rte_eth_dev *dev, struct rte_eth_xstat *xstats,
 static int
 dpaa2_xstats_get_names(__rte_unused struct rte_eth_dev *dev,
 		       struct rte_eth_xstat_name *xstats_names,
-		       __rte_unused unsigned int limit)
+		       unsigned int limit)
 {
 	unsigned int i, stat_cnt = RTE_DIM(dpaa2_xstats_strings);
 
+	if (limit < stat_cnt)
+		return stat_cnt;
+
 	if (xstats_names != NULL)
 		for (i = 0; i < stat_cnt; i++)
 			snprintf(xstats_names[i].name,
-- 
2.7.4

  parent reply	other threads:[~2018-04-05  8:56 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-05  8:54 [PATCH 1/8] bus/dpaa: fix the resource leak issue Hemant Agrawal
2018-04-05  8:54 ` [PATCH 2/8] bus/dpaa: fix the unchecked return value Hemant Agrawal
2018-04-05  8:54 ` [PATCH 3/8] net/dpaa: fix the array overrun Hemant Agrawal
2018-04-09  5:29   ` Shreyansh Jain
2018-04-05  8:54 ` [PATCH 4/8] net/dpaa: fix the oob access Hemant Agrawal
2018-04-09  7:23   ` Shreyansh Jain
2018-04-05  8:54 ` [PATCH 5/8] bus/dpaa: fix resource leak Hemant Agrawal
2018-04-09  7:18   ` Shreyansh Jain
2018-04-05  8:54 ` [PATCH 6/8] net/dpaa: update checksum for external pool obj Hemant Agrawal
2018-04-05  8:54 ` Hemant Agrawal [this message]
2018-04-05  8:54 ` [PATCH 8/8] bus/fslmc: configure separate portal for Ethernet Rx Hemant Agrawal
2018-04-09 10:22 ` [PATCH v2 1/8] bus/dpaa: fix the resource leak issue Hemant Agrawal
2018-04-09 10:22   ` [PATCH v2 2/8] bus/dpaa: fix the unchecked return value Hemant Agrawal
2018-04-09 10:22   ` [PATCH v2 3/8] net/dpaa: fix the array overrun Hemant Agrawal
2018-04-09 10:22   ` [PATCH v2 4/8] net/dpaa: fix the oob access Hemant Agrawal
2018-04-09 10:22   ` [PATCH v2 5/8] bus/dpaa: fix resource leak Hemant Agrawal
2018-04-09 10:22   ` [PATCH v2 6/8] net/dpaa: update checksum for external pool obj Hemant Agrawal
2018-04-09 10:22   ` [PATCH v2 7/8] net/dpaa2: fix the implementation of xstats Hemant Agrawal
2018-04-09 10:22   ` [PATCH v2 8/8] bus/fslmc: configure separate portal for Ethernet Rx Hemant Agrawal
2018-04-11 22:20   ` [PATCH v2 1/8] bus/dpaa: fix the resource leak issue Thomas Monjalon

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=1522918464-4586-7-git-send-email-hemant.agrawal@nxp.com \
    --to=hemant.agrawal@nxp.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    --cc=shreyansh.jain@nxp.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.