lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CACKFLikNuOgJPOd1xCcSkB9-BJczVZsfqUKy4EVhPLYTE5xbQQ@mail.gmail.com>
Date: Sun, 9 Jul 2023 21:22:50 -0700
From: Michael Chan <michael.chan@...adcom.com>
To: Jakub Kicinski <kuba@...nel.org>
Cc: netdev@...r.kernel.org, almasrymina@...gle.com, hawk@...nel.org, 
	ilias.apalodimas@...aro.org, edumazet@...gle.com, dsahern@...il.com, 
	willemb@...gle.com, Andrew Gospodarek <gospo@...adcom.com>, 
	Somnath Kotur <somnath.kotur@...adcom.com>
Subject: Re: [RFC 09/12] eth: bnxt: use the page pool for data pages

On Fri, Jul 7, 2023 at 11:39 AM Jakub Kicinski <kuba@...nel.org> wrote:
>
> 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@...nel.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.

>                 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,

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