aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/inet_diag.c
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2007-04-19 23:29:13 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2007-04-26 01:26:28 -0400
commit27a884dc3cb63b93c2b3b643f5b31eed5f8a4d26 (patch)
tree5a267e40f9b94014be38dad5de0a52b6628834e0 /net/ipv4/inet_diag.c
parentbe8bd86321fa7f06359d866ef61fb4d2f3e9dce9 (diff)
[SK_BUFF]: Convert skb->tail to sk_buff_data_t
So that it is also an offset from skb->head, reduces its size from 8 to 4 bytes on 64bit architectures, allowing us to combine the 4 bytes hole left by the layer headers conversion, reducing struct sk_buff size to 256 bytes, i.e. 4 64byte cachelines, and since the sk_buff slab cache is SLAB_HWCACHE_ALIGN... :-) Many calculations that previously required that skb->{transport,network, mac}_header be first converted to a pointer now can be done directly, being meaningful as offsets or pointers. Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/inet_diag.c')
-rw-r--r--net/ipv4/inet_diag.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/net/ipv4/inet_diag.c b/net/ipv4/inet_diag.c
index 5df71cd08da8..37362cd1d07f 100644
--- a/net/ipv4/inet_diag.c
+++ b/net/ipv4/inet_diag.c
@@ -60,7 +60,7 @@ static int inet_csk_diag_fill(struct sock *sk,
60 struct nlmsghdr *nlh; 60 struct nlmsghdr *nlh;
61 void *info = NULL; 61 void *info = NULL;
62 struct inet_diag_meminfo *minfo = NULL; 62 struct inet_diag_meminfo *minfo = NULL;
63 unsigned char *b = skb->tail; 63 unsigned char *b = skb_tail_pointer(skb);
64 const struct inet_diag_handler *handler; 64 const struct inet_diag_handler *handler;
65 65
66 handler = inet_diag_table[unlh->nlmsg_type]; 66 handler = inet_diag_table[unlh->nlmsg_type];
@@ -147,7 +147,7 @@ static int inet_csk_diag_fill(struct sock *sk,
147 icsk->icsk_ca_ops && icsk->icsk_ca_ops->get_info) 147 icsk->icsk_ca_ops && icsk->icsk_ca_ops->get_info)
148 icsk->icsk_ca_ops->get_info(sk, ext, skb); 148 icsk->icsk_ca_ops->get_info(sk, ext, skb);
149 149
150 nlh->nlmsg_len = skb->tail - b; 150 nlh->nlmsg_len = skb_tail_pointer(skb) - b;
151 return skb->len; 151 return skb->len;
152 152
153rtattr_failure: 153rtattr_failure:
@@ -163,7 +163,7 @@ static int inet_twsk_diag_fill(struct inet_timewait_sock *tw,
163{ 163{
164 long tmo; 164 long tmo;
165 struct inet_diag_msg *r; 165 struct inet_diag_msg *r;
166 const unsigned char *previous_tail = skb->tail; 166 const unsigned char *previous_tail = skb_tail_pointer(skb);
167 struct nlmsghdr *nlh = NLMSG_PUT(skb, pid, seq, 167 struct nlmsghdr *nlh = NLMSG_PUT(skb, pid, seq,
168 unlh->nlmsg_type, sizeof(*r)); 168 unlh->nlmsg_type, sizeof(*r));
169 169
@@ -205,7 +205,7 @@ static int inet_twsk_diag_fill(struct inet_timewait_sock *tw,
205 &tw6->tw_v6_daddr); 205 &tw6->tw_v6_daddr);
206 } 206 }
207#endif 207#endif
208 nlh->nlmsg_len = skb->tail - previous_tail; 208 nlh->nlmsg_len = skb_tail_pointer(skb) - previous_tail;
209 return skb->len; 209 return skb->len;
210nlmsg_failure: 210nlmsg_failure:
211 skb_trim(skb, previous_tail - skb->data); 211 skb_trim(skb, previous_tail - skb->data);
@@ -535,7 +535,7 @@ static int inet_diag_fill_req(struct sk_buff *skb, struct sock *sk,
535{ 535{
536 const struct inet_request_sock *ireq = inet_rsk(req); 536 const struct inet_request_sock *ireq = inet_rsk(req);
537 struct inet_sock *inet = inet_sk(sk); 537 struct inet_sock *inet = inet_sk(sk);
538 unsigned char *b = skb->tail; 538 unsigned char *b = skb_tail_pointer(skb);
539 struct inet_diag_msg *r; 539 struct inet_diag_msg *r;
540 struct nlmsghdr *nlh; 540 struct nlmsghdr *nlh;
541 long tmo; 541 long tmo;
@@ -574,7 +574,7 @@ static int inet_diag_fill_req(struct sk_buff *skb, struct sock *sk,
574 &inet6_rsk(req)->rmt_addr); 574 &inet6_rsk(req)->rmt_addr);
575 } 575 }
576#endif 576#endif
577 nlh->nlmsg_len = skb->tail - b; 577 nlh->nlmsg_len = skb_tail_pointer(skb) - b;
578 578
579 return skb->len; 579 return skb->len;
580 580