From: Joe Damato <jdamato@fastly.com>
To: netdev@vger.kernel.org
Cc: Joe Damato <jdamato@fastly.com>,
Saeed Mahameed <saeedm@nvidia.com>,
Leon Romanovsky <leon@kernel.org>,
Tariq Toukan <tariqt@nvidia.com>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
linux-rdma@vger.kernel.org (open list:MELLANOX MLX5 core VPI
driver), linux-kernel@vger.kernel.org (open list)
Subject: [RFC net-next 2/6] mlx5: Use napi_affinity_no_change
Date: Mon, 12 Aug 2024 14:56:23 +0000 [thread overview]
Message-ID: <20240812145633.52911-3-jdamato@fastly.com> (raw)
In-Reply-To: <20240812145633.52911-1-jdamato@fastly.com>
Use napi_affinity_no_change instead of mlx5's internal implementation,
simplifying and centralizing the logic.
Signed-off-by: Joe Damato <jdamato@fastly.com>
---
drivers/net/ethernet/mellanox/mlx5/core/en.h | 2 +-
drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 2 +-
drivers/net/ethernet/mellanox/mlx5/core/en_txrx.c | 9 +--------
3 files changed, 3 insertions(+), 10 deletions(-)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en.h b/drivers/net/ethernet/mellanox/mlx5/core/en.h
index 7832f6b6c8a8..c288e3f45a06 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en.h
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en.h
@@ -767,7 +767,7 @@ struct mlx5e_channel {
spinlock_t async_icosq_lock;
/* data path - accessed per napi poll */
- const struct cpumask *aff_mask;
+ unsigned int irq;
struct mlx5e_ch_stats *stats;
/* control */
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
index 6f686fabed44..7b217aafbdfd 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
@@ -2684,8 +2684,8 @@ static int mlx5e_open_channel(struct mlx5e_priv *priv, int ix,
c->mkey_be = cpu_to_be32(mdev->mlx5e_res.hw_objs.mkey);
c->num_tc = mlx5e_get_dcb_num_tc(params);
c->xdp = !!params->xdp_prog;
+ c->irq = irq;
c->stats = &priv->channel_stats[ix]->ch;
- c->aff_mask = irq_get_effective_affinity_mask(irq);
c->lag_port = mlx5e_enumerate_lag_port(mdev, ix);
netif_napi_add(netdev, &c->napi, mlx5e_napi_poll);
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_txrx.c b/drivers/net/ethernet/mellanox/mlx5/core/en_txrx.c
index 5873fde65c2e..ee453d019c3b 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_txrx.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_txrx.c
@@ -39,13 +39,6 @@
#include "en/xsk/tx.h"
#include "en_accel/ktls_txrx.h"
-static inline bool mlx5e_channel_no_affinity_change(struct mlx5e_channel *c)
-{
- int current_cpu = smp_processor_id();
-
- return cpumask_test_cpu(current_cpu, c->aff_mask);
-}
-
static void mlx5e_handle_tx_dim(struct mlx5e_txqsq *sq)
{
struct mlx5e_sq_stats *stats = sq->stats;
@@ -201,7 +194,7 @@ int mlx5e_napi_poll(struct napi_struct *napi, int budget)
busy |= busy_xsk;
if (busy) {
- if (likely(mlx5e_channel_no_affinity_change(c))) {
+ if (likely(napi_affinity_no_change(c->irq))) {
work_done = budget;
goto out;
}
--
2.25.1
next prev parent reply other threads:[~2024-08-12 14:57 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-12 14:56 [RFC net-next 0/6] Cleanup IRQ affinity checks in several drivers Joe Damato
2024-08-12 14:56 ` Joe Damato [this message]
2024-08-12 14:56 ` [RFC net-next 6/6] mlx4: Use napi_affinity_no_change Joe Damato
2024-08-14 0:17 ` [RFC net-next 0/6] Cleanup IRQ affinity checks in several drivers Jakub Kicinski
2024-08-14 7:14 ` Joe Damato
2024-08-14 12:12 ` Joe Damato
2024-08-14 15:09 ` Jakub Kicinski
2024-08-14 15:19 ` Joe Damato
2024-08-14 16:03 ` Shay Drori
2024-08-14 18:01 ` Joe Damato
2024-08-15 0:20 ` Jakub Kicinski
2024-08-15 10:22 ` Joe Damato
2024-08-20 6:40 ` Shay Drori
2024-08-20 8:33 ` Joe Damato
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=20240812145633.52911-3-jdamato@fastly.com \
--to=jdamato@fastly.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=leon@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--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