]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
psp: use sk->sk_hash in psp_write_headers()
authorEric Dumazet <edumazet@google.com>
Wed, 18 Feb 2026 14:13:37 +0000 (14:13 +0000)
committerJakub Kicinski <kuba@kernel.org>
Thu, 19 Feb 2026 22:04:23 +0000 (14:04 -0800)
commitf891007ab1c77436950d10e09eae54507f1865ff
tree7fb77fda1423e77a451a92aaa8647933375d7169
parent858d2a4f67ff69e645a43487ef7ea7f28f06deae
psp: use sk->sk_hash in psp_write_headers()

udp_flow_src_port() is indirectly using sk->sk_txhash as a base,
because __tcp_transmit_skb() uses skb_set_hash_from_sk().

This is problematic because this field can change over the
lifetime of a TCP flow, thanks to calls to sk_rethink_txhash().

Problem is that some NIC might (ab)use the PSP UDP source port in their
RSS computation, and PSP packets for a given flow could jump
from one queue to another.

In order to avoid surprises, it is safer to let Protective Load
Balancing (PLB) get its entropy from the IPv6 flowlabel,
and change psp_write_headers() to use sk->sk_hash which
does not change for the duration of the flow.

We might add a sysctl to select the behavior, if there
is a need for it.

Fixes: fc724515741a ("psp: provide encapsulation helper for drivers")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Reviewed-By: Daniel Zahka <daniel.zahka@gmail.com>
Link: https://patch.msgid.link/20260218141337.999945-1-edumazet@google.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
net/psp/psp_main.c