[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>
This commit is contained in:
committed by
David S. Miller
parent
be8bd86321
commit
27a884dc3c
@@ -60,7 +60,7 @@ static int inet_csk_diag_fill(struct sock *sk,
|
||||
struct nlmsghdr *nlh;
|
||||
void *info = NULL;
|
||||
struct inet_diag_meminfo *minfo = NULL;
|
||||
unsigned char *b = skb->tail;
|
||||
unsigned char *b = skb_tail_pointer(skb);
|
||||
const struct inet_diag_handler *handler;
|
||||
|
||||
handler = inet_diag_table[unlh->nlmsg_type];
|
||||
@@ -147,7 +147,7 @@ static int inet_csk_diag_fill(struct sock *sk,
|
||||
icsk->icsk_ca_ops && icsk->icsk_ca_ops->get_info)
|
||||
icsk->icsk_ca_ops->get_info(sk, ext, skb);
|
||||
|
||||
nlh->nlmsg_len = skb->tail - b;
|
||||
nlh->nlmsg_len = skb_tail_pointer(skb) - b;
|
||||
return skb->len;
|
||||
|
||||
rtattr_failure:
|
||||
@@ -163,7 +163,7 @@ static int inet_twsk_diag_fill(struct inet_timewait_sock *tw,
|
||||
{
|
||||
long tmo;
|
||||
struct inet_diag_msg *r;
|
||||
const unsigned char *previous_tail = skb->tail;
|
||||
const unsigned char *previous_tail = skb_tail_pointer(skb);
|
||||
struct nlmsghdr *nlh = NLMSG_PUT(skb, pid, seq,
|
||||
unlh->nlmsg_type, sizeof(*r));
|
||||
|
||||
@@ -205,7 +205,7 @@ static int inet_twsk_diag_fill(struct inet_timewait_sock *tw,
|
||||
&tw6->tw_v6_daddr);
|
||||
}
|
||||
#endif
|
||||
nlh->nlmsg_len = skb->tail - previous_tail;
|
||||
nlh->nlmsg_len = skb_tail_pointer(skb) - previous_tail;
|
||||
return skb->len;
|
||||
nlmsg_failure:
|
||||
skb_trim(skb, previous_tail - skb->data);
|
||||
@@ -535,7 +535,7 @@ static int inet_diag_fill_req(struct sk_buff *skb, struct sock *sk,
|
||||
{
|
||||
const struct inet_request_sock *ireq = inet_rsk(req);
|
||||
struct inet_sock *inet = inet_sk(sk);
|
||||
unsigned char *b = skb->tail;
|
||||
unsigned char *b = skb_tail_pointer(skb);
|
||||
struct inet_diag_msg *r;
|
||||
struct nlmsghdr *nlh;
|
||||
long tmo;
|
||||
@@ -574,7 +574,7 @@ static int inet_diag_fill_req(struct sk_buff *skb, struct sock *sk,
|
||||
&inet6_rsk(req)->rmt_addr);
|
||||
}
|
||||
#endif
|
||||
nlh->nlmsg_len = skb->tail - b;
|
||||
nlh->nlmsg_len = skb_tail_pointer(skb) - b;
|
||||
|
||||
return skb->len;
|
||||
|
||||
|
Reference in New Issue
Block a user