[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <DD16EAXYP4SM.1JYDYPDJ4I7VV@gmail.com>
Date: Thu, 25 Sep 2025 01:36:57 +0900
From: "Yeounsu Moon" <yyyynoom@...il.com>
To: "Jakub Kicinski" <kuba@...nel.org>
Cc: "Andrew Lunn" <andrew+netdev@...n.ch>, "David S. Miller"
<davem@...emloft.net>, "Eric Dumazet" <edumazet@...gle.com>, "Paolo Abeni"
<pabeni@...hat.com>, <netdev@...r.kernel.org>,
<linux-kernel@...r.kernel.org>
Subject: Re: [PATCH net v3 2/2] net: dlink: handle copy_thresh allocation
failure
On Thu Sep 18, 2025 at 8:09 AM KST, Jakub Kicinski wrote:
Thank you for reviewing! and sorry for the delayed reply.
There have been quite a lot of things on my end recently.
> On Wed, 17 Sep 2025 03:33:05 +0900 Yeounsu Moon wrote:
>> @@ -965,14 +965,11 @@ receive_packet (struct net_device *dev)
>> struct sk_buff *skb;
>>
>> /* Small skbuffs for short packets */
>> - if (pkt_len > copy_thresh) {
>> - dma_unmap_single(&np->pdev->dev,
>> - desc_to_dma(desc),
>> - np->rx_buf_sz,
>> - DMA_FROM_DEVICE);
>> - skb_put(skb = np->rx_skbuff[entry], pkt_len);
>> - np->rx_skbuff[entry] = NULL;
>> - } else if ((skb = netdev_alloc_skb_ip_align(dev, pkt_len))) {
>> + if (pkt_len <= copy_thresh) {
>> + skb = netdev_alloc_skb_ip_align(dev, pkt_len);
>> + if (!skb)
>> + goto fallback_to_normal_path;
>
> The goto looks pretty awkward.
>
> skb = NULL;
> if (pkt_len <= copy_thresh)
> skb = netdev_alloc_skb_ip_align(dev, pkt_len);
> if (!skb) {
> // existing non-copy path
> } else {
> // existing copybreak path
> }
I totally agree with your point. However, the two cases handle `skb` and
`rx_skbuff` differently depending on the `copy_thresh` condition,
regardless of whether `skb` is NULL or not.
This patch is only intended to gracefully handle the failure case when `skb`
allocation fails.
Yeounsu Moon
Powered by blists - more mailing lists