Re: [PATCH net v2] bnge/bng_re: fix ring ID widths
From: Vikas Gupta
Date: Fri Jul 10 2026 - 10:35:36 EST
On Fri, Jul 10, 2026 at 3:36 PM Przemek Kitszel
<przemyslaw.kitszel@xxxxxxxxx> wrote:
>
> On 7/4/26 18:47, Vikas Gupta wrote:
> > Firmware requires more than 16 bits to address TX ring IDs for its
> > internal QP management. Widen the associated HSI ring ID fields to
> > 32 bits. The values firmware assigns remain within 24 bits, bounded
> > by the hardware doorbell XID field.
> >
> > RX, completion, and NQ ring IDs are unaffected and remain 16-bit.
>
> Here you mention Rx is unaffected. But you touch multiple places that
> are Rx specific (some comments below).
The fw_ring_id field belongs to bnge_ring_struct, a common struct
shared by all ring types. Widening it to u32 applies uniformly across
TX, RX, CP, and NQ rings at the struct level.
I believe the commit message is incomplete but the intent was that
firmware assigns values within 16-bit range for all ring types
except TX, which requires the wider field.
Please let me know if this clarifies.
>
> [..]
>
> > --- a/drivers/net/ethernet/broadcom/bnge/bnge.h
> > +++ b/drivers/net/ethernet/broadcom/bnge/bnge.h
> > @@ -36,6 +36,7 @@ struct bnge_pf_info {
> > };
> >
> > #define INVALID_HW_RING_ID ((u16)-1)
> > +#define INVALID_HW_RING_ID_32BIT (U32_MAX)
>
> OK, there is much more usage of INVALID_HW_RING_ID than places touched
> by this patch.
INVALID_HW_RING_ID applies to 16-bit fields such as those in
bnge_ring_grp_info (rx_fw_ring_id, agg_fw_ring_id, nq_fw_ring_id)
and vnic fields.
INVALID_HW_RING_ID_32BIT applies to ring_struct.fw_ring_id (u32), all
instances of which are updated in this patch.
Thanks,
Vikas
>
> [...]
>
> > +++ b/drivers/net/ethernet/broadcom/bnge/bnge_netdev.c
> > @@ -1327,12 +1327,12 @@ static int bnge_alloc_core(struct bnge_net *bn)
> > return rc;
> > }
> >
> > -u16 bnge_cp_ring_for_rx(struct bnge_rx_ring_info *rxr)
> > +u32 bnge_cp_ring_for_rx(struct bnge_rx_ring_info *rxr)
>
> and here you change Rx ring ID width.
>
> > {
> > return rxr->rx_cpr->ring_struct.fw_ring_id;
> > }
> >
> > -u16 bnge_cp_ring_for_tx(struct bnge_tx_ring_info *txr)
> > +u32 bnge_cp_ring_for_tx(struct bnge_tx_ring_info *txr)
> > {
> > return txr->tx_cpr->ring_struct.fw_ring_id;
> > }
> > @@ -1375,12 +1375,12 @@ static void bnge_init_nq_tree(struct bnge_net *bn)
> > struct bnge_nq_ring_info *nqr = &bn->bnapi[i]->nq_ring;
> > struct bnge_ring_struct *ring = &nqr->ring_struct;
> >
> > - ring->fw_ring_id = INVALID_HW_RING_ID;
> > + ring->fw_ring_id = INVALID_HW_RING_ID_32BIT;
> > for (j = 0; j < nqr->cp_ring_count; j++) {
> > struct bnge_cp_ring_info *cpr = &nqr->cp_ring_arr[j];
> >
> > ring = &cpr->ring_struct;
> > - ring->fw_ring_id = INVALID_HW_RING_ID;
> > + ring->fw_ring_id = INVALID_HW_RING_ID_32BIT;
> > }
> > }
> > }
> > @@ -1637,7 +1637,7 @@ static void bnge_init_one_rx_ring_rxbd(struct bnge_net *bn,
>
> ditto Rx
>
> >
> > ring = &rxr->rx_ring_struct;
> > bnge_init_rxbd_pages(ring, type);
> > - ring->fw_ring_id = INVALID_HW_RING_ID;
> > + ring->fw_ring_id = INVALID_HW_RING_ID_32BIT;
> > }
> >
> > static void bnge_init_one_agg_ring_rxbd(struct bnge_net *bn,
> > @@ -1647,7 +1647,7 @@ static void bnge_init_one_agg_ring_rxbd(struct bnge_net *bn,
>
> ditto Rx, and in some other places too
Attachment:
smime.p7s
Description: S/MIME Cryptographic Signature