Re: [PATCH net-next v6 06/15] bnxt_en: Allocate and free MPC channels from firmware
Michael Chan <[email protected]>
| Newsgroups | org.kernel.vger.netdev |
|---|---|
| Message-ID | <CACKFLinLEGcLXV+n1hv986QR=5faOgrU7B1qSDV0u57C=Ch=6Q@mail.gmail.com> |
Responding to 2 High Sashiko comments: https://sashiko.dev/#/patchset/20260810051358.1244418-1-michael.chan%40broadcom.com On Sun, Aug 9, 2026 at 10:14 PM Michael Chan <[email protected]> wrote: > +void bnxt_init_mpc_rings(struct bnxt *bp) > +{ > + struct bnxt_mpc_info *mpc = bp->mpc_info; > + int i, j; > + > + if (!mpc) > + return; > + > + for (i = 0; i < BNXT_MPC_TYPE_MAX; i++) { > + int num = mpc->mpc_ring_count[i]; > + > + for (j = 0; j < num; j++) { > + struct bnxt_tx_ring_info *txr = &mpc->mpc_rings[i][j]; > + struct bnxt_ring_struct *ring = &txr->tx_ring_struct; > + > + txr->tx_prod = 0; > + txr->tx_cons = 0; > + txr->tx_hw_cons = 0; > + WRITE_ONCE(txr->dev_state, 0); > + ring->fw_ring_id = INVALID_HW_RING_ID; > + } > + } > +} > + Sashiko: When an MPC ring processes a transmission, will the generated completion in __bnxt_poll_work() route to the wrong ring? ... Response: No, MPC transmissions generate new completion types (CMP_TYPE_MPC_CMP_SHORT and CMP_TYPE_MPC_CMP_LONG), not the existing TX completions. > +static int bnxt_hwrm_one_mpc_ring_alloc(struct bnxt *bp, > + struct bnxt_tx_ring_info *txr) > +{ > + struct bnxt_cp_ring_info *cpr = txr->tx_cpr; > + struct bnxt_ring_struct *ring; > + int rc; > + > + ring = &cpr->cp_ring_struct; Sashiko: Will txr->tx_cpr be NULL here during driver initialization? During driver load, bnxt_alloc_mem() allocates MPC rings via bnxt_alloc_mpcs(), which leaves txr->bnapi as NULL. Immediately after, bnxt_alloc_all_cp_arrays() calls bnxt_set_mpc_cp_ring(), which expects txr->bnapi to be initialized to match and set txr->tx_cpr. Because txr->bnapi is still NULL, the match fails and txr->tx_cpr remains NULL. ... Response: No, bnxt_alloc_all_cp_arrays() does not call bnxt_set_mpc_cp_ring(). It is called by bnxt_alloc_cp_rings() much later. By then txr->napi is already initialized and txr->tx_cpr will be set correctly. So txr->tx_cpr will not be NULL when we get here.
smime.p7s
(application/pkcs7-signature, 5.3 KB) - not displayed