From: Bhargava Marreddy <bhargava.marreddy@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,
michael.chan@broadcom.com, pavan.chebbi@broadcom.com,
vsrama-krishna.nemani@broadcom.com, vikas.gupta@broadcom.com,
Bhargava Marreddy <bhargava.marreddy@broadcom.com>,
Dharmender Garg <dharmender.garg@broadcom.com>,
Rajashekar Hudumula <rajashekar.hudumula@broadcom.com>,
Ramakrishna Koduri <ramakrishna.koduri@broadcom.com>
Subject: [PATCH net-next v3 4/5] bnge: make irq_tbl layout depend on BNGE_FIRST_OPEN_NQ
Date: Wed, 14 Oct 2026 01:36:44 +0530 [thread overview]
Message-ID: <20261013200645.1346299-5-bhargava.marreddy@broadcom.com> (raw)
In-Reply-To: <20261013200645.1346299-1-bhargava.marreddy@broadcom.com>
NQ0 will be created at probe, before the aux (RoCE) device has been
given its MSI-X vectors, and must keep its vector for the lifetime of
the driver. So the probe NQs must come first in irq_tbl, followed by the
aux vectors and then the open NQs, instead of putting all NQs after the
aux vectors.
Describe the irq_tbl layout once, next to BNGE_FIRST_OPEN_NQ, and add
bnge_nq_irq_idx() and bnge_aux_irq_idx() to compute the irq_tbl index of
an NQ and of an aux vector from it. bnge_fill_msix_vecs() uses the
latter to hand the aux device the vectors that follow the probe NQs.
The ring_idx passed to the aux device changes meaning accordingly: it is
the irq_tbl index of the vector, not an index within the aux range. This
matches how NQ rings are created, where the ring index is used as the
logical ID that ties the ring to its doorbell and MSI-X vector. The aux
driver uses the values it is given, so it needs no change. The total
number of vectors is unchanged.
BNGE_FIRST_OPEN_NQ is 0 for now, so the layout is unchanged. No
functional change.
Signed-off-by: Bhargava Marreddy <bhargava.marreddy@broadcom.com>
Reviewed-by: Dharmender Garg <dharmender.garg@broadcom.com>
Reviewed-by: Rajashekar Hudumula <rajashekar.hudumula@broadcom.com>
Reviewed-by: Ramakrishna Koduri <ramakrishna.koduri@broadcom.com>
---
drivers/net/ethernet/broadcom/bnge/bnge.h | 19 +++++++++++++++++++
.../net/ethernet/broadcom/bnge/bnge_auxr.c | 4 ++--
.../net/ethernet/broadcom/bnge/bnge_netdev.c | 2 +-
3 files changed, 22 insertions(+), 3 deletions(-)
diff --git a/drivers/net/ethernet/broadcom/bnge/bnge.h b/drivers/net/ethernet/broadcom/bnge/bnge.h
index fdd8bca01440..13452caa9081 100644
--- a/drivers/net/ethernet/broadcom/bnge/bnge.h
+++ b/drivers/net/ethernet/broadcom/bnge/bnge.h
@@ -241,6 +241,10 @@ struct bnge_dev {
/* Index of the first NQ created in ndo_open() and destroyed in ndo_stop().
* NQs below it are created at probe and destroyed at remove. It starts at 0,
* i.e. all NQs are open NQs, until NQ0 moves to probe.
+ *
+ * Layout of bd->irq_tbl: the NQs created at probe (none yet) come first,
+ * then the aux (RoCE) vectors, then the NQs created in open. The ring_idx
+ * the aux device receives is its irq_tbl index.
*/
#define BNGE_FIRST_OPEN_NQ 0
@@ -290,4 +294,19 @@ static inline void bnge_db_write(struct bnge_dev *bd, struct bnge_db_info *db,
bool bnge_aux_registered(struct bnge_dev *bd);
u16 bnge_aux_get_msix(struct bnge_dev *bd);
+/* irq_tbl index of the i-th aux vector, also used as its ring_idx */
+static inline int bnge_aux_irq_idx(int i)
+{
+ return BNGE_FIRST_OPEN_NQ + i;
+}
+
+/* irq_tbl index of NQ nq_idx */
+static inline int bnge_nq_irq_idx(struct bnge_dev *bd, int nq_idx)
+{
+ if (nq_idx < BNGE_FIRST_OPEN_NQ)
+ return nq_idx;
+
+ return bnge_aux_get_msix(bd) + nq_idx;
+}
+
#endif /* _BNGE_H_ */
diff --git a/drivers/net/ethernet/broadcom/bnge/bnge_auxr.c b/drivers/net/ethernet/broadcom/bnge/bnge_auxr.c
index 0955b488b6fe..0393bfea7b65 100644
--- a/drivers/net/ethernet/broadcom/bnge/bnge_auxr.c
+++ b/drivers/net/ethernet/broadcom/bnge/bnge_auxr.c
@@ -34,9 +34,9 @@ static void bnge_fill_msix_vecs(struct bnge_dev *bd,
}
num_msix = auxr_dev->auxr_info->msix_requested;
for (i = 0; i < num_msix; i++) {
- info[i].vector = bd->irq_tbl[i].vector;
+ info[i].vector = bd->irq_tbl[bnge_aux_irq_idx(i)].vector;
info[i].db_offset = bd->db_offset;
- info[i].ring_idx = i;
+ info[i].ring_idx = bnge_aux_irq_idx(i);
}
}
diff --git a/drivers/net/ethernet/broadcom/bnge/bnge_netdev.c b/drivers/net/ethernet/broadcom/bnge/bnge_netdev.c
index 0d98223cd703..dc6cf3525034 100644
--- a/drivers/net/ethernet/broadcom/bnge/bnge_netdev.c
+++ b/drivers/net/ethernet/broadcom/bnge/bnge_netdev.c
@@ -539,7 +539,7 @@ static int bnge_alloc_nq(struct bnge_net *bn, struct bnge_napi *bnapi)
}
ring->fw_ring_id = INVALID_HW_RING_ID_32BIT;
- ring->map_idx = bnge_aux_get_msix(bn->bd) + bnapi->index;
+ ring->map_idx = bnge_nq_irq_idx(bn->bd, bnapi->index);
return 0;
}
--
2.47.3
next prev parent reply other threads:[~2026-10-13 20:08 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-13 20:06 [PATCH net-next v3 0/5] bnge: Make NQ0 persistent across open/close Bhargava Marreddy
2026-10-13 20:06 ` [PATCH net-next v3 1/5] bnge: factor out per-NQ alloc/free helpers Bhargava Marreddy
2026-10-13 20:06 ` [PATCH net-next v3 2/5] bnge: add bnge_err()/bnge_warn()/bnge_dbg() logging helpers Bhargava Marreddy
2026-10-13 20:06 ` [PATCH net-next v3 3/5] bnge: add bnge_for_each_open_nq() iterator Bhargava Marreddy
2026-10-13 20:06 ` Bhargava Marreddy [this message]
2026-10-13 20:06 ` [PATCH net-next v3 5/5] bnge: make NQ0 persistent across open/stop cycles Bhargava Marreddy
2026-10-18 15:32 ` Bhargava Chenna Marreddy
2026-10-18 17:20 ` Bhargava Chenna Marreddy
2026-10-20 20:34 ` 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=20261013200645.1346299-5-bhargava.marreddy@broadcom.com \
--to=bhargava.marreddy@broadcom.com \
--cc=andrew+netdev@lunn.ch \
--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=michael.chan@broadcom.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=pavan.chebbi@broadcom.com \
--cc=rajashekar.hudumula@broadcom.com \
--cc=ramakrishna.koduri@broadcom.com \
--cc=vikas.gupta@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox