netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next 0/4] wireguard updates and fixes for 6.13
@ 2024-11-17 21:20 Jason A. Donenfeld
  2024-11-17 21:20 ` [PATCH net-next 1/4] wireguard: device: omit unnecessary memset of netdev private data Jason A. Donenfeld
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Jason A. Donenfeld @ 2024-11-17 21:20 UTC (permalink / raw)
  To: netdev, kuba, pabeni; +Cc: Jason A. Donenfeld

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(-)

-- 
2.46.0


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

* [PATCH net-next 1/4] wireguard: device: omit unnecessary memset of netdev private data
  2024-11-17 21:20 [PATCH net-next 0/4] wireguard updates and fixes for 6.13 Jason A. Donenfeld
@ 2024-11-17 21:20 ` Jason A. Donenfeld
  2024-11-17 21:20 ` [PATCH net-next 2/4] wireguard: allowedips: remove redundant selftest call Jason A. Donenfeld
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Jason A. Donenfeld @ 2024-11-17 21:20 UTC (permalink / raw)
  To: netdev, kuba, pabeni; +Cc: Tobias Klauser, Simon Horman, Jason A. Donenfeld

From: Tobias Klauser <tklauser@distanz.ch>

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.

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Reviewed-by: Simon Horman <horms@kernel.org>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
---
 drivers/net/wireguard/device.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/net/wireguard/device.c b/drivers/net/wireguard/device.c
index 45e9b908dbfb..a2ba71fbbed4 100644
--- a/drivers/net/wireguard/device.c
+++ b/drivers/net/wireguard/device.c
@@ -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;
 }
 
-- 
2.46.0


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

* [PATCH net-next 2/4] wireguard: allowedips: remove redundant selftest call
  2024-11-17 21:20 [PATCH net-next 0/4] wireguard updates and fixes for 6.13 Jason A. Donenfeld
  2024-11-17 21:20 ` [PATCH net-next 1/4] wireguard: device: omit unnecessary memset of netdev private data Jason A. Donenfeld
@ 2024-11-17 21:20 ` Jason A. Donenfeld
  2024-11-17 21:20 ` [PATCH net-next 3/4] wireguard: selftests: load nf_conntrack if not present Jason A. Donenfeld
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Jason A. Donenfeld @ 2024-11-17 21:20 UTC (permalink / raw)
  To: netdev, kuba, pabeni; +Cc: Dheeraj Reddy Jonnalagadda, Jason A. Donenfeld

From: Dheeraj Reddy Jonnalagadda <dheeraj.linuxdev@gmail.com>

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.

Signed-off-by: Dheeraj Reddy Jonnalagadda <dheeraj.linuxdev@gmail.com>
Fixes: e7096c131e51 ("net: WireGuard secure network tunnel")
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
---
 drivers/net/wireguard/selftest/allowedips.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/net/wireguard/selftest/allowedips.c b/drivers/net/wireguard/selftest/allowedips.c
index 3d1f64ff2e12..25de7058701a 100644
--- a/drivers/net/wireguard/selftest/allowedips.c
+++ b/drivers/net/wireguard/selftest/allowedips.c
@@ -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;
 			}
-- 
2.46.0


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

* [PATCH net-next 3/4] wireguard: selftests: load nf_conntrack if not present
  2024-11-17 21:20 [PATCH net-next 0/4] wireguard updates and fixes for 6.13 Jason A. Donenfeld
  2024-11-17 21:20 ` [PATCH net-next 1/4] wireguard: device: omit unnecessary memset of netdev private data Jason A. Donenfeld
  2024-11-17 21:20 ` [PATCH net-next 2/4] wireguard: allowedips: remove redundant selftest call Jason A. Donenfeld
