net/mlx5e: Fix ICOSQ recovery flow for XSK
authorMaxim Mikityanskiy <maximmi@mellanox.com>
Wed, 22 Jul 2020 13:32:44 +0000 (16:32 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 5 Jan 2022 11:40:30 +0000 (12:40 +0100)
[ Upstream commit 19c4aba2d4e23997061fb11aed8a3e41334bfa14 ]

There are two ICOSQs per channel: one is needed for RX, and the other
for async operations (XSK TX, kTLS offload). Currently, the recovery
flow for both is the same, and async ICOSQ is mistakenly treated like
the regular ICOSQ.

This patch prevents running the regular ICOSQ recovery on async ICOSQ.
The purpose of async ICOSQ is to handle XSK wakeup requests and post
kTLS offload RX parameters, it has nothing to do with RQ and XSKRQ UMRs,
so the regular recovery sequence is not applicable here.

Fixes: be5323c8379f ("net/mlx5e: Report and recover from CQE error on ICOSQ")
Signed-off-by: Maxim Mikityanskiy <maximmi@mellanox.com>
Reviewed-by: Aya Levin <ayal@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/ethernet/mellanox/mlx5/core/en.h
drivers/net/ethernet/mellanox/mlx5/core/en_main.c

index 9da34f82d466815d2b4a52197970a9d130dca9f7..73060b30fece312f011543dc615bffe70ce075f9 100644 (file)
@@ -916,9 +916,6 @@ void mlx5e_deactivate_rq(struct mlx5e_rq *rq);
 void mlx5e_close_rq(struct mlx5e_rq *rq);
 
 struct mlx5e_sq_param;
-int mlx5e_open_icosq(struct mlx5e_channel *c, struct mlx5e_params *params,
-                    struct mlx5e_sq_param *param, struct mlx5e_icosq *sq);
-void mlx5e_close_icosq(struct mlx5e_icosq *sq);
 int mlx5e_open_xdpsq(struct mlx5e_channel *c, struct mlx5e_params *params,
                     struct mlx5e_sq_param *param, struct xsk_buff_pool *xsk_pool,
                     struct mlx5e_xdpsq *sq, bool is_redirect);
index 6ec4b96497ffb7b2a79b77794819397e2ff0bf05..3f5a2bb9b3c0bbe829b3eed83213d642a69295b6 100644 (file)
@@ -1051,9 +1051,20 @@ static void mlx5e_icosq_err_cqe_work(struct work_struct *recover_work)
        mlx5e_reporter_icosq_cqe_err(sq);
 }
 
+static void mlx5e_async_icosq_err_cqe_work(struct work_struct *recover_work)
+{
+       struct mlx5e_icosq *sq = container_of(recover_work, struct mlx5e_icosq,
+                                             recover_work);
+
+       /* Not implemented yet. */
+
+       netdev_warn(sq->channel->netdev, "async_icosq recovery is not implemented\n");
+}
+
 static int mlx5e_alloc_icosq(struct mlx5e_channel *c,
                             struct mlx5e_sq_param *param,
-                            struct mlx5e_icosq *sq)
+                            struct mlx5e_icosq *sq,
+                            work_func_t recover_work_func)
 {
        void *sqc_wq               = MLX5_ADDR_OF(sqc, param->sqc, wq);
        struct mlx5_core_dev *mdev = c->mdev;
@@ -1073,7 +1084,7 @@ static int mlx5e_alloc_icosq(struct mlx5e_channel *c,
        if (err)
                goto err_sq_wq_destroy;
 
-       INIT_WORK(&sq->recover_work, mlx5e_icosq_err_cqe_work);
+       INIT_WORK(&sq->recover_work, recover_work_func);
 
        return 0;
 
@@ -1423,13 +1434,14 @@ static void mlx5e_tx_err_cqe_work(struct work_struct *recover_work)
        mlx5e_reporter_tx_err_cqe(sq);
 }
 
-int mlx5e_open_icosq(struct mlx5e_channel *c, struct mlx5e_params *params,
-                    struct mlx5e_sq_param *param, struct mlx5e_icosq *sq)
+static int mlx5e_open_icosq(struct mlx5e_channel *c, struct mlx5e_params *params,
+                           struct mlx5e_sq_param *param, struct mlx5e_icosq *sq,
+                           work_func_t recover_work_func)
 {
        struct mlx5e_create_sq_param csp = {};
        int err;
 
-       err = mlx5e_alloc_icosq(c, param, sq);
+       err = mlx5e_alloc_icosq(c, param, sq, recover_work_func);
        if (err)
                return err;
 
@@ -1459,7 +1471,7 @@ void mlx5e_deactivate_icosq(struct mlx5e_icosq *icosq)
        synchronize_net(); /* Sync with NAPI. */
 }
 
-void mlx5e_close_icosq(struct mlx5e_icosq *sq)
+static void mlx5e_close_icosq(struct mlx5e_icosq *sq)
 {
        struct mlx5e_channel *c = sq->channel;
 
@@ -1862,11 +1874,13 @@ static int mlx5e_open_queues(struct mlx5e_channel *c,
 
        spin_lock_init(&c->async_icosq_lock);
 
-       err = mlx5e_open_icosq(c, params, &cparam->async_icosq, &c->async_icosq);
+       err = mlx5e_open_icosq(c, params, &cparam->async_icosq, &c->async_icosq,
+                              mlx5e_async_icosq_err_cqe_work);
        if (err)
                goto err_disable_napi;
 
-       err = mlx5e_open_icosq(c, params, &cparam->icosq, &c->icosq);
+       err = mlx5e_open_icosq(c, params, &cparam->icosq, &c->icosq,
+                              mlx5e_icosq_err_cqe_work);
        if (err)
                goto err_close_async_icosq;