mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-12 05:48:39 +08:00
net/mlx5e: XDP, Drop fragmented packets larger than MTU size
XDP transmits fragmented packets that are larger than MTU size instead of
dropping those packets. The drop check that checks whether a packet is larger
than MTU is comparing MTU size against the linear part length only.
Adjust the drop check to compare MTU size against both linear and non-linear
part lengths to avoid transmitting fragmented packets larger than MTU size.
Fixes: 39a1665d16
("net/mlx5e: Implement sending multi buffer XDP frames")
Signed-off-by: Carolina Jubran <cjubran@nvidia.com>
Reviewed-by: Tariq Toukan <tariqt@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
This commit is contained in:
parent
be86106fd7
commit
bcaf109f79
@ -493,6 +493,7 @@ mlx5e_xmit_xdp_frame(struct mlx5e_xdpsq *sq, struct mlx5e_xmit_data *xdptxd,
|
||||
dma_addr_t dma_addr = xdptxd->dma_addr;
|
||||
u32 dma_len = xdptxd->len;
|
||||
u16 ds_cnt, inline_hdr_sz;
|
||||
unsigned int frags_size;
|
||||
u8 num_wqebbs = 1;
|
||||
int num_frags = 0;
|
||||
bool inline_ok;
|
||||
@ -503,8 +504,9 @@ mlx5e_xmit_xdp_frame(struct mlx5e_xdpsq *sq, struct mlx5e_xmit_data *xdptxd,
|
||||
|
||||
inline_ok = sq->min_inline_mode == MLX5_INLINE_MODE_NONE ||
|
||||
dma_len >= MLX5E_XDP_MIN_INLINE;
|
||||
frags_size = xdptxd->has_frags ? xdptxdf->sinfo->xdp_frags_size : 0;
|
||||
|
||||
if (unlikely(!inline_ok || sq->hw_mtu < dma_len)) {
|
||||
if (unlikely(!inline_ok || sq->hw_mtu < dma_len + frags_size)) {
|
||||
stats->err++;
|
||||
return false;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user