From: Saeed Mahameed <saeed@kernel.org>
To: "David S. Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>
Cc: netdev@vger.kernel.org, Aya Levin <ayal@nvidia.com>,
Tariq Toukan <tariqt@nvidia.com>,
Saeed Mahameed <saeedm@nvidia.com>
Subject: [net-next 11/15] net/mlx5e: Generalize close RQ
Date: Wed, 24 Mar 2021 22:04:34 -0700 [thread overview]
Message-ID: <20210325050438.261511-12-saeed@kernel.org> (raw)
In-Reply-To: <20210325050438.261511-1-saeed@kernel.org>
From: Aya Levin <ayal@nvidia.com>
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: Aya Levin <ayal@nvidia.com>
Reviewed-by: Tariq Toukan <tariqt@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
---
drivers/net/ethernet/mellanox/mlx5/core/en/trap.c | 12 +-----------
drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 13 ++++++++-----
2 files changed, 9 insertions(+), 16 deletions(-)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/trap.c b/drivers/net/ethernet/mellanox/mlx5/core/en/trap.c
index d6e6641e9288..86ab4e864fe6 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en/trap.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en/trap.c
@@ -30,14 +30,6 @@ static int mlx5e_trap_napi_poll(struct napi_struct *napi, int budget)
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,
struct mlx5e_rq *rq)
{
@@ -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)
{
- mlx5e_destroy_rq(rq);
- mlx5e_free_rx_descs(rq);
- mlx5e_free_trap_rq(rq);
+ mlx5e_close_rq(rq);
mlx5e_close_cq(&rq->cq);
}
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
index b25e1501e236..eda30bc80a51 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
@@ -592,10 +592,12 @@ static void mlx5e_free_rq(struct mlx5e_rq *rq)
struct bpf_prog *old_prog;
int i;
- old_prog = rcu_dereference_protected(rq->xdp_prog,
- lockdep_is_held(&rq->priv->state_lock));
- if (old_prog)
- bpf_prog_put(old_prog);
+ if (xdp_rxq_info_is_reg(&rq->xdp_rxq)) {
+ old_prog = rcu_dereference_protected(rq->xdp_prog,
+ lockdep_is_held(&rq->priv->state_lock));
+ if (old_prog)
+ bpf_prog_put(old_prog);
+ }
switch (rq->wq_type) {
case MLX5_WQ_TYPE_LINKED_LIST_STRIDING_RQ:
@@ -901,7 +903,8 @@ void mlx5e_deactivate_rq(struct mlx5e_rq *rq)
void mlx5e_close_rq(struct mlx5e_rq *rq)
{
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);
mlx5e_destroy_rq(rq);
mlx5e_free_rx_descs(rq);
--
2.30.2
next prev parent reply other threads:[~2021-03-25 5:05 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-25 5:04 [pull request][net-next 00/15] mlx5 updates 2021-03-24 Saeed Mahameed
2021-03-25 5:04 ` [net-next 01/15] net/mlx5e: Enforce minimum value check for ICOSQ size Saeed Mahameed
2021-03-25 5:04 ` [net-next 02/15] net/mlx5: DR, Fix potential shift wrapping of 32-bit value in STEv1 getter Saeed Mahameed
2021-03-25 5:04 ` [net-next 03/15] net/mlx5e: alloc the correct size for indirection_rqt Saeed Mahameed
2021-03-25 5:04 ` [net-next 04/15] net/mlx5e: Pass q_counter indentifier as parameter to rq_param builders Saeed Mahameed
2021-03-25 5:04 ` [net-next 05/15] net/mlx5e: Move params logic into its dedicated file Saeed Mahameed
2021-03-25 23:44 ` David Miller
2021-03-25 5:04 ` [net-next 06/15] net/mlx5e: Restrict usage of mlx5e_priv in params logic functions Saeed Mahameed
2021-03-25 5:04 ` [net-next 07/15] net/mlx5e: Allow creating mpwqe info without channel Saeed Mahameed
2021-03-25 5:04 ` [net-next 08/15] net/mlx5: Add helper to set time-stamp translator on a queue Saeed Mahameed
2021-03-25 5:04 ` [net-next 09/15] net/mlx5e: Generalize open RQ Saeed Mahameed
2021-03-25 5:04 ` [net-next 10/15] net/mlx5e: Generalize RQ activation Saeed Mahameed
2021-03-25 5:04 ` Saeed Mahameed [this message]
2021-03-25 5:04 ` [net-next 12/15] net/mlx5e: Generalize direct-TIRs and direct-RQTs API Saeed Mahameed
2021-03-25 5:04 ` [net-next 13/15] net/mlx5e: Generalize PTP implementation Saeed Mahameed
2021-03-25 5:04 ` [net-next 14/15] net/mlx5e: Cleanup PTP Saeed Mahameed
2021-03-25 5:04 ` [net-next 15/15] net/mlx5: Fix spelling mistakes in mlx5_core_info message Saeed Mahameed
2021-03-25 23:43 ` [pull request][net-next 00/15] mlx5 updates 2021-03-24 David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210325050438.261511-12-saeed@kernel.org \
--to=saeed@kernel.org \
--cc=ayal@nvidia.com \
--cc=davem@davemloft.net \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=saeedm@nvidia.com \
--cc=tariqt@nvidia.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.