aboutsummaryrefslogtreecommitdiffstats
path: root/include/net
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 /include/net
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 'include/net')
-rw-r--r--include/net/inet6_hashtables.h4
-rw-r--r--include/net/inet_hashtables.h12
-rw-r--r--include/net/inet_sock.h36
-rw-r--r--include/net/inet_timewait_sock.h2
-rw-r--r--include/net/ip.h12
5 files changed, 33 insertions, 33 deletions
diff --git a/include/net/inet6_hashtables.h b/include/net/inet6_hashtables.h
index 22c73a77cd99..92838d3a1ab7 100644
--- a/include/net/inet6_hashtables.h
+++ b/include/net/inet6_hashtables.h
@@ -46,8 +46,8 @@ static inline int inet6_sk_ehashfn(const struct sock *sk)
46 const struct ipv6_pinfo *np = inet6_sk(sk); 46 const struct ipv6_pinfo *np = inet6_sk(sk);
47 const struct in6_addr *laddr = &np->rcv_saddr; 47 const struct in6_addr *laddr = &np->rcv_saddr;
48 const struct in6_addr *faddr = &np->daddr; 48 const struct in6_addr *faddr = &np->daddr;
49 const __u16 lport = inet->num; 49 const __u16 lport = inet->inet_num;
50 const __be16 fport = inet->dport; 50 const __be16 fport = inet->inet_dport;
51 struct net *net = sock_net(sk); 51 struct net *net = sock_net(sk);
52 52
53 return inet6_ehashfn(net, laddr, lport, faddr, fport); 53 return inet6_ehashfn(net, laddr, lport, faddr, fport);
diff --git a/include/net/inet_hashtables.h b/include/net/inet_hashtables.h
index 5f11c4a0daca..5b698b3b463d 100644
--- a/include/net/inet_hashtables.h
+++ b/include/net/inet_hashtables.h
@@ -241,7 +241,7 @@ static inline int inet_lhashfn(struct net *net, const unsigned short num)
241 241
242static inline int inet_sk_listen_hashfn(const struct sock *sk) 242static inline int inet_sk_listen_hashfn(const struct sock *sk)
243{ 243{
244 return inet_lhashfn(sock_net(sk), inet_sk(sk)->num); 244 return inet_lhashfn(sock_net(sk), inet_sk(sk)->inet_num);
245} 245}
246 246
247/* Caller must disable local BH processing. */ 247/* Caller must disable local BH processing. */
@@ -301,8 +301,8 @@ typedef __u64 __bitwise __addrpair;
301#endif /* __BIG_ENDIAN */ 301#endif /* __BIG_ENDIAN */
302#define INET_MATCH(__sk, __net, __hash, __cookie, __saddr, __daddr, __ports, __dif)\ 302#define INET_MATCH(__sk, __net, __hash, __cookie, __saddr, __daddr, __ports, __dif)\
303 (((__sk)->sk_hash == (__hash)) && net_eq(sock_net(__sk), (__net)) && \ 303 (((__sk)->sk_hash == (__hash)) && net_eq(sock_net(__sk), (__net)) && \
304 ((*((__addrpair *)&(inet_sk(__sk)->daddr))) == (__cookie)) && \ 304 ((*((__addrpair *)&(inet_sk(__sk)->inet_daddr))) == (__cookie)) && \
305 ((*((__portpair *)&(inet_sk(__sk)->dport))) == (__ports)) && \ 305 ((*((__portpair *)&(inet_sk(__sk)->inet_dport))) == (__ports)) && \
306 (!((__sk)->sk_bound_dev_if) || ((__sk)->sk_bound_dev_if == (__dif)))) 306 (!((__sk)->sk_bound_dev_if) || ((__sk)->sk_bound_dev_if == (__dif))))
307#define INET_TW_MATCH(__sk, __net, __hash, __cookie, __saddr, __daddr, __ports, __dif)\ 307#define INET_TW_MATCH(__sk, __net, __hash, __cookie, __saddr, __daddr, __ports, __dif)\
308 (((__sk)->sk_hash == (__hash)) && net_eq(sock_net(__sk), (__net)) && \ 308 (((__sk)->sk_hash == (__hash)) && net_eq(sock_net(__sk), (__net)) && \
@@ -313,9 +313,9 @@ typedef __u64 __bitwise __addrpair;
313#define INET_ADDR_COOKIE(__name, __saddr, __daddr) 313#define INET_ADDR_COOKIE(__name, __saddr, __daddr)
314#define INET_MATCH(__sk, __net, __hash, __cookie, __saddr, __daddr, __ports, __dif) \ 314#define INET_MATCH(__sk, __net, __hash, __cookie, __saddr, __daddr, __ports, __dif) \
315 (((__sk)->sk_hash == (__hash)) && net_eq(sock_net(__sk), (__net)) && \ 315 (((__sk)->sk_hash == (__hash)) && net_eq(sock_net(__sk), (__net)) && \
316 (inet_sk(__sk)->daddr == (__saddr)) && \ 316 (inet_sk(__sk)->inet_daddr == (__saddr)) && \
317 (inet_sk(__sk)->rcv_saddr == (__daddr)) && \ 317 (inet_sk(__sk)->inet_rcv_saddr == (__daddr)) && \
318 ((*((__portpair *)&(inet_sk(__sk)->dport))) == (__ports)) && \ 318 ((*((__portpair *)&(inet_sk(__sk)->inet_dport))) == (__ports)) && \
319 (!((__sk)->sk_bound_dev_if) || ((__sk)->sk_bound_dev_if == (__dif)))) 319 (!((__sk)->sk_bound_dev_if) || ((__sk)->sk_bound_dev_if == (__dif))))
320#define INET_TW_MATCH(__sk, __net, __hash,__cookie, __saddr, __daddr, __ports, __dif) \ 320#define INET_TW_MATCH(__sk, __net, __hash,__cookie, __saddr, __daddr, __ports, __dif) \
321 (((__sk)->sk_hash == (__hash)) && net_eq(sock_net(__sk), (__net)) && \ 321 (((__sk)->sk_hash == (__hash)) && net_eq(sock_net(__sk), (__net)) && \
diff --git a/include/net/inet_sock.h b/include/net/inet_sock.h
index 47004f35cc7e..bd4c53f75ac0 100644
--- a/include/net/inet_sock.h
+++ b/include/net/inet_sock.h
@@ -93,14 +93,14 @@ struct rtable;
93 * 93 *
94 * @sk - ancestor class 94 * @sk - ancestor class
95 * @pinet6 - pointer to IPv6 control block 95 * @pinet6 - pointer to IPv6 control block
96 * @daddr - Foreign IPv4 addr 96 * @inet_daddr - Foreign IPv4 addr
97 * @rcv_saddr - Bound local IPv4 addr 97 * @inet_rcv_saddr - Bound local IPv4 addr
98 * @dport - Destination port 98 * @inet_dport - Destination port
99 * @num - Local port 99 * @inet_num - Local port
100 * @saddr - Sending source 100 * @inet_saddr - Sending source
101 * @uc_ttl - Unicast TTL 101 * @uc_ttl - Unicast TTL
102 * @sport - Source port 102 * @inet_sport - Source port
103 * @id - ID counter for DF pkts 103 * @inet_id - ID counter for DF pkts
104 * @tos - TOS 104 * @tos - TOS
105 * @mc_ttl - Multicasting TTL 105 * @mc_ttl - Multicasting TTL
106 * @is_icsk - is this an inet_connection_sock? 106 * @is_icsk - is this an inet_connection_sock?
@@ -115,16 +115,16 @@ struct inet_sock {
115 struct ipv6_pinfo *pinet6; 115 struct ipv6_pinfo *pinet6;
116#endif 116#endif
117 /* Socket demultiplex comparisons on incoming packets. */ 117 /* Socket demultiplex comparisons on incoming packets. */
118 __be32 daddr; 118 __be32 inet_daddr;
119 __be32 rcv_saddr; 119 __be32 inet_rcv_saddr;
120 __be16 dport; 120 __be16 inet_dport;
121 __u16 num; 121 __u16 inet_num;
122 __be32 saddr; 122 __be32 inet_saddr;
123 __s16 uc_ttl; 123 __s16 uc_ttl;
124 __u16 cmsg_flags; 124 __u16 cmsg_flags;
125 struct ip_options *opt; 125 struct ip_options *opt;
126 __be16 sport; 126 __be16 inet_sport;
127 __u16 id; 127 __u16 inet_id;
128 __u8 tos; 128 __u8 tos;
129 __u8 mc_ttl; 129 __u8 mc_ttl;
130 __u8 pmtudisc; 130 __u8 pmtudisc;
@@ -190,10 +190,10 @@ static inline unsigned int inet_ehashfn(struct net *net,
190static inline int inet_sk_ehashfn(const struct sock *sk) 190static inline int inet_sk_ehashfn(const struct sock *sk)
191{ 191{
192 const struct inet_sock *inet = inet_sk(sk); 192 const struct inet_sock *inet = inet_sk(sk);
193 const __be32 laddr = inet->rcv_saddr; 193 const __be32 laddr = inet->inet_rcv_saddr;
194 const __u16 lport = inet->num; 194 const __u16 lport = inet->inet_num;
195 const __be32 faddr = inet->daddr; 195 const __be32 faddr = inet->inet_daddr;
196 const __be16 fport = inet->dport; 196 const __be16 fport = inet->inet_dport;
197 struct net *net = sock_net(sk); 197 struct net *net = sock_net(sk);
198 198
199 return inet_ehashfn(net, laddr, lport, faddr, fport); 199 return inet_ehashfn(net, laddr, lport, faddr, fport);
diff --git a/include/net/inet_timewait_sock.h b/include/net/inet_timewait_sock.h
index b63b80fac567..37f3aea074a5 100644
--- a/include/net/inet_timewait_sock.h
+++ b/include/net/inet_timewait_sock.h
@@ -194,7 +194,7 @@ static inline struct inet_timewait_sock *inet_twsk(const struct sock *sk)
194static inline __be32 inet_rcv_saddr(const struct sock *sk) 194static inline __be32 inet_rcv_saddr(const struct sock *sk)
195{ 195{
196 return likely(sk->sk_state != TCP_TIME_WAIT) ? 196 return likely(sk->sk_state != TCP_TIME_WAIT) ?
197 inet_sk(sk)->rcv_saddr : inet_twsk(sk)->tw_rcv_saddr; 197 inet_sk(sk)->inet_rcv_saddr : inet_twsk(sk)->tw_rcv_saddr;
198} 198}
199 199
200extern void inet_twsk_put(struct inet_timewait_sock *tw); 200extern void inet_twsk_put(struct inet_timewait_sock *tw);
diff --git a/include/net/ip.h b/include/net/ip.h
index 2f47e5482b55..376adf47764e 100644
--- a/include/net/ip.h
+++ b/include/net/ip.h
@@ -240,8 +240,8 @@ static inline void ip_select_ident(struct iphdr *iph, struct dst_entry *dst, str
240 * does not change, they drop every other packet in 240 * does not change, they drop every other packet in
241 * a TCP stream using header compression. 241 * a TCP stream using header compression.
242 */ 242 */
243 iph->id = (sk && inet_sk(sk)->daddr) ? 243 iph->id = (sk && inet_sk(sk)->inet_daddr) ?
244 htons(inet_sk(sk)->id++) : 0; 244 htons(inet_sk(sk)->inet_id++) : 0;
245 } else 245 } else
246 __ip_select_ident(iph, dst, 0); 246 __ip_select_ident(iph, dst, 0);
247} 247}
@@ -249,9 +249,9 @@ static inline void ip_select_ident(struct iphdr *iph, struct dst_entry *dst, str
249static inline void ip_select_ident_more(struct iphdr *iph, struct dst_entry *dst, struct sock *sk, int more) 249static inline void ip_select_ident_more(struct iphdr *iph, struct dst_entry *dst, struct sock *sk, int more)
250{ 250{
251 if (iph->frag_off & htons(IP_DF)) { 251 if (iph->frag_off & htons(IP_DF)) {
252 if (sk && inet_sk(sk)->daddr) { 252 if (sk && inet_sk(sk)->inet_daddr) {
253 iph->id = htons(inet_sk(sk)->id); 253 iph->id = htons(inet_sk(sk)->inet_id);
254 inet_sk(sk)->id += 1 + more; 254 inet_sk(sk)->inet_id += 1 + more;
255 } else 255 } else
256 iph->id = 0; 256 iph->id = 0;
257 } else 257 } else
@@ -317,7 +317,7 @@ static inline void ip_ib_mc_map(__be32 naddr, const unsigned char *broadcast, ch
317 317
318static __inline__ void inet_reset_saddr(struct sock *sk) 318static __inline__ void inet_reset_saddr(struct sock *sk)
319{ 319{
320 inet_sk(sk)->rcv_saddr = inet_sk(sk)->saddr = 0; 320 inet_sk(sk)->inet_rcv_saddr = inet_sk(sk)->inet_saddr = 0;
321#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) 321#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
322 if (sk->sk_family == PF_INET6) { 322 if (sk->sk_family == PF_INET6) {
323 struct ipv6_pinfo *np = inet6_sk(sk); 323 struct ipv6_pinfo *np = inet6_sk(sk);