aboutsummaryrefslogtreecommitdiffstats
path: root/net/sched/ematch.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/sched/ematch.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/sched/ematch.c')
-rw-r--r--net/sched/ematch.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/net/sched/ematch.c b/net/sched/ematch.c
index 959c306c5714..63146d339d81 100644
--- a/net/sched/ematch.c
+++ b/net/sched/ematch.c
@@ -418,17 +418,19 @@ void tcf_em_tree_destroy(struct tcf_proto *tp, struct tcf_ematch_tree *tree)
418int tcf_em_tree_dump(struct sk_buff *skb, struct tcf_ematch_tree *tree, int tlv) 418int tcf_em_tree_dump(struct sk_buff *skb, struct tcf_ematch_tree *tree, int tlv)
419{ 419{
420 int i; 420 int i;
421 struct rtattr * top_start = (struct rtattr*) skb->tail; 421 u8 *tail;
422 struct rtattr * list_start; 422 struct rtattr *top_start = (struct rtattr *)skb_tail_pointer(skb);
423 struct rtattr *list_start;
423 424
424 RTA_PUT(skb, tlv, 0, NULL); 425 RTA_PUT(skb, tlv, 0, NULL);
425 RTA_PUT(skb, TCA_EMATCH_TREE_HDR, sizeof(tree->hdr), &tree->hdr); 426 RTA_PUT(skb, TCA_EMATCH_TREE_HDR, sizeof(tree->hdr), &tree->hdr);
426 427
427 list_start = (struct rtattr *) skb->tail; 428 list_start = (struct rtattr *)skb_tail_pointer(skb);
428 RTA_PUT(skb, TCA_EMATCH_TREE_LIST, 0, NULL); 429 RTA_PUT(skb, TCA_EMATCH_TREE_LIST, 0, NULL);
429 430
431 tail = skb_tail_pointer(skb);
430 for (i = 0; i < tree->hdr.nmatches; i++) { 432 for (i = 0; i < tree->hdr.nmatches; i++) {
431 struct rtattr *match_start = (struct rtattr*) skb->tail; 433 struct rtattr *match_start = (struct rtattr *)tail;
432 struct tcf_ematch *em = tcf_em_get_match(tree, i); 434 struct tcf_ematch *em = tcf_em_get_match(tree, i);
433 struct tcf_ematch_hdr em_hdr = { 435 struct tcf_ematch_hdr em_hdr = {
434 .kind = em->ops ? em->ops->kind : TCF_EM_CONTAINER, 436 .kind = em->ops ? em->ops->kind : TCF_EM_CONTAINER,
@@ -447,11 +449,12 @@ int tcf_em_tree_dump(struct sk_buff *skb, struct tcf_ematch_tree *tree, int tlv)
447 } else if (em->datalen > 0) 449 } else if (em->datalen > 0)
448 RTA_PUT_NOHDR(skb, em->datalen, (void *) em->data); 450 RTA_PUT_NOHDR(skb, em->datalen, (void *) em->data);
449 451
450 match_start->rta_len = skb->tail - (u8*) match_start; 452 tail = skb_tail_pointer(skb);
453 match_start->rta_len = tail - (u8 *)match_start;
451 } 454 }
452 455
453 list_start->rta_len = skb->tail - (u8 *) list_start; 456 list_start->rta_len = tail - (u8 *)list_start;
454 top_start->rta_len = skb->tail - (u8 *) top_start; 457 top_start->rta_len = tail - (u8 *)top_start;
455 458
456 return 0; 459 return 0;
457 460