From: Jakub Kicinski <kuba@kernel.org>
To: davem@davemloft.net
Cc: netdev@vger.kernel.org, edumazet@google.com, pabeni@redhat.com,
andrew+netdev@lunn.ch, horms@kernel.org, shuah@kernel.org,
willemb@google.com, petrm@nvidia.com, donald.hunter@gmail.com,
michael.chan@broadcom.com, pavan.chebbi@broadcom.com,
linux-kselftest@vger.kernel.org, Jakub Kicinski <kuba@kernel.org>
Subject: [PATCH net-next v2 1/9] eth: bnxt: gather and report HW-GRO stats
Date: Fri, 6 Feb 2026 16:35:01 -0800 [thread overview]
Message-ID: <20260207003509.3927744-2-kuba@kernel.org> (raw)
In-Reply-To: <20260207003509.3927744-1-kuba@kernel.org>
Count and report HW-GRO stats as seen by the kernel.
The device stats for GRO seem to not reflect the reality,
perhaps they count sessions which did not actually result
in any aggregation. Also they count wire packets, so we
have to count super-frames, anyway.
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
v2:
- remove unnecessary condition for feature check (Michael)
- move the stats to the end of array to avoid messing up
ethtool -S output (AI)
v1: https://lore.kernel.org/20260205220541.2992807-2-kuba@kernel.org
---
drivers/net/ethernet/broadcom/bnxt/bnxt.h | 6 ++++++
drivers/net/ethernet/broadcom/bnxt/bnxt.c | 15 +++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.h b/drivers/net/ethernet/broadcom/bnxt/bnxt.h
index f036ef60230b..9a41b9e0423c 100644
--- a/drivers/net/ethernet/broadcom/bnxt/bnxt.h
+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.h
@@ -1126,8 +1126,11 @@ struct bnxt_rx_sw_stats {
u64 rx_l4_csum_errors;
u64 rx_resets;
u64 rx_buf_errors;
+ /* end of ethtool -S stats */
u64 rx_oom_discards;
u64 rx_netpoll_discards;
+ u64 rx_hw_gro_packets;
+ u64 rx_hw_gro_wire_packets;
};
struct bnxt_tx_sw_stats {
@@ -1154,6 +1157,9 @@ struct bnxt_total_ring_err_stats {
u64 tx_total_resets;
u64 tx_total_ring_discards;
u64 total_missed_irqs;
+ /* end of ethtool -S stats */
+ u64 rx_total_hw_gro_packets;
+ u64 rx_total_hw_gro_wire_packets;
};
struct bnxt_stats_mem {
diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
index 466e0fc6141f..44c46bac92d9 100644
--- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c
+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
@@ -1804,7 +1804,8 @@ static inline struct sk_buff *bnxt_gro_skb(struct bnxt *bp,
struct bnxt_tpa_info *tpa_info,
struct rx_tpa_end_cmp *tpa_end,
struct rx_tpa_end_cmp_ext *tpa_end1,
- struct sk_buff *skb)
+ struct sk_buff *skb,
+ struct bnxt_rx_sw_stats *rx_stats)
{
#ifdef CONFIG_INET
int payload_off;
@@ -1814,6 +1815,9 @@ static inline struct sk_buff *bnxt_gro_skb(struct bnxt *bp,
if (segs == 1)
return skb;
+ rx_stats->rx_hw_gro_packets++;
+ rx_stats->rx_hw_gro_wire_packets += segs;
+
NAPI_GRO_CB(skb)->count = segs;
skb_shinfo(skb)->gso_size =
le32_to_cpu(tpa_end1->rx_tpa_end_cmp_seg_len);
@@ -1987,7 +1991,8 @@ static inline struct sk_buff *bnxt_tpa_end(struct bnxt *bp,
}
if (gro)
- skb = bnxt_gro_skb(bp, tpa_info, tpa_end, tpa_end1, skb);
+ skb = bnxt_gro_skb(bp, tpa_info, tpa_end, tpa_end1, skb,
+ &cpr->sw_stats->rx);
return skb;
}
@@ -13492,6 +13497,8 @@ static void bnxt_get_one_ring_err_stats(struct bnxt *bp,
stats->rx_total_netpoll_discards += sw_stats->rx.rx_netpoll_discards;
stats->rx_total_ring_discards +=
BNXT_GET_RING_STATS64(hw_stats, rx_discard_pkts);
+ stats->rx_total_hw_gro_packets += sw_stats->rx.rx_hw_gro_packets;
+ stats->rx_total_hw_gro_wire_packets += sw_stats->rx.rx_hw_gro_wire_packets;
stats->tx_total_resets += sw_stats->tx.tx_resets;
stats->tx_total_ring_discards +=
BNXT_GET_RING_STATS64(hw_stats, tx_discard_pkts);
@@ -15931,6 +15938,8 @@ static void bnxt_get_queue_stats_rx(struct net_device *dev, int i,
stats->bytes += BNXT_GET_RING_STATS64(sw, rx_bcast_bytes);
stats->alloc_fail = cpr->sw_stats->rx.rx_oom_discards;
+ stats->hw_gro_packets = cpr->sw_stats->rx.rx_hw_gro_packets;
+ stats->hw_gro_wire_packets = cpr->sw_stats->rx.rx_hw_gro_wire_packets;
}
static void bnxt_get_queue_stats_tx(struct net_device *dev, int i,
@@ -15966,6 +15975,8 @@ static void bnxt_get_base_stats(struct net_device *dev,
rx->packets = bp->net_stats_prev.rx_packets;
rx->bytes = bp->net_stats_prev.rx_bytes;
rx->alloc_fail = bp->ring_err_stats_prev.rx_total_oom_discards;
+ rx->hw_gro_packets = bp->ring_err_stats_prev.rx_total_hw_gro_packets;
+ rx->hw_gro_wire_packets = bp->ring_err_stats_prev.rx_total_hw_gro_wire_packets;
tx->packets = bp->net_stats_prev.tx_packets;
tx->bytes = bp->net_stats_prev.tx_bytes;
--
2.53.0
next prev parent reply other threads:[~2026-02-07 0:35 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-07 0:35 [PATCH net-next v2 0/9] net: stats, tools, driver tests for HW GRO Jakub Kicinski
2026-02-07 0:35 ` Jakub Kicinski [this message]
2026-02-08 0:09 ` [PATCH net-next v2 1/9] eth: bnxt: gather and report HW-GRO stats Michael Chan
2026-02-11 1:51 ` Jakub Kicinski
2026-02-07 0:35 ` [PATCH net-next v2 2/9] tools: ynltool: factor out qstat dumping Jakub Kicinski
2026-02-07 0:35 ` [PATCH net-next v2 3/9] tools: ynltool: add qstats analysis for HW-GRO efficiency / savings Jakub Kicinski
2026-02-09 9:43 ` Petr Machata
2026-02-07 0:35 ` [PATCH net-next v2 4/9] selftests: net: move gro to lib for HW vs SW reuse Jakub Kicinski
2026-02-09 2:36 ` Willem de Bruijn
2026-02-07 0:35 ` [PATCH net-next v2 5/9] selftests: drv-net: give HW stats sync time extra 25% of margin Jakub Kicinski
2026-02-09 2:37 ` Willem de Bruijn
2026-02-07 0:35 ` [PATCH net-next v2 6/9] selftests: drv-net: gro: use SO_TXTIME to schedule packets together Jakub Kicinski
2026-02-09 2:39 ` Willem de Bruijn
2026-02-11 1:56 ` Jakub Kicinski
2026-02-11 3:15 ` Willem de Bruijn
2026-02-11 3:48 ` Jakub Kicinski
2026-02-11 4:21 ` Willem de Bruijn
2026-02-11 17:00 ` Jakub Kicinski
2026-02-11 17:22 ` Willem de Bruijn
2026-02-07 0:35 ` [PATCH net-next v2 7/9] selftests: drv-net: gro: test GRO stats Jakub Kicinski
2026-02-07 0:35 ` [PATCH net-next v2 8/9] selftests: drv-net: gro: add test for packet ordering Jakub Kicinski
2026-02-07 0:35 ` [PATCH net-next v2 9/9] selftests: drv-net: gro: add a test for GRO depth Jakub Kicinski
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=20260207003509.3927744-2-kuba@kernel.org \
--to=kuba@kernel.org \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=donald.hunter@gmail.com \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=michael.chan@broadcom.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=pavan.chebbi@broadcom.com \
--cc=petrm@nvidia.com \
--cc=shuah@kernel.org \
--cc=willemb@google.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox