]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
ipv6: sr: Prepare HMAC key ahead of time
authorEric Biggers <ebiggers@kernel.org>
Sun, 24 Aug 2025 01:36:44 +0000 (21:36 -0400)
committerJakub Kicinski <kuba@kernel.org>
Wed, 27 Aug 2025 01:11:29 +0000 (18:11 -0700)
commitfe60065689048edf4df99fffdb180a2166f9a54d
treeeb6d86af91ea0b85b711cfad0a1fc96e0087b412
parent095928e7d80186c524013a5b5d54889fa2ec1eaa
ipv6: sr: Prepare HMAC key ahead of time

Prepare the HMAC key when it is added to the kernel, instead of
preparing it implicitly for every packet.  This significantly improves
the performance of seg6_hmac_compute().  A microbenchmark on x86_64
shows seg6_hmac_compute() (with HMAC-SHA256) dropping from ~1978 cycles
to ~1419 cycles, a 28% improvement.

The size of 'struct seg6_hmac_info' increases by 128 bytes, but that
should be fine, since there should not be a massive number of keys.

Signed-off-by: Eric Biggers <ebiggers@kernel.org>
Link: https://patch.msgid.link/20250824013644.71928-3-ebiggers@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
include/net/seg6_hmac.h
net/ipv6/seg6_hmac.c