net/mlx5e: Validate MTU when building non-linear legacy RQ fragments info
authorMaxim Mikityanskiy <maximmi@nvidia.com>
Mon, 14 Feb 2022 17:59:19 +0000 (19:59 +0200)
committerSaeed Mahameed <saeedm@nvidia.com>
Thu, 17 Mar 2022 18:51:54 +0000 (11:51 -0700)
commit7c3b4df594b6c51c1fc95e6fd9f949bdddff34b5
tree8d686e233ec76df85f8ca4113401b36a536b0fc6
parent1abea24af42c35c6eb537e4402836e2cde2a5b13
net/mlx5e: Validate MTU when building non-linear legacy RQ fragments info

mlx5e_build_rq_frags_info() assumes that MTU is not bigger than
PAGE_SIZE * MLX5E_MAX_RX_FRAGS, which is 16K for 4K pages. Currently,
the firmware limits MTU to 10K, so the assumption doesn't lead to a bug.

This commits adds an additional driver check for reliability, since the
firmware boundary might be changed.

The calculation is taken to a separate function with a comment
explaining it. It's a preparation for the following patches that
introcuce XDP multi buffer support.

Signed-off-by: Maxim Mikityanskiy <maximmi@nvidia.com>
Reviewed-by: Tariq Toukan <tariqt@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
drivers/net/ethernet/mellanox/mlx5/core/en/params.c