Patch "ip6_gre: fix device features for ioctl setup" has been added to the 4.14-stable tree
Subsystems (3)
This is a note to let you know that I've just added the patch titled
ip6_gre: fix device features for ioctl setup
to the 4.14-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
The filename of the patch is:
ip6_gre-fix-device-features-for-ioctl-setup.patch
and it can be found in the queue-4.14 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.
Quoted 1 line
From foo@baz Sun Dec 31 11:12:48 CET 2017
From: Alexey Kodanev <[email protected]>
Date: Wed, 20 Dec 2017 19:36:03 +0300
Subject: ip6_gre: fix device features for ioctl setup
From: Alexey Kodanev <[email protected]>
[ Upstream commit e5a9336adb317db55eb3fe8200856096f3c71109 ]
When ip6gre is created using ioctl, its features, such as scatter-gather, GSO and tx-checksumming will be turned off:
# ip -f inet6 tunnel add gre6 mode ip6gre remote fd00::1
# ethtool -k gre6 (truncated output)
tx-checksumming: off
scatter-gather: off
tcp-segmentation-offload: off
generic-segmentation-offload: off [requested on]But when netlink is used, they will be enabled:
# ip link add gre6 type ip6gre remote fd00::1
# ethtool -k gre6 (truncated output)
tx-checksumming: on
scatter-gather: on
tcp-segmentation-offload: on
generic-segmentation-offload: onThis results in a loss of performance when gre6 is created via ioctl. The issue was found with LTP/gre tests.
Fix it by moving the setup of device features to a separate function and invoke it with ndo_init callback because both netlink and ioctl will eventually call it via register_netdevice():
register_netdevice()
- ndo_init() callback -> ip6gre_tunnel_init() or ip6gre_tap_init()
- ip6gre_tunnel_init_common()
- ip6gre_tnl_init_features()
The moved code also contains two minor style fixes:
* removed needless tab from GRE6_FEATURES on NETIF_F_HIGHDMA line.
* fixed the issue reported by checkpatch: "Unnecessary parentheses around
'nt->encap.type == TUNNEL_ENCAP_NONE'"
--- net/ipv6/ip6_gre.c | 57 +++++++++++++++++++++++++++++------------------------ 1 file changed, 32 insertions(+), 25 deletions(-)
net/ipv6/ip6_gre.c +32 -25
@@ -1020,6 +1020,36 @@ static void ip6gre_tunnel_setup(struct neth_random_addr (dev->perm_addr); } +#define GRE6_FEATURES (NETIF_F_SG | \ + NETIF_F_FRAGLIST | \ + NETIF_F_HIGHDMA | \ + NETIF_F_HW_CSUM) + +static void ip6gre_tnl_init_features (struct net_device *dev) +{ +struct ip6_tnl *nt =netdev_priv (dev); + + dev->features |=GRE6_FEATURES ; + 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 ; + } + +/* Can use a lockless transmit, unless we generate +* output sequences +*/ + dev->features |=NETIF_F_LLTX ; + } +} +static int ip6gre_tunnel_init_common (struct net_device *dev) {struct ip6_tnl *tunnel;
@@ -1054,6 +1084,8 @@ static int ip6gre_tunnel_init_common(strif (!(tunnel->parms.flags &IP6_TNL_F_IGN_ENCAP_LIMIT )) dev->mtu -=8 ; +ip6gre_tnl_init_features (dev); +return 0 ; }
@@ -1302,11 +1334,6 @@ static const struct net_device_ops ip6gr .ndo_get_iflink = ip6_tnl_get_iflink, }; -#define GRE6_FEATURES (NETIF_F_SG | \ - NETIF_F_FRAGLIST | \ - NETIF_F_HIGHDMA | \ - NETIF_F_HW_CSUM) -static void ip6gre_tap_setup (struct net_device *dev) {
@@ -1386,26 +1413,6 @@ static int ip6gre_newlink(struct net *sr nt->net =dev_net (dev);ip6gre_tnl_link_config (nt, !tb[IFLA_MTU ]); - dev->features |=GRE6_FEATURES ; - 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 ; - } - -/* Can use a lockless transmit, unless we generate -* output sequences -*/ - dev->features |=NETIF_F_LLTX ; - } - err =register_netdevice (dev);if (err) goto out;
Patches currently in stable-queue which might be from [email protected] are
queue-4.14/vxlan-restore-dev-mtu-setting-based-on-lower-device.patch queue-4.14/ip6_gre-fix-device-features-for-ioctl-setup.patch