mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrew Lunn <andrew@lunn.ch>
To: Yeounsu Moon <yyyynoom@gmail.com>
Cc: Andrew Lunn <andrew+netdev@lunn.ch>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH net v2 2/2] net: dlink: handle copy_thresh allocation failure
Date: Sun, 14 Sep 2025 20:53:38 +0200	[thread overview]
Message-ID: <3e889e5d-0a10-4529-a506-b26f65f4c157@lunn.ch> (raw)
In-Reply-To: <20250914182653.3152-4-yyyynoom@gmail.com>

> 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

      reply	other threads:[~2025-09-14 18:53 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-14 18:26 [PATCH net v2 0/2] net: dlink: handle copy_thresh allocation Yeounsu Moon
2025-09-14 18:26 ` [PATCH net v2 1/2] net: dlink: fix whitespace around function call Yeounsu Moon
2025-09-14 18:55   ` Andrew Lunn
2025-09-14 18:26 ` [PATCH net v2 2/2] net: dlink: handle copy_thresh allocation failure Yeounsu Moon
2025-09-14 18:53   ` Andrew Lunn [this message]

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=3e889e5d-0a10-4529-a506-b26f65f4c157@lunn.ch \
    --to=andrew@lunn.ch \
    --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 \
    --cc=yyyynoom@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®