All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 net-next 0/2] ip_gre, ip6_gre: Make [IP6]GRE[TAP] devices always NETIF_F_LLTX
@ 2022-04-29  5:24 Peilin Ye
  2022-04-29  5:25 ` [PATCH v2 net-next 1/2] ip_gre: Make GRE and GRETAP " Peilin Ye
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Peilin Ye @ 2022-04-29  5:24 UTC (permalink / raw)
  To: David S. Miller, Jakub Kicinski, Eric Dumazet, Hideaki YOSHIFUJI,
	David Ahern, Paolo Abeni
  Cc: Peilin Ye, William Tu, Cong Wang, netdev, linux-kernel, Peilin Ye

From: Peilin Ye <peilin.ye@bytedance.com>

v1: https://lore.kernel.org/netdev/cover.1650580763.git.peilin.ye@bytedance.com/

change since v1:
  - deleted "depends on patch..." in [1/2]'s commit message

Hi all,

This patchset depends on these fixes [1], which has been merged into
net-next.  Since o_seqno is now atomic_t, we can always turn on
NETIF_F_LLTX for [IP6]GRE[TAP] devices, since we no longer need the TX
lock (&txq->_xmit_lock).

We could probably do the same thing to [IP6]ERSPAN devices as well, but
I'm not familiar with them yet.  For example, ERSPAN devices are
initialized as |= GRE_FEATURES in erspan_tunnel_init(), but I don't see
IP6ERSPAN devices being initialized as |= GRE6_FEATURES.  Where should we
initialize IP6ERSPAN devices' ->features?  Please suggest if I'm missing
something, thanks!

[1] https://lore.kernel.org/netdev/cover.1650575919.git.peilin.ye@bytedance.com/

Thanks,
Peilin Ye (2):
  ip_gre: Make GRE and GRETAP devices always NETIF_F_LLTX
  ip6_gre: Make IP6GRE and IP6GRETAP devices always NETIF_F_LLTX

 net/ipv4/ip_gre.c  | 50 ++++++++++++++++++++--------------------------
 net/ipv6/ip6_gre.c | 34 ++++++++++++-------------------
 2 files changed, 35 insertions(+), 49 deletions(-)

-- 
2.20.1


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

* [PATCH v2 net-next 1/2] ip_gre: Make GRE and GRETAP devices always NETIF_F_LLTX
  2022-04-29  5:24 [PATCH v2 net-next 0/2] ip_gre, ip6_gre: Make [IP6]GRE[TAP] devices always NETIF_F_LLTX Peilin Ye
@ 2022-04-29  5:25 ` Peilin Ye
  2022-04-29  5:25 ` [PATCH v2 net-next 2/2] ip6_gre: Make IP6GRE and IP6GRETAP " Peilin Ye
  2022-05-02  8:50 ` [PATCH v2 net-next 0/2] ip_gre, ip6_gre: Make [IP6]GRE[TAP] " patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: Peilin Ye @ 2022-04-29  5:25 UTC (permalink / raw)
  To: David S. Miller, Jakub Kicinski, Eric Dumazet, Hideaki YOSHIFUJI,
	David Ahern, Paolo Abeni
  Cc: Peilin Ye, William Tu, Cong Wang, netdev, linux-kernel, Peilin Ye

From: Peilin Ye <peilin.ye@bytedance.com>

