From: Michael Chan <michael.chan@broadcom.com>
To: davem@davemloft.net
Cc: netdev@vger.kernel.org, edumazet@google.com, kuba@kernel.org,
pabeni@redhat.com, andrew+netdev@lunn.ch,
pavan.chebbi@broadcom.com, andrew.gospodarek@broadcom.com,
Joe Damato <joe@dama.to>
Subject: [PATCH net-next v4 4/8] bnxt_en: Refactor IRQs required logic
Date: Thu, 15 Oct 2026 23:44:23 -0700 [thread overview]
Message-ID: <20261016064427.496944-5-michael.chan@broadcom.com> (raw)
In-Reply-To: <20261016064427.496944-1-michael.chan@broadcom.com>
Refactor the logic to determine the required IRQ vectors into a new
helper. Later patches in the series will make additional use of the
helper. There is no change in behavior.
Reviewed-by: Andy Gospodarek <andrew.gospodarek@broadcom.com>
Reviewed-by: Joe Damato <joe@dama.to>
Signed-off-by: Michael Chan <michael.chan@broadcom.com>
---
drivers/net/ethernet/broadcom/bnxt/bnxt.c | 25 ++++++++++++++---------
1 file changed, 15 insertions(+), 10 deletions(-)
diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
index 0556a9b60791..4cc6ffeb56f6 100644
--- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c
+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
@@ -11712,9 +11712,22 @@ static void bnxt_clear_int_mode(struct bnxt *bp)
bp->irq_tbl_size = 0;
}
-int bnxt_reserve_rings(struct bnxt *bp, bool irq_re_init)
+static int bnxt_irqs_required(struct bnxt *bp)
{
struct bnxt_en_dev *edev = bp->edev[BNXT_AUXDEV_RDMA];
+
+ if (BNXT_NEW_RM(bp) && !bnxt_ulp_registered(edev)) {
+ int ulp_msix = bnxt_get_avail_msix(bp, bp->ulp_num_msix_want);
+
+ if (ulp_msix > bp->ulp_num_msix_want)
+ ulp_msix = bp->ulp_num_msix_want;
+ return ulp_msix + bp->cp_nr_rings;
+ }
+ return bnxt_get_num_msix(bp);
+}
+
+int bnxt_reserve_rings(struct bnxt *bp, bool irq_re_init)
+{
bool irq_cleared = false;
bool irq_change = false;
int tcs = bp->num_tc;
@@ -11724,15 +11737,7 @@ int bnxt_reserve_rings(struct bnxt *bp, bool irq_re_init)
if (!bnxt_need_reserve_rings(bp))
return 0;
- if (BNXT_NEW_RM(bp) && !bnxt_ulp_registered(edev)) {
- int ulp_msix = bnxt_get_avail_msix(bp, bp->ulp_num_msix_want);
-
- if (ulp_msix > bp->ulp_num_msix_want)
- ulp_msix = bp->ulp_num_msix_want;
- irqs_required = ulp_msix + bp->cp_nr_rings;
- } else {
- irqs_required = bnxt_get_num_msix(bp);
- }
+ irqs_required = bnxt_irqs_required(bp);
if (irq_re_init && BNXT_NEW_RM(bp) && irqs_required != bp->total_irqs) {
irq_change = true;
--
2.51.0
next prev parent reply other threads:[~2026-10-16 6:45 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-16 6:44 [PATCH net-next v4 0/8] bnxt_en: Ring accounting fixes Michael Chan
2026-10-16 6:44 ` [PATCH net-next v4 1/8] bnxt_en: Clear bp->total_irqs when disabling IRQs Michael Chan
2026-10-16 6:44 ` [PATCH net-next v4 2/8] bnxt_en: Fix bnxt_reinit_features() when irq_re_init is true Michael Chan
2026-10-16 6:44 ` [PATCH net-next v4 3/8] bnxt_en: Refactor RSS table check logic Michael Chan
2026-10-16 6:44 ` Michael Chan [this message]
2026-10-16 6:44 ` [PATCH net-next v4 5/8] bnxt_en: Reinit IRQ when configuring LRO/GRO/HDS Michael Chan
2026-10-16 6:44 ` [PATCH net-next v4 6/8] bnxt_en: Remove support for the old NITRO A0 chip Michael Chan
2026-10-16 6:44 ` [PATCH net-next v4 7/8] bnxt_en: Refactor bnxt_num_cp_to_tx()/bnxt_num_tx_to_cp() helpers Michael Chan
2026-10-16 6:44 ` [PATCH net-next v4 8/8] bnxt_en: Fix ring accounting and validation when rings are constrained Michael Chan
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=20261016064427.496944-5-michael.chan@broadcom.com \
--to=michael.chan@broadcom.com \
--cc=andrew+netdev@lunn.ch \
--cc=andrew.gospodarek@broadcom.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=joe@dama.to \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=pavan.chebbi@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