public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Ben Hutchings <ben@decadent.org.uk>
To: Jakub Kicinski <kuba@kernel.org>, davem@davemloft.net
Cc: netdev@vger.kernel.org, edumazet@google.com, pabeni@redhat.com,
	 andrew+netdev@lunn.ch, horms@kernel.org, sdf@fomichev.me,
	hawk@kernel.org,  alexander.h.duyck@intel.com
Subject: Re: [PATCH net v2] net: consume xmit errors of GSO frames
Date: Wed, 25 Mar 2026 13:01:59 +0100	[thread overview]
Message-ID: <cfbb231e80caceb4138e37d036de7dca39ec7e7b.camel@decadent.org.uk> (raw)
In-Reply-To: <20260223235100.108939-1-kuba@kernel.org>

[-- Attachment #1: Type: text/plain, Size: 2108 bytes --]

On Mon, 2026-02-23 at 15:51 -0800, Jakub Kicinski wrote:
[...]
> --- a/net/core/dev.c
> +++ b/net/core/dev.c
> @@ -4822,6 +4822,8 @@ int __dev_queue_xmit(struct sk_buff *skb, struct net_device *sb_dev)
>  		 * to -1 or to their cpu id, but not to our id.
>  		 */
>  		if (READ_ONCE(txq->xmit_lock_owner) != cpu) {
> +			bool is_list = false;
> +
>  			if (dev_xmit_recursion())
>  				goto recursion_alert;
>  
> @@ -4832,17 +4834,28 @@ int __dev_queue_xmit(struct sk_buff *skb, struct net_device *sb_dev)
>  			HARD_TX_LOCK(dev, txq, cpu);
>  
>  			if (!netif_xmit_stopped(txq)) {
> +				is_list = !!skb->next;
> +
>  				dev_xmit_recursion_inc();
>  				skb = dev_hard_start_xmit(skb, dev, txq, &rc);
>  				dev_xmit_recursion_dec();
> -				if (dev_xmit_complete(rc)) {
> -					HARD_TX_UNLOCK(dev, txq);
> -					goto out;
> -				}
> +
> +				/* GSO segments a single SKB into
> +				 * a list of frames. TCP expects error
> +				 * to mean none of the data was sent.
> +				 */
> +				if (is_list)
> +					rc = NETDEV_TX_OK;
>  			}
>  			HARD_TX_UNLOCK(dev, txq);
> +			if (!skb) /* xmit completed */
> +				goto out;
> +
>  			net_crit_ratelimited("Virtual device %s asks to queue packet!\n",
>  					     dev->name);
> +			/* NETDEV_TX_BUSY or queue was stopped */
> +			if (!is_list)
> +				rc = -ENETDOWN;
>  		} else {
>  			/* Recursion is detected! It is possible,
>  			 * unfortunately
> @@ -4850,10 +4863,10 @@ int __dev_queue_xmit(struct sk_buff *skb, struct net_device *sb_dev)
>  recursion_alert:
>  			net_crit_ratelimited("Dead loop on virtual device %s, fix it urgently!\n",
>  					     dev->name);
> +			rc = -ENETDOWN;
>  		}
>  	}
>  
> -	rc = -ENETDOWN;

After removing this assignment, rc is not set properly in case the
device is down or TX is stopped.

Perhaps this assignment should be restored before the check for
(dev->flags & IFF_UP)?

Ben.

>  	rcu_read_unlock_bh();
>  
>  	dev_core_stats_tx_dropped_inc(dev);

-- 
Ben Hutchings
Theory and practice are closer in theory than in practice - John Levine

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

      parent reply	other threads:[~2026-03-25 12:02 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-23 23:51 [PATCH net v2] net: consume xmit errors of GSO frames Jakub Kicinski
2026-02-24  9:00 ` Eric Dumazet
2026-02-26 10:40 ` patchwork-bot+netdevbpf
2026-03-25 12:01 ` Ben Hutchings [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=cfbb231e80caceb4138e37d036de7dca39ec7e7b.camel@decadent.org.uk \
    --to=ben@decadent.org.uk \
    --cc=alexander.h.duyck@intel.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=hawk@kernel.org \
    --cc=horms@kernel.org \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=sdf@fomichev.me \
    /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