Commit a7fc1a48 authored by Jakub Kicinski's avatar Jakub Kicinski
Browse files

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: default avatarMichael Chan <michael.chan@broadcom.com>
Link: https://patch.msgid.link/20260207003509.3927744-2-kuba@kernel.org


Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 57be33f8
Loading
Loading
Loading
Loading
+13 −2
Original line number Diff line number Diff line
@@ -1801,7 +1801,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;
@@ -1811,6 +1812,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);
@@ -1984,7 +1988,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;
}
@@ -13489,6 +13494,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);
@@ -15910,6 +15917,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,
@@ -15945,6 +15954,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;
+6 −0
Original line number Diff line number Diff line
@@ -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 {