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/tcp_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/ipv6/tcp_ipv6.c')
-rw-r--r-- | net/ipv6/tcp_ipv6.c | 32 |
1 files changed, 17 insertions, 15 deletions
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c index 451763059142..c54ec3615ded 100644 --- a/net/ipv6/tcp_ipv6.c +++ b/net/ipv6/tcp_ipv6.c | |||
@@ -226,8 +226,9 @@ static int tcp_v6_connect(struct sock *sk, struct sockaddr *uaddr, | |||
226 | #endif | 226 | #endif |
227 | goto failure; | 227 | goto failure; |
228 | } else { | 228 | } else { |
229 | ipv6_addr_set_v4mapped(inet->saddr, &np->saddr); | 229 | ipv6_addr_set_v4mapped(inet->inet_saddr, &np->saddr); |
230 | ipv6_addr_set_v4mapped(inet->rcv_saddr, &np->rcv_saddr); | 230 | ipv6_addr_set_v4mapped(inet->inet_rcv_saddr, |
231 | &np->rcv_saddr); | ||
231 | } | 232 | } |
232 | 233 | ||
233 | return err; | 234 | return err; |
@@ -243,7 +244,7 @@ static int tcp_v6_connect(struct sock *sk, struct sockaddr *uaddr, | |||
243 | fl.oif = sk->sk_bound_dev_if; | 244 | fl.oif = sk->sk_bound_dev_if; |
244 | fl.mark = sk->sk_mark; | 245 | fl.mark = sk->sk_mark; |
245 | fl.fl_ip_dport = usin->sin6_port; | 246 | fl.fl_ip_dport = usin->sin6_port; |
246 | fl.fl_ip_sport = inet->sport; | 247 | fl.fl_ip_sport = inet->inet_sport; |
247 | 248 | ||
248 | if (np->opt && np->opt->srcrt) { | 249 | if (np->opt && np->opt->srcrt) { |
249 | struct rt0_hdr *rt0 = (struct rt0_hdr *)np->opt->srcrt; | 250 | struct rt0_hdr *rt0 = (struct rt0_hdr *)np->opt->srcrt; |
@@ -275,7 +276,7 @@ static int tcp_v6_connect(struct sock *sk, struct sockaddr *uaddr, | |||
275 | 276 | ||
276 | /* set the source address */ | 277 | /* set the source address */ |
277 | ipv6_addr_copy(&np->saddr, saddr); | 278 | ipv6_addr_copy(&np->saddr, saddr); |
278 | inet->rcv_saddr = LOOPBACK4_IPV6; | 279 | inet->inet_rcv_saddr = LOOPBACK4_IPV6; |
279 | 280 | ||
280 | sk->sk_gso_type = SKB_GSO_TCPV6; | 281 | sk->sk_gso_type = SKB_GSO_TCPV6; |
281 | __ip6_dst_store(sk, dst, NULL, NULL); | 282 | __ip6_dst_store(sk, dst, NULL, NULL); |
@@ -287,7 +288,7 @@ static int tcp_v6_connect(struct sock *sk, struct sockaddr *uaddr, | |||
287 | 288 | ||
288 | tp->rx_opt.mss_clamp = IPV6_MIN_MTU - sizeof(struct tcphdr) - sizeof(struct ipv6hdr); | 289 | tp->rx_opt.mss_clamp = IPV6_MIN_MTU - sizeof(struct tcphdr) - sizeof(struct ipv6hdr); |
289 | 290 | ||
290 | inet->dport = usin->sin6_port; | 291 | inet->inet_dport = usin->sin6_port; |
291 | 292 | ||
292 | tcp_set_state(sk, TCP_SYN_SENT); | 293 | tcp_set_state(sk, TCP_SYN_SENT); |
293 | err = inet6_hash_connect(&tcp_death_row, sk); | 294 | err = inet6_hash_connect(&tcp_death_row, sk); |
@@ -297,8 +298,8 @@ static int tcp_v6_connect(struct sock *sk, struct sockaddr *uaddr, | |||
297 | if (!tp->write_seq) | 298 | if (!tp->write_seq) |
298 | tp->write_seq = secure_tcpv6_sequence_number(np->saddr.s6_addr32, | 299 | tp->write_seq = secure_tcpv6_sequence_number(np->saddr.s6_addr32, |
299 | np->daddr.s6_addr32, | 300 | np->daddr.s6_addr32, |
300 | inet->sport, | 301 | inet->inet_sport, |
301 | inet->dport); | 302 | inet->inet_dport); |
302 | 303 | ||
303 | err = tcp_connect(sk); | 304 | err = tcp_connect(sk); |
304 | if (err) | 305 | if (err) |
@@ -310,7 +311,7 @@ late_failure: | |||
310 | tcp_set_state(sk, TCP_CLOSE); | 311 | tcp_set_state(sk, TCP_CLOSE); |
311 | __sk_dst_reset(sk); | 312 | __sk_dst_reset(sk); |
312 | failure: | 313 | failure: |
313 | inet->dport = 0; | 314 | inet->inet_dport = 0; |
314 | sk->sk_route_caps = 0; | 315 | sk->sk_route_caps = 0; |
315 | return err; | 316 | return err; |
316 | } | 317 | } |
@@ -383,8 +384,8 @@ static void tcp_v6_err(struct sk_buff *skb, struct inet6_skb_parm *opt, | |||
383 | ipv6_addr_copy(&fl.fl6_src, &np->saddr); | 384 | ipv6_addr_copy(&fl.fl6_src, &np->saddr); |
384 | fl.oif = sk->sk_bound_dev_if; | 385 | fl.oif = sk->sk_bound_dev_if; |
385 | fl.mark = sk->sk_mark; | 386 | fl.mark = sk->sk_mark; |
386 | fl.fl_ip_dport = inet->dport; | 387 | fl.fl_ip_dport = inet->inet_dport; |
387 | fl.fl_ip_sport = inet->sport; | 388 | fl.fl_ip_sport = inet->inet_sport; |
388 | security_skb_classify_flow(skb, &fl); | 389 | security_skb_classify_flow(skb, &fl); |
389 | 390 | ||
390 | if ((err = ip6_dst_lookup(sk, &dst, &fl))) { | 391 | if ((err = ip6_dst_lookup(sk, &dst, &fl))) { |
@@ -1291,9 +1292,9 @@ static struct sock * tcp_v6_syn_recv_sock(struct sock *sk, struct sk_buff *skb, | |||
1291 | 1292 | ||
1292 | memcpy(newnp, np, sizeof(struct ipv6_pinfo)); | 1293 | memcpy(newnp, np, sizeof(struct ipv6_pinfo)); |
1293 | 1294 | ||
1294 | ipv6_addr_set_v4mapped(newinet->daddr, &newnp->daddr); | 1295 | ipv6_addr_set_v4mapped(newinet->inet_daddr, &newnp->daddr); |
1295 | 1296 | ||
1296 | ipv6_addr_set_v4mapped(newinet->saddr, &newnp->saddr); | 1297 | ipv6_addr_set_v4mapped(newinet->inet_saddr, &newnp->saddr); |
1297 | 1298 | ||
1298 | ipv6_addr_copy(&newnp->rcv_saddr, &newnp->saddr); | 1299 | ipv6_addr_copy(&newnp->rcv_saddr, &newnp->saddr); |
1299 | 1300 | ||
@@ -1431,7 +1432,8 @@ static struct sock * tcp_v6_syn_recv_sock(struct sock *sk, struct sk_buff *skb, | |||
1431 | newtp->advmss = dst_metric(dst, RTAX_ADVMSS); | 1432 | newtp->advmss = dst_metric(dst, RTAX_ADVMSS); |
1432 | tcp_initialize_rcv_mss(newsk); | 1433 | tcp_initialize_rcv_mss(newsk); |
1433 | 1434 | ||
1434 | newinet->daddr = newinet->saddr = newinet->rcv_saddr = LOOPBACK4_IPV6; | 1435 | newinet->inet_daddr = newinet->inet_saddr = LOOPBACK4_IPV6; |
1436 | newinet->inet_rcv_saddr = LOOPBACK4_IPV6; | ||
1435 | 1437 | ||
1436 | #ifdef CONFIG_TCP_MD5SIG | 1438 | #ifdef CONFIG_TCP_MD5SIG |
1437 | /* Copy over the MD5 key from the original socket */ | 1439 | /* Copy over the MD5 key from the original socket */ |
@@ -1931,8 +1933,8 @@ static void get_tcp6_sock(struct seq_file *seq, struct sock *sp, int i) | |||
1931 | 1933 | ||
1932 | dest = &np->daddr; | 1934 | dest = &np->daddr; |
1933 | src = &np->rcv_saddr; | 1935 | src = &np->rcv_saddr; |
1934 | destp = ntohs(inet->dport); | 1936 | destp = ntohs(inet->inet_dport); |
1935 | srcp = ntohs(inet->sport); | 1937 | srcp = ntohs(inet->inet_sport); |
1936 | 1938 | ||
1937 | if (icsk->icsk_pending == ICSK_TIME_RETRANS) { | 1939 | if (icsk->icsk_pending == ICSK_TIME_RETRANS) { |
1938 | timer_active = 1; | 1940 | timer_active = 1; |