Skip to content

Commit cc18129

Browse files
Binary-Eaterkuba-moo
authored andcommitted
net/mlx5e: Match cleanup order in mlx5e_free_rq in reverse of mlx5e_alloc_rq
mlx5e_free_rq previously cleaned resources in an order that was not the reverse of the resource allocation order in mlx5e_alloc_rq. Signed-off-by: Rahul Rameshbabu <[email protected]> Signed-off-by: Tariq Toukan <[email protected]> Signed-off-by: Saeed Mahameed <[email protected]> Reviewed-by: Jacob Keller <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 909fc8d commit cc18129

File tree

1 file changed

+13
-12
lines changed
  • drivers/net/ethernet/mellanox/mlx5/core

1 file changed

+13
-12
lines changed

drivers/net/ethernet/mellanox/mlx5/core/en_main.c

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1016,30 +1016,31 @@ static int mlx5e_alloc_rq(struct mlx5e_params *params,
10161016

10171017
static void mlx5e_free_rq(struct mlx5e_rq *rq)
10181018
{
1019-
struct bpf_prog *old_prog;
1020-
1021-
if (xdp_rxq_info_is_reg(&rq->xdp_rxq)) {
1022-
old_prog = rcu_dereference_protected(rq->xdp_prog,
1023-
lockdep_is_held(&rq->priv->state_lock));
1024-
if (old_prog)
1025-
bpf_prog_put(old_prog);
1026-
}
1019+
kvfree(rq->dim);
1020+
page_pool_destroy(rq->page_pool);
10271021

10281022
switch (rq->wq_type) {
10291023
case MLX5_WQ_TYPE_LINKED_LIST_STRIDING_RQ:
1024+
mlx5e_rq_free_shampo(rq);
10301025
kvfree(rq->mpwqe.info);
10311026
mlx5_core_destroy_mkey(rq->mdev, be32_to_cpu(rq->mpwqe.umr_mkey_be));
10321027
mlx5e_free_mpwqe_rq_drop_page(rq);
1033-
mlx5e_rq_free_shampo(rq);
10341028
break;
10351029
default: /* MLX5_WQ_TYPE_CYCLIC */
10361030
mlx5e_free_wqe_alloc_info(rq);
10371031
}
10381032

1039-
kvfree(rq->dim);
1040-
xdp_rxq_info_unreg(&rq->xdp_rxq);
1041-
page_pool_destroy(rq->page_pool);
10421033
mlx5_wq_destroy(&rq->wq_ctrl);
1034+
1035+
if (xdp_rxq_info_is_reg(&rq->xdp_rxq)) {
1036+
struct bpf_prog *old_prog;
1037+
1038+
old_prog = rcu_dereference_protected(rq->xdp_prog,
1039+
lockdep_is_held(&rq->priv->state_lock));
1040+
if (old_prog)
1041+
bpf_prog_put(old_prog);
1042+
}
1043+
xdp_rxq_info_unreg(&rq->xdp_rxq);
10431044
}
10441045

10451046
int mlx5e_create_rq(struct mlx5e_rq *rq, struct mlx5e_rq_param *param, u16 q_counter)

0 commit comments

Comments
 (0)