* [PATCH net-next 0/2] Make [IP6]GRE[TAP] devices always NETIF_F_LLTX
@ 2022-04-21 22:43 Peilin Ye
2022-04-21 22:44 ` [PATCH net-next 1/2] ip_gre: Make GRE and GRETAP " Peilin Ye
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Peilin Ye @ 2022-04-21 22:43 UTC (permalink / raw)
To: David S. Miller, Jakub Kicinski, Hideaki YOSHIFUJI, David Ahern,
Paolo Abeni
Cc: Peilin Ye, Cong Wang, Eric Dumazet, netdev, linux-kernel, Peilin Ye
From: Peilin Ye <peilin.ye@bytedance.com>
Hi all,
This patchset depends on these fixes [1]. 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. 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] 5+ messages in thread
* [PATCH net-next 1/2] ip_gre: Make GRE and GRETAP devices always NETIF_F_LLTX
2022-04-21 22:43 [PATCH net-next 0/2] Make [IP6]GRE[TAP] devices always NETIF_F_LLTX Peilin Ye
@ 2022-04-21 22:44 ` Peilin Ye
2022-04-21 22:45 ` [PATCH net-next 2/2] ip6_gre: Make IP6GRE and IP6GRETAP " Peilin Ye
2022-04-25 18:02 ` [PATCH net-next 0/2] Make [IP6]GRE[TAP] " Jakub Kicinski
2 siblings, 0 replies; 5+ messages in thread
From: Peilin Ye @ 2022-04-21 22:44 UTC (permalink / raw)
To: David S. Miller, Jakub Kicinski, Hideaki YOSHIFUJI, David Ahern,
Paolo Abeni
Cc: Peilin Ye, Cong Wang, Eric Dumazet, 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).
Depends on patch "ip_gre, ip6_gre: Fix race condition on o_seqno in
collect_md mode".
Signed-off-by: Peilin Ye <peilin.ye@bytedance.com>
---
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] 5+ messages in thread
* [PATCH net-next 2/2] ip6_gre: Make IP6GRE and IP6GRETAP devices always NETIF_F_LLTX
2022-04-21 22:43 [PATCH net-next 0/2] Make [IP6]GRE[TAP] devices always NETIF_F_LLTX Peilin Ye
2022-04-21 22:44 ` [PATCH net-next 1/2] ip_gre: Make GRE and GRETAP " Peilin Ye
@ 2022-04-21 22:45 ` Peilin Ye
2022-04-25 18:02 ` [PATCH net-next 0/2] Make [IP6]GRE[TAP] " Jakub Kicinski
2 siblings, 0 replies; 5+ messages in thread
From: Peilin Ye @ 2022-04-21 22:45 UTC (permalink / raw)
To: David S. Miller, Jakub Kicinski, Hideaki YOSHIFUJI, David Ahern,
Paolo Abeni
Cc: Peilin Ye, Cong Wang, Eric Dumazet, 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>
---
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] 5+ messages in thread
* Re: [PATCH net-next 0/2] Make [IP6]GRE[TAP] devices always NETIF_F_LLTX
2022-04-21 22:43 [PATCH net-next 0/2] Make [IP6]GRE[TAP] devices always NETIF_F_LLTX Peilin Ye
2022-04-21 22:44 ` [PATCH net-next 1/2] ip_gre: Make GRE and GRETAP " Peilin Ye
2022-04-21 22:45 ` [PATCH net-next 2/2] ip6_gre: Make IP6GRE and IP6GRETAP " Peilin Ye
@ 2022-04-25 18:02 ` Jakub Kicinski
2022-04-25 19:05 ` Peilin Ye
2 siblings, 1 reply; 5+ messages in thread
From: Jakub Kicinski @ 2022-04-25 18:02 UTC (permalink / raw)
To: Peilin Ye
Cc: David S. Miller, Hideaki YOSHIFUJI, David Ahern, Paolo Abeni,
Peilin Ye, Cong Wang, Eric Dumazet, netdev, linux-kernel
On Thu, 21 Apr 2022 15:43:42 -0700 Peilin Ye wrote:
> This patchset depends on these fixes [1]. 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).
LGTM, thanks, but please repost on Thu / Fri. The fixes make their way
into net-next on Thu so until then we can't apply.
> 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. Please suggest
> if I'm missing something, thanks!
Probably good to CC William when you repost.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH net-next 0/2] Make [IP6]GRE[TAP] devices always NETIF_F_LLTX
2022-04-25 18:02 ` [PATCH net-next 0/2] Make [IP6]GRE[TAP] " Jakub Kicinski
@ 2022-04-25 19:05 ` Peilin Ye
0 siblings, 0 replies; 5+ messages in thread
From: Peilin Ye @ 2022-04-25 19:05 UTC (permalink / raw)
To: Jakub Kicinski
Cc: David S. Miller, Hideaki YOSHIFUJI, David Ahern, Paolo Abeni,
Peilin Ye, Cong Wang, Eric Dumazet, netdev, linux-kernel
Hi Jakub,
On Mon, Apr 25, 2022 at 11:02:59AM -0700, Jakub Kicinski wrote:
> On Thu, 21 Apr 2022 15:43:42 -0700 Peilin Ye wrote:
> > This patchset depends on these fixes [1]. 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).
>
> LGTM, thanks, but please repost on Thu / Fri. The fixes make their way
> into net-next on Thu so until then we can't apply.
Thanks for the review!
> > 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. Please suggest
> > if I'm missing something, thanks!
>
> Probably good to CC William when you repost.
Sure, I will resend then.
Thanks,
Peilin Ye
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2022-04-25 19:05 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-21 22:43 [PATCH net-next 0/2] Make [IP6]GRE[TAP] devices always NETIF_F_LLTX Peilin Ye
2022-04-21 22:44 ` [PATCH net-next 1/2] ip_gre: Make GRE and GRETAP " Peilin Ye
2022-04-21 22:45 ` [PATCH net-next 2/2] ip6_gre: Make IP6GRE and IP6GRETAP " Peilin Ye
2022-04-25 18:02 ` [PATCH net-next 0/2] Make [IP6]GRE[TAP] " Jakub Kicinski
2022-04-25 19:05 ` Peilin Ye
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).