Skip to contentSkip to conversation

wireguard updates and fixes for 6.13

PATCH Applied Jason A. Donenfeld 2 participants 6 messages Nov 17, 2024 – Nov 19, 2024

Subsystems (4)
lore
Share & tools
lore

Jason A. Donenfeld

author maintainer
#0 lore raw

cover wireguard updates and fixes for 6.13

Hi Jakub/Paolo,

This tiny series (+3/-2) fixes one bug and has three small improvements.

1) Fix running the netns.sh test suite on systems that haven't yet inserted the nf_conntrack module.

2) Remove a stray useless function call in a selftest.

3) There's no need to zero out the netdev private data in recent kernels.

4) Set the TSO max size to be GSO_MAX_SIZE, so that we aggregate larger packets. Daniel reports seeing a 15% improvement in a simple load and suggested the speedups would be even better in more complex loads.

Thanks,
Jason

Daniel Borkmann (1):
wireguard: device: support big tcp GSO

Dheeraj Reddy Jonnalagadda (1):
wireguard: allowedips: remove redundant selftest call

Hangbin Liu (1):
wireguard: selftests: load nf_conntrack if not present

Tobias Klauser (1):
wireguard: device: omit unnecessary memset of netdev private data

 drivers/net/wireguard/device.c              | 3 ++-
 drivers/net/wireguard/selftest/allowedips.c | 1 -
 tools/testing/selftests/wireguard/netns.sh  | 1 +
 3 files changed, 3 insertions(+), 2 deletions(-)
Signature · 1 line
2.46.0
author maintainer
#1 lore raw

PATCH 1/4 wireguard: device: omit unnecessary memset of netdev private data

From: Tobias Klauser <[email protected]>

The memory for netdev_priv is allocated using kvzalloc in alloc_netdev_mqs before rtnl_link_ops->setup is called so there is no need to zero it again in wg_setup.

---
 drivers/net/wireguard/device.c | 1 -
 1 file changed, 1 deletion(-)
drivers/net/wireguard/device.c +0 -1
index 45e9b908dbfb..a2ba71fbbed4 100644
@@ -302,7 +302,6 @@ static void wg_setup(struct net_device *dev)
 	/* We need to keep the dst around in case of icmp replies. */
 	netif_keep_dst(dev);
 
-	memset(wg, 0, sizeof(*wg));
 	wg->dev = dev;
 }
 
Signature · 1 line
2.46.0
author maintainer
#2 lore raw

PATCH 2/4 wireguard: allowedips: remove redundant selftest call

In reply to Jason A. Donenfeld

From: Dheeraj Reddy Jonnalagadda <[email protected]>

This commit fixes a useless call issue detected by Coverity (CID 1508092). The call to horrible_allowedips_lookup_v4 is unnecessary as its return value is never checked.

Fixes e7096c131e51 ("net: WireGuard secure network tunnel")
---
 drivers/net/wireguard/selftest/allowedips.c | 1 -
 1 file changed, 1 deletion(-)
drivers/net/wireguard/selftest/allowedips.c +0 -1
index 3d1f64ff2e12..25de7058701a 100644
@@ -383,7 +383,6 @@ static __init bool randomized_test(void)
 		for (i = 0; i < NUM_QUERIES; ++i) {
 			get_random_bytes(ip, 4);
 			if (lookup(t.root4, 32, ip) != horrible_allowedips_lookup_v4(&h, (struct in_addr *)ip)) {
-				horrible_allowedips_lookup_v4(&h, (struct in_addr *)ip);
 				pr_err("allowedips random v4 self-test: FAIL\n");
 				goto free;
 			}
Signature · 1 line
2.46.0
author maintainer
#3 lore raw

PATCH 3/4 wireguard: selftests: load nf_conntrack if not present

In reply to Jason A. Donenfeld

From: Hangbin Liu <[email protected]>

Some distros may not load nf_conntrack by default, which will cause subsequent nf_conntrack sets to fail. Load this module if it is not already loaded.

Fixes e7096c131e51 ("net: WireGuard secure network tunnel")
[ Jason: add [[ -e ... ]] check so this works in the qemu harness. ]
---
 tools/testing/selftests/wireguard/netns.sh | 1 +
 1 file changed, 1 insertion(+)
tools/testing/selftests/wireguard/netns.sh +1 -0
index 405ff262ca93..55500f901fbc 100755
@@ -332,6 +332,7 @@ waitiface $netns1 vethc
 waitiface $netns2 veths
 
 n0 bash -c 'printf 1 > /proc/sys/net/ipv4/ip_forward'
+[[ -e /proc/sys/net/netfilter/nf_conntrack_udp_timeout ]] || modprobe nf_conntrack
 n0 bash -c 'printf 2 > /proc/sys/net/netfilter/nf_conntrack_udp_timeout'
 n0 bash -c 'printf 2 > /proc/sys/net/netfilter/nf_conntrack_udp_timeout_stream'
 n0 iptables -t nat -A POSTROUTING -s 192.168.1.0/24 -d 10.0.0.0/24 -j SNAT --to 10.0.0.1
Signature · 1 line
2.46.0
author maintainer
#4 lore raw

PATCH 4/4 wireguard: device: support big tcp GSO

In reply to Jason A. Donenfeld

From: Daniel Borkmann <[email protected]>

Advertise GSO_MAX_SIZE as TSO max size in order support BIG TCP for wireguard. This helps to improve wireguard performance a bit when enabled as it allows wireguard to aggregate larger skbs in wg_packet_consume_data_done() via napi_gro_receive(), but also allows the stack to build larger skbs on xmit where the driver then segments them before encryption inside wg_xmit(). We've seen a 15% improvement in TCP stream performance.

---
 drivers/net/wireguard/device.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/net/wireguard/device.c +2 -0
index a2ba71fbbed4..6cf173a008e7 100644
@@ -302,6 +302,8 @@ static void wg_setup(struct net_device *dev)
 	/* We need to keep the dst around in case of icmp replies. */
 	netif_keep_dst(dev);
 
+	netif_set_tso_max_size(dev, GSO_MAX_SIZE);
+
 	wg->dev = dev;
 }
 
Signature · 1 line
2.46.0
#5 lore raw
In reply to Jason A. Donenfeld
This series was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Hello:

This series was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Quoted 8 lines · On Sun, 17 Nov 2024 22:20:26 +0100 you wrote:

Hi Jakub/Paolo,

This tiny series (+3/-2) fixes one bug and has three small improvements.

1) Fix running the netns.sh test suite on systems that haven't yet inserted the nf_conntrack module.

[...]

Here is the summary with links:
- [net-next,1/4] wireguard: device: omit unnecessary memset of netdev private data

    https://git.kernel.org/netdev/net-next/c/2c862914fbcf
  - [net-next,2/4] wireguard: allowedips: remove redundant selftest call
    https://git.kernel.org/netdev/net-next/c/c1822fb64f67
  - [net-next,3/4] wireguard: selftests: load nf_conntrack if not present
    https://git.kernel.org/netdev/net-next/c/0290abc98609
  - [net-next,4/4] wireguard: device: support big tcp GSO
    https://git.kernel.org/netdev/net-next/c/06a34f7db773

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html