]> www.infradead.org Git - users/hch/configfs.git/commit
l2tp: store l2tpv2 sessions in per-net IDR
authorJames Chapman <jchapman@katalix.com>
Thu, 20 Jun 2024 11:22:39 +0000 (12:22 +0100)
committerDavid S. Miller <davem@davemloft.net>
Fri, 21 Jun 2024 10:33:33 +0000 (11:33 +0100)
commit2a3339f6c9636aa39f2493865e4664df1ef2baed
tree26a15f56b6328b138e00f322fe479afbaf488354
parentaa5e17e1f5ecb68d3f67a069f7345dbf1a8f274f
l2tp: store l2tpv2 sessions in per-net IDR

L2TPv2 sessions are currently kept in a per-tunnel hashlist, keyed by
16-bit session_id. When handling received L2TPv2 packets, we need to
first derive the tunnel using the 16-bit tunnel_id or sock, then
lookup the session in a per-tunnel hlist using the 16-bit session_id.

We want to avoid using sk_user_data in the datapath and double lookups
on every packet. So instead, use a per-net IDR to hold L2TPv2
sessions, keyed by a 32-bit value derived from the 16-bit tunnel_id
and session_id. This will allow the L2TPv2 UDP receive datapath to
lookup a session with a single lookup without deriving the tunnel
first.

L2TPv2 sessions are held in their own IDR to avoid potential
key collisions with L2TPv3 sessions.

Signed-off-by: James Chapman <jchapman@katalix.com>
Reviewed-by: Tom Parkin <tparkin@katalix.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/l2tp/l2tp_core.c
net/l2tp/l2tp_core.h