Commit 8f9eb8bb authored by Dragos Tatulea's avatar Dragos Tatulea Committed by Jakub Kicinski
Browse files

net/mlx5e: SHAMPO, Make GRO counters more precise



Don't count non GRO packets. A non GRO packet is a packet with
a GRO cb count of 1.

Signed-off-by: default avatarDragos Tatulea <dtatulea@nvidia.com>
Signed-off-by: default avatarTariq Toukan <tariqt@nvidia.com>
Link: https://lore.kernel.org/r/20240603212219.1037656-10-tariqt@nvidia.com


Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent f5a699e0
Loading
Loading
Loading
Loading
+6 −4
Original line number Diff line number Diff line
@@ -189,17 +189,19 @@ the software port.

   * - `rx[i]_gro_packets`
     - Number of received packets processed using hardware-accelerated GRO. The
       number of hardware GRO offloaded packets received on ring i.
       number of hardware GRO offloaded packets received on ring i. Only true GRO
       packets are counted: only packets that are in an SKB with a GRO count > 1.
     - Acceleration

   * - `rx[i]_gro_bytes`
     - Number of received bytes processed using hardware-accelerated GRO. The
       number of hardware GRO offloaded bytes received on ring i.
       number of hardware GRO offloaded bytes received on ring i. Only true GRO
       packets are counted: only packets that are in an SKB with a GRO count > 1.
     - Acceleration

   * - `rx[i]_gro_skbs`
     - The number of receive SKBs constructed while performing
       hardware-accelerated GRO.
     - The number of GRO SKBs constructed from hardware-accelerated GRO. Only SKBs
       with a GRO count > 1 are counted.
     - Informative

   * - `rx[i]_gro_match_packets`
+8 −5
Original line number Diff line number Diff line
@@ -1596,9 +1596,7 @@ static void mlx5e_shampo_complete_rx_cqe(struct mlx5e_rq *rq,
	struct mlx5e_rq_stats *stats = rq->stats;

	stats->packets++;
	stats->gro_packets++;
	stats->bytes += cqe_bcnt;
	stats->gro_bytes += cqe_bcnt;
	if (NAPI_GRO_CB(skb)->count != 1)
		return;
	mlx5e_build_rx_skb(cqe, cqe_bcnt, rq, skb);
@@ -2240,14 +2238,19 @@ mlx5e_shampo_flush_skb(struct mlx5e_rq *rq, struct mlx5_cqe64 *cqe, bool match)
{
	struct sk_buff *skb = rq->hw_gro_data->skb;
	struct mlx5e_rq_stats *stats = rq->stats;
	u16 gro_count = NAPI_GRO_CB(skb)->count;

	stats->gro_skbs++;
	if (likely(skb_shinfo(skb)->nr_frags))
		mlx5e_shampo_align_fragment(skb, rq->mpwqe.log_stride_sz);
	if (NAPI_GRO_CB(skb)->count > 1)
	if (gro_count > 1) {
		stats->gro_skbs++;
		stats->gro_packets += gro_count;
		stats->gro_bytes += skb->data_len + skb_headlen(skb) * gro_count;

		mlx5e_shampo_update_hdr(rq, cqe, match);
	else
	} else {
		skb_shinfo(skb)->gso_size = 0;
	}
	napi_gro_receive(rq->cq.napi, skb);
	rq->hw_gro_data->skb = NULL;
}