diff options
author | Eric Dumazet <eric.dumazet@gmail.com> | 2009-10-15 02:30:45 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-10-18 21:52:53 -0400 |
commit | c720c7e8383aff1cb219bddf474ed89d850336e3 (patch) | |
tree | 4f12337e6690fccced376db9f501eaf98614a65e /net/ipv6/af_inet6.c | |
parent | 988ade6b8e27e79311812f83a87b5cea11fabcd7 (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/ipv6/af_inet6.c')
-rw-r--r-- | net/ipv6/af_inet6.c | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/net/ipv6/af_inet6.c b/net/ipv6/af_inet6.c index 94216519873c..b6d058818673 100644 --- a/net/ipv6/af_inet6.c +++ b/net/ipv6/af_inet6.c | |||
@@ -185,7 +185,7 @@ lookup_protocol: | |||
185 | inet->is_icsk = (INET_PROTOSW_ICSK & answer_flags) != 0; | 185 | inet->is_icsk = (INET_PROTOSW_ICSK & answer_flags) != 0; |
186 | 186 | ||
187 | if (SOCK_RAW == sock->type) { | 187 | if (SOCK_RAW == sock->type) { |
188 | inet->num = protocol; | 188 | inet->inet_num = protocol; |
189 | if (IPPROTO_RAW == protocol) | 189 | if (IPPROTO_RAW == protocol) |
190 | inet->hdrincl = 1; | 190 | inet->hdrincl = 1; |
191 | } | 191 | } |
@@ -228,12 +228,12 @@ lookup_protocol: | |||
228 | */ | 228 | */ |
229 | sk_refcnt_debug_inc(sk); | 229 | sk_refcnt_debug_inc(sk); |
230 | 230 | ||
231 | if (inet->num) { | 231 | if (inet->inet_num) { |
232 | /* It assumes that any protocol which allows | 232 | /* It assumes that any protocol which allows |
233 | * the user to assign a number at socket | 233 | * the user to assign a number at socket |
234 | * creation time automatically shares. | 234 | * creation time automatically shares. |
235 | */ | 235 | */ |
236 | inet->sport = htons(inet->num); | 236 | inet->inet_sport = htons(inet->inet_num); |
237 | sk->sk_prot->hash(sk); | 237 | sk->sk_prot->hash(sk); |
238 | } | 238 | } |
239 | if (sk->sk_prot->init) { | 239 | if (sk->sk_prot->init) { |
@@ -281,7 +281,7 @@ int inet6_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) | |||
281 | lock_sock(sk); | 281 | lock_sock(sk); |
282 | 282 | ||
283 | /* Check these errors (active socket, double bind). */ | 283 | /* Check these errors (active socket, double bind). */ |
284 | if (sk->sk_state != TCP_CLOSE || inet->num) { | 284 | if (sk->sk_state != TCP_CLOSE || inet->inet_num) { |
285 | err = -EINVAL; | 285 | err = -EINVAL; |
286 | goto out; | 286 | goto out; |
287 | } | 287 | } |
@@ -353,8 +353,8 @@ int inet6_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) | |||
353 | } | 353 | } |
354 | } | 354 | } |
355 | 355 | ||
356 | inet->rcv_saddr = v4addr; | 356 | inet->inet_rcv_saddr = v4addr; |
357 | inet->saddr = v4addr; | 357 | inet->inet_saddr = v4addr; |
358 | 358 | ||
359 | ipv6_addr_copy(&np->rcv_saddr, &addr->sin6_addr); | 359 | ipv6_addr_copy(&np->rcv_saddr, &addr->sin6_addr); |
360 | 360 | ||
@@ -375,9 +375,9 @@ int inet6_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) | |||
375 | } | 375 | } |
376 | if (snum) | 376 | if (snum) |
377 | sk->sk_userlocks |= SOCK_BINDPORT_LOCK; | 377 | sk->sk_userlocks |= SOCK_BINDPORT_LOCK; |
378 | inet->sport = htons(inet->num); | 378 | inet->inet_sport = htons(inet->inet_num); |
379 | inet->dport = 0; | 379 | inet->inet_dport = 0; |
380 | inet->daddr = 0; | 380 | inet->inet_daddr = 0; |
381 | out: | 381 | out: |
382 | release_sock(sk); | 382 | release_sock(sk); |
383 | return err; | 383 | return err; |
@@ -441,12 +441,12 @@ int inet6_getname(struct socket *sock, struct sockaddr *uaddr, | |||
441 | sin->sin6_flowinfo = 0; | 441 | sin->sin6_flowinfo = 0; |
442 | sin->sin6_scope_id = 0; | 442 | sin->sin6_scope_id = 0; |
443 | if (peer) { | 443 | if (peer) { |
444 | if (!inet->dport) | 444 | if (!inet->inet_dport) |
445 | return -ENOTCONN; | 445 | return -ENOTCONN; |
446 | if (((1 << sk->sk_state) & (TCPF_CLOSE | TCPF_SYN_SENT)) && | 446 | if (((1 << sk->sk_state) & (TCPF_CLOSE | TCPF_SYN_SENT)) && |
447 | peer == 1) | 447 | peer == 1) |
448 | return -ENOTCONN; | 448 | return -ENOTCONN; |
449 | sin->sin6_port = inet->dport; | 449 | sin->sin6_port = inet->inet_dport; |
450 | ipv6_addr_copy(&sin->sin6_addr, &np->daddr); | 450 | ipv6_addr_copy(&sin->sin6_addr, &np->daddr); |
451 | if (np->sndflow) | 451 | if (np->sndflow) |
452 | sin->sin6_flowinfo = np->flow_label; | 452 | sin->sin6_flowinfo = np->flow_label; |
@@ -456,7 +456,7 @@ int inet6_getname(struct socket *sock, struct sockaddr *uaddr, | |||
456 | else | 456 | else |
457 | ipv6_addr_copy(&sin->sin6_addr, &np->rcv_saddr); | 457 | ipv6_addr_copy(&sin->sin6_addr, &np->rcv_saddr); |
458 | 458 | ||
459 | sin->sin6_port = inet->sport; | 459 | sin->sin6_port = inet->inet_sport; |
460 | } | 460 | } |
461 | if (ipv6_addr_type(&sin->sin6_addr) & IPV6_ADDR_LINKLOCAL) | 461 | if (ipv6_addr_type(&sin->sin6_addr) & IPV6_ADDR_LINKLOCAL) |
462 | sin->sin6_scope_id = sk->sk_bound_dev_if; | 462 | sin->sin6_scope_id = sk->sk_bound_dev_if; |
@@ -655,8 +655,8 @@ int inet6_sk_rebuild_header(struct sock *sk) | |||
655 | fl.fl6_flowlabel = np->flow_label; | 655 | fl.fl6_flowlabel = np->flow_label; |
656 | fl.oif = sk->sk_bound_dev_if; | 656 | fl.oif = sk->sk_bound_dev_if; |
657 | fl.mark = sk->sk_mark; | 657 | fl.mark = sk->sk_mark; |
658 | fl.fl_ip_dport = inet->dport; | 658 | fl.fl_ip_dport = inet->inet_dport; |
659 | fl.fl_ip_sport = inet->sport; | 659 | fl.fl_ip_sport = inet->inet_sport; |
660 | security_sk_classify_flow(sk, &fl); | 660 | security_sk_classify_flow(sk, &fl); |
661 | 661 | ||
662 | if (np->opt && np->opt->srcrt) { | 662 | if (np->opt && np->opt->srcrt) { |