* [PATCH net-next 1/2] bnxt_en: Refactor bnxt_need_reserve_rings()
2026-02-07 23:51 [PATCH net-next 0/2] bnxt_en: Add RSS context resource check Michael Chan
@ 2026-02-07 23:51 ` Michael Chan
2026-02-09 22:21 ` Joe Damato
2026-02-07 23:51 ` [PATCH net-next 2/2] bnxt_en: Check RSS contexts in bnxt_need_reserve_rings() Michael Chan
2026-02-11 4:30 ` [PATCH net-next 0/2] bnxt_en: Add RSS context resource check patchwork-bot+netdevbpf
2 siblings, 1 reply; 6+ messages in thread
From: Michael Chan @ 2026-02-07 23:51 UTC (permalink / raw)
To: davem
Cc: netdev, edumazet, kuba, pabeni, andrew+netdev, pavan.chebbi,
andrew.gospodarek
bnxt_need_reserve_rings() checks 6 ring resources against the reserved
values to determine if a new reservation is needed. Factor out the code
to collect the total resources into a new helper function
bnxt_get_total_resources() to make the code cleaner and easier to read.
Instead of individual scalar variables, use the struct bnxt_hw_rings to
hold all the ring resources. Using the struct, hwr.cp replaces the nq
variable and the chip specific hwr.cp_p5 replaces cp on newer chips.
There is no change in behavior. This will make it easier to check the
RSS context resource in the next patch.
Reviewed-by: Andy Gospodarek <andrew.gospodarek@broadcom.com>
Signed-off-by: Michael Chan <michael.chan@broadcom.com>
---
drivers/net/ethernet/broadcom/bnxt/bnxt.c | 45 +++++++++++++++--------
1 file changed, 30 insertions(+), 15 deletions(-)
diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
index 7d63d6b0d2c2..4745063d2f5c 100644
--- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c
+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
@@ -7946,13 +7946,27 @@ static int bnxt_get_total_vnics(struct bnxt *bp, int rx_rings)
return 1;
}
+static void bnxt_get_total_resources(struct bnxt *bp, struct bnxt_hw_rings *hwr)
+{
+ hwr->cp = bnxt_nq_rings_in_use(bp);
+ hwr->cp_p5 = 0;
+ if (bp->flags & BNXT_FLAG_CHIP_P5_PLUS)
+ hwr->cp_p5 = bnxt_cp_rings_in_use(bp);
+ hwr->tx = bp->tx_nr_rings;
+ hwr->rx = bp->rx_nr_rings;
+ hwr->grp = hwr->rx;
+ hwr->vnic = bnxt_get_total_vnics(bp, hwr->rx);
+ if (bp->flags & BNXT_FLAG_AGG_RINGS)
+ hwr->rx <<= 1;
+ hwr->stat = bnxt_get_func_stat_ctxs(bp);
+}
+
static bool bnxt_need_reserve_rings(struct bnxt *bp)
{
struct bnxt_hw_resc *hw_resc = &bp->hw_resc;
- int cp = bnxt_cp_rings_in_use(bp);
- int nq = bnxt_nq_rings_in_use(bp);
- int rx = bp->rx_nr_rings, stat;
- int vnic, grp = rx;
+ struct bnxt_hw_rings hwr;
+
+ bnxt_get_total_resources(bp, &hwr);
/* Old firmware does not need RX ring reservations but we still
* need to setup a default RSS map when needed. With new firmware
@@ -7962,25 +7976,26 @@ static bool bnxt_need_reserve_rings(struct bnxt *bp)
if (!BNXT_NEW_RM(bp))
bnxt_check_rss_tbl_no_rmgr(bp);
- if (hw_resc->resv_tx_rings != bp->tx_nr_rings &&
- bp->hwrm_spec_code >= 0x10601)
+ if (hw_resc->resv_tx_rings != hwr.tx && bp->hwrm_spec_code >= 0x10601)
return true;
if (!BNXT_NEW_RM(bp))
return false;
- vnic = bnxt_get_total_vnics(bp, rx);
-
- if (bp->flags & BNXT_FLAG_AGG_RINGS)
- rx <<= 1;
- stat = bnxt_get_func_stat_ctxs(bp);
- if (hw_resc->resv_rx_rings != rx || hw_resc->resv_cp_rings != cp ||
- hw_resc->resv_vnics != vnic || hw_resc->resv_stat_ctxs != stat ||
- (hw_resc->resv_hw_ring_grps != grp &&
+ if (hw_resc->resv_rx_rings != hwr.rx ||
+ hw_resc->resv_vnics != hwr.vnic ||
+ hw_resc->resv_stat_ctxs != hwr.stat ||
+ (hw_resc->resv_hw_ring_grps != hwr.grp &&
!(bp->flags & BNXT_FLAG_CHIP_P5_PLUS)))
return true;
+ if (bp->flags & BNXT_FLAG_CHIP_P5_PLUS) {
+ if (hw_resc->resv_cp_rings != hwr.cp_p5)
+ return true;
+ } else if (hw_resc->resv_cp_rings != hwr.cp) {
+ return true;
+ }
if ((bp->flags & BNXT_FLAG_CHIP_P5_PLUS) && BNXT_PF(bp) &&
- hw_resc->resv_irqs != nq)
+ hw_resc->resv_irqs != hwr.cp)
return true;
return false;
}
--
2.51.0
^ permalink raw reply related [flat|nested] 6+ messages in thread* Re: [PATCH net-next 1/2] bnxt_en: Refactor bnxt_need_reserve_rings()
2026-02-07 23:51 ` [PATCH net-next 1/2] bnxt_en: Refactor bnxt_need_reserve_rings() Michael Chan
@ 2026-02-09 22:21 ` Joe Damato
0 siblings, 0 replies; 6+ messages in thread
From: Joe Damato @ 2026-02-09 22:21 UTC (permalink / raw)
To: Michael Chan
Cc: davem, netdev, edumazet, kuba, pabeni, andrew+netdev,
pavan.chebbi, andrew.gospodarek
On Sat, Feb 07, 2026 at 03:51:17PM -0800, Michael Chan wrote:
> bnxt_need_reserve_rings() checks 6 ring resources against the reserved
> values to determine if a new reservation is needed. Factor out the code
> to collect the total resources into a new helper function
> bnxt_get_total_resources() to make the code cleaner and easier to read.
> Instead of individual scalar variables, use the struct bnxt_hw_rings to
> hold all the ring resources. Using the struct, hwr.cp replaces the nq
> variable and the chip specific hwr.cp_p5 replaces cp on newer chips.
>
> There is no change in behavior. This will make it easier to check the
> RSS context resource in the next patch.
>
> Reviewed-by: Andy Gospodarek <andrew.gospodarek@broadcom.com>
> Signed-off-by: Michael Chan <michael.chan@broadcom.com>
> ---
> drivers/net/ethernet/broadcom/bnxt/bnxt.c | 45 +++++++++++++++--------
> 1 file changed, 30 insertions(+), 15 deletions(-)
Reviewed-by: Joe Damato <joe@dama.to>
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH net-next 2/2] bnxt_en: Check RSS contexts in bnxt_need_reserve_rings()
2026-02-07 23:51 [PATCH net-next 0/2] bnxt_en: Add RSS context resource check Michael Chan
2026-02-07 23:51 ` [PATCH net-next 1/2] bnxt_en: Refactor bnxt_need_reserve_rings() Michael Chan
@ 2026-02-07 23:51 ` Michael Chan
2026-02-09 22:22 ` Joe Damato
2026-02-11 4:30 ` [PATCH net-next 0/2] bnxt_en: Add RSS context resource check patchwork-bot+netdevbpf
2 siblings, 1 reply; 6+ messages in thread
From: Michael Chan @ 2026-02-07 23:51 UTC (permalink / raw)
To: davem
Cc: netdev, edumazet, kuba, pabeni, andrew+netdev, pavan.chebbi,
andrew.gospodarek, Kalesh AP
bnxt_need_reserve_rings() checks all resources except HW RSS contexts
to determine if a new reservation is required. For completeness, add
the check for HW RSS contexts. This makes the code more complete after
the recent commit to increase the number of RSS contexts for a larger
RSS indirection table:
51b9d3f948b8 ("bnxt_en: Use a larger RSS indirection table on P5_PLUS chips")
Reviewed-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Signed-off-by: Michael Chan <michael.chan@broadcom.com>
---
drivers/net/ethernet/broadcom/bnxt/bnxt.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
index 4745063d2f5c..59f0ae745446 100644
--- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c
+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
@@ -7956,6 +7956,7 @@ static void bnxt_get_total_resources(struct bnxt *bp, struct bnxt_hw_rings *hwr)
hwr->rx = bp->rx_nr_rings;
hwr->grp = hwr->rx;
hwr->vnic = bnxt_get_total_vnics(bp, hwr->rx);
+ hwr->rss_ctx = bnxt_get_total_rss_ctxs(bp, hwr);
if (bp->flags & BNXT_FLAG_AGG_RINGS)
hwr->rx <<= 1;
hwr->stat = bnxt_get_func_stat_ctxs(bp);
@@ -7985,6 +7986,7 @@ static bool bnxt_need_reserve_rings(struct bnxt *bp)
if (hw_resc->resv_rx_rings != hwr.rx ||
hw_resc->resv_vnics != hwr.vnic ||
hw_resc->resv_stat_ctxs != hwr.stat ||
+ hw_resc->resv_rsscos_ctxs != hwr.rss_ctx ||
(hw_resc->resv_hw_ring_grps != hwr.grp &&
!(bp->flags & BNXT_FLAG_CHIP_P5_PLUS)))
return true;
--
2.51.0
^ permalink raw reply related [flat|nested] 6+ messages in thread* Re: [PATCH net-next 2/2] bnxt_en: Check RSS contexts in bnxt_need_reserve_rings()
2026-02-07 23:51 ` [PATCH net-next 2/2] bnxt_en: Check RSS contexts in bnxt_need_reserve_rings() Michael Chan
@ 2026-02-09 22:22 ` Joe Damato
0 siblings, 0 replies; 6+ messages in thread
From: Joe Damato @ 2026-02-09 22:22 UTC (permalink / raw)
To: Michael Chan
Cc: davem, netdev, edumazet, kuba, pabeni, andrew+netdev,
pavan.chebbi, andrew.gospodarek, Kalesh AP
On Sat, Feb 07, 2026 at 03:51:18PM -0800, Michael Chan wrote:
> bnxt_need_reserve_rings() checks all resources except HW RSS contexts
> to determine if a new reservation is required. For completeness, add
> the check for HW RSS contexts. This makes the code more complete after
> the recent commit to increase the number of RSS contexts for a larger
> RSS indirection table:
>
> 51b9d3f948b8 ("bnxt_en: Use a larger RSS indirection table on P5_PLUS chips")
>
> Reviewed-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
> Signed-off-by: Michael Chan <michael.chan@broadcom.com>
> ---
> drivers/net/ethernet/broadcom/bnxt/bnxt.c | 2 ++
> 1 file changed, 2 insertions(+)
Reviewed-by: Joe Damato <joe@dama.to>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH net-next 0/2] bnxt_en: Add RSS context resource check
2026-02-07 23:51 [PATCH net-next 0/2] bnxt_en: Add RSS context resource check Michael Chan
2026-02-07 23:51 ` [PATCH net-next 1/2] bnxt_en: Refactor bnxt_need_reserve_rings() Michael Chan
2026-02-07 23:51 ` [PATCH net-next 2/2] bnxt_en: Check RSS contexts in bnxt_need_reserve_rings() Michael Chan
@ 2026-02-11 4:30 ` patchwork-bot+netdevbpf
2 siblings, 0 replies; 6+ messages in thread
From: patchwork-bot+netdevbpf @ 2026-02-11 4:30 UTC (permalink / raw)
To: Michael Chan
Cc: davem, netdev, edumazet, kuba, pabeni, andrew+netdev,
pavan.chebbi, andrew.gospodarek
Hello:
This series was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:
On Sat, 7 Feb 2026 15:51:16 -0800 you wrote:
> Add missing logic to check that we have enough RSS contexts. This
> will make the recent change to increase the use of RSS contexts for
> a larger RSS indirection table more complete.
>
> Michael Chan (2):
> bnxt_en: Refactor bnxt_need_reserve_rings()
> bnxt_en: Check RSS contexts in bnxt_need_reserve_rings()
>
> [...]
Here is the summary with links:
- [net-next,1/2] bnxt_en: Refactor bnxt_need_reserve_rings()
https://git.kernel.org/netdev/net-next/c/5a2f3aa2896f
- [net-next,2/2] bnxt_en: Check RSS contexts in bnxt_need_reserve_rings()
https://git.kernel.org/netdev/net-next/c/b9355ad52b38
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 6+ messages in thread