• Leon Romanovsky's avatar
    xfrm: speed-up lookup of HW policies · 3c611d40
    Leon Romanovsky authored
    Devices that implement IPsec packet offload mode should offload SA and
    policies too. In RX path, it causes to the situation that HW will always
    have higher priority over any SW policies.
    
    It means that we don't need to perform any search of inexact policies
    and/or priority checks if HW policy was discovered. In such situation,
    the HW will catch the packets anyway and HW can still implement inexact
    lookups.
    
    In case specific policy is not found, we will continue with packet lookup and
    check for existence of HW policies in inexact list.
    
    HW policies are added to the head of SPD to ensure fast lookup, as XFRM
    iterates over all policies in the loop.
    
    The same solution of adding HW SAs at the begging of the list is applied
    to SA database too. However, we don't need to change lookups as they are
    sorted by insertion order and not priority.
    Signed-off-by: default avatarLeon Romanovsky <leonro@nvidia.com>
    Signed-off-by: default avatarSteffen Klassert <steffen.klassert@secunet.com>
    3c611d40
xfrm_state.c 73.6 KB