[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Y77GMD58O1CktpI+@C02YVCJELVCG>
Date: Wed, 11 Jan 2023 09:22:40 -0500
From: Andy Gospodarek <andrew.gospodarek@...adcom.com>
To: Jakub Kicinski <kuba@...nel.org>
Cc: davem@...emloft.net, netdev@...r.kernel.org, edumazet@...gle.com,
pabeni@...hat.com, somnath.kotur@...adcom.com,
andrew.gospodarek@...adcom.com, michael.chan@...adcom.com
Subject: Re: [PATCH net] bnxt: make sure we return pages to the pool
On Tue, Jan 10, 2023 at 08:25:47PM -0800, Jakub Kicinski wrote:
> Before the commit under Fixes the page would have been released
> from the pool before the napi_alloc_skb() call, so normal page
> freeing was fine (released page == no longer in the pool).
>
> After the change we just mark the page for recycling so it's still
> in the pool if the skb alloc fails, we need to recycle.
>
> Same commit added the same bug in the new bnxt_rx_multi_page_skb().
Good catch, thank you.
> Fixes: 1dc4c557bfed ("bnxt: adding bnxt_xdp_build_skb to build skb from multibuffer xdp_buff")
> Signed-off-by: Jakub Kicinski <kuba@...nel.org>
Reviewed-by: Andy Gospodarek <gospo@...adcom.com>
> ---
> drivers/net/ethernet/broadcom/bnxt/bnxt.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
> index 16ce7a90610c..240a7e8a7652 100644
> --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c
> +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
> @@ -993,7 +993,7 @@ static struct sk_buff *bnxt_rx_multi_page_skb(struct bnxt *bp,
> DMA_ATTR_WEAK_ORDERING);
> skb = build_skb(page_address(page), PAGE_SIZE);
> if (!skb) {
> - __free_page(page);
> + page_pool_recycle_direct(rxr->page_pool, page);
> return NULL;
> }
> skb_mark_for_recycle(skb);
> @@ -1031,7 +1031,7 @@ static struct sk_buff *bnxt_rx_page_skb(struct bnxt *bp,
>
> skb = napi_alloc_skb(&rxr->bnapi->napi, payload);
> if (!skb) {
> - __free_page(page);
> + page_pool_recycle_direct(rxr->page_pool, page);
> return NULL;
> }
>
> --
> 2.38.1
>
Powered by blists - more mailing lists