Netdev List
 help / color / mirror / Atom feed
From: Michael Chan <michael.chan@broadcom.com>
To: davem@davemloft.net
Cc: netdev@vger.kernel.org
Subject: [PATCH net-next 13/16] bnxt_en: Support TPA counters on 57500 chips.
Date: Mon, 29 Jul 2019 06:10:30 -0400	[thread overview]
Message-ID: <1564395033-19511-14-git-send-email-michael.chan@broadcom.com> (raw)
In-Reply-To: <1564395033-19511-1-git-send-email-michael.chan@broadcom.com>

Support the new expanded TPA v2 counters on 57500 B0 chips for
ethtool -S.

Signed-off-by: Michael Chan <michael.chan@broadcom.com>
---
 drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c | 41 +++++++++++++++++------
 1 file changed, 31 insertions(+), 10 deletions(-)

diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c
index a3a7bec..3a3d8a9 100644
--- a/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c
+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c
@@ -163,6 +163,14 @@ static const char * const bnxt_ring_tpa_stats_str[] = {
 	"tpa_aborts",
 };
 
+static const char * const bnxt_ring_tpa2_stats_str[] = {
+	"rx_tpa_eligible_pkt",
+	"rx_tpa_eligible_bytes",
+	"rx_tpa_pkt",
+	"rx_tpa_bytes",
+	"rx_tpa_errors",
+};
+
 static const char * const bnxt_ring_sw_stats_str[] = {
 	"rx_l4_csum_errors",
 	"missed_irqs",
@@ -461,14 +469,23 @@ static const struct {
 	 ARRAY_SIZE(bnxt_tx_pkts_pri_arr))
 #define BNXT_NUM_PCIE_STATS ARRAY_SIZE(bnxt_pcie_stats_arr)
 
+static int bnxt_get_num_tpa_ring_stats(struct bnxt *bp)
+{
+	if (BNXT_SUPPORTS_TPA(bp)) {
+		if (bp->max_tpa_v2)
+			return ARRAY_SIZE(bnxt_ring_tpa2_stats_str);
+		return ARRAY_SIZE(bnxt_ring_tpa_stats_str);
+	}
+	return 0;
+}
+
 static int bnxt_get_num_ring_stats(struct bnxt *bp)
 {
 	int num_stats;
 
 	num_stats = ARRAY_SIZE(bnxt_ring_stats_str) +
-		    ARRAY_SIZE(bnxt_ring_sw_stats_str);
-	if (BNXT_SUPPORTS_TPA(bp))
-		num_stats += ARRAY_SIZE(bnxt_ring_tpa_stats_str);
+		    ARRAY_SIZE(bnxt_ring_sw_stats_str) +
+		    bnxt_get_num_tpa_ring_stats(bp);
 	return num_stats * bp->cp_nr_rings;
 }
 
@@ -515,10 +532,8 @@ static void bnxt_get_ethtool_stats(struct net_device *dev,
 {
 	u32 i, j = 0;
 	struct bnxt *bp = netdev_priv(dev);
-	u32 stat_fields = ARRAY_SIZE(bnxt_ring_stats_str);
-
-	if (BNXT_SUPPORTS_TPA(bp))
-		stat_fields += ARRAY_SIZE(bnxt_ring_tpa_stats_str);
+	u32 stat_fields = ARRAY_SIZE(bnxt_ring_stats_str) +
+			  bnxt_get_num_tpa_ring_stats(bp);
 
 	if (!bp->bnapi) {
 		j += bnxt_get_num_ring_stats(bp) + BNXT_NUM_SW_FUNC_STATS;
@@ -609,6 +624,7 @@ static void bnxt_get_ethtool_stats(struct net_device *dev,
 static void bnxt_get_strings(struct net_device *dev, u32 stringset, u8 *buf)
 {
 	struct bnxt *bp = netdev_priv(dev);
+	static const char * const *str;
 	u32 i, j, num_str;
 
 	switch (stringset) {
@@ -623,10 +639,15 @@ static void bnxt_get_strings(struct net_device *dev, u32 stringset, u8 *buf)
 			if (!BNXT_SUPPORTS_TPA(bp))
 				goto skip_tpa_stats;
 
-			num_str = ARRAY_SIZE(bnxt_ring_tpa_stats_str);
+			if (bp->max_tpa_v2) {
+				num_str = ARRAY_SIZE(bnxt_ring_tpa2_stats_str);
+				str = bnxt_ring_tpa2_stats_str;
+			} else {
+				num_str = ARRAY_SIZE(bnxt_ring_tpa_stats_str);
+				str = bnxt_ring_tpa_stats_str;
+			}
 			for (j = 0; j < num_str; j++) {
-				sprintf(buf, "[%d]: %s", i,
-					bnxt_ring_tpa_stats_str[j]);
+				sprintf(buf, "[%d]: %s", i, str[j]);
 				buf += ETH_GSTRING_LEN;
 			}
 skip_tpa_stats:
-- 
2.5.1


  parent reply	other threads:[~2019-07-29 10:11 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-29 10:10 [PATCH net-next 00/16] bnxt_en: Add TPA (GRO_HW and LRO) on 57500 chips Michael Chan
2019-07-29 10:10 ` [PATCH net-next 01/16] bnxt_en: Update firmware interface spec. to 1.10.0.89 Michael Chan
2019-07-29 10:10 ` [PATCH net-next 02/16] bnxt_en: Add TPA structure definitions for BCM57500 chips Michael Chan
2019-07-29 10:10 ` [PATCH net-next 03/16] bnxt_en: Refactor TPA logic Michael Chan
2019-07-29 10:10 ` [PATCH net-next 04/16] bnxt_en: Expand bnxt_tpa_info struct to support 57500 chips Michael Chan
2019-07-29 10:10 ` [PATCH net-next 05/16] bnxt_en: Handle standalone RX_AGG completions Michael Chan
2019-07-29 10:10 ` [PATCH net-next 06/16] bnxt_en: Refactor tunneled hardware GRO logic Michael Chan
2019-07-29 10:10 ` [PATCH net-next 07/16] bnxt_en: Set TPA GRO mode flags on 57500 chips properly Michael Chan
2019-07-29 10:10 ` [PATCH net-next 08/16] bnxt_en: Add fast path logic for TPA on 57500 chips Michael Chan
2019-07-29 10:10 ` [PATCH net-next 09/16] bnxt_en: Add TPA ID mapping logic for " Michael Chan
2019-07-29 10:10 ` [PATCH net-next 10/16] bnxt_en: Add hardware GRO setup function " Michael Chan
2019-07-29 10:10 ` [PATCH net-next 11/16] bnxt_en: Refactor ethtool ring statistics logic Michael Chan
2019-07-29 10:10 ` [PATCH net-next 12/16] bnxt_en: Allocate the larger per-ring statistics block for 57500 chips Michael Chan
2019-07-29 10:10 ` Michael Chan [this message]
2019-07-29 10:10 ` [PATCH net-next 14/16] bnxt_en: Refactor bnxt_init_one() and turn on TPA support on " Michael Chan
2019-07-29 10:10 ` [PATCH net-next 15/16] bnxt_en: Support all variants of the 5750X chip family Michael Chan
2019-07-29 10:10 ` [PATCH net-next 16/16] bnxt_en: Add PCI IDs for 57500 series NPAR devices Michael Chan
2019-07-29 21:24 ` [PATCH net-next 00/16] bnxt_en: Add TPA (GRO_HW and LRO) on 57500 chips David Miller
2019-07-29 22:00   ` Michael Chan

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=1564395033-19511-14-git-send-email-michael.chan@broadcom.com \
    --to=michael.chan@broadcom.com \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.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