aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv6/udp.c
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/ipv6/udp.c
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/ipv6/udp.c')
-rw-r--r--net/ipv6/udp.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c
index b86425b7ea22..829d300a6f35 100644
--- a/net/ipv6/udp.c
+++ b/net/ipv6/udp.c
@@ -53,7 +53,7 @@ int ipv6_rcv_saddr_equal(const struct sock *sk, const struct sock *sk2)
53{ 53{
54 const struct in6_addr *sk_rcv_saddr6 = &inet6_sk(sk)->rcv_saddr; 54 const struct in6_addr *sk_rcv_saddr6 = &inet6_sk(sk)->rcv_saddr;
55 const struct in6_addr *sk2_rcv_saddr6 = inet6_rcv_saddr(sk2); 55 const struct in6_addr *sk2_rcv_saddr6 = inet6_rcv_saddr(sk2);
56 __be32 sk_rcv_saddr = inet_sk(sk)->rcv_saddr; 56 __be32 sk1_rcv_saddr = inet_sk(sk)->inet_rcv_saddr;
57 __be32 sk2_rcv_saddr = inet_rcv_saddr(sk2); 57 __be32 sk2_rcv_saddr = inet_rcv_saddr(sk2);
58 int sk_ipv6only = ipv6_only_sock(sk); 58 int sk_ipv6only = ipv6_only_sock(sk);
59 int sk2_ipv6only = inet_v6_ipv6only(sk2); 59 int sk2_ipv6only = inet_v6_ipv6only(sk2);
@@ -63,8 +63,8 @@ int ipv6_rcv_saddr_equal(const struct sock *sk, const struct sock *sk2)
63 /* if both are mapped, treat as IPv4 */ 63 /* if both are mapped, treat as IPv4 */
64 if (addr_type == IPV6_ADDR_MAPPED && addr_type2 == IPV6_ADDR_MAPPED) 64 if (addr_type == IPV6_ADDR_MAPPED && addr_type2 == IPV6_ADDR_MAPPED)
65 return (!sk2_ipv6only && 65 return (!sk2_ipv6only &&
66 (!sk_rcv_saddr || !sk2_rcv_saddr || 66 (!sk1_rcv_saddr || !sk2_rcv_saddr ||
67 sk_rcv_saddr == sk2_rcv_saddr)); 67 sk1_rcv_saddr == sk2_rcv_saddr));
68 68
69 if (addr_type2 == IPV6_ADDR_ANY && 69 if (addr_type2 == IPV6_ADDR_ANY &&
70 !(sk2_ipv6only && addr_type == IPV6_ADDR_MAPPED)) 70 !(sk2_ipv6only && addr_type == IPV6_ADDR_MAPPED))
@@ -100,8 +100,8 @@ static inline int compute_score(struct sock *sk, struct net *net,
100 struct inet_sock *inet = inet_sk(sk); 100 struct inet_sock *inet = inet_sk(sk);
101 101
102 score = 0; 102 score = 0;
103 if (inet->dport) { 103 if (inet->inet_dport) {
104 if (inet->dport != sport) 104 if (inet->inet_dport != sport)
105 return -1; 105 return -1;
106 score++; 106 score++;
107 } 107 }
@@ -417,8 +417,8 @@ static struct sock *udp_v6_mcast_next(struct net *net, struct sock *sk,
417 417
418 if (s->sk_hash == num && s->sk_family == PF_INET6) { 418 if (s->sk_hash == num && s->sk_family == PF_INET6) {
419 struct ipv6_pinfo *np = inet6_sk(s); 419 struct ipv6_pinfo *np = inet6_sk(s);
420 if (inet->dport) { 420 if (inet->inet_dport) {
421 if (inet->dport != rmt_port) 421 if (inet->inet_dport != rmt_port)
422 continue; 422 continue;
423 } 423 }
424 if (!ipv6_addr_any(&np->daddr) && 424 if (!ipv6_addr_any(&np->daddr) &&
@@ -792,7 +792,7 @@ int udpv6_sendmsg(struct kiocb *iocb, struct sock *sk,
792 if (ipv6_addr_v4mapped(daddr)) { 792 if (ipv6_addr_v4mapped(daddr)) {
793 struct sockaddr_in sin; 793 struct sockaddr_in sin;
794 sin.sin_family = AF_INET; 794 sin.sin_family = AF_INET;
795 sin.sin_port = sin6 ? sin6->sin6_port : inet->dport; 795 sin.sin_port = sin6 ? sin6->sin6_port : inet->inet_dport;
796 sin.sin_addr.s_addr = daddr->s6_addr32[3]; 796 sin.sin_addr.s_addr = daddr->s6_addr32[3];
797 msg->msg_name = &sin; 797 msg->msg_name = &sin;
798 msg->msg_namelen = sizeof(sin); 798 msg->msg_namelen = sizeof(sin);
@@ -865,7 +865,7 @@ do_udp_sendmsg:
865 if (sk->sk_state != TCP_ESTABLISHED) 865 if (sk->sk_state != TCP_ESTABLISHED)
866 return -EDESTADDRREQ; 866 return -EDESTADDRREQ;
867 867
868 fl.fl_ip_dport = inet->dport; 868 fl.fl_ip_dport = inet->inet_dport;
869 daddr = &np->daddr; 869 daddr = &np->daddr;
870 fl.fl6_flowlabel = np->flow_label; 870 fl.fl6_flowlabel = np->flow_label;
871 connected = 1; 871 connected = 1;
@@ -911,7 +911,7 @@ do_udp_sendmsg:
911 fl.fl6_dst.s6_addr[15] = 0x1; /* :: means loopback (BSD'ism) */ 911 fl.fl6_dst.s6_addr[15] = 0x1; /* :: means loopback (BSD'ism) */
912 if (ipv6_addr_any(&fl.fl6_src) && !ipv6_addr_any(&np->saddr)) 912 if (ipv6_addr_any(&fl.fl6_src) && !ipv6_addr_any(&np->saddr))
913 ipv6_addr_copy(&fl.fl6_src, &np->saddr); 913 ipv6_addr_copy(&fl.fl6_src, &np->saddr);
914 fl.fl_ip_sport = inet->sport; 914 fl.fl_ip_sport = inet->inet_sport;
915 915
916 /* merge ip6_build_xmit from ip6_output */ 916 /* merge ip6_build_xmit from ip6_output */
917 if (opt && opt->srcrt) { 917 if (opt && opt->srcrt) {
@@ -1192,8 +1192,8 @@ static void udp6_sock_seq_show(struct seq_file *seq, struct sock *sp, int bucket
1192 1192
1193 dest = &np->daddr; 1193 dest = &np->daddr;
1194 src = &np->rcv_saddr; 1194 src = &np->rcv_saddr;
1195 destp = ntohs(inet->dport); 1195 destp = ntohs(inet->inet_dport);
1196 srcp = ntohs(inet->sport); 1196 srcp = ntohs(inet->inet_sport);
1197 seq_printf(seq, 1197 seq_printf(seq,
1198 "%5d: %08X%08X%08X%08X:%04X %08X%08X%08X%08X:%04X " 1198 "%5d: %08X%08X%08X%08X:%04X %08X%08X%08X%08X:%04X "
1199 "%02X %08X:%08X %02X:%08lX %08X %5d %8d %lu %d %p %d\n", 1199 "%02X %08X:%08X %02X:%08lX %08X %5d %8d %lu %d %p %d\n",