[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <3e889e5d-0a10-4529-a506-b26f65f4c157@lunn.ch>
Date: Sun, 14 Sep 2025 20:53:38 +0200
From: Andrew Lunn <andrew@...n.ch>
To: Yeounsu Moon <yyyynoom@...il.com>
Cc: Andrew Lunn <andrew+netdev@...n.ch>,
"David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>,
netdev@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH net v2 2/2] net: dlink: handle copy_thresh allocation
failure
> This patch adds proper error handling by falling back to the `else` clause
> when the allocation fails.
> + if (pkt_len <= copy_thresh) {
> + skb = netdev_alloc_skb_ip_align(dev, pkt_len);
> + if (!skb)
> + goto reuse_skbuff;
> +
> dma_sync_single_for_cpu(&np->pdev->dev,
> desc_to_dma(desc),
> np->rx_buf_sz,
> @@ -985,6 +982,14 @@ receive_packet (struct net_device *dev)
> desc_to_dma(desc),
> np->rx_buf_sz,
> DMA_FROM_DEVICE);
> + } else {
> +reuse_skbuff:
To me, the name is confusing. What Ethernet drivers usually mean with
reuse of an skbuf, is that they will give it straight back to the
hardware for use. If you can successfully do copy break, this makes
sense, the frame is no longer in the skbuf, it is in a new skbuf, so
the old skbuf can be recycled.
But that is not what is going on here. Copy break fails, and you fall
back to the normal path. The data is still in the skbuf, so you cannot
reuse it.
Andrew
---
pw-bot: cr
Powered by blists - more mailing lists