Skip to content

Commit a7fc1a4

Browse files
committed
eth: bnxt: gather and report HW-GRO stats
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. Reviewed-by: Michael Chan <michael.chan@broadcom.com> Link: https://patch.msgid.link/20260207003509.3927744-2-kuba@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
1 parent 57be33f commit a7fc1a4

2 files changed

Lines changed: 19 additions & 2 deletions

File tree

drivers/net/ethernet/broadcom/bnxt/bnxt.c

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1801,7 +1801,8 @@ static inline struct sk_buff *bnxt_gro_skb(struct bnxt *bp,
18011801
struct bnxt_tpa_info *tpa_info,
18021802
struct rx_tpa_end_cmp *tpa_end,
18031803
struct rx_tpa_end_cmp_ext *tpa_end1,
1804-
struct sk_buff *skb)
1804+
struct sk_buff *skb,
1805+
struct bnxt_rx_sw_stats *rx_stats)
18051806
{
18061807
#ifdef CONFIG_INET
18071808
int payload_off;
@@ -1811,6 +1812,9 @@ static inline struct sk_buff *bnxt_gro_skb(struct bnxt *bp,
18111812
if (segs == 1)
18121813
return skb;
18131814

1815+
rx_stats->rx_hw_gro_packets++;
1816+
rx_stats->rx_hw_gro_wire_packets += segs;
1817+
18141818
NAPI_GRO_CB(skb)->count = segs;
18151819
skb_shinfo(skb)->gso_size =
18161820
le32_to_cpu(tpa_end1->rx_tpa_end_cmp_seg_len);
@@ -1984,7 +1988,8 @@ static inline struct sk_buff *bnxt_tpa_end(struct bnxt *bp,
19841988
}
19851989

19861990
if (gro)
1987-
skb = bnxt_gro_skb(bp, tpa_info, tpa_end, tpa_end1, skb);
1991+
skb = bnxt_gro_skb(bp, tpa_info, tpa_end, tpa_end1, skb,
1992+
&cpr->sw_stats->rx);
19881993

19891994
return skb;
19901995
}
@@ -13489,6 +13494,8 @@ static void bnxt_get_one_ring_err_stats(struct bnxt *bp,
1348913494
stats->rx_total_netpoll_discards += sw_stats->rx.rx_netpoll_discards;
1349013495
stats->rx_total_ring_discards +=
1349113496
BNXT_GET_RING_STATS64(hw_stats, rx_discard_pkts);
13497+
stats->rx_total_hw_gro_packets += sw_stats->rx.rx_hw_gro_packets;
13498+
stats->rx_total_hw_gro_wire_packets += sw_stats->rx.rx_hw_gro_wire_packets;
1349213499
stats->tx_total_resets += sw_stats->tx.tx_resets;
1349313500
stats->tx_total_ring_discards +=
1349413501
BNXT_GET_RING_STATS64(hw_stats, tx_discard_pkts);
@@ -15910,6 +15917,8 @@ static void bnxt_get_queue_stats_rx(struct net_device *dev, int i,
1591015917
stats->bytes += BNXT_GET_RING_STATS64(sw, rx_bcast_bytes);
1591115918

1591215919
stats->alloc_fail = cpr->sw_stats->rx.rx_oom_discards;
15920+
stats->hw_gro_packets = cpr->sw_stats->rx.rx_hw_gro_packets;
15921+
stats->hw_gro_wire_packets = cpr->sw_stats->rx.rx_hw_gro_wire_packets;
1591315922
}
1591415923

1591515924
static void bnxt_get_queue_stats_tx(struct net_device *dev, int i,
@@ -15945,6 +15954,8 @@ static void bnxt_get_base_stats(struct net_device *dev,
1594515954
rx->packets = bp->net_stats_prev.rx_packets;
1594615955
rx->bytes = bp->net_stats_prev.rx_bytes;
1594715956
rx->alloc_fail = bp->ring_err_stats_prev.rx_total_oom_discards;
15957+
rx->hw_gro_packets = bp->ring_err_stats_prev.rx_total_hw_gro_packets;
15958+
rx->hw_gro_wire_packets = bp->ring_err_stats_prev.rx_total_hw_gro_wire_packets;
1594815959

1594915960
tx->packets = bp->net_stats_prev.tx_packets;
1595015961
tx->bytes = bp->net_stats_prev.tx_bytes;

drivers/net/ethernet/broadcom/bnxt/bnxt.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1126,8 +1126,11 @@ struct bnxt_rx_sw_stats {
11261126
u64 rx_l4_csum_errors;
11271127
u64 rx_resets;
11281128
u64 rx_buf_errors;
1129+
/* end of ethtool -S stats */
11291130
u64 rx_oom_discards;
11301131
u64 rx_netpoll_discards;
1132+
u64 rx_hw_gro_packets;
1133+
u64 rx_hw_gro_wire_packets;
11311134
};
11321135

11331136
struct bnxt_tx_sw_stats {
@@ -1154,6 +1157,9 @@ struct bnxt_total_ring_err_stats {
11541157
u64 tx_total_resets;
11551158
u64 tx_total_ring_discards;
11561159
u64 total_missed_irqs;
1160+
/* end of ethtool -S stats */
1161+
u64 rx_total_hw_gro_packets;
1162+
u64 rx_total_hw_gro_wire_packets;
11571163
};
11581164

11591165
struct bnxt_stats_mem {

0 commit comments

Comments
 (0)