Skip to content

Commit b38c553

Browse files
ddaskalakuba-moo
authored andcommitted
eth: fbnic: Account for page fragments when updating BDQ tail
FBNIC supports fixed size buffers of 4K. When PAGE_SIZE > 4K, we fragment the page across multiple descriptors (FBNIC_BD_FRAG_COUNT). When refilling the BDQ, the correct number of entries are populated, but tail was only incremented by one. So on a system with 64K pages, HW would get one descriptor refilled for every 16 we populate. Additionally, we program the ring size in the HW when enabling the BDQ. This was not accounting for page fragments, so on systems with 64K pages, the HW used 1/16th of the ring. Fixes: 0cb4c0a ("eth: fbnic: Implement Rx queue alloc/start/stop/free") Signed-off-by: Dimitri Daskalakis <daskald@meta.com> Link: https://patch.msgid.link/20260324195123.3486219-2-dimitri.daskalakis1@gmail.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
1 parent 2edfa31 commit b38c553

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

drivers/net/ethernet/meta/fbnic/fbnic_txrx.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -927,7 +927,7 @@ static void fbnic_fill_bdq(struct fbnic_ring *bdq)
927927
/* Force DMA writes to flush before writing to tail */
928928
dma_wmb();
929929

930-
writel(i, bdq->doorbell);
930+
writel(i * FBNIC_BD_FRAG_COUNT, bdq->doorbell);
931931
}
932932
}
933933

@@ -2564,7 +2564,7 @@ static void fbnic_enable_bdq(struct fbnic_ring *hpq, struct fbnic_ring *ppq)
25642564
hpq->tail = 0;
25652565
hpq->head = 0;
25662566

2567-
log_size = fls(hpq->size_mask);
2567+
log_size = fls(hpq->size_mask) + ilog2(FBNIC_BD_FRAG_COUNT);
25682568

25692569
/* Store descriptor ring address and size */
25702570
fbnic_ring_wr32(hpq, FBNIC_QUEUE_BDQ_HPQ_BAL, lower_32_bits(hpq->dma));
@@ -2576,7 +2576,7 @@ static void fbnic_enable_bdq(struct fbnic_ring *hpq, struct fbnic_ring *ppq)
25762576
if (!ppq->size_mask)
25772577
goto write_ctl;
25782578

2579-
log_size = fls(ppq->size_mask);
2579+
log_size = fls(ppq->size_mask) + ilog2(FBNIC_BD_FRAG_COUNT);
25802580

25812581
/* Add enabling of PPQ to BDQ control */
25822582
bdq_ctl |= FBNIC_QUEUE_BDQ_CTL_PPQ_ENABLE;

0 commit comments

Comments
 (0)