]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
net/mlx5e: SHAMPO, Disable gso_size for non GRO packets
authorDragos Tatulea <dtatulea@nvidia.com>
Mon, 3 Jun 2024 21:22:10 +0000 (00:22 +0300)
committerJakub Kicinski <kuba@kernel.org>
Thu, 6 Jun 2024 03:20:46 +0000 (20:20 -0700)
When HW GRO is enabled, forwarding of packets is broken due to gso_size
being set incorrectly on non GRO packets.

Non GRO packets have a skb GRO count of 1. mlx5 always sets gso_size on
the skb, even for non GRO packets. It leans on the fact that gso_size is
normally reset in napi_gro_complete(). But this happens only for packets
from GRO'able protocols (TCP/UDP) that have a gro_receive() handler.

The problematic scenarios are:

1) Non GRO protocol packets are received, validate_xmit_skb() will drop
   them (see EPROTONOSUPPORT in skb_mac_gso_segment()). The fix for
   this case would be to not set gso_size at all for SHAMPO packets with
   header size 0.

2) Packets from a GRO'ed protocol (TCP) are received but immediately
   flushed because they are not GRO'able (TCP SYN for example).
   mlx5e_shampo_update_hdr(), which updates the remaining GRO state on
   the skb, is not called because skb GRO count is 1. The fix here would
   be to always call mlx5e_shampo_update_hdr(), regardless of skb GRO
   count. But this call is expensive

The unified fix for both cases is to reset gso_size before calling
napi_gro_receive(). It is a change that is more effective (no call to
mlx5e_shampo_update_hdr() necessary) and simple (smallest code
footprint).

Signed-off-by: Dragos Tatulea <dtatulea@nvidia.com>
Signed-off-by: Tariq Toukan <tariqt@nvidia.com>
Link: https://lore.kernel.org/r/20240603212219.1037656-6-tariqt@nvidia.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/mellanox/mlx5/core/en_rx.c

index b3ef0dd237298bfc6723d2df9720046287849f2d..a13fa760f948af4ee9225c0972c4b68a3bbc073e 100644 (file)
@@ -2267,6 +2267,8 @@ mlx5e_shampo_flush_skb(struct mlx5e_rq *rq, struct mlx5_cqe64 *cqe, bool match)
                mlx5e_shampo_align_fragment(skb, rq->mpwqe.log_stride_sz);
        if (NAPI_GRO_CB(skb)->count > 1)
                mlx5e_shampo_update_hdr(rq, cqe, match);
+       else
+               skb_shinfo(skb)->gso_size = 0;
        napi_gro_receive(rq->cq.napi, skb);
        rq->hw_gro_data->skb = NULL;
 }