]> git.baikalelectronics.ru Git - kernel.git/commit
ipv4: udp: optimize unicast RX path
authorEric Dumazet <eric.dumazet@gmail.com>
Sun, 8 Nov 2009 10:18:11 +0000 (10:18 +0000)
committerDavid S. Miller <davem@davemloft.net>
Mon, 9 Nov 2009 04:53:07 +0000 (20:53 -0800)
commit37fe1bbfe6663dcb210f1e6d0fb9fa082ee865f9
treebfbf0d9f1b231671a8ee20d92a04d26860eb38b1
parent7e398ec2e78cf5529fb65f88b74e8286981de4bc
ipv4: udp: optimize unicast RX path

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: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ipv4/udp.c