aboutsummaryrefslogtreecommitdiffstats
path: root/net/sctp
diff options
context:
space:
mode:
authorEric Dumazet <eric.dumazet@gmail.com>2009-10-15 02:30:45 -0400
committerDavid S. Miller <davem@davemloft.net>2009-10-18 21:52:53 -0400
commitc720c7e8383aff1cb219bddf474ed89d850336e3 (patch)
tree4f12337e6690fccced376db9f501eaf98614a65e /net/sctp
parent988ade6b8e27e79311812f83a87b5cea11fabcd7 (diff)
inet: rename some inet_sock fields
In order to have better cache layouts of struct sock (separate zones for rx/tx paths), we need this preliminary patch. Goal is to transfert fields used at lookup time in the first read-mostly cache line (inside struct sock_common) and move sk_refcnt to a separate cache line (only written by rx path) This patch adds inet_ prefix to daddr, rcv_saddr, dport, num, saddr, sport and id fields. This allows a future patch to define these fields as macros, like sk_refcnt, without name clashes. Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/sctp')
-rw-r--r--net/sctp/protocol.c8
-rw-r--r--net/sctp/socket.c30
2 files changed, 19 insertions, 19 deletions
diff --git a/net/sctp/protocol.c b/net/sctp/protocol.c
index 612dc878e05c..d9f4cc2c7869 100644
--- a/net/sctp/protocol.c
+++ b/net/sctp/protocol.c
@@ -296,19 +296,19 @@ static void sctp_v4_from_sk(union sctp_addr *addr, struct sock *sk)
296{ 296{
297 addr->v4.sin_family = AF_INET; 297 addr->v4.sin_family = AF_INET;
298 addr->v4.sin_port = 0; 298 addr->v4.sin_port = 0;
299 addr->v4.sin_addr.s_addr = inet_sk(sk)->rcv_saddr; 299 addr->v4.sin_addr.s_addr = inet_sk(sk)->inet_rcv_saddr;
300} 300}
301 301
302/* Initialize sk->sk_rcv_saddr from sctp_addr. */ 302/* Initialize sk->sk_rcv_saddr from sctp_addr. */
303static void sctp_v4_to_sk_saddr(union sctp_addr *addr, struct sock *sk) 303static void sctp_v4_to_sk_saddr(union sctp_addr *addr, struct sock *sk)
304{ 304{
305 inet_sk(sk)->rcv_saddr = addr->v4.sin_addr.s_addr; 305 inet_sk(sk)->inet_rcv_saddr = addr->v4.sin_addr.s_addr;
306} 306}
307 307
308/* Initialize sk->sk_daddr from sctp_addr. */ 308/* Initialize sk->sk_daddr from sctp_addr. */
309static void sctp_v4_to_sk_daddr(union sctp_addr *addr, struct sock *sk) 309static void sctp_v4_to_sk_daddr(union sctp_addr *addr, struct sock *sk)
310{ 310{
311 inet_sk(sk)->daddr = addr->v4.sin_addr.s_addr; 311 inet_sk(sk)->inet_daddr = addr->v4.sin_addr.s_addr;
312} 312}
313 313
314/* Initialize a sctp_addr from an address parameter. */ 314/* Initialize a sctp_addr from an address parameter. */
@@ -598,7 +598,7 @@ static struct sock *sctp_v4_create_accept_sk(struct sock *sk,
598 598
599 newinet = inet_sk(newsk); 599 newinet = inet_sk(newsk);
600 600
601 newinet->daddr = asoc->peer.primary_addr.v4.sin_addr.s_addr; 601 newinet->inet_daddr = asoc->peer.primary_addr.v4.sin_addr.s_addr;
602 602
603 sk_refcnt_debug_inc(newsk); 603 sk_refcnt_debug_inc(newsk);
604 604
diff --git a/net/sctp/socket.c b/net/sctp/socket.c
index 0970e92c6acd..4085db99033d 100644
--- a/net/sctp/socket.c
+++ b/net/sctp/socket.c
@@ -394,7 +394,7 @@ SCTP_STATIC int sctp_do_bind(struct sock *sk, union sctp_addr *addr, int len)
394 394
395 /* Refresh ephemeral port. */ 395 /* Refresh ephemeral port. */
396 if (!bp->port) 396 if (!bp->port)
397 bp->port = inet_sk(sk)->num; 397 bp->port = inet_sk(sk)->inet_num;
398 398
399 /* Add the address to the bind address list. 399 /* Add the address to the bind address list.
400 * Use GFP_ATOMIC since BHs will be disabled. 400 * Use GFP_ATOMIC since BHs will be disabled.
@@ -403,7 +403,7 @@ SCTP_STATIC int sctp_do_bind(struct sock *sk, union sctp_addr *addr, int len)
403 403
404 /* Copy back into socket for getsockname() use. */ 404 /* Copy back into socket for getsockname() use. */
405 if (!ret) { 405 if (!ret) {
406 inet_sk(sk)->sport = htons(inet_sk(sk)->num); 406 inet_sk(sk)->inet_sport = htons(inet_sk(sk)->inet_num);
407 af->to_sk_saddr(addr, sk); 407 af->to_sk_saddr(addr, sk);
408 } 408 }
409 409
@@ -1115,7 +1115,7 @@ static int __sctp_connect(struct sock* sk,
1115 } 1115 }
1116 1116
1117 /* Initialize sk's dport and daddr for getpeername() */ 1117 /* Initialize sk's dport and daddr for getpeername() */
1118 inet_sk(sk)->dport = htons(asoc->peer.port); 1118 inet_sk(sk)->inet_dport = htons(asoc->peer.port);
1119 af = sctp_get_af_specific(sa_addr->sa.sa_family); 1119 af = sctp_get_af_specific(sa_addr->sa.sa_family);
1120 af->to_sk_daddr(sa_addr, sk); 1120 af->to_sk_daddr(sa_addr, sk);
1121 sk->sk_err = 0; 1121 sk->sk_err = 0;
@@ -5851,7 +5851,7 @@ pp_not_found:
5851 */ 5851 */
5852success: 5852success:
5853 if (!sctp_sk(sk)->bind_hash) { 5853 if (!sctp_sk(sk)->bind_hash) {
5854 inet_sk(sk)->num = snum; 5854 inet_sk(sk)->inet_num = snum;
5855 sk_add_bind_node(sk, &pp->owner); 5855 sk_add_bind_node(sk, &pp->owner);
5856 sctp_sk(sk)->bind_hash = pp; 5856 sctp_sk(sk)->bind_hash = pp;
5857 } 5857 }
@@ -5923,7 +5923,7 @@ SCTP_STATIC int sctp_listen_start(struct sock *sk, int backlog)
5923 if (sctp_autobind(sk)) 5923 if (sctp_autobind(sk))
5924 return -EAGAIN; 5924 return -EAGAIN;
5925 } else { 5925 } else {
5926 if (sctp_get_port(sk, inet_sk(sk)->num)) { 5926 if (sctp_get_port(sk, inet_sk(sk)->inet_num)) {
5927 sk->sk_state = SCTP_SS_CLOSED; 5927 sk->sk_state = SCTP_SS_CLOSED;
5928 return -EADDRINUSE; 5928 return -EADDRINUSE;
5929 } 5929 }
@@ -6094,14 +6094,14 @@ static void sctp_bucket_destroy(struct sctp_bind_bucket *pp)
6094static inline void __sctp_put_port(struct sock *sk) 6094static inline void __sctp_put_port(struct sock *sk)
6095{ 6095{
6096 struct sctp_bind_hashbucket *head = 6096 struct sctp_bind_hashbucket *head =
6097 &sctp_port_hashtable[sctp_phashfn(inet_sk(sk)->num)]; 6097 &sctp_port_hashtable[sctp_phashfn(inet_sk(sk)->inet_num)];
6098 struct sctp_bind_bucket *pp; 6098 struct sctp_bind_bucket *pp;
6099 6099
6100 sctp_spin_lock(&head->lock); 6100 sctp_spin_lock(&head->lock);
6101 pp = sctp_sk(sk)->bind_hash; 6101 pp = sctp_sk(sk)->bind_hash;
6102 __sk_del_bind_node(sk); 6102 __sk_del_bind_node(sk);
6103 sctp_sk(sk)->bind_hash = NULL; 6103 sctp_sk(sk)->bind_hash = NULL;
6104 inet_sk(sk)->num = 0; 6104 inet_sk(sk)->inet_num = 0;
6105 sctp_bucket_destroy(pp); 6105 sctp_bucket_destroy(pp);
6106 sctp_spin_unlock(&head->lock); 6106 sctp_spin_unlock(&head->lock);
6107} 6107}
@@ -6128,7 +6128,7 @@ static int sctp_autobind(struct sock *sk)
6128 /* Initialize a local sockaddr structure to INADDR_ANY. */ 6128 /* Initialize a local sockaddr structure to INADDR_ANY. */
6129 af = sctp_sk(sk)->pf->af; 6129 af = sctp_sk(sk)->pf->af;
6130 6130
6131 port = htons(inet_sk(sk)->num); 6131 port = htons(inet_sk(sk)->inet_num);
6132 af->inaddr_any(&autoaddr, port); 6132 af->inaddr_any(&autoaddr, port);
6133 6133
6134 return sctp_do_bind(sk, &autoaddr, af->sockaddr_len); 6134 return sctp_do_bind(sk, &autoaddr, af->sockaddr_len);
@@ -6697,12 +6697,12 @@ void sctp_copy_sock(struct sock *newsk, struct sock *sk,
6697 /* Initialize sk's sport, dport, rcv_saddr and daddr for 6697 /* Initialize sk's sport, dport, rcv_saddr and daddr for
6698 * getsockname() and getpeername() 6698 * getsockname() and getpeername()
6699 */ 6699 */
6700 newinet->sport = inet->sport; 6700 newinet->inet_sport = inet->inet_sport;
6701 newinet->saddr = inet->saddr; 6701 newinet->inet_saddr = inet->inet_saddr;
6702 newinet->rcv_saddr = inet->rcv_saddr; 6702 newinet->inet_rcv_saddr = inet->inet_rcv_saddr;
6703 newinet->dport = htons(asoc->peer.port); 6703 newinet->inet_dport = htons(asoc->peer.port);
6704 newinet->pmtudisc = inet->pmtudisc; 6704 newinet->pmtudisc = inet->pmtudisc;
6705 newinet->id = asoc->next_tsn ^ jiffies; 6705 newinet->inet_id = asoc->next_tsn ^ jiffies;
6706 6706
6707 newinet->uc_ttl = inet->uc_ttl; 6707 newinet->uc_ttl = inet->uc_ttl;
6708 newinet->mc_loop = 1; 6708 newinet->mc_loop = 1;
@@ -6741,13 +6741,13 @@ static void sctp_sock_migrate(struct sock *oldsk, struct sock *newsk,
6741 newsp->hmac = NULL; 6741 newsp->hmac = NULL;
6742 6742
6743 /* Hook this new socket in to the bind_hash list. */ 6743 /* Hook this new socket in to the bind_hash list. */
6744 head = &sctp_port_hashtable[sctp_phashfn(inet_sk(oldsk)->num)]; 6744 head = &sctp_port_hashtable[sctp_phashfn(inet_sk(oldsk)->inet_num)];
6745 sctp_local_bh_disable(); 6745 sctp_local_bh_disable();
6746 sctp_spin_lock(&head->lock); 6746 sctp_spin_lock(&head->lock);
6747 pp = sctp_sk(oldsk)->bind_hash; 6747 pp = sctp_sk(oldsk)->bind_hash;
6748 sk_add_bind_node(newsk, &pp->owner); 6748 sk_add_bind_node(newsk, &pp->owner);
6749 sctp_sk(newsk)->bind_hash = pp; 6749 sctp_sk(newsk)->bind_hash = pp;
6750 inet_sk(newsk)->num = inet_sk(oldsk)->num; 6750 inet_sk(newsk)->inet_num = inet_sk(oldsk)->inet_num;
6751 sctp_spin_unlock(&head->lock); 6751 sctp_spin_unlock(&head->lock);
6752 sctp_local_bh_enable(); 6752 sctp_local_bh_enable();
6753 6753