All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Yeounsu Moon" <yyyynoom@gmail.com>
To: "Jakub Kicinski" <kuba@kernel.org>
Cc: "Andrew Lunn" <andrew+netdev@lunn.ch>,
	"David S. Miller" <davem@davemloft.net>,
	"Eric Dumazet" <edumazet@google.com>,
	"Paolo Abeni" <pabeni@redhat.com>, <netdev@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH net v3 2/2] net: dlink: handle copy_thresh allocation failure
Date: Thu, 25 Sep 2025 01:36:57 +0900	[thread overview]
Message-ID: <DD16EAXYP4SM.1JYDYPDJ4I7VV@gmail.com> (raw)
In-Reply-To: <20250917160924.6c2a5f47@kernel.org>

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

  reply	other threads:[~2025-09-24 16:37 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-16 18:33 [PATCH net v3 0/2] net: dlink: handle copy_thresh allocation Yeounsu Moon
2025-09-16 18:33 ` [PATCH net v3 1/2] net: dlink: fix whitespace around function call Yeounsu Moon
2025-09-17 23:06   ` Jakub Kicinski
2025-09-24 16:38     ` Yeounsu Moon
2025-09-24 23:12       ` Jakub Kicinski
2025-09-16 18:33 ` [PATCH net v3 2/2] net: dlink: handle copy_thresh allocation failure Yeounsu Moon
2025-09-16 19:36   ` Andrew Lunn
2025-09-17 23:09   ` Jakub Kicinski
2025-09-24 16:36     ` Yeounsu Moon [this message]
2025-09-24 23:11       ` Jakub Kicinski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=DD16EAXYP4SM.1JYDYPDJ4I7VV@gmail.com \
    --to=yyyynoom@gmail.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.