@ 2024-11-17 21:20 ` Jason A. Donenfeld
  2024-11-17 21:20 ` [PATCH net-next 4/4] wireguard: device: support big tcp GSO Jason A. Donenfeld
  2024-11-19  4:00 ` [PATCH net-next 0/4] wireguard updates and fixes for 6.13 patchwork-bot+netdevbpf
  4 siblings, 0 replies; 6+ messages in thread
From: Jason A. Donenfeld @ 2024-11-17 21:20 UTC (permalink / raw)
  To: netdev, kuba, pabeni; +Cc: Hangbin Liu, Simon Horman, Jason A. Donenfeld

From: Hangbin Liu <liuhangbin@gmail.com>

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")
Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
Reviewed-by: Simon Horman <horms@kernel.org>
[ Jason: add [[ -e ... ]] check so this works in the qemu harness. ]
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
---
 tools/testing/selftests/wireguard/netns.sh | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/testing/selftests/wireguard/netns.sh b/tools/testing/selftests/wireguard/netns.sh
index 405ff262ca93..55500f901fbc 100755
--- a/tools/testing/selftests/wireguard/netns.sh
+++ b/tools/testing/selftests/wireguard/netns.sh
@@ -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
-- 
2.46.0


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

* [PATCH net-next 4/4] wireguard: device: support big tcp GSO
  2024-11-17 21:20 [PATCH net-next 0/4] wireguard updates and fixes for 6.13 Jason A. Donenfeld
                   ` (2 preceding siblings ...)
  2024-11-17 21:20 ` [PATCH net-next 3/4] wireguard: selftests: load nf_conntrack if not present Jason A. Donenfeld
@ 2024-11-17 21:20 ` Jason A. Donenfeld
  2024-11-19  4:00 ` [PATCH net-next 0/4] wireguard updates and fixes for 6.13 patchwork-bot+netdevbpf
  4 siblings, 0 replies; 6+ messages in thread
From: Jason A. Donenfeld @ 2024-11-17 21:20 UTC (permalink / raw)
  To: netdev, kuba, pabeni; +Cc: Daniel Borkmann, Jason A. Donenfeld

From: Daniel Borkmann <daniel@iogearbox.net>

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.

Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
---
 drivers/net/wireguard/device.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/net/wireguard/device.c b/drivers/net/wireguard/device.c
index a2ba71fbbed4..6cf173a008e7 100644
--- a/drivers/net/wireguard/device.c
+++ b/drivers/net/wireguard/device.c
@@ -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;
 }
 
-- 
2.46.0


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

* Re: [PATCH net-next 0/4] wireguard updates and fixes for 6.13
  2024-11-17 21:20 [PATCH net-next 0/4] wireguard updates and fixes for 6.13 Jason A. Donenfeld
                   ` (3 preceding siblings ...)
  2024-11-17 21:20 ` [PATCH net-next 4/4] wireguard: device: support big tcp GSO Jason A. Donenfeld
@ 2024-11-19  4:00 ` patchwork-bot+netdevbpf
  4 siblings, 0 replies; 6+ messages in thread
From: patchwork-bot+netdevbpf @ 2024-11-19  4:00 UTC (permalink / raw)
  To: Jason A. Donenfeld; +Cc: netdev, kuba, pabeni

Hello:

This series was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:

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!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



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

end of thread, other threads:[~2024-11-19  4:00 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-17 21:20 [PATCH net-next 0/4] wireguard updates and fixes for 6.13 Jason A. Donenfeld
2024-11-17 21:20 ` [PATCH net-next 1/4] wireguard: device: omit unnecessary memset of netdev private data Jason A. Donenfeld
2024-11-17 21:20 ` [PATCH net-next 2/4] wireguard: allowedips: remove redundant selftest call Jason A. Donenfeld
2024-11-17 21:20 ` [PATCH net-next 3/4] wireguard: selftests: load nf_conntrack if not present Jason A. Donenfeld
2024-11-17 21:20 ` [PATCH net-next 4/4] wireguard: device: support big tcp GSO Jason A. Donenfeld
2024-11-19  4:00 ` [PATCH net-next 0/4] wireguard updates and fixes for 6.13 patchwork-bot+netdevbpf

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).