Commit 0f0c0452 authored by Paolo Abeni's avatar Paolo Abeni

Merge branch 'devices-always-netif_f_lltx'

Peilin Ye says:

====================
devices always NETIF_F_LLTX

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

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/
====================

Link: https://lore.kernel.org/r/cover.1651207788.git.peilin.ye@bytedance.comSigned-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
parents 6e28f56c b11ebf2c
...@@ -748,6 +748,7 @@ static netdev_tx_t gre_tap_xmit(struct sk_buff *skb, ...@@ -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) static void ipgre_link_update(struct net_device *dev, bool set_mtu)
{ {
struct ip_tunnel *tunnel = netdev_priv(dev); struct ip_tunnel *tunnel = netdev_priv(dev);
__be16 flags;
int len; int len;
len = tunnel->tun_hlen; len = tunnel->tun_hlen;
...@@ -763,19 +764,15 @@ static void ipgre_link_update(struct net_device *dev, bool set_mtu) ...@@ -763,19 +764,15 @@ static void ipgre_link_update(struct net_device *dev, bool set_mtu)
if (set_mtu) if (set_mtu)
dev->mtu = max_t(int, dev->mtu - len, 68); dev->mtu = max_t(int, dev->mtu - len, 68);
if (!(tunnel->parms.o_flags & TUNNEL_SEQ)) { flags = tunnel->parms.o_flags;
if (!(tunnel->parms.o_flags & TUNNEL_CSUM) ||
tunnel->encap.type == TUNNEL_ENCAP_NONE) { if (flags & TUNNEL_SEQ ||
dev->features |= NETIF_F_GSO_SOFTWARE; (flags & TUNNEL_CSUM && tunnel->encap.type != TUNNEL_ENCAP_NONE)) {
dev->hw_features |= NETIF_F_GSO_SOFTWARE; dev->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 {
dev->hw_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) ...@@ -949,6 +946,7 @@ static void ipgre_tunnel_setup(struct net_device *dev)
static void __gre_tunnel_init(struct net_device *dev) static void __gre_tunnel_init(struct net_device *dev)
{ {
struct ip_tunnel *tunnel; struct ip_tunnel *tunnel;
__be16 flags;
tunnel = netdev_priv(dev); tunnel = netdev_priv(dev);
tunnel->tun_hlen = gre_calc_hlen(tunnel->parms.o_flags); tunnel->tun_hlen = gre_calc_hlen(tunnel->parms.o_flags);
...@@ -957,25 +955,21 @@ static void __gre_tunnel_init(struct net_device *dev) ...@@ -957,25 +955,21 @@ static void __gre_tunnel_init(struct net_device *dev)
tunnel->hlen = tunnel->tun_hlen + tunnel->encap_hlen; tunnel->hlen = tunnel->tun_hlen + tunnel->encap_hlen;
dev->needed_headroom = tunnel->hlen + sizeof(tunnel->parms.iph); 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; dev->hw_features |= GRE_FEATURES;
if (!(tunnel->parms.o_flags & TUNNEL_SEQ)) { flags = tunnel->parms.o_flags;
/* 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;
}
/* Can use a lockless transmit, unless we generate /* TCP offload with GRE SEQ is not supported, nor can we support 2
* output sequences * levels of outer headers requiring an update.
*/ */
dev->features |= NETIF_F_LLTX; 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) static int ipgre_tunnel_init(struct net_device *dev)
......
...@@ -382,11 +382,6 @@ static struct ip6_tnl *ip6gre_tunnel_locate(struct net *net, ...@@ -382,11 +382,6 @@ static struct ip6_tnl *ip6gre_tunnel_locate(struct net *net,
goto failed_free; goto failed_free;
ip6gre_tnl_link_config(nt, 1); 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); ip6gre_tunnel_link(ign, nt);
return nt; return nt;
...@@ -1445,26 +1440,23 @@ static void ip6gre_tunnel_setup(struct net_device *dev) ...@@ -1445,26 +1440,23 @@ static void ip6gre_tunnel_setup(struct net_device *dev)
static void ip6gre_tnl_init_features(struct net_device *dev) static void ip6gre_tnl_init_features(struct net_device *dev)
{ {
struct ip6_tnl *nt = netdev_priv(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; dev->hw_features |= GRE6_FEATURES;
if (!(nt->parms.o_flags & TUNNEL_SEQ)) { flags = nt->parms.o_flags;
/* 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;
}
/* Can use a lockless transmit, unless we generate /* TCP offload with GRE SEQ is not supported, nor can we support 2
* output sequences * levels of outer headers requiring an update.
*/ */
dev->features |= NETIF_F_LLTX; 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) static int ip6gre_tunnel_init_common(struct net_device *dev)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment