diff mbox series

[net-next] net: axienet: Use napi_alloc_skb when refilling RX ring

Message ID 20220308211013.1530955-1-robert.hancock@calian.com (mailing list archive)
State New, archived
Headers show
Series [net-next] net: axienet: Use napi_alloc_skb when refilling RX ring | expand

Commit Message

Robert Hancock March 8, 2022, 9:10 p.m. UTC
Use napi_alloc_skb to allocate memory when refilling the RX ring in
axienet_poll for more efficiency.

Signed-off-by: Robert Hancock <robert.hancock@calian.com>
---
 drivers/net/ethernet/xilinx/xilinx_axienet_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Radhey Shyam Pandey March 9, 2022, 8:17 a.m. UTC | #1
> -----Original Message-----
> From: Robert Hancock <robert.hancock@calian.com>
> Sent: Wednesday, March 9, 2022 2:40 AM
> To: netdev@vger.kernel.org
> Cc: Radhey Shyam Pandey <radheys@xilinx.com>; davem@davemloft.net;
> kuba@kernel.org; Michal Simek <michals@xilinx.com>; linux-arm-
> kernel@lists.infradead.org; jwiedmann.dev@gmail.com; Robert Hancock
> <robert.hancock@calian.com>
> Subject: [PATCH net-next] net: axienet: Use napi_alloc_skb when refilling RX
> ring
> 
> Use napi_alloc_skb to allocate memory when refilling the RX ring in
> axienet_poll for more efficiency.

Minor nit - Good to add some details on "more efficiency" (assume it's perf?)

> 
> Signed-off-by: Robert Hancock <robert.hancock@calian.com>
> ---
>  drivers/net/ethernet/xilinx/xilinx_axienet_main.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c
> b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c
> index a51a8228e1b7..1da90ec553c5 100644
> --- a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c
> +++ b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c
> @@ -965,7 +965,7 @@ static int axienet_poll(struct napi_struct *napi, int
> budget)
>  			packets++;
>  		}
> 
> -		new_skb = netdev_alloc_skb_ip_align(lp->ndev, lp-
> >max_frm_size);
> +		new_skb = napi_alloc_skb(napi, lp->max_frm_size);
>  		if (!new_skb)
>  			break;
> 
> --
> 2.31.1
Robert Hancock March 9, 2022, 5:37 p.m. UTC | #2
On Wed, 2022-03-09 at 08:17 +0000, Radhey Shyam Pandey wrote:
> > -----Original Message-----
> > From: Robert Hancock <robert.hancock@calian.com>
> > Sent: Wednesday, March 9, 2022 2:40 AM
> > To: netdev@vger.kernel.org
> > Cc: Radhey Shyam Pandey <radheys@xilinx.com>; davem@davemloft.net;
> > kuba@kernel.org; Michal Simek <michals@xilinx.com>; linux-arm-
> > kernel@lists.infradead.org; jwiedmann.dev@gmail.com; Robert Hancock
> > <robert.hancock@calian.com>
> > Subject: [PATCH net-next] net: axienet: Use napi_alloc_skb when refilling
> > RX
> > ring
> > 
> > Use napi_alloc_skb to allocate memory when refilling the RX ring in
> > axienet_poll for more efficiency.
> 
> Minor nit - Good to add some details on "more efficiency" (assume it's perf?)

Yes, it's as described in the comments for napi_alloc_skb:

 *      Allocate a new sk_buff for use in NAPI receive.  This buffer will
 *      attempt to allocate the head from a special reserved region used
 *      only for NAPI Rx allocation.  By doing this we can save several
 *      CPU cycles by avoiding having to disable and re-enable IRQs.

I guess this could be mentioned in the commit description if desired?

> 
> > Signed-off-by: Robert Hancock <robert.hancock@calian.com>
> > ---
> >  drivers/net/ethernet/xilinx/xilinx_axienet_main.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c
> > b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c
> > index a51a8228e1b7..1da90ec553c5 100644
> > --- a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c
> > +++ b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c
> > @@ -965,7 +965,7 @@ static int axienet_poll(struct napi_struct *napi, int
> > budget)
> >  			packets++;
> >  		}
> > 
> > -		new_skb = netdev_alloc_skb_ip_align(lp->ndev, lp-
> > > max_frm_size);
> > +		new_skb = napi_alloc_skb(napi, lp->max_frm_size);
> >  		if (!new_skb)
> >  			break;
> > 
> > --
> > 2.31.1
patchwork-bot+netdevbpf@kernel.org March 10, 2022, 5 a.m. UTC | #3
Hello:

This patch was applied to netdev/net-next.git (master)
by Jakub Kicinski <kuba@kernel.org>:

On Tue,  8 Mar 2022 15:10:13 -0600 you wrote:
> Use napi_alloc_skb to allocate memory when refilling the RX ring in
> axienet_poll for more efficiency.
> 
> Signed-off-by: Robert Hancock <robert.hancock@calian.com>
> ---
>  drivers/net/ethernet/xilinx/xilinx_axienet_main.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Here is the summary with links:
  - [net-next] net: axienet: Use napi_alloc_skb when refilling RX ring
    https://git.kernel.org/netdev/net-next/c/6c7e7da2e0f2

You are awesome, thank you!
diff mbox series

Patch

diff --git a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c
index a51a8228e1b7..1da90ec553c5 100644
--- a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c
+++ b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c
@@ -965,7 +965,7 @@  static int axienet_poll(struct napi_struct *napi, int budget)
 			packets++;
 		}
 
-		new_skb = netdev_alloc_skb_ip_align(lp->ndev, lp->max_frm_size);
+		new_skb = napi_alloc_skb(napi, lp->max_frm_size);
 		if (!new_skb)
 			break;