From: Tariq Toukan <tariqt@nvidia.com>
To: Andrew Lunn <andrew+netdev@lunn.ch>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@kernel.org>,
Jakub Kicinski <kuba@kernel.org>, <netdev@vger.kernel.org>,
Paolo Abeni <pabeni@redhat.com>
Cc: "Alexei Starovoitov" <ast@kernel.org>,
bpf@vger.kernel.org, "Carolina Jubran" <cjubran@nvidia.com>,
"Cosmin Ratiu" <cratiu@nvidia.com>,
"Daniel Borkmann" <daniel@iogearbox.net>,
"Dragos Tatulea" <dtatulea@nvidia.com>,
"Gal Pressman" <gal@nvidia.com>,
"Jesper Dangaard Brouer" <hawk@kernel.org>,
"John Fastabend" <john.fastabend@gmail.com>,
"Kees Cook" <kees@kernel.org>,
"Leon Romanovsky" <leon@kernel.org>,
"open list" <linux-kernel@vger.kernel.org>,
linux-rdma@vger.kernel.org, "Li RongQing" <lirongqing@baidu.com>,
"Mark Bloch" <mbloch@nvidia.com>,
"Richard Cochran" <richardcochran@gmail.com>,
"Saeed Mahameed" <saeedm@nvidia.com>,
"Shahar Shitrit" <shshitrit@nvidia.com>,
"Stanislav Fomichev" <sdf@fomichev.me>,
"Tariq Toukan" <tariqt@nvidia.com>,
"Toke Høiland-Jørgensen" <toke@redhat.com>,
"Toke Høiland-Jørgensen" <toke@kernel.org>,
"Adrian Moreno" <amorenoz@redhat.com>,
"Michal Schmidt" <mschmidt@redhat.com>
Subject: [PATCH net-next 2/2] net/mlx5e: Batch ICOSQ trigger RCU synchronization
Date: Sun, 11 Oct 2026 16:32:12 +0300 [thread overview]
Message-ID: <20261011133212.807979-3-tariqt@nvidia.com> (raw)
In-Reply-To: <20261011133212.807979-1-tariqt@nvidia.com>
From: Carolina Jubran <cjubran@nvidia.com>
During channel activation, mlx5e_activate_channels() triggers the ICOSQ
once for every channel in order to kick NAPI. mlx5e_trigger_napi_icosq()
sets MLX5E_SQ_STATE_LOCK_NEEDED and waits for an RCU grace period before
serializing the trigger with ICOSQ users in NAPI context.
Mark all channel ICOSQs as requiring locking first, wait for a single
grace period, and then trigger all of them.
Keep mlx5e_trigger_napi_icosq() with its existing synchronization
semantics for standalone callers.
248 channels, rcu_normal=1, ip link set eth2 up:
Before: 3.095s
After: 1.794s (~1.7x faster)
Signed-off-by: Carolina Jubran <cjubran@nvidia.com>
Signed-off-by: Tariq Toukan <tariqt@nvidia.com>
---
.../net/ethernet/mellanox/mlx5/core/en_main.c | 28 +++++++++++++++----
1 file changed, 22 insertions(+), 6 deletions(-)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
index fe4e5d0b2e9a..58e4874b664f 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
@@ -2837,14 +2837,11 @@ static int mlx5e_channel_stats_alloc(struct mlx5e_priv *priv, int ix, int cpu)
return 0;
}
-void mlx5e_trigger_napi_icosq(struct mlx5e_channel *c)
+static void mlx5e_trigger_napi_icosq_post_sync(struct mlx5e_channel *c)
{
struct mlx5e_icosq *sq = &c->icosq;
bool locked;
- set_bit(MLX5E_SQ_STATE_LOCK_NEEDED, &sq->state);
- synchronize_net();
-
locked = mlx5e_icosq_sync_lock(sq);
mlx5e_trigger_irq(sq);
mlx5e_icosq_sync_unlock(sq, locked);
@@ -2852,6 +2849,13 @@ void mlx5e_trigger_napi_icosq(struct mlx5e_channel *c)
clear_bit(MLX5E_SQ_STATE_LOCK_NEEDED, &sq->state);
}
+void mlx5e_trigger_napi_icosq(struct mlx5e_channel *c)
+{
+ set_bit(MLX5E_SQ_STATE_LOCK_NEEDED, &c->icosq.state);
+ synchronize_net();
+ mlx5e_trigger_napi_icosq_post_sync(c);
+}
+
void mlx5e_trigger_napi_async_icosq(struct mlx5e_channel *c)
{
struct mlx5e_icosq *sq = c->async_icosq;
@@ -3099,6 +3103,19 @@ int mlx5e_open_channels(struct mlx5e_priv *priv,
return err;
}
+static void mlx5e_trigger_napi_icosqs(struct mlx5e_channels *chs)
+{
+ int i;
+
+ for (i = 0; i < chs->num; i++)
+ set_bit(MLX5E_SQ_STATE_LOCK_NEEDED, &chs->c[i]->icosq.state);
+
+ synchronize_net();
+
+ for (i = 0; i < chs->num; i++)
+ mlx5e_trigger_napi_icosq_post_sync(chs->c[i]);
+}
+
static void mlx5e_activate_channels(struct mlx5e_priv *priv, struct mlx5e_channels *chs)
{
int i;
@@ -3109,8 +3126,7 @@ static void mlx5e_activate_channels(struct mlx5e_priv *priv, struct mlx5e_channe
if (priv->htb)
mlx5e_qos_activate_queues(priv);
- for (i = 0; i < chs->num; i++)
- mlx5e_trigger_napi_icosq(chs->c[i]);
+ mlx5e_trigger_napi_icosqs(chs);
if (chs->ptp)
mlx5e_ptp_activate_channel(chs->ptp);
--
2.44.0
next prev parent reply other threads:[~2026-10-11 13:33 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-11 13:32 [PATCH net-next 0/2] net/mlx5e: Batch RCU grace periods on channel open and close Tariq Toukan
2026-10-11 13:32 ` [PATCH net-next 1/2] net/mlx5e: Batch NAPI RCU grace periods on channel close Tariq Toukan
2026-10-12 13:48 ` netdev-bot+sashiko
2026-10-11 13:32 ` Tariq Toukan [this message]
2026-10-12 10:40 ` [PATCH net-next 0/2] net/mlx5e: Batch RCU grace periods on channel open and close Toke Høiland-Jørgensen
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=20261011133212.807979-3-tariqt@nvidia.com \
--to=tariqt@nvidia.com \
--cc=amorenoz@redhat.com \
--cc=andrew+netdev@lunn.ch \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=cjubran@nvidia.com \
--cc=cratiu@nvidia.com \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=dtatulea@nvidia.com \
--cc=edumazet@kernel.org \
--cc=gal@nvidia.com \
--cc=hawk@kernel.org \
--cc=john.fastabend@gmail.com \
--cc=kees@kernel.org \
--cc=kuba@kernel.org \
--cc=leon@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=lirongqing@baidu.com \
--cc=mbloch@nvidia.com \
--cc=mschmidt@redhat.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=richardcochran@gmail.com \
--cc=saeedm@nvidia.com \
--cc=sdf@fomichev.me \
--cc=shshitrit@nvidia.com \
--cc=toke@kernel.org \
--cc=toke@redhat.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
all inboxes | Powered by JetHome®