mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Dave Jiang <dave.jiang@intel.com>
To: Koichiro Den <den@valinux.co.jp>, Jon Mason <jdmason@kudzu.us>,
	Allen Hubbe <allenbh@gmail.com>,
	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>,
	Nicholas Bellinger <nab@linux-iscsi.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: ntb@lists.linux.dev, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH net] NTB: ntb_netdev: Preserve RX queue depth on allocation failure
Date: Thu, 6 Aug 2026 09:13:38 -0700	[thread overview]
Message-ID: <8fff7c7b-726a-4d9b-b950-6968d07f54ca@intel.com> (raw)
In-Reply-To: <20260806032537.3526498-1-den@valinux.co.jp>



On 8/5/26 8:25 PM, Koichiro Den wrote:
> ntb_netdev_rx_handler() hands the received skb to the network stack
> before allocating its replacement. If the allocation fails, nothing is
> reposted. Every failure therefore takes one buffer out of the RX queue
> while the interface remains up, and enough failures eventually stall
> reception.
> 
> A retry path could refill the queue later, but ntb_netdev has none.
> Allocate the replacement first instead. If that fails, drop the packet
> and repost the same skb. This keeps the queue full and lets packet
> delivery resume as soon as memory is available again.
> 
> Fixes: 548c237c0a99 ("net: Add support for NTB virtual ethernet device")
> Cc: stable@vger.kernel.org
> Signed-off-by: Koichiro Den <den@valinux.co.jp>

Reviewed-by: Dave Jiang <dave.jiang@intel.com>

> ---
>  drivers/net/ntb_netdev.c | 15 ++++++++-------
>  1 file changed, 8 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/net/ntb_netdev.c b/drivers/net/ntb_netdev.c
> index c3a6ba96fc8a..029a4a532a10 100644
> --- a/drivers/net/ntb_netdev.c
> +++ b/drivers/net/ntb_netdev.c
> @@ -127,8 +127,8 @@ static void ntb_netdev_rx_handler(struct ntb_transport_qp *qp, void *qp_data,
>  {
>  	struct ntb_netdev_queue *q = qp_data;
>  	struct ntb_netdev *dev = q->ntdev;
> +	struct sk_buff *skb, *new_skb;
>  	struct net_device *ndev;
> -	struct sk_buff *skb;
>  	int rc;
>  
>  	ndev = dev->ndev;
> @@ -144,6 +144,12 @@ static void ntb_netdev_rx_handler(struct ntb_transport_qp *qp, void *qp_data,
>  		goto enqueue_again;
>  	}
>  
> +	new_skb = netdev_alloc_skb(ndev, ndev->mtu + ETH_HLEN);
> +	if (!new_skb) {
> +		ndev->stats.rx_dropped++;
> +		goto enqueue_again;
> +	}
> +
>  	skb_put(skb, len);
>  	skb->protocol = eth_type_trans(skb, ndev);
>  	skb->ip_summed = CHECKSUM_NONE;
> @@ -157,12 +163,7 @@ static void ntb_netdev_rx_handler(struct ntb_transport_qp *qp, void *qp_data,
>  		ndev->stats.rx_bytes += len;
>  	}
>  
> -	skb = netdev_alloc_skb(ndev, ndev->mtu + ETH_HLEN);
> -	if (!skb) {
> -		ndev->stats.rx_errors++;
> -		ndev->stats.rx_frame_errors++;
> -		return;
> -	}
> +	skb = new_skb;
>  
>  enqueue_again:
>  	rc = ntb_transport_rx_enqueue(qp, skb, skb->data, ndev->mtu + ETH_HLEN);


  reply	other threads:[~2026-08-06 16:13 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-06  3:25 Koichiro Den
2026-08-06 16:13 ` Dave Jiang [this message]
2026-08-11  9:20 ` patchwork-bot+netdevbpf

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=8fff7c7b-726a-4d9b-b950-6968d07f54ca@intel.com \
    --to=dave.jiang@intel.com \
    --cc=allenbh@gmail.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=den@valinux.co.jp \
    --cc=edumazet@google.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jdmason@kudzu.us \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nab@linux-iscsi.org \
    --cc=netdev@vger.kernel.org \
    --cc=ntb@lists.linux.dev \
    --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 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®