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/raw.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/raw.c')
-rw-r--r-- | net/ipv6/raw.c | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/net/ipv6/raw.c b/net/ipv6/raw.c index fd737efed96c..52ed7d7f9dab 100644 --- a/net/ipv6/raw.c +++ b/net/ipv6/raw.c | |||
@@ -72,7 +72,7 @@ static struct sock *__raw_v6_lookup(struct net *net, struct sock *sk, | |||
72 | int is_multicast = ipv6_addr_is_multicast(loc_addr); | 72 | int is_multicast = ipv6_addr_is_multicast(loc_addr); |
73 | 73 | ||
74 | sk_for_each_from(sk, node) | 74 | sk_for_each_from(sk, node) |
75 | if (inet_sk(sk)->num == num) { | 75 | if (inet_sk(sk)->inet_num == num) { |
76 | struct ipv6_pinfo *np = inet6_sk(sk); | 76 | struct ipv6_pinfo *np = inet6_sk(sk); |
77 | 77 | ||
78 | if (!net_eq(sock_net(sk), net)) | 78 | if (!net_eq(sock_net(sk), net)) |
@@ -298,7 +298,7 @@ static int rawv6_bind(struct sock *sk, struct sockaddr *uaddr, int addr_len) | |||
298 | dev_put(dev); | 298 | dev_put(dev); |
299 | } | 299 | } |
300 | 300 | ||
301 | inet->rcv_saddr = inet->saddr = v4addr; | 301 | inet->inet_rcv_saddr = inet->inet_saddr = v4addr; |
302 | ipv6_addr_copy(&np->rcv_saddr, &addr->sin6_addr); | 302 | ipv6_addr_copy(&np->rcv_saddr, &addr->sin6_addr); |
303 | if (!(addr_type & IPV6_ADDR_MULTICAST)) | 303 | if (!(addr_type & IPV6_ADDR_MULTICAST)) |
304 | ipv6_addr_copy(&np->saddr, &addr->sin6_addr); | 304 | ipv6_addr_copy(&np->saddr, &addr->sin6_addr); |
@@ -415,14 +415,14 @@ int rawv6_rcv(struct sock *sk, struct sk_buff *skb) | |||
415 | skb_network_header_len(skb)); | 415 | skb_network_header_len(skb)); |
416 | if (!csum_ipv6_magic(&ipv6_hdr(skb)->saddr, | 416 | if (!csum_ipv6_magic(&ipv6_hdr(skb)->saddr, |
417 | &ipv6_hdr(skb)->daddr, | 417 | &ipv6_hdr(skb)->daddr, |
418 | skb->len, inet->num, skb->csum)) | 418 | skb->len, inet->inet_num, skb->csum)) |
419 | skb->ip_summed = CHECKSUM_UNNECESSARY; | 419 | skb->ip_summed = CHECKSUM_UNNECESSARY; |
420 | } | 420 | } |
421 | if (!skb_csum_unnecessary(skb)) | 421 | if (!skb_csum_unnecessary(skb)) |
422 | skb->csum = ~csum_unfold(csum_ipv6_magic(&ipv6_hdr(skb)->saddr, | 422 | skb->csum = ~csum_unfold(csum_ipv6_magic(&ipv6_hdr(skb)->saddr, |
423 | &ipv6_hdr(skb)->daddr, | 423 | &ipv6_hdr(skb)->daddr, |
424 | skb->len, | 424 | skb->len, |
425 | inet->num, 0)); | 425 | inet->inet_num, 0)); |
426 | 426 | ||
427 | if (inet->hdrincl) { | 427 | if (inet->hdrincl) { |
428 | if (skb_checksum_complete(skb)) { | 428 | if (skb_checksum_complete(skb)) { |
@@ -765,8 +765,8 @@ static int rawv6_sendmsg(struct kiocb *iocb, struct sock *sk, | |||
765 | proto = ntohs(sin6->sin6_port); | 765 | proto = ntohs(sin6->sin6_port); |
766 | 766 | ||
767 | if (!proto) | 767 | if (!proto) |
768 | proto = inet->num; | 768 | proto = inet->inet_num; |
769 | else if (proto != inet->num) | 769 | else if (proto != inet->inet_num) |
770 | return(-EINVAL); | 770 | return(-EINVAL); |
771 | 771 | ||
772 | if (proto > 255) | 772 | if (proto > 255) |
@@ -799,7 +799,7 @@ static int rawv6_sendmsg(struct kiocb *iocb, struct sock *sk, | |||
799 | if (sk->sk_state != TCP_ESTABLISHED) | 799 | if (sk->sk_state != TCP_ESTABLISHED) |
800 | return -EDESTADDRREQ; | 800 | return -EDESTADDRREQ; |
801 | 801 | ||
802 | proto = inet->num; | 802 | proto = inet->inet_num; |
803 | daddr = &np->daddr; | 803 | daddr = &np->daddr; |
804 | fl.fl6_flowlabel = np->flow_label; | 804 | fl.fl6_flowlabel = np->flow_label; |
805 | } | 805 | } |
@@ -966,7 +966,7 @@ static int do_rawv6_setsockopt(struct sock *sk, int level, int optname, | |||
966 | 966 | ||
967 | switch (optname) { | 967 | switch (optname) { |
968 | case IPV6_CHECKSUM: | 968 | case IPV6_CHECKSUM: |
969 | if (inet_sk(sk)->num == IPPROTO_ICMPV6 && | 969 | if (inet_sk(sk)->inet_num == IPPROTO_ICMPV6 && |
970 | level == IPPROTO_IPV6) { | 970 | level == IPPROTO_IPV6) { |
971 | /* | 971 | /* |
972 | * RFC3542 tells that IPV6_CHECKSUM socket | 972 | * RFC3542 tells that IPV6_CHECKSUM socket |
@@ -1006,7 +1006,7 @@ static int rawv6_setsockopt(struct sock *sk, int level, int optname, | |||
1006 | break; | 1006 | break; |
1007 | 1007 | ||
1008 | case SOL_ICMPV6: | 1008 | case SOL_ICMPV6: |
1009 | if (inet_sk(sk)->num != IPPROTO_ICMPV6) | 1009 | if (inet_sk(sk)->inet_num != IPPROTO_ICMPV6) |
1010 | return -EOPNOTSUPP; | 1010 | return -EOPNOTSUPP; |
1011 | return rawv6_seticmpfilter(sk, level, optname, optval, | 1011 | return rawv6_seticmpfilter(sk, level, optname, optval, |
1012 | optlen); | 1012 | optlen); |
@@ -1029,7 +1029,7 @@ static int compat_rawv6_setsockopt(struct sock *sk, int level, int optname, | |||
1029 | case SOL_RAW: | 1029 | case SOL_RAW: |
1030 | break; | 1030 | break; |
1031 | case SOL_ICMPV6: | 1031 | case SOL_ICMPV6: |
1032 | if (inet_sk(sk)->num != IPPROTO_ICMPV6) | 1032 | if (inet_sk(sk)->inet_num != IPPROTO_ICMPV6) |
1033 | return -EOPNOTSUPP; | 1033 | return -EOPNOTSUPP; |
1034 | return rawv6_seticmpfilter(sk, level, optname, optval, optlen); | 1034 | return rawv6_seticmpfilter(sk, level, optname, optval, optlen); |
1035 | case SOL_IPV6: | 1035 | case SOL_IPV6: |
@@ -1086,7 +1086,7 @@ static int rawv6_getsockopt(struct sock *sk, int level, int optname, | |||
1086 | break; | 1086 | break; |
1087 | 1087 | ||
1088 | case SOL_ICMPV6: | 1088 | case SOL_ICMPV6: |
1089 | if (inet_sk(sk)->num != IPPROTO_ICMPV6) | 1089 | if (inet_sk(sk)->inet_num != IPPROTO_ICMPV6) |
1090 | return -EOPNOTSUPP; | 1090 | return -EOPNOTSUPP; |
1091 | return rawv6_geticmpfilter(sk, level, optname, optval, | 1091 | return rawv6_geticmpfilter(sk, level, optname, optval, |
1092 | optlen); | 1092 | optlen); |
@@ -1109,7 +1109,7 @@ static int compat_rawv6_getsockopt(struct sock *sk, int level, int optname, | |||
1109 | case SOL_RAW: | 1109 | case SOL_RAW: |
1110 | break; | 1110 | break; |
1111 | case SOL_ICMPV6: | 1111 | case SOL_ICMPV6: |
1112 | if (inet_sk(sk)->num != IPPROTO_ICMPV6) | 1112 | if (inet_sk(sk)->inet_num != IPPROTO_ICMPV6) |
1113 | return -EOPNOTSUPP; | 1113 | return -EOPNOTSUPP; |
1114 | return rawv6_geticmpfilter(sk, level, optname, optval, optlen); | 1114 | return rawv6_geticmpfilter(sk, level, optname, optval, optlen); |
1115 | case SOL_IPV6: | 1115 | case SOL_IPV6: |
@@ -1156,7 +1156,7 @@ static int rawv6_ioctl(struct sock *sk, int cmd, unsigned long arg) | |||
1156 | 1156 | ||
1157 | static void rawv6_close(struct sock *sk, long timeout) | 1157 | static void rawv6_close(struct sock *sk, long timeout) |
1158 | { | 1158 | { |
1159 | if (inet_sk(sk)->num == IPPROTO_RAW) | 1159 | if (inet_sk(sk)->inet_num == IPPROTO_RAW) |
1160 | ip6_ra_control(sk, -1); | 1160 | ip6_ra_control(sk, -1); |
1161 | ip6mr_sk_done(sk); | 1161 | ip6mr_sk_done(sk); |
1162 | sk_common_release(sk); | 1162 | sk_common_release(sk); |
@@ -1175,7 +1175,7 @@ static int rawv6_init_sk(struct sock *sk) | |||
1175 | { | 1175 | { |
1176 | struct raw6_sock *rp = raw6_sk(sk); | 1176 | struct raw6_sock *rp = raw6_sk(sk); |
1177 | 1177 | ||
1178 | switch (inet_sk(sk)->num) { | 1178 | switch (inet_sk(sk)->inet_num) { |
1179 | case IPPROTO_ICMPV6: | 1179 | case IPPROTO_ICMPV6: |
1180 | rp->checksum = 1; | 1180 | rp->checksum = 1; |
1181 | rp->offset = 2; | 1181 | rp->offset = 2; |
@@ -1225,7 +1225,7 @@ static void raw6_sock_seq_show(struct seq_file *seq, struct sock *sp, int i) | |||
1225 | dest = &np->daddr; | 1225 | dest = &np->daddr; |
1226 | src = &np->rcv_saddr; | 1226 | src = &np->rcv_saddr; |
1227 | destp = 0; | 1227 | destp = 0; |
1228 | srcp = inet_sk(sp)->num; | 1228 | srcp = inet_sk(sp)->inet_num; |
1229 | seq_printf(seq, | 1229 | seq_printf(seq, |
1230 | "%4d: %08X%08X%08X%08X:%04X %08X%08X%08X%08X:%04X " | 1230 | "%4d: %08X%08X%08X%08X:%04X %08X%08X%08X%08X:%04X " |
1231 | "%02X %08X:%08X %02X:%08lX %08X %5d %8d %lu %d %p %d\n", | 1231 | "%02X %08X:%08X %02X:%08lX %08X %5d %8d %lu %d %p %d\n", |