Deleted Added
full compact
35c35
< * $FreeBSD: head/sys/netinet/in_pcb.h 222217 2011-05-23 19:32:02Z rwatson $
---
> * $FreeBSD: head/sys/netinet/in_pcb.h 222488 2011-05-30 09:43:55Z rwatson $
271,272c271,273
< * Each pcbinfo is protected by ipi_lock, covering mutable global fields (such
< * as the global pcb list) and hashed lookup tables. The lock order is:
---
> * Each pcbinfo is protected by two locks: ipi_lock and ipi_hash_lock,
> * the former covering mutable global fields (such as the global pcb list),
> * and the latter covering the hashed lookup tables. The lock order is:
274c275
< * ipi_lock (before) inpcb locks
---
> * ipi_lock (before) inpcb locks (before) ipi_hash_lock
280c281
< * (h) Read using either ipi_lock or inpcb lock; write requires both.
---
> * (h) Read using either ipi_hash_lock or inpcb lock; write requires both.
285,286c286
< * Global lock protecting global inpcb list, inpcb count, hash tables,
< * etc.
---
> * Global lock protecting global inpcb list, inpcb count, etc.
314a315,319
> * Global lock protecting hash lookup tables.
> */
> struct rwlock ipi_hash_lock;
>
> /*
318,319c323,324
< struct inpcbhead *ipi_hashbase; /* (g) */
< u_long ipi_hashmask; /* (g) */
---
> struct inpcbhead *ipi_hashbase; /* (h) */
> u_long ipi_hashmask; /* (h) */
324,325c329,330
< struct inpcbporthead *ipi_porthashbase; /* (g) */
< u_long ipi_porthashmask; /* (g) */
---
> struct inpcbporthead *ipi_porthashbase; /* (h) */
> u_long ipi_porthashmask; /* (h) */
408a414,425
> #define INP_HASH_LOCK_INIT(ipi, d) \
> rw_init_flags(&(ipi)->ipi_hash_lock, (d), 0)
> #define INP_HASH_LOCK_DESTROY(ipi) rw_destroy(&(ipi)->ipi_hash_lock)
> #define INP_HASH_RLOCK(ipi) rw_rlock(&(ipi)->ipi_hash_lock)
> #define INP_HASH_WLOCK(ipi) rw_wlock(&(ipi)->ipi_hash_lock)
> #define INP_HASH_RUNLOCK(ipi) rw_runlock(&(ipi)->ipi_hash_lock)
> #define INP_HASH_WUNLOCK(ipi) rw_wunlock(&(ipi)->ipi_hash_lock)
> #define INP_HASH_LOCK_ASSERT(ipi) rw_assert(&(ipi)->ipi_hash_lock, \
> RA_LOCKED)
> #define INP_HASH_WLOCK_ASSERT(ipi) rw_assert(&(ipi)->ipi_hash_lock, \
> RA_WLOCKED)
>
469c486,495
< #define INPLOOKUP_WILDCARD 1
---
> /*
> * Flags passed to in_pcblookup*() functions.
> */
> #define INPLOOKUP_WILDCARD 0x00000001 /* Allow wildcard sockets. */
> #define INPLOOKUP_RLOCKPCB 0x00000002 /* Return inpcb read-locked. */
> #define INPLOOKUP_WLOCKPCB 0x00000004 /* Return inpcb write-locked. */
>
> #define INPLOOKUP_MASK (INPLOOKUP_WILDCARD | INPLOOKUP_RLOCKPCB | \
> INPLOOKUP_WLOCKPCB)
>
530c556
< in_pcblookup_hash(struct inpcbinfo *, struct in_addr, u_int,
---
> in_pcblookup(struct inpcbinfo *, struct in_addr, u_int,