[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250924161151.7d6054c2@kernel.org>
Date: Wed, 24 Sep 2025 16:11:51 -0700
From: Jakub Kicinski <kuba@...nel.org>
To: "Yeounsu Moon" <yyyynoom@...il.com>
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, 25 Sep 2025 01:36:57 +0900 Yeounsu Moon wrote:
> > 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.
I don't understand.
Powered by blists - more mailing lists