Development discussion of WireGuard
 help / color / mirror / Atom feed
* [PATCH net-next v2] wireguard: Wire-up big tcp support
@ 2024-10-04 16:55 Daniel Borkmann
  2024-10-07 16:42 ` Jason A. Donenfeld
  0 siblings, 1 reply; 3+ messages in thread
From: Daniel Borkmann @ 2024-10-04 16:55 UTC (permalink / raw)
  To: kuba; +Cc: edumazet, Jason, aspsk, m, netdev, wireguard

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

Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Cc: Jason A. Donenfeld <Jason@zx2c4.com>
Cc: Anton Protopopov <aspsk@isovalent.com>
Cc: Martynas Pumputis <m@lambda.lt>
---
 v2: fixed up my gitconfig and Cc's now

 drivers/net/wireguard/device.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/wireguard/device.c b/drivers/net/wireguard/device.c
index 45e9b908dbfb..79be517b2216 100644
--- a/drivers/net/wireguard/device.c
+++ b/drivers/net/wireguard/device.c
@@ -301,6 +301,7 @@ 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);
 
 	memset(wg, 0, sizeof(*wg));
 	wg->dev = dev;
-- 
2.43.0


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

* Re: [PATCH net-next v2] wireguard: Wire-up big tcp support
  2024-10-04 16:55 [PATCH net-next v2] wireguard: Wire-up big tcp support Daniel Borkmann
@ 2024-10-07 16:42 ` Jason A. Donenfeld
  2024-10-07 17:50   ` Daniel Borkmann
  0 siblings, 1 reply; 3+ messages in thread
From: Jason A. Donenfeld @ 2024-10-07 16:42 UTC (permalink / raw)
  To: Daniel Borkmann; +Cc: kuba, edumazet, aspsk, m, netdev, wireguard

Hi Daniel,

On Fri, Oct 04, 2024 at 06:55:18PM +0200, Daniel Borkmann wrote:
> 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().

Thanks, I'll queue this up. Do you have any perf numbers on the speedup,
btw?

Jason

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

* Re: [PATCH net-next v2] wireguard: Wire-up big tcp support
  2024-10-07 16:42 ` Jason A. Donenfeld
@ 2024-10-07 17:50   ` Daniel Borkmann
  0 siblings, 0 replies; 3+ messages in thread
From: Daniel Borkmann @ 2024-10-07 17:50 UTC (permalink / raw)
  To: Jason A. Donenfeld; +Cc: kuba, edumazet, aspsk, m, netdev, wireguard

Hi Jason,

On 10/7/24 6:42 PM, Jason A. Donenfeld wrote:
> On Fri, Oct 04, 2024 at 06:55:18PM +0200, Daniel Borkmann wrote:
>> 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().
> 
> Thanks, I'll queue this up. Do you have any perf numbers on the speedup,
> btw?

Awesome, thanks! Few weeks back we had an LPC session with some initial work
around wireguard performance (https://lpc.events/event/18/contributions/1968/)
including benchmarks. It depends on the specific scenario, but this as well as
an L2 GRO implementation (yet to come as patches in the next weeks) we got
~+15% for host-host in case of TCP STREAM. In case of Cilium I haven't done
the measurement yet, but I expect that there would be further gains as bigger
packets can traverse the stack and thus less processing in upper layers (e.g.
our tcx BPF code).

Thanks,
Daniel

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

end of thread, other threads:[~2024-11-18  2:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-10-04 16:55 [PATCH net-next v2] wireguard: Wire-up big tcp support Daniel Borkmann
2024-10-07 16:42 ` Jason A. Donenfeld
2024-10-07 17:50   ` Daniel Borkmann

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