Netdev List
 help / color / mirror / Atom feed
* [PATCH] net: gre: fix lltx regression for GRE tunnels with SEQ/CSUM
@ 2026-07-09 10:52 Yun Zhou
  2026-07-13  8:53 ` Ido Schimmel
  0 siblings, 1 reply; 3+ messages in thread
From: Yun Zhou @ 2026-07-09 10:52 UTC (permalink / raw)
  To: dsahern, idosch, davem, edumazet, kuba, pabeni, horms
  Cc: netdev, linux-kernel, yun.zhou

Before commit 00d066a4d4ed ("netdev_features: convert NETIF_F_LLTX to
dev->lltx"), NETIF_F_LLTX was set unconditionally in __gre_tunnel_init()
alongside GRE_FEATURES:

    dev->features |= GRE_FEATURES | NETIF_F_LLTX;

When that commit converted NETIF_F_LLTX to the dev->lltx flag, it
placed 'dev->lltx = true' after the SEQ/CSUM early returns instead
of before them. This causes GRE/GRETAP tunnels with SEQ or CSUM+encap
to lose lockless TX, reintroducing _xmit_lock acquisition around their
ndo_start_xmit. Since GRE xmit re-enters the stack via
ip_tunnel_xmit(), holding _xmit_lock risks ABBA deadlock with the
underlay device.

  CPU0                        CPU1
  ----                        ----
  lock(&qdisc_xmit_lock_key#6);
                              lock(&qdisc_xmit_lock_key#3);
                              lock(&qdisc_xmit_lock_key#6);
  lock(&qdisc_xmit_lock_key#3);

Fix by moving dev->lltx = true before the early returns, restoring
the original unconditional behavior.

Fixes: 00d066a4d4ed ("netdev_features: convert NETIF_F_LLTX to dev->lltx")
Signed-off-by: Yun Zhou <yun.zhou@windriver.com>
---
 net/ipv4/ip_gre.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c
index 9fbff16cda1d..8c5ad8ec8d09 100644
--- a/net/ipv4/ip_gre.c
+++ b/net/ipv4/ip_gre.c
@@ -1018,6 +1018,8 @@ static void __gre_tunnel_init(struct net_device *dev)
 	dev->features		|= GRE_FEATURES;
 	dev->hw_features	|= GRE_FEATURES;
 
+	dev->lltx = true;
+
 	/* TCP offload with GRE SEQ is not supported, nor can we support 2
 	 * levels of outer headers requiring an update.
 	 */
@@ -1029,8 +1031,6 @@ static void __gre_tunnel_init(struct net_device *dev)
 
 	dev->features |= NETIF_F_GSO_SOFTWARE;
 	dev->hw_features |= NETIF_F_GSO_SOFTWARE;
-
-	dev->lltx = true;
 }
 
 static int ipgre_tunnel_init(struct net_device *dev)
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] net: gre: fix lltx regression for GRE tunnels with SEQ/CSUM
  2026-07-09 10:52 [PATCH] net: gre: fix lltx regression for GRE tunnels with SEQ/CSUM Yun Zhou
@ 2026-07-13  8:53 ` Ido Schimmel
  2026-07-13  9:42   ` Zhou, Yun
  0 siblings, 1 reply; 3+ messages in thread
From: Ido Schimmel @ 2026-07-13  8:53 UTC (permalink / raw)
  To: Yun Zhou
  Cc: dsahern, davem, edumazet, kuba, pabeni, horms, netdev,
	linux-kernel

Patch prefix should be [PATCH net]:

https://docs.kernel.org/process/maintainer-netdev.html

On Thu, Jul 09, 2026 at 06:52:43PM +0800, Yun Zhou wrote:
> Before commit 00d066a4d4ed ("netdev_features: convert NETIF_F_LLTX to
> dev->lltx"), NETIF_F_LLTX was set unconditionally in __gre_tunnel_init()
> alongside GRE_FEATURES:
> 
>     dev->features |= GRE_FEATURES | NETIF_F_LLTX;
> 
> When that commit converted NETIF_F_LLTX to the dev->lltx flag, it
> placed 'dev->lltx = true' after the SEQ/CSUM early returns instead
> of before them. This causes GRE/GRETAP tunnels with SEQ or CSUM+encap
> to lose lockless TX, reintroducing _xmit_lock acquisition around their
> ndo_start_xmit. Since GRE xmit re-enters the stack via
> ip_tunnel_xmit(), holding _xmit_lock risks ABBA deadlock with the
> underlay device.
> 
>   CPU0                        CPU1
>   ----                        ----
>   lock(&qdisc_xmit_lock_key#6);
>                               lock(&qdisc_xmit_lock_key#3);
>                               lock(&qdisc_xmit_lock_key#6);
>   lock(&qdisc_xmit_lock_key#3);
> 
> Fix by moving dev->lltx = true before the early returns, restoring
> the original unconditional behavior.
> 
> Fixes: 00d066a4d4ed ("netdev_features: convert NETIF_F_LLTX to dev->lltx")

Both sashiko instances indicate that this commit introduced the same bug
in ip6gre_tnl_init_features(). Please perform the same fix there and
fold it into v2.

> Signed-off-by: Yun Zhou <yun.zhou@windriver.com>
> ---
>  net/ipv4/ip_gre.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c
> index 9fbff16cda1d..8c5ad8ec8d09 100644
> --- a/net/ipv4/ip_gre.c
> +++ b/net/ipv4/ip_gre.c
> @@ -1018,6 +1018,8 @@ static void __gre_tunnel_init(struct net_device *dev)
>  	dev->features		|= GRE_FEATURES;
>  	dev->hw_features	|= GRE_FEATURES;
>  
> +	dev->lltx = true;
> +
>  	/* TCP offload with GRE SEQ is not supported, nor can we support 2
>  	 * levels of outer headers requiring an update.
>  	 */
> @@ -1029,8 +1031,6 @@ static void __gre_tunnel_init(struct net_device *dev)
>  
>  	dev->features |= NETIF_F_GSO_SOFTWARE;
>  	dev->hw_features |= NETIF_F_GSO_SOFTWARE;
> -
> -	dev->lltx = true;
>  }
>  
>  static int ipgre_tunnel_init(struct net_device *dev)
> -- 
> 2.43.0
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] net: gre: fix lltx regression for GRE tunnels with SEQ/CSUM
  2026-07-13  8:53 ` Ido Schimmel
