diff options
| author | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-11-09 18:07:57 -0500 |
|---|---|---|
| committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-11-09 18:07:57 -0500 |
| commit | c5b875e354a54e2b5ba24eecae69bf94e025edd5 (patch) | |
| tree | 0446a68d99ad50305ab78835456d9faa62be5948 /net/ipv6/inet6_hashtables.c | |
| parent | eae1920a21b4f87e89cea802e7df39442b119617 (diff) | |
| parent | c3d8d1e30cace31fed6186a4b8c6b1401836d89c (diff) | |
Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
* 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6: (44 commits)
[NETLINK]: Fix unicast timeouts
[INET]: Remove per bucket rwlock in tcp/dccp ehash table.
[IPVS]: Synchronize closing of Connections
[IPVS]: Bind connections on stanby if the destination exists
[NET]: Remove Documentation/networking/pt.txt
[NET]: Remove Documentation/networking/routing.txt
[NET]: Remove Documentation/networking/ncsa-telnet
[NET]: Remove comx driver docs.
[NET]: Remove Documentation/networking/Configurable
[NET]: Clean proto_(un)register from in-code ifdefs
[IPSEC]: Fix crypto_alloc_comp error checking
[VLAN]: Fix SET_VLAN_INGRESS_PRIORITY_CMD ioctl
[NETNS]: Fix compiler error in net_namespace.c
[TTY]: Use tty_mode_ioctl() in network drivers.
[TTY]: Fix network driver interactions with TCGET/SET calls.
[PKT_SCHED] CLS_U32: Fix endianness problem with u32 classifier hash masks.
[NET]: Removing duplicit #includes
[NET]: Let USB_USBNET always select MII.
[RRUNNER]: Do not muck with sysctl_{r,w}mem_max
[DLM] lowcomms: Do not muck with sysctl_rmem_max.
...
Diffstat (limited to 'net/ipv6/inet6_hashtables.c')
| -rw-r--r-- | net/ipv6/inet6_hashtables.c | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/net/ipv6/inet6_hashtables.c b/net/ipv6/inet6_hashtables.c index d6f1026f1943..adc73adadfae 100644 --- a/net/ipv6/inet6_hashtables.c +++ b/net/ipv6/inet6_hashtables.c | |||
| @@ -37,9 +37,8 @@ void __inet6_hash(struct inet_hashinfo *hashinfo, | |||
| 37 | } else { | 37 | } else { |
| 38 | unsigned int hash; | 38 | unsigned int hash; |
| 39 | sk->sk_hash = hash = inet6_sk_ehashfn(sk); | 39 | sk->sk_hash = hash = inet6_sk_ehashfn(sk); |
| 40 | hash &= (hashinfo->ehash_size - 1); | 40 | list = &inet_ehash_bucket(hashinfo, hash)->chain; |
| 41 | list = &hashinfo->ehash[hash].chain; | 41 | lock = inet_ehash_lockp(hashinfo, hash); |
| 42 | lock = &hashinfo->ehash[hash].lock; | ||
| 43 | write_lock(lock); | 42 | write_lock(lock); |
| 44 | } | 43 | } |
| 45 | 44 | ||
| @@ -70,9 +69,10 @@ struct sock *__inet6_lookup_established(struct inet_hashinfo *hashinfo, | |||
| 70 | */ | 69 | */ |
| 71 | unsigned int hash = inet6_ehashfn(daddr, hnum, saddr, sport); | 70 | unsigned int hash = inet6_ehashfn(daddr, hnum, saddr, sport); |
| 72 | struct inet_ehash_bucket *head = inet_ehash_bucket(hashinfo, hash); | 71 | struct inet_ehash_bucket *head = inet_ehash_bucket(hashinfo, hash); |
| 72 | rwlock_t *lock = inet_ehash_lockp(hashinfo, hash); | ||
| 73 | 73 | ||
| 74 | prefetch(head->chain.first); | 74 | prefetch(head->chain.first); |
| 75 | read_lock(&head->lock); | 75 | read_lock(lock); |
| 76 | sk_for_each(sk, node, &head->chain) { | 76 | sk_for_each(sk, node, &head->chain) { |
| 77 | /* For IPV6 do the cheaper port and family tests first. */ | 77 | /* For IPV6 do the cheaper port and family tests first. */ |
| 78 | if (INET6_MATCH(sk, hash, saddr, daddr, ports, dif)) | 78 | if (INET6_MATCH(sk, hash, saddr, daddr, ports, dif)) |
| @@ -92,12 +92,12 @@ struct sock *__inet6_lookup_established(struct inet_hashinfo *hashinfo, | |||
| 92 | goto hit; | 92 | goto hit; |
| 93 | } | 93 | } |
| 94 | } | 94 | } |
| 95 | read_unlock(&head->lock); | 95 | read_unlock(lock); |
| 96 | return NULL; | 96 | return NULL; |
| 97 | 97 | ||
| 98 | hit: | 98 | hit: |
| 99 | sock_hold(sk); | 99 | sock_hold(sk); |
| 100 | read_unlock(&head->lock); | 100 | read_unlock(lock); |
| 101 | return sk; | 101 | return sk; |
| 102 | } | 102 | } |
| 103 | EXPORT_SYMBOL(__inet6_lookup_established); | 103 | EXPORT_SYMBOL(__inet6_lookup_established); |
| @@ -175,12 +175,13 @@ static int __inet6_check_established(struct inet_timewait_death_row *death_row, | |||
| 175 | const unsigned int hash = inet6_ehashfn(daddr, lport, saddr, | 175 | const unsigned int hash = inet6_ehashfn(daddr, lport, saddr, |
| 176 | inet->dport); | 176 | inet->dport); |
| 177 | struct inet_ehash_bucket *head = inet_ehash_bucket(hinfo, hash); | 177 | struct inet_ehash_bucket *head = inet_ehash_bucket(hinfo, hash); |
| 178 | rwlock_t *lock = inet_ehash_lockp(hinfo, hash); | ||
| 178 | struct sock *sk2; | 179 | struct sock *sk2; |
| 179 | const struct hlist_node *node; | 180 | const struct hlist_node *node; |
| 180 | struct inet_timewait_sock *tw; | 181 | struct inet_timewait_sock *tw; |
| 181 | 182 | ||
| 182 | prefetch(head->chain.first); | 183 | prefetch(head->chain.first); |
| 183 | write_lock(&head->lock); | 184 | write_lock(lock); |
| 184 | 185 | ||
| 185 | /* Check TIME-WAIT sockets first. */ | 186 | /* Check TIME-WAIT sockets first. */ |
| 186 | sk_for_each(sk2, node, &head->twchain) { | 187 | sk_for_each(sk2, node, &head->twchain) { |
| @@ -216,7 +217,7 @@ unique: | |||
| 216 | __sk_add_node(sk, &head->chain); | 217 | __sk_add_node(sk, &head->chain); |
| 217 | sk->sk_hash = hash; | 218 | sk->sk_hash = hash; |
| 218 | sock_prot_inc_use(sk->sk_prot); | 219 | sock_prot_inc_use(sk->sk_prot); |
| 219 | write_unlock(&head->lock); | 220 | write_unlock(lock); |
| 220 | 221 | ||
| 221 | if (twp != NULL) { | 222 | if (twp != NULL) { |
| 222 | *twp = tw; | 223 | *twp = tw; |
| @@ -231,7 +232,7 @@ unique: | |||
| 231 | return 0; | 232 | return 0; |
| 232 | 233 | ||
| 233 | not_unique: | 234 | not_unique: |
| 234 | write_unlock(&head->lock); | 235 | write_unlock(lock); |
| 235 | return -EADDRNOTAVAIL; | 236 | return -EADDRNOTAVAIL; |
| 236 | } | 237 | } |
| 237 | 238 | ||
