• James Chapman's avatar
    l2tp: store l2tpv2 sessions in per-net IDR · 2a3339f6
    James Chapman authored
    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: default avatarJames Chapman <jchapman@katalix.com>
    Reviewed-by: default avatarTom Parkin <tparkin@katalix.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    2a3339f6
l2tp_core.h 11.2 KB