You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
kmod-redhat-bnxt_en/SOURCES/0052-netdrv-bnxt_en-Support...

114 lines
3.6 KiB

From ecb8a317044a5892e9f0d5a3ebe27689dcb264b4 Mon Sep 17 00:00:00 2001
From: Jonathan Toppins <jtoppins@redhat.com>
Date: Wed, 2 Oct 2019 18:23:07 -0400
Subject: [PATCH 52/96] [netdrv] bnxt_en: Support TPA counters on 57500 chips
Message-id: <af5cd8f6d840cf1d1352c7bfd76e0c1044e9871b.1570027456.git.jtoppins@redhat.com>
Patchwork-id: 276468
O-Subject: [RHEL-8.2 PATCH 45/78] bnxt_en: Support TPA counters on 57500 chips.
Bugzilla: 1724766
RH-Acked-by: John Linville <linville@redhat.com>
RH-Acked-by: Jarod Wilson <jarod@redhat.com>
Support the new expanded TPA v2 counters on 57500 B0 chips for
ethtool -S.
Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 78e7b86605b460e8b40622d16d840f9276d58627)
Bugzilla: 1724766
Build Info: https://brewweb.engineering.redhat.com/brew/taskinfo?taskID=23809532
Tested: build, boot, basic ping
Signed-off-by: Jonathan Toppins <jtoppins@redhat.com>
Signed-off-by: Bruno Meneguele <bmeneg@redhat.com>
---
drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c | 41 +++++++++++++++++------
1 file changed, 31 insertions(+), 10 deletions(-)
Index: src/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c
===================================================================
--- src.orig/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c 2020-02-06 16:23:17.017501155 +0100
+++ src/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c 2020-02-06 16:23:17.286498686 +0100
@@ -163,6 +163,14 @@
"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 @@
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 @@
{
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_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 @@
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: