Skip to content

Commit a5535e5

Browse files
arndbkuba-moo
authored andcommitted
mlx5: stop warning for 64KB pages
When building with 64KB pages, clang points out that xsk->chunk_size can never be PAGE_SIZE: drivers/net/ethernet/mellanox/mlx5/core/en/xsk/setup.c:19:22: error: result of comparison of constant 65536 with expression of type 'u16' (aka 'unsigned short') is always false [-Werror,-Wtautological-constant-out-of-range-compare] if (xsk->chunk_size > PAGE_SIZE || ~~~~~~~~~~~~~~~ ^ ~~~~~~~~~ In older versions of this code, using PAGE_SIZE was the only possibility, so this would have never worked on 64KB page kernels, but the patch apparently did not address this case completely. As Maxim Mikityanskiy suggested, 64KB chunks are really not all that useful, so just shut up the warning by adding a cast. Fixes: 282c0c7 ("net/mlx5e: Allow XSK frames smaller than a page") Link: https://lore.kernel.org/netdev/[email protected]/ Link: https://lore.kernel.org/lkml/[email protected]/ Signed-off-by: Arnd Bergmann <[email protected]> Acked-by: Maxim Mikityanskiy <[email protected]> Reviewed-by: Justin Stitt <[email protected]> Reviewed-by: Tariq Toukan <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 06c2a5c commit a5535e5

File tree

1 file changed

+4
-2
lines changed
  • drivers/net/ethernet/mellanox/mlx5/core/en/xsk

1 file changed

+4
-2
lines changed

drivers/net/ethernet/mellanox/mlx5/core/en/xsk/setup.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,10 @@ bool mlx5e_validate_xsk_param(struct mlx5e_params *params,
2828
struct mlx5e_xsk_param *xsk,
2929
struct mlx5_core_dev *mdev)
3030
{
31-
/* AF_XDP doesn't support frames larger than PAGE_SIZE. */
32-
if (xsk->chunk_size > PAGE_SIZE || xsk->chunk_size < MLX5E_MIN_XSK_CHUNK_SIZE) {
31+
/* AF_XDP doesn't support frames larger than PAGE_SIZE,
32+
* and xsk->chunk_size is limited to 65535 bytes.
33+
*/
34+
if ((size_t)xsk->chunk_size > PAGE_SIZE || xsk->chunk_size < MLX5E_MIN_XSK_CHUNK_SIZE) {
3335
mlx5_core_err(mdev, "XSK chunk size %u out of bounds [%u, %lu]\n", xsk->chunk_size,
3436
MLX5E_MIN_XSK_CHUNK_SIZE, PAGE_SIZE);
3537
return false;

0 commit comments

Comments
 (0)