Dmitry Safonov 459837b522 net/tcp: Disable TCP-MD5 static key on tcp_md5sig_info destruction
To do that, separate two scenarios:
- where it's the first MD5 key on the system, which means that enabling
  of the static key may need to sleep;
- copying of an existing key from a listening socket to the request
  socket upon receiving a signed TCP segment, where static key was
  already enabled (when the key was added to the listening socket).

Now the life-time of the static branch for TCP-MD5 is until:
- last tcp_md5sig_info is destroyed
- last socket in time-wait state with MD5 key is closed.

Which means that after all sockets with TCP-MD5 keys are gone, the
system gets back the performance of disabled md5-key static branch.

While at here, provide static_key_fast_inc() helper that does ref
counter increment in atomic fashion (without grabbing cpus_read_lock()
on CONFIG_JUMP_LABEL=y). This is needed to add a new user for
a static_key when the caller controls the lifetime of another user.

Signed-off-by: Dmitry Safonov <dima@arista.com>
Acked-by: Jakub Kicinski <kuba@kernel.org>
Reviewed-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2022-12-01 15:53:05 -08:00
..
2021-05-17 15:29:35 -07:00
2022-11-16 12:48:44 +00:00
2022-11-16 12:48:44 +00:00
2022-11-16 12:48:44 +00:00
2022-11-16 12:48:44 +00:00
2022-11-16 12:48:44 +00:00
2022-10-28 10:47:42 +01:00
2021-05-17 15:29:35 -07:00
2022-06-21 11:38:29 +02:00
2022-06-24 22:48:33 -07:00
2022-10-28 10:47:42 +01:00
2022-09-20 10:21:49 -07:00
2021-05-17 15:29:35 -07:00
2022-11-16 09:43:35 +00:00
2022-11-16 09:43:35 +00:00