diff options
Diffstat (limited to 'net/ipv4')
-rw-r--r-- | net/ipv4/inet_diag.c | 2 | ||||
-rw-r--r-- | net/ipv4/inet_hashtables.c | 2 | ||||
-rw-r--r-- | net/ipv4/inet_timewait_sock.c | 2 | ||||
-rw-r--r-- | net/ipv4/tcp.c | 11 | ||||
-rw-r--r-- | net/ipv4/tcp_ipv4.c | 6 |
5 files changed, 11 insertions, 12 deletions
diff --git a/net/ipv4/inet_diag.c b/net/ipv4/inet_diag.c index a706a47f4dbb..cb73fdefba91 100644 --- a/net/ipv4/inet_diag.c +++ b/net/ipv4/inet_diag.c | |||
@@ -774,7 +774,7 @@ skip_listen_ht: | |||
774 | if (!(r->idiag_states & ~(TCPF_LISTEN | TCPF_SYN_RECV))) | 774 | if (!(r->idiag_states & ~(TCPF_LISTEN | TCPF_SYN_RECV))) |
775 | goto unlock; | 775 | goto unlock; |
776 | 776 | ||
777 | for (i = s_i; i < hashinfo->ehash_size; i++) { | 777 | for (i = s_i; i <= hashinfo->ehash_mask; i++) { |
778 | struct inet_ehash_bucket *head = &hashinfo->ehash[i]; | 778 | struct inet_ehash_bucket *head = &hashinfo->ehash[i]; |
779 | spinlock_t *lock = inet_ehash_lockp(hashinfo, i); | 779 | spinlock_t *lock = inet_ehash_lockp(hashinfo, i); |
780 | struct sock *sk; | 780 | struct sock *sk; |
diff --git a/net/ipv4/inet_hashtables.c b/net/ipv4/inet_hashtables.c index 625cc5f64c94..a45aaf3d48b1 100644 --- a/net/ipv4/inet_hashtables.c +++ b/net/ipv4/inet_hashtables.c | |||
@@ -209,7 +209,7 @@ struct sock * __inet_lookup_established(struct net *net, | |||
209 | * have wildcards anyways. | 209 | * have wildcards anyways. |
210 | */ | 210 | */ |
211 | unsigned int hash = inet_ehashfn(net, daddr, hnum, saddr, sport); | 211 | unsigned int hash = inet_ehashfn(net, daddr, hnum, saddr, sport); |
212 | unsigned int slot = hash & (hashinfo->ehash_size - 1); | 212 | unsigned int slot = hash & hashinfo->ehash_mask; |
213 | struct inet_ehash_bucket *head = &hashinfo->ehash[slot]; | 213 | struct inet_ehash_bucket *head = &hashinfo->ehash[slot]; |
214 | 214 | ||
215 | rcu_read_lock(); | 215 | rcu_read_lock(); |
diff --git a/net/ipv4/inet_timewait_sock.c b/net/ipv4/inet_timewait_sock.c index 13f0781f35cd..2fe571155b22 100644 --- a/net/ipv4/inet_timewait_sock.c +++ b/net/ipv4/inet_timewait_sock.c | |||
@@ -430,7 +430,7 @@ void inet_twsk_purge(struct net *net, struct inet_hashinfo *hashinfo, | |||
430 | int h; | 430 | int h; |
431 | 431 | ||
432 | local_bh_disable(); | 432 | local_bh_disable(); |
433 | for (h = 0; h < (hashinfo->ehash_size); h++) { | 433 | for (h = 0; h <= hashinfo->ehash_mask; h++) { |
434 | struct inet_ehash_bucket *head = | 434 | struct inet_ehash_bucket *head = |
435 | inet_ehash_bucket(hashinfo, h); | 435 | inet_ehash_bucket(hashinfo, h); |
436 | spinlock_t *lock = inet_ehash_lockp(hashinfo, h); | 436 | spinlock_t *lock = inet_ehash_lockp(hashinfo, h); |
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c index 64d0af675823..cf13726259cd 100644 --- a/net/ipv4/tcp.c +++ b/net/ipv4/tcp.c | |||
@@ -2865,11 +2865,10 @@ void __init tcp_init(void) | |||
2865 | (totalram_pages >= 128 * 1024) ? | 2865 | (totalram_pages >= 128 * 1024) ? |
2866 | 13 : 15, | 2866 | 13 : 15, |
2867 | 0, | 2867 | 0, |
2868 | &tcp_hashinfo.ehash_size, | ||
2869 | NULL, | 2868 | NULL, |
2869 | &tcp_hashinfo.ehash_mask, | ||
2870 | thash_entries ? 0 : 512 * 1024); | 2870 | thash_entries ? 0 : 512 * 1024); |
2871 | tcp_hashinfo.ehash_size = 1 << tcp_hashinfo.ehash_size; | 2871 | for (i = 0; i <= tcp_hashinfo.ehash_mask; i++) { |
2872 | for (i = 0; i < tcp_hashinfo.ehash_size; i++) { | ||
2873 | INIT_HLIST_NULLS_HEAD(&tcp_hashinfo.ehash[i].chain, i); | 2872 | INIT_HLIST_NULLS_HEAD(&tcp_hashinfo.ehash[i].chain, i); |
2874 | INIT_HLIST_NULLS_HEAD(&tcp_hashinfo.ehash[i].twchain, i); | 2873 | INIT_HLIST_NULLS_HEAD(&tcp_hashinfo.ehash[i].twchain, i); |
2875 | } | 2874 | } |
@@ -2878,7 +2877,7 @@ void __init tcp_init(void) | |||
2878 | tcp_hashinfo.bhash = | 2877 | tcp_hashinfo.bhash = |
2879 | alloc_large_system_hash("TCP bind", | 2878 | alloc_large_system_hash("TCP bind", |
2880 | sizeof(struct inet_bind_hashbucket), | 2879 | sizeof(struct inet_bind_hashbucket), |
2881 | tcp_hashinfo.ehash_size, | 2880 | tcp_hashinfo.ehash_mask + 1, |
2882 | (totalram_pages >= 128 * 1024) ? | 2881 | (totalram_pages >= 128 * 1024) ? |
2883 | 13 : 15, | 2882 | 13 : 15, |
2884 | 0, | 2883 | 0, |
@@ -2933,8 +2932,8 @@ void __init tcp_init(void) | |||
2933 | sysctl_tcp_rmem[2] = max(87380, max_share); | 2932 | sysctl_tcp_rmem[2] = max(87380, max_share); |
2934 | 2933 | ||
2935 | printk(KERN_INFO "TCP: Hash tables configured " | 2934 | printk(KERN_INFO "TCP: Hash tables configured " |
2936 | "(established %d bind %d)\n", | 2935 | "(established %u bind %u)\n", |
2937 | tcp_hashinfo.ehash_size, tcp_hashinfo.bhash_size); | 2936 | tcp_hashinfo.ehash_mask + 1, tcp_hashinfo.bhash_size); |
2938 | 2937 | ||
2939 | tcp_register_congestion_control(&tcp_reno); | 2938 | tcp_register_congestion_control(&tcp_reno); |
2940 | } | 2939 | } |
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c index 7cda24b53f61..99718703d040 100644 --- a/net/ipv4/tcp_ipv4.c +++ b/net/ipv4/tcp_ipv4.c | |||
@@ -2000,7 +2000,7 @@ static void *established_get_first(struct seq_file *seq) | |||
2000 | struct net *net = seq_file_net(seq); | 2000 | struct net *net = seq_file_net(seq); |
2001 | void *rc = NULL; | 2001 | void *rc = NULL; |
2002 | 2002 | ||
2003 | for (st->bucket = 0; st->bucket < tcp_hashinfo.ehash_size; ++st->bucket) { | 2003 | for (st->bucket = 0; st->bucket <= tcp_hashinfo.ehash_mask; ++st->bucket) { |
2004 | struct sock *sk; | 2004 | struct sock *sk; |
2005 | struct hlist_nulls_node *node; | 2005 | struct hlist_nulls_node *node; |
2006 | struct inet_timewait_sock *tw; | 2006 | struct inet_timewait_sock *tw; |
@@ -2061,10 +2061,10 @@ get_tw: | |||
2061 | st->state = TCP_SEQ_STATE_ESTABLISHED; | 2061 | st->state = TCP_SEQ_STATE_ESTABLISHED; |
2062 | 2062 | ||
2063 | /* Look for next non empty bucket */ | 2063 | /* Look for next non empty bucket */ |
2064 | while (++st->bucket < tcp_hashinfo.ehash_size && | 2064 | while (++st->bucket <= tcp_hashinfo.ehash_mask && |
2065 | empty_bucket(st)) | 2065 | empty_bucket(st)) |
2066 | ; | 2066 | ; |
2067 | if (st->bucket >= tcp_hashinfo.ehash_size) | 2067 | if (st->bucket > tcp_hashinfo.ehash_mask) |
2068 | return NULL; | 2068 | return NULL; |
2069 | 2069 | ||
2070 | spin_lock_bh(inet_ehash_lockp(&tcp_hashinfo, st->bucket)); | 2070 | spin_lock_bh(inet_ehash_lockp(&tcp_hashinfo, st->bucket)); |