Skip to content

Commit 84116f3

Browse files
cpaasch-oaiopsiff
authored andcommitted
net/mlx5: Correctly set gso_segs when LRO is used
[ Upstream commit 77bf1c55b2acc7fa3734b14f4561e3d75aea1a90 ] When gso_segs is left at 0, a number of assumptions will end up being incorrect throughout the stack. For example, in the GRO-path, we set NAPI_GRO_CB()->count to gso_segs. So, if a non-LRO'ed packet followed by an LRO'ed packet is being processed in GRO, the first one will have NAPI_GRO_CB()->count set to 1 and the next one to 0 (in dev_gro_receive()). Since commit 531d0d32de3e ("net/mlx5: Correctly set gso_size when LRO is used") these packets will get merged (as their gso_size now matches). So, we end up in gro_complete() with NAPI_GRO_CB()->count == 1 and thus don't call inet_gro_complete(). Meaning, checksum-validation in tcp_checksum_complete() will fail with a "hw csum failure". Even before the above mentioned commit, incorrect gso_segs means that other things like TCP's accounting of incoming packets (tp->segs_in, data_segs_in, rcv_ooopack) will be incorrect. Which means that if one does bytes_received/data_segs_in, the result will be bigger than the MTU. Fix this by initializing gso_segs correctly when LRO is used. Fixes: e586b3b ("net/mlx5: Ethernet Datapath files") Reported-by: Gal Pressman <[email protected]> Closes: https://lore.kernel.org/netdev/[email protected]/ Signed-off-by: Christoph Paasch <[email protected]> Reviewed-by: Gal Pressman <[email protected]> Reviewed-by: Eric Dumazet <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]> Signed-off-by: Sasha Levin <[email protected]> (cherry picked from commit 194cd28c889a3bc3edbb1b108293de66878da9a1)
1 parent d7f05b8 commit 84116f3

File tree

1 file changed

+1
-0
lines changed
  • drivers/net/ethernet/mellanox/mlx5/core

1 file changed

+1
-0
lines changed

drivers/net/ethernet/mellanox/mlx5/core/en_rx.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1573,6 +1573,7 @@ static inline void mlx5e_build_rx_skb(struct mlx5_cqe64 *cqe,
15731573
unsigned int hdrlen = mlx5e_lro_update_hdr(skb, cqe, cqe_bcnt);
15741574

15751575
skb_shinfo(skb)->gso_size = DIV_ROUND_UP(cqe_bcnt - hdrlen, lro_num_seg);
1576+
skb_shinfo(skb)->gso_segs = lro_num_seg;
15761577
/* Subtract one since we already counted this as one
15771578
* "regular" packet in mlx5e_complete_rx_cqe()
15781579
*/

0 commit comments

Comments
 (0)