Thread (33 messages) 33 messages, 6 authors, 2023-07-26

Re: [RFC 09/12] eth: bnxt: use the page pool for data pages

flat view

From: Michael Chan <michael.chan@broadcom.com>
Date: 2023-07-10 04:23:10

On Fri, Jul 7, 2023 at 11:39 AM Jakub Kicinski [off-list ref] wrote:
quoted hunk ↗ jump to hunk
To benefit from page recycling allocate the agg pages (used by HW-GRO
and jumbo) from the page pool.

Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
 drivers/net/ethernet/broadcom/bnxt/bnxt.c | 43 ++++++++++++-----------
 1 file changed, 22 insertions(+), 21 deletions(-)
diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
index 6512514cd498..734c2c6cad69 100644
--- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c
+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
@@ -811,33 +811,27 @@ static inline int bnxt_alloc_rx_page(struct bnxt *bp,
        u16 sw_prod = rxr->rx_sw_agg_prod;
        unsigned int offset = 0;

-       if (BNXT_RX_PAGE_MODE(bp)) {
+       if (PAGE_SIZE <= BNXT_RX_PAGE_SIZE || BNXT_RX_PAGE_MODE(bp)) {
We have a very similar set of patches from my colleague Somnath to
support page pool and it supports PAGE_SIZE >= BNXT_RX_PAGE_SIZE in a
more unified way.  So here, we don't have to deal with the if/else
condition. I should be able to post the patches later in the week
after some more QA.
quoted hunk ↗ jump to hunk
                page = __bnxt_alloc_rx_page(bp, &mapping, rxr, gfp);

                if (!page)
                        return -ENOMEM;

        } else {
-               if (PAGE_SIZE > BNXT_RX_PAGE_SIZE) {
-                       page = rxr->rx_page;
-                       if (!page) {
-                               page = alloc_page(gfp);
-                               if (!page)
-                                       return -ENOMEM;
-                               rxr->rx_page = page;
-                               rxr->rx_page_offset = 0;
-                       }
-                       offset = rxr->rx_page_offset;
-                       rxr->rx_page_offset += BNXT_RX_PAGE_SIZE;
-                       if (rxr->rx_page_offset == PAGE_SIZE)
-                               rxr->rx_page = NULL;
-                       else
-                               get_page(page);
-               } else {
+               page = rxr->rx_page;
+               if (!page) {
                        page = alloc_page(gfp);
                        if (!page)
                                return -ENOMEM;
+                       rxr->rx_page = page;
+                       rxr->rx_page_offset = 0;
                }
+               offset = rxr->rx_page_offset;
+               rxr->rx_page_offset += BNXT_RX_PAGE_SIZE;
+               if (rxr->rx_page_offset == PAGE_SIZE)
+                       rxr->rx_page = NULL;
+               else
+                       get_page(page);

                mapping = dma_map_page_attrs(&pdev->dev, page, offset,
                                             BNXT_RX_PAGE_SIZE, DMA_FROM_DEVICE,
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help