Loading include/net/sctp/sctp.h +3 −0 Original line number Diff line number Diff line Loading @@ -665,6 +665,9 @@ static inline int sctp_vtag_hashfn(__u16 lport, __u16 rport, __u32 vtag) return (h & (sctp_assoc_hashsize-1)); } #define sctp_for_each_hentry(epb, node, head) \ hlist_for_each_entry(epb, node, head, node) /* Is a socket of this style? */ #define sctp_style(sk, style) __sctp_style((sk), (SCTP_SOCKET_##style)) static inline int __sctp_style(const struct sock *sk, sctp_socket_type_t style) Loading include/net/sctp/structs.h +4 −6 Original line number Diff line number Diff line Loading @@ -100,20 +100,19 @@ struct crypto_hash; struct sctp_bind_bucket { unsigned short port; unsigned short fastreuse; struct sctp_bind_bucket *next; struct sctp_bind_bucket **pprev; struct hlist_node node; struct hlist_head owner; }; struct sctp_bind_hashbucket { spinlock_t lock; struct sctp_bind_bucket *chain; struct hlist_head chain; }; /* Used for hashing all associations. */ struct sctp_hashbucket { rwlock_t lock; struct sctp_ep_common *chain; struct hlist_head chain; } __attribute__((__aligned__(8))); Loading Loading @@ -1230,8 +1229,7 @@ typedef enum { struct sctp_ep_common { /* Fields to help us manage our entries in the hash tables. */ struct sctp_ep_common *next; struct sctp_ep_common **pprev; struct hlist_node node; int hashent; /* Runtime type information. What kind of endpoint is this? */ Loading net/sctp/endpointola.c +2 −1 Original line number Diff line number Diff line Loading @@ -332,6 +332,7 @@ static struct sctp_association *__sctp_endpoint_lookup_assoc( struct sctp_transport *t = NULL; struct sctp_hashbucket *head; struct sctp_ep_common *epb; struct hlist_node *node; int hash; int rport; Loading @@ -341,7 +342,7 @@ static struct sctp_association *__sctp_endpoint_lookup_assoc( hash = sctp_assoc_hashfn(ep->base.bind_addr.port, rport); head = &sctp_assoc_hashtable[hash]; read_lock(&head->lock); for (epb = head->chain; epb; epb = epb->next) { sctp_for_each_hentry(epb, node, &head->chain) { asoc = sctp_assoc(epb); if (asoc->ep != ep || rport != asoc->peer.port) goto next; Loading net/sctp/input.c +11 −32 Original line number Diff line number Diff line Loading @@ -656,7 +656,6 @@ static int sctp_rcv_ootb(struct sk_buff *skb) /* Insert endpoint into the hash table. */ static void __sctp_hash_endpoint(struct sctp_endpoint *ep) { struct sctp_ep_common **epp; struct sctp_ep_common *epb; struct sctp_hashbucket *head; Loading @@ -666,12 +665,7 @@ static void __sctp_hash_endpoint(struct sctp_endpoint *ep) head = &sctp_ep_hashtable[epb->hashent]; sctp_write_lock(&head->lock); epp = &head->chain; epb->next = *epp; if (epb->next) (*epp)->pprev = &epb->next; *epp = epb; epb->pprev = epp; hlist_add_head(&epb->node, &head->chain); sctp_write_unlock(&head->lock); } Loading @@ -691,19 +685,15 @@ static void __sctp_unhash_endpoint(struct sctp_endpoint *ep) epb = &ep->base; if (hlist_unhashed(&epb->node)) return; epb->hashent = sctp_ep_hashfn(epb->bind_addr.port); head = &sctp_ep_hashtable[epb->hashent]; sctp_write_lock(&head->lock); if (epb->pprev) { if (epb->next) epb->next->pprev = epb->pprev; *epb->pprev = epb->next; epb->pprev = NULL; } __hlist_del(&epb->node); sctp_write_unlock(&head->lock); } Loading @@ -721,12 +711,13 @@ static struct sctp_endpoint *__sctp_rcv_lookup_endpoint(const union sctp_addr *l struct sctp_hashbucket *head; struct sctp_ep_common *epb; struct sctp_endpoint *ep; struct hlist_node *node; int hash; hash = sctp_ep_hashfn(ntohs(laddr->v4.sin_port)); head = &sctp_ep_hashtable[hash]; read_lock(&head->lock); for (epb = head->chain; epb; epb = epb->next) { sctp_for_each_hentry(epb, node, &head->chain) { ep = sctp_ep(epb); if (sctp_endpoint_is_match(ep, laddr)) goto hit; Loading @@ -744,7 +735,6 @@ static struct sctp_endpoint *__sctp_rcv_lookup_endpoint(const union sctp_addr *l /* Insert association into the hash table. */ static void __sctp_hash_established(struct sctp_association *asoc) { struct sctp_ep_common **epp; struct sctp_ep_common *epb; struct sctp_hashbucket *head; Loading @@ -756,12 +746,7 @@ static void __sctp_hash_established(struct sctp_association *asoc) head = &sctp_assoc_hashtable[epb->hashent]; sctp_write_lock(&head->lock); epp = &head->chain; epb->next = *epp; if (epb->next) (*epp)->pprev = &epb->next; *epp = epb; epb->pprev = epp; hlist_add_head(&epb->node, &head->chain); sctp_write_unlock(&head->lock); } Loading Loading @@ -790,14 +775,7 @@ static void __sctp_unhash_established(struct sctp_association *asoc) head = &sctp_assoc_hashtable[epb->hashent]; sctp_write_lock(&head->lock); if (epb->pprev) { if (epb->next) epb->next->pprev = epb->pprev; *epb->pprev = epb->next; epb->pprev = NULL; } __hlist_del(&epb->node); sctp_write_unlock(&head->lock); } Loading @@ -822,6 +800,7 @@ static struct sctp_association *__sctp_lookup_association( struct sctp_ep_common *epb; struct sctp_association *asoc; struct sctp_transport *transport; struct hlist_node *node; int hash; /* Optimize here for direct hit, only listening connections can Loading @@ -830,7 +809,7 @@ static struct sctp_association *__sctp_lookup_association( hash = sctp_assoc_hashfn(ntohs(local->v4.sin_port), ntohs(peer->v4.sin_port)); head = &sctp_assoc_hashtable[hash]; read_lock(&head->lock); for (epb = head->chain; epb; epb = epb->next) { sctp_for_each_hentry(epb, node, &head->chain) { asoc = sctp_assoc(epb); transport = sctp_assoc_is_match(asoc, local, peer); if (transport) Loading net/sctp/proc.c +4 −2 Original line number Diff line number Diff line Loading @@ -225,6 +225,7 @@ static int sctp_eps_seq_show(struct seq_file *seq, void *v) struct sctp_ep_common *epb; struct sctp_endpoint *ep; struct sock *sk; struct hlist_node *node; int hash = *(loff_t *)v; if (hash >= sctp_ep_hashsize) Loading @@ -233,7 +234,7 @@ static int sctp_eps_seq_show(struct seq_file *seq, void *v) head = &sctp_ep_hashtable[hash]; sctp_local_bh_disable(); read_lock(&head->lock); for (epb = head->chain; epb; epb = epb->next) { sctp_for_each_hentry(epb, node, &head->chain) { ep = sctp_ep(epb); sk = epb->sk; seq_printf(seq, "%8p %8p %-3d %-3d %-4d %-5d %5d %5lu ", ep, sk, Loading Loading @@ -328,6 +329,7 @@ static int sctp_assocs_seq_show(struct seq_file *seq, void *v) struct sctp_ep_common *epb; struct sctp_association *assoc; struct sock *sk; struct hlist_node *node; int hash = *(loff_t *)v; if (hash >= sctp_assoc_hashsize) Loading @@ -336,7 +338,7 @@ static int sctp_assocs_seq_show(struct seq_file *seq, void *v) head = &sctp_assoc_hashtable[hash]; sctp_local_bh_disable(); read_lock(&head->lock); for (epb = head->chain; epb; epb = epb->next) { sctp_for_each_hentry(epb, node, &head->chain) { assoc = sctp_assoc(epb); sk = epb->sk; seq_printf(seq, Loading Loading
include/net/sctp/sctp.h +3 −0 Original line number Diff line number Diff line Loading @@ -665,6 +665,9 @@ static inline int sctp_vtag_hashfn(__u16 lport, __u16 rport, __u32 vtag) return (h & (sctp_assoc_hashsize-1)); } #define sctp_for_each_hentry(epb, node, head) \ hlist_for_each_entry(epb, node, head, node) /* Is a socket of this style? */ #define sctp_style(sk, style) __sctp_style((sk), (SCTP_SOCKET_##style)) static inline int __sctp_style(const struct sock *sk, sctp_socket_type_t style) Loading
include/net/sctp/structs.h +4 −6 Original line number Diff line number Diff line Loading @@ -100,20 +100,19 @@ struct crypto_hash; struct sctp_bind_bucket { unsigned short port; unsigned short fastreuse; struct sctp_bind_bucket *next; struct sctp_bind_bucket **pprev; struct hlist_node node; struct hlist_head owner; }; struct sctp_bind_hashbucket { spinlock_t lock; struct sctp_bind_bucket *chain; struct hlist_head chain; }; /* Used for hashing all associations. */ struct sctp_hashbucket { rwlock_t lock; struct sctp_ep_common *chain; struct hlist_head chain; } __attribute__((__aligned__(8))); Loading Loading @@ -1230,8 +1229,7 @@ typedef enum { struct sctp_ep_common { /* Fields to help us manage our entries in the hash tables. */ struct sctp_ep_common *next; struct sctp_ep_common **pprev; struct hlist_node node; int hashent; /* Runtime type information. What kind of endpoint is this? */ Loading
net/sctp/endpointola.c +2 −1 Original line number Diff line number Diff line Loading @@ -332,6 +332,7 @@ static struct sctp_association *__sctp_endpoint_lookup_assoc( struct sctp_transport *t = NULL; struct sctp_hashbucket *head; struct sctp_ep_common *epb; struct hlist_node *node; int hash; int rport; Loading @@ -341,7 +342,7 @@ static struct sctp_association *__sctp_endpoint_lookup_assoc( hash = sctp_assoc_hashfn(ep->base.bind_addr.port, rport); head = &sctp_assoc_hashtable[hash]; read_lock(&head->lock); for (epb = head->chain; epb; epb = epb->next) { sctp_for_each_hentry(epb, node, &head->chain) { asoc = sctp_assoc(epb); if (asoc->ep != ep || rport != asoc->peer.port) goto next; Loading
net/sctp/input.c +11 −32 Original line number Diff line number Diff line Loading @@ -656,7 +656,6 @@ static int sctp_rcv_ootb(struct sk_buff *skb) /* Insert endpoint into the hash table. */ static void __sctp_hash_endpoint(struct sctp_endpoint *ep) { struct sctp_ep_common **epp; struct sctp_ep_common *epb; struct sctp_hashbucket *head; Loading @@ -666,12 +665,7 @@ static void __sctp_hash_endpoint(struct sctp_endpoint *ep) head = &sctp_ep_hashtable[epb->hashent]; sctp_write_lock(&head->lock); epp = &head->chain; epb->next = *epp; if (epb->next) (*epp)->pprev = &epb->next; *epp = epb; epb->pprev = epp; hlist_add_head(&epb->node, &head->chain); sctp_write_unlock(&head->lock); } Loading @@ -691,19 +685,15 @@ static void __sctp_unhash_endpoint(struct sctp_endpoint *ep) epb = &ep->base; if (hlist_unhashed(&epb->node)) return; epb->hashent = sctp_ep_hashfn(epb->bind_addr.port); head = &sctp_ep_hashtable[epb->hashent]; sctp_write_lock(&head->lock); if (epb->pprev) { if (epb->next) epb->next->pprev = epb->pprev; *epb->pprev = epb->next; epb->pprev = NULL; } __hlist_del(&epb->node); sctp_write_unlock(&head->lock); } Loading @@ -721,12 +711,13 @@ static struct sctp_endpoint *__sctp_rcv_lookup_endpoint(const union sctp_addr *l struct sctp_hashbucket *head; struct sctp_ep_common *epb; struct sctp_endpoint *ep; struct hlist_node *node; int hash; hash = sctp_ep_hashfn(ntohs(laddr->v4.sin_port)); head = &sctp_ep_hashtable[hash]; read_lock(&head->lock); for (epb = head->chain; epb; epb = epb->next) { sctp_for_each_hentry(epb, node, &head->chain) { ep = sctp_ep(epb); if (sctp_endpoint_is_match(ep, laddr)) goto hit; Loading @@ -744,7 +735,6 @@ static struct sctp_endpoint *__sctp_rcv_lookup_endpoint(const union sctp_addr *l /* Insert association into the hash table. */ static void __sctp_hash_established(struct sctp_association *asoc) { struct sctp_ep_common **epp; struct sctp_ep_common *epb; struct sctp_hashbucket *head; Loading @@ -756,12 +746,7 @@ static void __sctp_hash_established(struct sctp_association *asoc) head = &sctp_assoc_hashtable[epb->hashent]; sctp_write_lock(&head->lock); epp = &head->chain; epb->next = *epp; if (epb->next) (*epp)->pprev = &epb->next; *epp = epb; epb->pprev = epp; hlist_add_head(&epb->node, &head->chain); sctp_write_unlock(&head->lock); } Loading Loading @@ -790,14 +775,7 @@ static void __sctp_unhash_established(struct sctp_association *asoc) head = &sctp_assoc_hashtable[epb->hashent]; sctp_write_lock(&head->lock); if (epb->pprev) { if (epb->next) epb->next->pprev = epb->pprev; *epb->pprev = epb->next; epb->pprev = NULL; } __hlist_del(&epb->node); sctp_write_unlock(&head->lock); } Loading @@ -822,6 +800,7 @@ static struct sctp_association *__sctp_lookup_association( struct sctp_ep_common *epb; struct sctp_association *asoc; struct sctp_transport *transport; struct hlist_node *node; int hash; /* Optimize here for direct hit, only listening connections can Loading @@ -830,7 +809,7 @@ static struct sctp_association *__sctp_lookup_association( hash = sctp_assoc_hashfn(ntohs(local->v4.sin_port), ntohs(peer->v4.sin_port)); head = &sctp_assoc_hashtable[hash]; read_lock(&head->lock); for (epb = head->chain; epb; epb = epb->next) { sctp_for_each_hentry(epb, node, &head->chain) { asoc = sctp_assoc(epb); transport = sctp_assoc_is_match(asoc, local, peer); if (transport) Loading
net/sctp/proc.c +4 −2 Original line number Diff line number Diff line Loading @@ -225,6 +225,7 @@ static int sctp_eps_seq_show(struct seq_file *seq, void *v) struct sctp_ep_common *epb; struct sctp_endpoint *ep; struct sock *sk; struct hlist_node *node; int hash = *(loff_t *)v; if (hash >= sctp_ep_hashsize) Loading @@ -233,7 +234,7 @@ static int sctp_eps_seq_show(struct seq_file *seq, void *v) head = &sctp_ep_hashtable[hash]; sctp_local_bh_disable(); read_lock(&head->lock); for (epb = head->chain; epb; epb = epb->next) { sctp_for_each_hentry(epb, node, &head->chain) { ep = sctp_ep(epb); sk = epb->sk; seq_printf(seq, "%8p %8p %-3d %-3d %-4d %-5d %5d %5lu ", ep, sk, Loading Loading @@ -328,6 +329,7 @@ static int sctp_assocs_seq_show(struct seq_file *seq, void *v) struct sctp_ep_common *epb; struct sctp_association *assoc; struct sock *sk; struct hlist_node *node; int hash = *(loff_t *)v; if (hash >= sctp_assoc_hashsize) Loading @@ -336,7 +338,7 @@ static int sctp_assocs_seq_show(struct seq_file *seq, void *v) head = &sctp_assoc_hashtable[hash]; sctp_local_bh_disable(); read_lock(&head->lock); for (epb = head->chain; epb; epb = epb->next) { sctp_for_each_hentry(epb, node, &head->chain) { assoc = sctp_assoc(epb); sk = epb->sk; seq_printf(seq, Loading