netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: saeed@kernel.org
To: Jakub Kicinski <kuba@kernel.org>
Cc: "David S. Miller" <davem@davemloft.net>,
	netdev@vger.kernel.org, Tariq Toukan <tariqt@nvidia.com>,
	Aya Levin <ayal@nvidia.com>,
	Maxim Mikityanskiy <maximmi@mellanox.com>,
	Saeed Mahameed <saeedm@nvidia.com>
Subject: [net-next V3 01/15] net/mlx5e: Free drop RQ in a dedicated function
Date: Tue,  8 Dec 2020 11:35:41 -0800	[thread overview]
Message-ID: <20201208193555.674504-2-saeed@kernel.org> (raw)
In-Reply-To: <20201208193555.674504-1-saeed@kernel.org>

From: Tariq Toukan <tariqt@nvidia.com>

The drop RQ has very limited objects to be freed, and differs
from regular RQs in the context that it is freed from.
Add a dedicated function for it, use it where needed, and remove
the drop_rq-specific checks in the generic function.

Signed-off-by: Tariq Toukan <tariqt@nvidia.com>
Reviewed-by: Aya Levin <ayal@nvidia.com>
Reviewed-by: Maxim Mikityanskiy <maximmi@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
---
 .../net/ethernet/mellanox/mlx5/core/en_main.c  | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
index 330201dfe9a4..e88730606da3 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
@@ -613,14 +613,11 @@ static int mlx5e_alloc_rq(struct mlx5e_channel *c,
 
 static void mlx5e_free_rq(struct mlx5e_rq *rq)
 {
-	struct mlx5e_channel *c = rq->channel;
-	struct bpf_prog *old_prog = NULL;
+	struct bpf_prog *old_prog;
 	int i;
 
-	/* drop_rq has neither channel nor xdp_prog. */
-	if (c)
-		old_prog = rcu_dereference_protected(rq->xdp_prog,
-						     lockdep_is_held(&c->priv->state_lock));
+	old_prog = rcu_dereference_protected(rq->xdp_prog,
+					     lockdep_is_held(&rq->channel->priv->state_lock));
 	if (old_prog)
 		bpf_prog_put(old_prog);
 
@@ -3196,6 +3193,11 @@ int mlx5e_close(struct net_device *netdev)
 	return err;
 }
 
+static void mlx5e_free_drop_rq(struct mlx5e_rq *rq)
+{
+	mlx5_wq_destroy(&rq->wq_ctrl);
+}
+
 static int mlx5e_alloc_drop_rq(struct mlx5_core_dev *mdev,
 			       struct mlx5e_rq *rq,
 			       struct mlx5e_rq_param *param)
@@ -3263,7 +3265,7 @@ int mlx5e_open_drop_rq(struct mlx5e_priv *priv,
 	return 0;
 
 err_free_rq:
-	mlx5e_free_rq(drop_rq);
+	mlx5e_free_drop_rq(drop_rq);
 
 err_destroy_cq:
 	mlx5e_destroy_cq(cq);
@@ -3277,7 +3279,7 @@ int mlx5e_open_drop_rq(struct mlx5e_priv *priv,
 void mlx5e_close_drop_rq(struct mlx5e_rq *drop_rq)
 {
 	mlx5e_destroy_rq(drop_rq);
-	mlx5e_free_rq(drop_rq);
+	mlx5e_free_drop_rq(drop_rq);
 	mlx5e_destroy_cq(&drop_rq->cq);
 	mlx5e_free_cq(&drop_rq->cq);
 }
-- 
2.26.2


  reply	other threads:[~2020-12-08 20:21 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-08 19:35 [pull request][net-next V3 00/15] mlx5 updates 2020-12-01 saeed
2020-12-08 19:35 ` saeed [this message]
2020-12-08 19:35 ` [net-next V3 02/15] net/mlx5e: Allow CQ outside of channel context saeed
2020-12-08 19:35 ` [net-next V3 03/15] net/mlx5e: Allow RQ " saeed
2020-12-08 19:35 ` [net-next V3 04/15] net/mlx5e: Allow SQ " saeed
2020-12-08 19:35 ` [net-next V3 05/15] net/mlx5e: Change skb fifo push/pop API to be used without SQ saeed
2020-12-08 19:35 ` [net-next V3 06/15] net/mlx5e: Split SW group counters update function saeed
2020-12-08 19:35 ` [net-next V3 07/15] net/mlx5e: Move MLX5E_RX_ERR_CQE macro saeed
2020-12-08 19:35 ` [net-next V3 08/15] net/mlx5e: Add TX PTP port object support saeed
2020-12-08 19:35 ` [net-next V3 09/15] net/mlx5e: Add TX port timestamp support saeed
2020-12-08 19:35 ` [net-next V3 10/15] net/mlx5e: remove unnecessary memset saeed
2020-12-08 19:35 ` [net-next V3 11/15] net/mlx5e: Remove duplicated include saeed
2020-12-08 19:35 ` [net-next V3 12/15] net/mlx5: Arm only EQs with EQEs saeed
2020-12-08 19:35 ` [net-next V3 13/15] net/mlx5: Fix passing zero to 'PTR_ERR' saeed
2020-12-08 19:35 ` [net-next V3 14/15] net/mlx5e: Split between RX/TX tunnel FW support indication saeed
2020-12-08 19:35 ` [net-next V3 15/15] net/mlx5e: Fill mlx5e_create_cq_param in a function saeed
2020-12-08 23:40 ` [pull request][net-next V3 00/15] mlx5 updates 2020-12-01 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=20201208193555.674504-2-saeed@kernel.org \
    --to=saeed@kernel.org \
    --cc=ayal@nvidia.com \
    --cc=davem@davemloft.net \
    --cc=kuba@kernel.org \
    --cc=maximmi@mellanox.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).