[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <4b43c54d38e60c1995501ee9a0eb84fb80fb0944.camel@calian.com>
Date: Tue, 8 Mar 2022 21:13:44 +0000
From: Robert Hancock <robert.hancock@...ian.com>
To: "netdev@...r.kernel.org" <netdev@...r.kernel.org>,
"jwiedmann.dev@...il.com" <jwiedmann.dev@...il.com>
CC: "linux@...linux.org.uk" <linux@...linux.org.uk>,
"davem@...emloft.net" <davem@...emloft.net>,
"kuba@...nel.org" <kuba@...nel.org>,
"michal.simek@...inx.com" <michal.simek@...inx.com>,
"radhey.shyam.pandey@...inx.com" <radhey.shyam.pandey@...inx.com>,
"daniel@...earbox.net" <daniel@...earbox.net>,
"linux-arm-kernel@...ts.infradead.org"
<linux-arm-kernel@...ts.infradead.org>
Subject: Re: [PATCH net-next v3 5/7] net: axienet: implement NAPI and GRO
receive
On Mon, 2022-03-07 at 08:53 +0200, Julian Wiedmann wrote:
> On 05.03.22 04:24, Robert Hancock wrote:
> > Implement NAPI and GRO receive. In addition to better performance, this
> > also avoids handling RX packets in hard IRQ context, which reduces the
> > IRQ latency impact to other devices.
> >
> > Signed-off-by: Robert Hancock <robert.hancock@...ian.com>
> > ---
> > drivers/net/ethernet/xilinx/xilinx_axienet.h | 6 ++
> > .../net/ethernet/xilinx/xilinx_axienet_main.c | 81 ++++++++++++-------
> > 2 files changed, 59 insertions(+), 28 deletions(-)
> >
>
> [...]
>
> > -static void axienet_recv(struct net_device *ndev)
> > +static int axienet_poll(struct napi_struct *napi, int budget)
> > {
> > u32 length;
> > u32 csumstatus;
> > u32 size = 0;
> > - u32 packets = 0;
> > + int packets = 0;
> > dma_addr_t tail_p = 0;
> > - struct axienet_local *lp = netdev_priv(ndev);
> > - struct sk_buff *skb, *new_skb;
> > struct axidma_bd *cur_p;
> > + struct sk_buff *skb, *new_skb;
> > + struct axienet_local *lp = container_of(napi, struct axienet_local,
> > napi);
> >
> > cur_p = &lp->rx_bd_v[lp->rx_bd_ci];
> >
> > - while ((cur_p->status & XAXIDMA_BD_STS_COMPLETE_MASK)) {
> > + while (packets < budget && (cur_p->status &
> > XAXIDMA_BD_STS_COMPLETE_MASK)) {
> > dma_addr_t phys;
> >
> > /* Ensure we see complete descriptor update */
> > @@ -918,7 +916,7 @@ static void axienet_recv(struct net_device *ndev)
> > DMA_FROM_DEVICE);
> >
> > skb_put(skb, length);
> > - skb->protocol = eth_type_trans(skb, ndev);
> > + skb->protocol = eth_type_trans(skb, lp->ndev);
> > /*skb_checksum_none_assert(skb);*/
> > skb->ip_summed = CHECKSUM_NONE;
> >
> > @@ -937,13 +935,13 @@ static void axienet_recv(struct net_device *ndev)
> > skb->ip_summed = CHECKSUM_COMPLETE;
> > }
> >
> > - netif_rx(skb);
> > + napi_gro_receive(napi, skb);
> >
> > size += length;
> > packets++;
> > }
> >
> > - new_skb = netdev_alloc_skb_ip_align(ndev, lp->max_frm_size);
> > + new_skb = netdev_alloc_skb_ip_align(lp->ndev, lp-
> > >max_frm_size);
> > if (!new_skb)
> > break;
> >
>
> Here you should be able to use napi_alloc_skb() now instead.
Thanks - this patch set was merged to net-next already, but I just submitted a
follow-on patch to add in this change.
--
Robert Hancock
Senior Hardware Designer, Calian Advanced Technologies
www.calian.com
Powered by blists - more mailing lists