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/dccp/ipv6.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/dccp/ipv6.c')
-rw-r--r-- | net/dccp/ipv6.c | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/net/dccp/ipv6.c b/net/dccp/ipv6.c index a2afb553d8b3..6d89f9f7d5d8 100644 --- a/net/dccp/ipv6.c +++ b/net/dccp/ipv6.c | |||
@@ -158,8 +158,8 @@ static void dccp_v6_err(struct sk_buff *skb, struct inet6_skb_parm *opt, | |||
158 | ipv6_addr_copy(&fl.fl6_dst, &np->daddr); | 158 | ipv6_addr_copy(&fl.fl6_dst, &np->daddr); |
159 | ipv6_addr_copy(&fl.fl6_src, &np->saddr); | 159 | ipv6_addr_copy(&fl.fl6_src, &np->saddr); |
160 | fl.oif = sk->sk_bound_dev_if; | 160 | fl.oif = sk->sk_bound_dev_if; |
161 | fl.fl_ip_dport = inet->dport; | 161 | fl.fl_ip_dport = inet->inet_dport; |
162 | fl.fl_ip_sport = inet->sport; | 162 | fl.fl_ip_sport = inet->inet_sport; |
163 | security_sk_classify_flow(sk, &fl); | 163 | security_sk_classify_flow(sk, &fl); |
164 | 164 | ||
165 | err = ip6_dst_lookup(sk, &dst, &fl); | 165 | err = ip6_dst_lookup(sk, &dst, &fl); |
@@ -510,9 +510,9 @@ static struct sock *dccp_v6_request_recv_sock(struct sock *sk, | |||
510 | 510 | ||
511 | memcpy(newnp, np, sizeof(struct ipv6_pinfo)); | 511 | memcpy(newnp, np, sizeof(struct ipv6_pinfo)); |
512 | 512 | ||
513 | ipv6_addr_set_v4mapped(newinet->daddr, &newnp->daddr); | 513 | ipv6_addr_set_v4mapped(newinet->inet_daddr, &newnp->daddr); |
514 | 514 | ||
515 | ipv6_addr_set_v4mapped(newinet->saddr, &newnp->saddr); | 515 | ipv6_addr_set_v4mapped(newinet->inet_saddr, &newnp->saddr); |
516 | 516 | ||
517 | ipv6_addr_copy(&newnp->rcv_saddr, &newnp->saddr); | 517 | ipv6_addr_copy(&newnp->rcv_saddr, &newnp->saddr); |
518 | 518 | ||
@@ -640,7 +640,8 @@ static struct sock *dccp_v6_request_recv_sock(struct sock *sk, | |||
640 | 640 | ||
641 | dccp_sync_mss(newsk, dst_mtu(dst)); | 641 | dccp_sync_mss(newsk, dst_mtu(dst)); |
642 | 642 | ||
643 | newinet->daddr = newinet->saddr = newinet->rcv_saddr = LOOPBACK4_IPV6; | 643 | newinet->inet_daddr = newinet->inet_saddr = LOOPBACK4_IPV6; |
644 | newinet->inet_rcv_saddr = LOOPBACK4_IPV6; | ||
644 | 645 | ||
645 | __inet6_hash(newsk); | 646 | __inet6_hash(newsk); |
646 | __inet_inherit_port(sk, newsk); | 647 | __inet_inherit_port(sk, newsk); |
@@ -968,10 +969,9 @@ static int dccp_v6_connect(struct sock *sk, struct sockaddr *uaddr, | |||
968 | icsk->icsk_af_ops = &dccp_ipv6_af_ops; | 969 | icsk->icsk_af_ops = &dccp_ipv6_af_ops; |
969 | sk->sk_backlog_rcv = dccp_v6_do_rcv; | 970 | sk->sk_backlog_rcv = dccp_v6_do_rcv; |
970 | goto failure; | 971 | goto failure; |
971 | } else { | ||
972 | ipv6_addr_set_v4mapped(inet->saddr, &np->saddr); | ||
973 | ipv6_addr_set_v4mapped(inet->rcv_saddr, &np->rcv_saddr); | ||
974 | } | 972 | } |
973 | ipv6_addr_set_v4mapped(inet->inet_saddr, &np->saddr); | ||
974 | ipv6_addr_set_v4mapped(inet->inet_rcv_saddr, &np->rcv_saddr); | ||
975 | 975 | ||
976 | return err; | 976 | return err; |
977 | } | 977 | } |
@@ -984,7 +984,7 @@ static int dccp_v6_connect(struct sock *sk, struct sockaddr *uaddr, | |||
984 | ipv6_addr_copy(&fl.fl6_src, saddr ? saddr : &np->saddr); | 984 | ipv6_addr_copy(&fl.fl6_src, saddr ? saddr : &np->saddr); |
985 | fl.oif = sk->sk_bound_dev_if; | 985 | fl.oif = sk->sk_bound_dev_if; |
986 | fl.fl_ip_dport = usin->sin6_port; | 986 | fl.fl_ip_dport = usin->sin6_port; |
987 | fl.fl_ip_sport = inet->sport; | 987 | fl.fl_ip_sport = inet->inet_sport; |
988 | security_sk_classify_flow(sk, &fl); | 988 | security_sk_classify_flow(sk, &fl); |
989 | 989 | ||
990 | if (np->opt != NULL && np->opt->srcrt != NULL) { | 990 | if (np->opt != NULL && np->opt->srcrt != NULL) { |
@@ -1017,7 +1017,7 @@ static int dccp_v6_connect(struct sock *sk, struct sockaddr *uaddr, | |||
1017 | 1017 | ||
1018 | /* set the source address */ | 1018 | /* set the source address */ |
1019 | ipv6_addr_copy(&np->saddr, saddr); | 1019 | ipv6_addr_copy(&np->saddr, saddr); |
1020 | inet->rcv_saddr = LOOPBACK4_IPV6; | 1020 | inet->inet_rcv_saddr = LOOPBACK4_IPV6; |
1021 | 1021 | ||
1022 | __ip6_dst_store(sk, dst, NULL, NULL); | 1022 | __ip6_dst_store(sk, dst, NULL, NULL); |
1023 | 1023 | ||
@@ -1026,7 +1026,7 @@ static int dccp_v6_connect(struct sock *sk, struct sockaddr *uaddr, | |||
1026 | icsk->icsk_ext_hdr_len = (np->opt->opt_flen + | 1026 | icsk->icsk_ext_hdr_len = (np->opt->opt_flen + |
1027 | np->opt->opt_nflen); | 1027 | np->opt->opt_nflen); |
1028 | 1028 | ||
1029 | inet->dport = usin->sin6_port; | 1029 | inet->inet_dport = usin->sin6_port; |
1030 | 1030 | ||
1031 | dccp_set_state(sk, DCCP_REQUESTING); | 1031 | dccp_set_state(sk, DCCP_REQUESTING); |
1032 | err = inet6_hash_connect(&dccp_death_row, sk); | 1032 | err = inet6_hash_connect(&dccp_death_row, sk); |
@@ -1035,7 +1035,8 @@ static int dccp_v6_connect(struct sock *sk, struct sockaddr *uaddr, | |||
1035 | 1035 | ||
1036 | dp->dccps_iss = secure_dccpv6_sequence_number(np->saddr.s6_addr32, | 1036 | dp->dccps_iss = secure_dccpv6_sequence_number(np->saddr.s6_addr32, |
1037 | np->daddr.s6_addr32, | 1037 | np->daddr.s6_addr32, |
1038 | inet->sport, inet->dport); | 1038 | inet->inet_sport, |
1039 | inet->inet_dport); | ||
1039 | err = dccp_connect(sk); | 1040 | err = dccp_connect(sk); |
1040 | if (err) | 1041 | if (err) |
1041 | goto late_failure; | 1042 | goto late_failure; |
@@ -1046,7 +1047,7 @@ late_failure: | |||
1046 | dccp_set_state(sk, DCCP_CLOSED); | 1047 | dccp_set_state(sk, DCCP_CLOSED); |
1047 | __sk_dst_reset(sk); | 1048 | __sk_dst_reset(sk); |
1048 | failure: | 1049 | failure: |
1049 | inet->dport = 0; | 1050 | inet->inet_dport = 0; |
1050 | sk->sk_route_caps = 0; | 1051 | sk->sk_route_caps = 0; |
1051 | return err; | 1052 | return err; |
1052 | } | 1053 | } |