ip6_gre: Make IP6GRE and IP6GRETAP devices always NETIF_F_LLTX
authorPeilin Ye <peilin.ye@bytedance.com>
Fri, 29 Apr 2022 05:25:47 +0000 (22:25 -0700)
committerPaolo Abeni <pabeni@redhat.com>
Mon, 2 May 2022 08:30:33 +0000 (10:30 +0200)
Recently we made o_seqno atomic_t.  Stop special-casing TUNNEL_SEQ, and
always mark IP6GRE[TAP] devices as NETIF_F_LLTX, since we no longer need
the TX lock (&txq->_xmit_lock).

Signed-off-by: Peilin Ye <peilin.ye@bytedance.com>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
net/ipv6/ip6_gre.c

index 5136959b3dc5d64b3bbf2005f52ea1c67d342877..4e37f7c299004f71956a479b6933bd6526d17dde 100644 (file)
@@ -382,11 +382,6 @@ static struct ip6_tnl *ip6gre_tunnel_locate(struct net *net,
                goto failed_free;
 
        ip6gre_tnl_link_config(nt, 1);
-
-       /* Can use a lockless transmit, unless we generate output sequences */
-       if (!(nt->parms.o_flags & TUNNEL_SEQ))
-               dev->features |= NETIF_F_LLTX;
-
        ip6gre_tunnel_link(ign, nt);
        return nt;
 
@@ -1445,26 +1440,23 @@ static void ip6gre_tunnel_setup(struct net_device *dev)
 static void ip6gre_tnl_init_features(struct net_device *dev)
 {
        struct ip6_tnl *nt = netdev_priv(dev);
+       __be16 flags;
 
-       dev->features           |= GRE6_FEATURES;
+       dev->features           |= GRE6_FEATURES | NETIF_F_LLTX;
        dev->hw_features        |= GRE6_FEATURES;
 
-       if (!(nt->parms.o_flags & TUNNEL_SEQ)) {
-               /* TCP offload with GRE SEQ is not supported, nor
-                * can we support 2 levels of outer headers requiring
-                * an update.
-                */
-               if (!(nt->parms.o_flags & TUNNEL_CSUM) ||
-                   nt->encap.type == TUNNEL_ENCAP_NONE) {
-                       dev->features    |= NETIF_F_GSO_SOFTWARE;
-                       dev->hw_features |= NETIF_F_GSO_SOFTWARE;
-               }
+       flags = nt->parms.o_flags;
 
-               /* Can use a lockless transmit, unless we generate
-                * output sequences
-                */
-               dev->features |= NETIF_F_LLTX;
-       }
+       /* TCP offload with GRE SEQ is not supported, nor can we support 2
+        * levels of outer headers requiring an update.
+        */
+       if (flags & TUNNEL_SEQ)
+               return;
+       if (flags & TUNNEL_CSUM && nt->encap.type != TUNNEL_ENCAP_NONE)
+               return;
+
+       dev->features |= NETIF_F_GSO_SOFTWARE;
+       dev->hw_features |= NETIF_F_GSO_SOFTWARE;
 }
 
 static int ip6gre_tunnel_init_common(struct net_device *dev)