aboutsummaryrefslogtreecommitdiffstats
path: root/net/sched/cls_api.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/cls_api.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/cls_api.c')
-rw-r--r--net/sched/cls_api.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/net/sched/cls_api.c b/net/sched/cls_api.c
index 5c6ffdb77d2d..84231baf77d1 100644
--- a/net/sched/cls_api.c
+++ b/net/sched/cls_api.c
@@ -323,7 +323,7 @@ tcf_fill_node(struct sk_buff *skb, struct tcf_proto *tp, unsigned long fh,
323{ 323{
324 struct tcmsg *tcm; 324 struct tcmsg *tcm;
325 struct nlmsghdr *nlh; 325 struct nlmsghdr *nlh;
326 unsigned char *b = skb->tail; 326 unsigned char *b = skb_tail_pointer(skb);
327 327
328 nlh = NLMSG_NEW(skb, pid, seq, event, sizeof(*tcm), flags); 328 nlh = NLMSG_NEW(skb, pid, seq, event, sizeof(*tcm), flags);
329 tcm = NLMSG_DATA(nlh); 329 tcm = NLMSG_DATA(nlh);
@@ -340,7 +340,7 @@ tcf_fill_node(struct sk_buff *skb, struct tcf_proto *tp, unsigned long fh,
340 if (tp->ops->dump && tp->ops->dump(tp, fh, skb, tcm) < 0) 340 if (tp->ops->dump && tp->ops->dump(tp, fh, skb, tcm) < 0)
341 goto rtattr_failure; 341 goto rtattr_failure;
342 } 342 }
343 nlh->nlmsg_len = skb->tail - b; 343 nlh->nlmsg_len = skb_tail_pointer(skb) - b;
344 return skb->len; 344 return skb->len;
345 345
346nlmsg_failure: 346nlmsg_failure:
@@ -563,30 +563,30 @@ tcf_exts_dump(struct sk_buff *skb, struct tcf_exts *exts,
563 * to work with both old and new modes of entering 563 * to work with both old and new modes of entering
564 * tc data even if iproute2 was newer - jhs 564 * tc data even if iproute2 was newer - jhs
565 */ 565 */
566 struct rtattr * p_rta = (struct rtattr*) skb->tail; 566 struct rtattr *p_rta = (struct rtattr *)skb_tail_pointer(skb);
567 567
568 if (exts->action->type != TCA_OLD_COMPAT) { 568 if (exts->action->type != TCA_OLD_COMPAT) {
569 RTA_PUT(skb, map->action, 0, NULL); 569 RTA_PUT(skb, map->action, 0, NULL);
570 if (tcf_action_dump(skb, exts->action, 0, 0) < 0) 570 if (tcf_action_dump(skb, exts->action, 0, 0) < 0)
571 goto rtattr_failure; 571 goto rtattr_failure;
572 p_rta->rta_len = skb->tail - (u8*)p_rta; 572 p_rta->rta_len = skb_tail_pointer(skb) - (u8 *)p_rta;
573 } else if (map->police) { 573 } else if (map->police) {
574 RTA_PUT(skb, map->police, 0, NULL); 574 RTA_PUT(skb, map->police, 0, NULL);
575 if (tcf_action_dump_old(skb, exts->action, 0, 0) < 0) 575 if (tcf_action_dump_old(skb, exts->action, 0, 0) < 0)
576 goto rtattr_failure; 576 goto rtattr_failure;
577 p_rta->rta_len = skb->tail - (u8*)p_rta; 577 p_rta->rta_len = skb_tail_pointer(skb) - (u8 *)p_rta;
578 } 578 }
579 } 579 }
580#elif defined CONFIG_NET_CLS_POLICE 580#elif defined CONFIG_NET_CLS_POLICE
581 if (map->police && exts->police) { 581 if (map->police && exts->police) {
582 struct rtattr * p_rta = (struct rtattr*) skb->tail; 582 struct rtattr *p_rta = (struct rtattr *)skb_tail_pointer(skb);
583 583
584 RTA_PUT(skb, map->police, 0, NULL); 584 RTA_PUT(skb, map->police, 0, NULL);
585 585
586 if (tcf_police_dump(skb, exts->police) < 0) 586 if (tcf_police_dump(skb, exts->police) < 0)
587 goto rtattr_failure; 587 goto rtattr_failure;
588 588
589 p_rta->rta_len = skb->tail - (u8*)p_rta; 589 p_rta->rta_len = skb_tail_pointer(skb) - (u8 *)p_rta;
590 } 590 }
591#endif 591#endif
592 return 0; 592 return 0;