Subject: Re: [PATCH RFC 2/2] net: remove __skb_frag_set_page()

From: Simon Horman <[email-masked]>
Date: Mon, 8 May 2023 16:31:22 +0200

On Mon, May 08, 2023 at 08:39:22PM +0800, Yunsheng Lin wrote:
> The remaining users calling __skb_frag_set_page() with
> page being NULL seems to doing defensive programming, as
> shinfo->nr_frags is already decremented, so remove them.
> 
> Signed-off-by: Yunsheng Lin <[email-masked]>

...

> diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
> index efaff5018af8..f3f08660ec30 100644
> --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c
> +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
> @@ -1105,7 +1105,6 @@ static u32 __bnxt_rx_agg_pages(struct bnxt *bp,
>  			unsigned int nr_frags;
>  
>  			nr_frags = --shinfo->nr_frags;

Hi Yunsheng,

nr_frags is now  unused, other than being set on the line above.
Probably this local variable can be removed.

> -			__skb_frag_set_page(&shinfo->frags[nr_frags], NULL);
>  			cons_rx_buf->page = page;
>  

...