• Eric Dumazet's avatar
    ipv4: udp: optimize unicast RX path · 5051ebd2
    Eric Dumazet authored
    We first locate the (local port) hash chain head
    If few sockets are in this chain, we proceed with previous lookup algo.
    
    If too many sockets are listed, we take a look at the secondary
    (port, address) hash chain we added in previous patch.
    
    We choose the shortest chain and proceed with a RCU lookup on the elected chain.
    
    But, if we chose (port, address) chain, and fail to find a socket on given address,
     we must try another lookup on (port, INADDR_ANY) chain to find socket not bound
    to a particular IP.
    
    -> No extra cost for typical setups, where the first lookup will probabbly
    be performed.
    
    RCU lookups everywhere, we dont acquire spinlock.
    Signed-off-by: default avatarEric Dumazet <eric.dumazet@gmail.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    5051ebd2
udp.c 52.6 KB