Commit e078e8df authored by Aya Levin's avatar Aya Levin Committed by Saeed Mahameed

net/mlx5e: Generalize close RQ

Allow different flavours of RQ to use the same close flow. Add validity
checks to support different RQ types which not necessarily initialize
all the RQ's functionality.
Signed-off-by: default avatarAya Levin <ayal@nvidia.com>
Reviewed-by: default avatarTariq Toukan <tariqt@nvidia.com>
Signed-off-by: default avatarSaeed Mahameed <saeedm@nvidia.com>
parent a8dd7ac1
...@@ -30,14 +30,6 @@ static int mlx5e_trap_napi_poll(struct napi_struct *napi, int budget) ...@@ -30,14 +30,6 @@ static int mlx5e_trap_napi_poll(struct napi_struct *napi, int budget)
return work_done; return work_done;
} }
static void mlx5e_free_trap_rq(struct mlx5e_rq *rq)
{
page_pool_destroy(rq->page_pool);
mlx5e_free_di_list(rq);
kvfree(rq->wqe.frags);
mlx5_wq_destroy(&rq->wq_ctrl);
}
static void mlx5e_init_trap_rq(struct mlx5e_trap *t, struct mlx5e_params *params, static void mlx5e_init_trap_rq(struct mlx5e_trap *t, struct mlx5e_params *params,
struct mlx5e_rq *rq) struct mlx5e_rq *rq)
{ {
...@@ -93,9 +85,7 @@ static int mlx5e_open_trap_rq(struct mlx5e_priv *priv, struct mlx5e_trap *t) ...@@ -93,9 +85,7 @@ static int mlx5e_open_trap_rq(struct mlx5e_priv *priv, struct mlx5e_trap *t)
static void mlx5e_close_trap_rq(struct mlx5e_rq *rq) static void mlx5e_close_trap_rq(struct mlx5e_rq *rq)
{ {
mlx5e_destroy_rq(rq); mlx5e_close_rq(rq);
mlx5e_free_rx_descs(rq);
mlx5e_free_trap_rq(rq);
mlx5e_close_cq(&rq->cq); mlx5e_close_cq(&rq->cq);
} }
......
...@@ -592,10 +592,12 @@ static void mlx5e_free_rq(struct mlx5e_rq *rq) ...@@ -592,10 +592,12 @@ static void mlx5e_free_rq(struct mlx5e_rq *rq)
struct bpf_prog *old_prog; struct bpf_prog *old_prog;
int i; int i;
old_prog = rcu_dereference_protected(rq->xdp_prog, if (xdp_rxq_info_is_reg(&rq->xdp_rxq)) {
lockdep_is_held(&rq->priv->state_lock)); old_prog = rcu_dereference_protected(rq->xdp_prog,
if (old_prog) lockdep_is_held(&rq->priv->state_lock));
bpf_prog_put(old_prog); if (old_prog)
bpf_prog_put(old_prog);
}
switch (rq->wq_type) { switch (rq->wq_type) {
case MLX5_WQ_TYPE_LINKED_LIST_STRIDING_RQ: case MLX5_WQ_TYPE_LINKED_LIST_STRIDING_RQ:
...@@ -901,7 +903,8 @@ void mlx5e_deactivate_rq(struct mlx5e_rq *rq) ...@@ -901,7 +903,8 @@ void mlx5e_deactivate_rq(struct mlx5e_rq *rq)
void mlx5e_close_rq(struct mlx5e_rq *rq) void mlx5e_close_rq(struct mlx5e_rq *rq)
{ {
cancel_work_sync(&rq->dim.work); cancel_work_sync(&rq->dim.work);
cancel_work_sync(&rq->icosq->recover_work); if (rq->icosq)
cancel_work_sync(&rq->icosq->recover_work);
cancel_work_sync(&rq->recover_work); cancel_work_sync(&rq->recover_work);
mlx5e_destroy_rq(rq); mlx5e_destroy_rq(rq);
mlx5e_free_rx_descs(rq); mlx5e_free_rx_descs(rq);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment