Skip to content

[bnxt] Bound CQ and NQ service loops - #1880

Merged
mcb30 merged 1 commit into
ipxe:masterfrom
jw14812:bnxt
Nov 24, 2026
Merged

mcb30 merged 1 commit into
ipxe:masterfrom
jw14812:bnxt

Conversation

@jw14812

@jw14812 jw14812 commented Nov 18, 2026

Copy link
Copy Markdown
Contributor

Limit the number of entries processed per call in completion queue and notification queue service loops, so that a continuously populated queue cannot keep the driver in the service loop indefinitely.

@mcb30

mcb30 commented Nov 18, 2026

Copy link
Copy Markdown
Member

Does the bnxt driver actually need this? The structure of most iPXE drivers makes it impossible for this situation to arise: each ring typically has a producer counter and a consumer counter, refills are performed outside of the polling loop, and so it is logically impossible for the polling loop to fail to terminate (because the consumer counter can never be incremented higher than the producer counter).

For example:

while ( intel->tx.cons != intel->tx.prod ) {
/* Get next transmit descriptor */
tx_idx = ( intel->tx.cons % INTEL_NUM_TX_DESC );
tx = &intel->tx.desc[tx_idx];
/* Stop if descriptor is still in use */
status = intel->tx.status ( tx, &len );
if ( ! ( status & INTEL_DESC_STATUS_DD ) )
return;
DBGC2 ( intel, "INTEL %p TX %d complete\n", intel, tx_idx );
/* Complete TX descriptor */
netdev_tx_complete_next ( netdev );
intel->tx.cons++;
}

With the structure of the bnxt driver, it's not so immediately clear whether or not an infinite loop can happen, but I'd want to be convinced it's possible before adding more unnecessary complexity to the driver.

@jw14812

jw14812 commented Nov 23, 2026

Copy link
Copy Markdown
Contributor Author

Yes, I think bnxt can genuinely fail to terminate here, because it doesn't follow the usual structure: RX refill happens inside the CQ loop (bnxt_rx_process() → bnxt_post_rx_buffers() → RX doorbell), so each consumed completion immediately posts a new buffer, and the loop only exits when the valid bit is not set.

Limit the number of entries processed per call in completion queue and
notification queue service loops, so that a continuously populated
queue cannot keep the driver in the service loop indefinitely.

Signed-off-by: Joseph Wong <joseph.wong@broadcom.com>
@mcb30
mcb30 merged commit 91b9034 into ipxe:master Nov 24, 2026
32 checks passed

This branch was previously deployed

2 inactive deployments
publish — 91b90344 Deployed Nov 24, 2026 by mcb30 via Publish #3205
syncforks — 91b90344 Deployed Nov 24, 2026 by mcb30 via Sync (ipxe, aipxe) #231
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants