提交 0b2531bd 编写于 作者: F Folkert van Heusden 提交者: David S. Miller

[TCP]: Optimize check in port-allocation code.

Signed-off-by: NFolkert van Heusden <folkert@vanheusden.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 20cc6bef
......@@ -222,10 +222,13 @@ static int tcp_v4_get_port(struct sock *sk, unsigned short snum)
int rover;
spin_lock(&tcp_portalloc_lock);
rover = tcp_port_rover;
if (tcp_port_rover < low)
rover = low;
else
rover = tcp_port_rover;
do {
rover++;
if (rover < low || rover > high)
if (rover > high)
rover = low;
head = &tcp_bhash[tcp_bhashfn(rover)];
spin_lock(&head->lock);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册