Recently we made o_seqno atomic_t.  Stop special-casing TUNNEL_SEQ, and
always mark GRE[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>
---
change since v1:
  - deleted "depends on patch..." in commit message

 net/ipv4/ip_gre.c | 50 +++++++++++++++++++++--------------------------
 1 file changed, 22 insertions(+), 28 deletions(-)

diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c
index 8cf86e42c1d1..a81c2964f70b 100644
--- a/net/ipv4/ip_gre.c
+++ b/net/ipv4/ip_gre.c
@@ -748,6 +748,7 @@ static netdev_tx_t gre_tap_xmit(struct sk_buff *skb,
 static void ipgre_link_update(struct net_device *dev, bool set_mtu)
 {
 	struct ip_tunnel *tunnel = netdev_priv(dev);
+	__be16 flags;
 	int len;
 
 	len = tunnel->tun_hlen;
@@ -763,19 +764,15 @@ static void ipgre_link_update(struct net_device *dev, bool set_mtu)
 	if (set_mtu)
 		dev->mtu = max_t(int, dev->mtu - len, 68);
 
-	if (!(tunnel->parms.o_flags & TUNNEL_SEQ)) {
-		if (!(tunnel->parms.o_flags & TUNNEL_CSUM) ||
-		    tunnel->encap.type == TUNNEL_ENCAP_NONE) {
-			dev->features |= NETIF_F_GSO_SOFTWARE;
-			dev->hw_features |= NETIF_F_GSO_SOFTWARE;
-		} else {
-			dev->features &= ~NETIF_F_GSO_SOFTWARE;
-			dev->hw_features &= ~NETIF_F_GSO_SOFTWARE;
-		}
-		dev->features |= NETIF_F_LLTX;
-	} else {
+	flags = tunnel->parms.o_flags;
+
+	if (flags & TUNNEL_SEQ ||
+	    (flags & TUNNEL_CSUM && tunnel->encap.type != TUNNEL_ENCAP_NONE)) {
+		dev->features &= ~NETIF_F_GSO_SOFTWARE;
 		dev->hw_features &= ~NETIF_F_GSO_SOFTWARE;
-		dev->features &= ~(NETIF_F_LLTX | NETIF_F_GSO_SOFTWARE);
+	} else {
+		dev->features |= NETIF_F_GSO_SOFTWARE;
+		dev->hw_features |= NETIF_F_GSO_SOFTWARE;
 	}
 }
 
@@ -949,6 +946,7 @@ static void ipgre_tunnel_setup(struct net_device *dev)
 static void __gre_tunnel_init(struct net_device *dev)
 {
 	struct ip_tunnel *tunnel;
+	__be16 flags;
 
 	tunnel = netdev_priv(dev);
 	tunnel->tun_hlen = gre_calc_hlen(tunnel->parms.o_flags);
@@ -957,25 +955,21 @@ static void __gre_tunnel_init(struct net_device *dev)
 	tunnel->hlen = tunnel->tun_hlen + tunnel->encap_hlen;
 	dev->needed_headroom = tunnel->hlen + sizeof(tunnel->parms.iph);
 
-	dev->features		|= GRE_FEATURES;
+	dev->features		|= GRE_FEATURES | NETIF_F_LLTX;
 	dev->hw_features	|= GRE_FEATURES;
 
-	if (!(tunnel->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 (!(tunnel->parms.o_flags & TUNNEL_CSUM) ||
-		    (tunnel->encap.type == TUNNEL_ENCAP_NONE)) {
-			dev->features    |= NETIF_F_GSO_SOFTWARE;
-			dev->hw_features |= NETIF_F_GSO_SOFTWARE;
-		}
+	flags = tunnel->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 && tunnel->encap.type != TUNNEL_ENCAP_NONE)
+		return;
+
+	dev->features |= NETIF_F_GSO_SOFTWARE;
+	dev->hw_features |= NETIF_F_GSO_SOFTWARE;
 }
 
 static int ipgre_tunnel_init(struct net_device *dev)
-- 
2.20.1


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

* [PATCH v2 net-next 2/2] ip6_gre: Make IP6GRE and IP6GRETAP devices always NETIF_F_LLTX
  2022-04-29  5:24 [PATCH v2 net-next 0/2] ip_gre, ip6_gre: Make [IP6]GRE[TAP] devices always NETIF_F_LLTX Peilin Ye
  2022-04-29  5:25 ` [PATCH v2 net-next 1/2] ip_gre: Make GRE and GRETAP " Peilin Ye
@ 2022-04-29  5:25 ` Peilin Ye
  2022-05-02  8:50 ` [PATCH v2 net-next 0/2] ip_gre, ip6_gre: Make [IP6]GRE[TAP] " patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: Peilin Ye @ 2022-04-29  5:25 UTC (permalink / raw)
  To: David S. Miller, Jakub Kicinski, Eric Dumazet, Hideaki YOSHIFUJI,
	David Ahern, Paolo Abeni
  Cc: Peilin Ye, William Tu, Cong Wang, netdev, linux-kernel, Peilin Ye

From: Peilin Ye <peilin.ye@bytedance.com>

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>
---
(no changes since v1)

 net/ipv6/ip6_gre.c | 34 +++++++++++++---------------------
 1 file changed, 13 insertions(+), 21 deletions(-)

diff --git a/net/ipv6/ip6_gre.c b/net/ipv6/ip6_gre.c
index 5136959b3dc5..4e37f7c29900 100644
--- a/net/ipv6/ip6_gre.c
+++ b/net/ipv6/ip6_gre.c
@@ -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)
-- 
2.20.1


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

* Re: [PATCH v2 net-next 0/2] ip_gre, ip6_gre: Make [IP6]GRE[TAP] devices always NETIF_F_LLTX
  2022-04-29  5:24 [PATCH v2 net-next 0/2] ip_gre, ip6_gre: Make [IP6]GRE[TAP] devices always NETIF_F_LLTX Peilin Ye
  2022-04-29  5:25 ` [PATCH v2 net-next 1/2] ip_gre: Make GRE and GRETAP " Peilin Ye
  2022-04-29  5:25 ` [PATCH v2 net-next 2/2] ip6_gre: Make IP6GRE and IP6GRETAP " Peilin Ye
@ 2022-05-02  8:50 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: patchwork-bot+netdevbpf @ 2022-05-02  8:50 UTC (permalink / raw)
  To: Peilin Ye
  Cc: davem, kuba, eric.dumazet, yoshfuji, dsahern, pabeni, peilin.ye,
	u9012063, cong.wang, netdev, linux-kernel

Hello:

This series was applied to netdev/net-next.git (master)
by Paolo Abeni <pabeni@redhat.com>:

On Thu, 28 Apr 2022 22:24:17 -0700 you wrote:
> From: Peilin Ye <peilin.ye@bytedance.com>
> 
> v1: https://lore.kernel.org/netdev/cover.1650580763.git.peilin.ye@bytedance.com/
> 
> change since v1:
>   - deleted "depends on patch..." in [1/2]'s commit message
> 
> [...]

Here is the summary with links:
  - [v2,net-next,1/2] ip_gre: Make GRE and GRETAP devices always NETIF_F_LLTX
    https://git.kernel.org/netdev/net-next/c/020e8f60aa8b
  - [v2,net-next,2/2] ip6_gre: Make IP6GRE and IP6GRETAP devices always NETIF_F_LLTX
    https://git.kernel.org/netdev/net-next/c/b11ebf2ca2c1

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



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

end of thread, other threads:[~2022-05-02  8:50 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-29  5:24 [PATCH v2 net-next 0/2] ip_gre, ip6_gre: Make [IP6]GRE[TAP] devices always NETIF_F_LLTX Peilin Ye
2022-04-29  5:25 ` [PATCH v2 net-next 1/2] ip_gre: Make GRE and GRETAP " Peilin Ye
2022-04-29  5:25 ` [PATCH v2 net-next 2/2] ip6_gre: Make IP6GRE and IP6GRETAP " Peilin Ye
2022-05-02  8:50 ` [PATCH v2 net-next 0/2] ip_gre, ip6_gre: Make [IP6]GRE[TAP] " patchwork-bot+netdevbpf

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.