Skip to content

Commit 39f8fcd

Browse files
spikehkuba-moo
authored andcommitted
bnxt: fill data page pool with frags if PAGE_SIZE > BNXT_RX_PAGE_SIZE
The data page pool always fills the HW rx ring with pages. On arm64 with 64K pages, this will waste _at least_ 32K of memory per entry in the rx ring. Fix by fragmenting the pages if PAGE_SIZE > BNXT_RX_PAGE_SIZE. This makes the data page pool the same as the header pool. Tested with iperf3 with a small (64 entries) rx ring to encourage buffer circulation. Fixes: cd1fafe ("eth: bnxt: add support rx side device memory TCP") Reviewed-by: Michael Chan <[email protected]> Signed-off-by: David Wei <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent b2cafef commit 39f8fcd

File tree

1 file changed

+9
-3
lines changed
  • drivers/net/ethernet/broadcom/bnxt

1 file changed

+9
-3
lines changed

drivers/net/ethernet/broadcom/bnxt/bnxt.c

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -926,15 +926,21 @@ static struct page *__bnxt_alloc_rx_page(struct bnxt *bp, dma_addr_t *mapping,
926926

927927
static netmem_ref __bnxt_alloc_rx_netmem(struct bnxt *bp, dma_addr_t *mapping,
928928
struct bnxt_rx_ring_info *rxr,
929+
unsigned int *offset,
929930
gfp_t gfp)
930931
{
931932
netmem_ref netmem;
932933

933-
netmem = page_pool_alloc_netmems(rxr->page_pool, gfp);
934+
if (PAGE_SIZE > BNXT_RX_PAGE_SIZE) {
935+
netmem = page_pool_alloc_frag_netmem(rxr->page_pool, offset, BNXT_RX_PAGE_SIZE, gfp);
936+
} else {
937+
netmem = page_pool_alloc_netmems(rxr->page_pool, gfp);
938+
*offset = 0;
939+
}
934940
if (!netmem)
935941
return 0;
936942

937-
*mapping = page_pool_get_dma_addr_netmem(netmem);
943+
*mapping = page_pool_get_dma_addr_netmem(netmem) + *offset;
938944
return netmem;
939945
}
940946

@@ -1029,7 +1035,7 @@ static int bnxt_alloc_rx_netmem(struct bnxt *bp, struct bnxt_rx_ring_info *rxr,
10291035
dma_addr_t mapping;
10301036
netmem_ref netmem;
10311037

1032-
netmem = __bnxt_alloc_rx_netmem(bp, &mapping, rxr, gfp);
1038+
netmem = __bnxt_alloc_rx_netmem(bp, &mapping, rxr, &offset, gfp);
10331039
if (!netmem)
10341040
return -ENOMEM;
10351041

0 commit comments

Comments
 (0)