]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
net/mlx5e: RX, Verify MPWQE stride size is in range
authorMoshe Shemesh <moshe@mellanox.com>
Fri, 2 Nov 2018 04:10:49 +0000 (06:10 +0200)
committerSaeed Mahameed <saeedm@mellanox.com>
Thu, 13 Dec 2018 09:24:44 +0000 (01:24 -0800)
Add check of MPWQE stride size is within range supported by HW. In case
calculated MPWQE stride size exceed range, linear SKB can't be used and
we should use non linear MPWQE instead.

Fixes: 619a8f2a42f1 ("net/mlx5e: Use linear SKB in Striding RQ")
Signed-off-by: Moshe Shemesh <moshe@mellanox.com>
Reviewed-by: Tariq Toukan <tariqt@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
drivers/net/ethernet/mellanox/mlx5/core/en_main.c

index 871313d6b34d1b315e6ef1a9c07cba396de14186..c17de6a990ffc38a765261bd0cb4ef59b16492b7 100644 (file)
@@ -128,6 +128,8 @@ static bool mlx5e_rx_is_linear_skb(struct mlx5_core_dev *mdev,
        return !params->lro_en && frag_sz <= PAGE_SIZE;
 }
 
+#define MLX5_MAX_MPWQE_LOG_WQE_STRIDE_SZ ((BIT(__mlx5_bit_sz(wq, log_wqe_stride_size)) - 1) + \
+                                         MLX5_MPWQE_LOG_STRIDE_SZ_BASE)
 static bool mlx5e_rx_mpwqe_is_linear_skb(struct mlx5_core_dev *mdev,
                                         struct mlx5e_params *params)
 {
@@ -138,6 +140,9 @@ static bool mlx5e_rx_mpwqe_is_linear_skb(struct mlx5_core_dev *mdev,
        if (!mlx5e_rx_is_linear_skb(mdev, params))
                return false;
 
+       if (order_base_2(frag_sz) > MLX5_MAX_MPWQE_LOG_WQE_STRIDE_SZ)
+               return false;
+
        if (MLX5_CAP_GEN(mdev, ext_stride_num_range))
                return true;