diff options
author | Gabriel Oginski <gabrielx.oginski@intel.com> | 2021-10-08 09:09:45 +0100 |
---|---|---|
committer | Matthew Smith <mgsmith@netgate.com> | 2021-11-03 16:04:00 +0000 |
commit | 4739c8833e2e8013417ef0e52610d8b310e97a93 (patch) | |
tree | dbcc0c49dbeacad72005ef58c22d0e4ab13c2250 /src/plugins/wireguard/wireguard_peer.h | |
parent | 505fd37b31aa5a7d242184ebe281dbd4622ad277 (diff) |
wireguard: reduce memcopy and prefetch header
Originally wireguard implementation does memory copy of the whole
packet in encryption and decryption.
This patch removes unnecessary packet copy in wireguard. In addition,
it contains some performance improvement such as prefetching header
and deleting unnecessary lock and unlock for decryption.
Type: improvement
Signed-off-by: Gabriel Oginski <gabrielx.oginski@intel.com>
Change-Id: I1fe8e54d749e6922465341083b448c842e2b670f
Diffstat (limited to 'src/plugins/wireguard/wireguard_peer.h')
-rw-r--r-- | src/plugins/wireguard/wireguard_peer.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/plugins/wireguard/wireguard_peer.h b/src/plugins/wireguard/wireguard_peer.h index a08fff73d68..1af5799bc76 100644 --- a/src/plugins/wireguard/wireguard_peer.h +++ b/src/plugins/wireguard/wireguard_peer.h @@ -33,12 +33,26 @@ typedef struct ip4_udp_header_t_ udp_header_t udp; } __clib_packed ip4_udp_header_t; +typedef struct ip4_udp_wg_header_t_ +{ + ip4_header_t ip4; + udp_header_t udp; + message_data_t wg; +} __clib_packed ip4_udp_wg_header_t; + typedef struct ip6_udp_header_t_ { ip6_header_t ip6; udp_header_t udp; } __clib_packed ip6_udp_header_t; +typedef struct ip6_udp_wg_header_t_ +{ + ip6_header_t ip6; + udp_header_t udp; + message_data_t wg; +} __clib_packed ip6_udp_wg_header_t; + u8 *format_ip4_udp_header (u8 * s, va_list * va); u8 *format_ip6_udp_header (u8 *s, va_list *va); |