[PATCH net-next] net: axienet: Use napi_alloc_skb when refilling RX ring
Robert Hancock
robert.hancock at calian.com
Wed Mar 9 09:37:22 PST 2022
On Wed, 2022-03-09 at 08:17 +0000, Radhey Shyam Pandey wrote:
> > -----Original Message-----
> > From: Robert Hancock <robert.hancock at calian.com>
> > Sent: Wednesday, March 9, 2022 2:40 AM
> > To: netdev at vger.kernel.org
> > Cc: Radhey Shyam Pandey <radheys at xilinx.com>; davem at davemloft.net;
> > kuba at kernel.org; Michal Simek <michals at xilinx.com>; linux-arm-
> > kernel at lists.infradead.org; jwiedmann.dev at gmail.com; Robert Hancock
> > <robert.hancock at 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 at 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
Senior Hardware Designer, Calian Advanced Technologies
www.calian.com
More information about the linux-arm-kernel
mailing list