From: Vikas Gupta <vikas.gupta@broadcom.com>
To: davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
pabeni@redhat.com, andrew+netdev@lunn.ch, horms@kernel.org
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
bhargava.marreddy@broadcom.com, rahul-rg.gupta@broadcom.com,
vsrama-krishna.nemani@broadcom.com,
rajashekar.hudumula@broadcom.com, dharmender.garg@broadcom.com,
ajit.khaparde@broadcom.com,
Vikas Gupta <vikas.gupta@broadcom.com>
Subject: [PATCH net-next 11/11] bnge: add cpu_rmap support for IRQ affinity
Date: Fri, 14 Aug 2026 06:44:35 +0530 [thread overview]
Message-ID: <20260814011435.194631-12-vikas.gupta@broadcom.com> (raw)
In-Reply-To: <20260814011435.194631-1-vikas.gupta@broadcom.com>
When CONFIG_RFS_ACCEL is enabled, allocate and populate a cpu_rmap
for the RX IRQ vectors so that the kernel's aRFS infrastructure can
correctly map flows to the RX queues serviced by the nearest CPU.
This ensures that NTUPLE rules created by the kernel steer packets
to the optimal queue based on CPU/IRQ affinity.
Signed-off-by: Vikas Gupta <vikas.gupta@broadcom.com>
Reviewed-by: Bhargava Chenna Marreddy <bhargava.marreddy@broadcom.com>
Reviewed-by: Dharmender Garg <dharmender.garg@broadcom.com>
---
.../net/ethernet/broadcom/bnge/bnge_netdev.c | 35 ++++++++++++++++++-
1 file changed, 34 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/broadcom/bnge/bnge_netdev.c b/drivers/net/ethernet/broadcom/bnge/bnge_netdev.c
index fc752fe879b6..48de88924a7f 100644
--- a/drivers/net/ethernet/broadcom/bnge/bnge_netdev.c
+++ b/drivers/net/ethernet/broadcom/bnge/bnge_netdev.c
@@ -18,6 +18,7 @@
#include <net/ip.h>
#include <linux/skbuff.h>
#include <net/page_pool/helpers.h>
+#include <linux/cpu_rmap.h>
#include "bnge.h"
#include "bnge_hwrm.h"
@@ -2432,10 +2433,23 @@ static int bnge_setup_interrupts(struct bnge_net *bn)
{
struct net_device *dev = bn->netdev;
struct bnge_dev *bd = bn->bd;
+ int rc;
bnge_setup_msix(bn);
- return netif_set_real_num_queues(dev, bd->tx_nr_rings, bd->rx_nr_rings);
+ rc = netif_set_real_num_queues(dev, bd->tx_nr_rings, bd->rx_nr_rings);
+ if (rc)
+ return rc;
+
+#ifdef CONFIG_RFS_ACCEL
+ if (bn->priv_flags & BNGE_NET_EN_NTUPLE) {
+ dev->rx_cpu_rmap = alloc_irq_cpu_rmap(bd->rx_nr_rings);
+ if (!dev->rx_cpu_rmap)
+ return -ENOMEM;
+ }
+#endif
+
+ return rc;
}
static void bnge_hwrm_resource_free(struct bnge_net *bn, bool close_path)
@@ -2451,6 +2465,11 @@ static void bnge_free_irq(struct bnge_net *bn)
struct bnge_irq *irq;
int i;
+#ifdef CONFIG_RFS_ACCEL
+ free_irq_cpu_rmap(bn->netdev->rx_cpu_rmap);
+ bn->netdev->rx_cpu_rmap = NULL;
+#endif
+
for (i = 0; i < bd->nq_nr_rings; i++) {
int map_idx = bnge_cp_num_to_irq_num(bn, i);
@@ -2470,6 +2489,7 @@ static void bnge_free_irq(struct bnge_net *bn)
static int bnge_request_irq(struct bnge_net *bn)
{
+ struct cpu_rmap *rmap = NULL;
struct bnge_dev *bd = bn->bd;
int i, rc;
@@ -2478,10 +2498,23 @@ static int bnge_request_irq(struct bnge_net *bn)
netdev_err(bn->netdev, "bnge_setup_interrupts err: %d\n", rc);
return rc;
}
+
+#ifdef CONFIG_RFS_ACCEL
+ rmap = bn->netdev->rx_cpu_rmap;
+#endif
+
for (i = 0; i < bd->nq_nr_rings; i++) {
int map_idx = bnge_cp_num_to_irq_num(bn, i);
struct bnge_irq *irq = &bd->irq_tbl[map_idx];
+ if (IS_ENABLED(CONFIG_RFS_ACCEL) &&
+ rmap && bn->bnapi[i]->rx_ring) {
+ rc = irq_cpu_rmap_add(rmap, irq->vector);
+ if (rc)
+ netdev_warn(bn->netdev,
+ "failed adding irq rmap for ring %d\n", i);
+ }
+
rc = request_irq(irq->vector, irq->handler, 0, irq->name,
bn->bnapi[i]);
if (rc)
--
2.47.1
next prev parent reply other threads:[~2026-08-14 1:15 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-14 1:14 [PATCH net-next 00/11] add features to bnge Vikas Gupta
2026-08-14 1:14 ` [PATCH net-next 01/11] bnge: update HSI Vikas Gupta
2026-08-14 1:14 ` [PATCH net-next 02/11] bnge: restructure VNIC and filter code Vikas Gupta
2026-08-14 1:14 ` [PATCH net-next 03/11] bnge: add NTUPLE/ARFS VNIC Vikas Gupta
2026-08-14 1:14 ` [PATCH net-next 04/11] bnge: add helper functions for multi RSS contexts Vikas Gupta
2026-08-14 1:14 ` [PATCH net-next 05/11] bnge: add RXFH ethtool support Vikas Gupta
2026-08-14 1:14 ` [PATCH net-next 06/11] bnge: add ethtool support to manage RSS contexts Vikas Gupta
2026-08-14 1:14 ` [PATCH net-next 07/11] bnge: remove refcount from L2 filter Vikas Gupta
2026-08-14 1:14 ` [PATCH net-next 08/11] bnge: add NTUPLE filter infrastructure Vikas Gupta
2026-08-17 23:35 ` Jakub Kicinski
2026-08-14 1:14 ` [PATCH net-next 09/11] bnge: add NTUPLE filter support in ethtool Vikas Gupta
2026-08-14 1:14 ` [PATCH net-next 10/11] bnge: add aRFS flow steering ndo support Vikas Gupta
2026-08-17 23:36 ` Jakub Kicinski
2026-08-14 1:14 ` Vikas Gupta [this message]
2026-08-17 23:38 ` [PATCH net-next 00/11] add features to bnge Jakub Kicinski
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=20260814011435.194631-12-vikas.gupta@broadcom.com \
--to=vikas.gupta@broadcom.com \
--cc=ajit.khaparde@broadcom.com \
--cc=andrew+netdev@lunn.ch \
--cc=bhargava.marreddy@broadcom.com \
--cc=davem@davemloft.net \
--cc=dharmender.garg@broadcom.com \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=rahul-rg.gupta@broadcom.com \
--cc=rajashekar.hudumula@broadcom.com \
--cc=vsrama-krishna.nemani@broadcom.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.