diff mbox series

[net-next,v2] wireguard: Wire-up big tcp support

Message ID 20241004165518.120567-1-daniel@iogearbox.net (mailing list archive)
State Awaiting Upstream
Delegated to: Netdev Maintainers
Headers show
Series [net-next,v2] wireguard: Wire-up big tcp support | expand

Checks

Context Check Description
netdev/series_format success Single patches do not need cover letters
netdev/tree_selection success Clearly marked for net-next
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 6 this patch: 6
netdev/build_tools success No tools touched, skip
netdev/cc_maintainers warning 1 maintainers not CCed: pabeni@redhat.com
netdev/build_clang success Errors and warnings before: 6 this patch: 6
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 5 this patch: 5
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 7 lines checked
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0
netdev/contest success net-next-2024-10-06--15-00 (tests: 775)

Commit Message

Daniel Borkmann Oct. 4, 2024, 4:55 p.m. UTC
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(+)

Comments

Jason A. Donenfeld Oct. 7, 2024, 4:42 p.m. UTC | #1
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
Daniel Borkmann Oct. 7, 2024, 5:50 p.m. UTC | #2
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
diff mbox series

Patch

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;