[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <2013d6c1-cba7-03f2-7b56-1ab47656c928@gmail.com>
Date: Mon, 7 Mar 2022 08:53:58 +0200
From: Julian Wiedmann <jwiedmann.dev@...il.com>
To: Robert Hancock <robert.hancock@...ian.com>, netdev@...r.kernel.org
Cc: radhey.shyam.pandey@...inx.com, davem@...emloft.net,
kuba@...nel.org, michal.simek@...inx.com, linux@...linux.org.uk,
daniel@...earbox.net, linux-arm-kernel@...ts.infradead.org
Subject: Re: [PATCH net-next v3 5/7] net: axienet: implement NAPI and GRO
receive
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.
Powered by blists - more mailing lists