Re: [PATCH net v3 2/2] net: dlink: handle copy_thresh allocation failure
From: Yeounsu Moon <hidden>
Date: 2025-09-24 16:37:01
Also in:
lkml
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:quoted
@@ -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