Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 1e267ab

Browse files
Adham FarisSaeed Mahameed
authored andcommitted
net/mlx5e: Fix hw mtu initializing at XDP SQ allocation
Current xdp xmit functions logic (mlx5e_xmit_xdp_frame_mpwqe or mlx5e_xmit_xdp_frame), validates xdp packet length by comparing it to hw mtu (configured at xdp sq allocation) before xmiting it. This check does not account for ethernet fcs length (calculated and filled by the nic). Hence, when we try sending packets with length > (hw-mtu - ethernet-fcs-size), the device port drops it and tx_errors_phy is incremented. Desired behavior is to catch these packets and drop them by the driver. Fix this behavior in XDP SQ allocation function (mlx5e_alloc_xdpsq) by subtracting ethernet FCS header size (4 Bytes) from current hw mtu value, since ethernet FCS is calculated and written to ethernet frames by the nic. Fixes: d8bec2b ("net/mlx5e: Support bpf_xdp_adjust_head()") Signed-off-by: Adham Faris <[email protected]> Reviewed-by: Tariq Toukan <[email protected]> Signed-off-by: Saeed Mahameed <[email protected]>
1 parent 2951b2e commit 1e267ab

File tree

1 file changed

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

1 file changed

+1
-1
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1305,7 +1305,7 @@ static int mlx5e_alloc_xdpsq(struct mlx5e_channel *c,
13051305
sq->channel = c;
13061306
sq->uar_map = mdev->mlx5e_res.hw_objs.bfreg.map;
13071307
sq->min_inline_mode = params->tx_min_inline_mode;
1308-
sq->hw_mtu = MLX5E_SW2HW_MTU(params, params->sw_mtu);
1308+
sq->hw_mtu = MLX5E_SW2HW_MTU(params, params->sw_mtu) - ETH_FCS_LEN;
13091309
sq->xsk_pool = xsk_pool;
13101310

13111311
sq->stats = sq->xsk_pool ?

0 commit comments

Comments
 (0)