@ 2026-07-13  9:42   ` Zhou, Yun
  0 siblings, 0 replies; 3+ messages in thread
From: Zhou, Yun @ 2026-07-13  9:42 UTC (permalink / raw)
  To: Ido Schimmel
  Cc: dsahern, davem, edumazet, kuba, pabeni, horms, netdev,
	linux-kernel



On 7/13/26 16:53, Ido Schimmel wrote:
> 
> Patch prefix should be [PATCH net]:
> 
> https://docs.kernel.org/process/maintainer-netdev.html
> 
> On Thu, Jul 09, 2026 at 06:52:43PM +0800, Yun Zhou wrote:
>> Before commit 00d066a4d4ed ("netdev_features: convert NETIF_F_LLTX to
>> dev->lltx"), NETIF_F_LLTX was set unconditionally in __gre_tunnel_init()
>> alongside GRE_FEATURES:
>>
>>      dev->features |= GRE_FEATURES | NETIF_F_LLTX;
>>
>> When that commit converted NETIF_F_LLTX to the dev->lltx flag, it
>> placed 'dev->lltx = true' after the SEQ/CSUM early returns instead
>> of before them. This causes GRE/GRETAP tunnels with SEQ or CSUM+encap
>> to lose lockless TX, reintroducing _xmit_lock acquisition around their
>> ndo_start_xmit. Since GRE xmit re-enters the stack via
>> ip_tunnel_xmit(), holding _xmit_lock risks ABBA deadlock with the
>> underlay device.
>>
>>    CPU0                        CPU1
>>    ----                        ----
>>    lock(&qdisc_xmit_lock_key#6);
>>                                lock(&qdisc_xmit_lock_key#3);
>>                                lock(&qdisc_xmit_lock_key#6);
>>    lock(&qdisc_xmit_lock_key#3);
>>
>> Fix by moving dev->lltx = true before the early returns, restoring
>> the original unconditional behavior.
>>
>> Fixes: 00d066a4d4ed ("netdev_features: convert NETIF_F_LLTX to dev->lltx")
> 
> Both sashiko instances indicate that this commit introduced the same bug
> in ip6gre_tnl_init_features(). Please perform the same fix there and
> fold it into v2.
> 

Thanks a lot for your review. IPv6 indeed has the same issue. I will fix 
it in v2 as you suggested.

BR,
Yun

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-07-13  9:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-09 10:52 [PATCH] net: gre: fix lltx regression for GRE tunnels with SEQ/CSUM Yun Zhou
2026-07-13  8:53 ` Ido Schimmel
2026-07-13  9:42   ` Zhou, Yun

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox