tcp/dccp: better use of ephemeral ports in bind()
authorEric Dumazet <edumazet@google.com>
Fri, 12 Feb 2016 00:28:50 +0000 (16:28 -0800)
committerDavid S. Miller <davem@davemloft.net>
Fri, 12 Feb 2016 10:28:32 +0000 (05:28 -0500)
commitea8add2b190395408b22a9127bed2c0912aecbc8
tree8b75745c913c33eba2707c3dc5fb0e312bfe3387
parent1580ab63fc9a03593072cc5656167a75c4f1d173
tcp/dccp: better use of ephemeral ports in bind()

Implement strategy used in __inet_hash_connect() in opposite way :

Try to find a candidate using odd ports, then fallback to even ports.

We no longer disable BH for whole traversal, but one bucket at a time.
We also use cond_resched() to yield cpu to other tasks if needed.

I removed one indentation level and tried to mirror the loop we have
in __inet_hash_connect() and variable names to ease code maintenance.

Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ipv4/inet_connection_sock.c