aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/ipmr.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/ipmr.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/ipmr.c')
-rw-r--r--net/ipv4/ipmr.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/net/ipv4/ipmr.c b/net/ipv4/ipmr.c
index 50d0b301380e..ea0a491dce92 100644
--- a/net/ipv4/ipmr.c
+++ b/net/ipv4/ipmr.c
@@ -513,7 +513,8 @@ static void ipmr_cache_resolve(struct mfc_cache *uc, struct mfc_cache *c)
513 struct nlmsghdr *nlh = (struct nlmsghdr *)skb_pull(skb, sizeof(struct iphdr)); 513 struct nlmsghdr *nlh = (struct nlmsghdr *)skb_pull(skb, sizeof(struct iphdr));
514 514
515 if (ipmr_fill_mroute(skb, c, NLMSG_DATA(nlh)) > 0) { 515 if (ipmr_fill_mroute(skb, c, NLMSG_DATA(nlh)) > 0) {
516 nlh->nlmsg_len = skb->tail - (u8*)nlh; 516 nlh->nlmsg_len = (skb_tail_pointer(skb) -
517 (u8 *)nlh);
517 } else { 518 } else {
518 nlh->nlmsg_type = NLMSG_ERROR; 519 nlh->nlmsg_type = NLMSG_ERROR;
519 nlh->nlmsg_len = NLMSG_LENGTH(sizeof(struct nlmsgerr)); 520 nlh->nlmsg_len = NLMSG_LENGTH(sizeof(struct nlmsgerr));
@@ -580,7 +581,7 @@ static int ipmr_cache_report(struct sk_buff *pkt, vifi_t vifi, int assert)
580 * Copy the IP header 581 * Copy the IP header
581 */ 582 */
582 583
583 skb_set_network_header(skb, skb->tail - skb->data); 584 skb->network_header = skb->tail;
584 skb_put(skb, ihl); 585 skb_put(skb, ihl);
585 memcpy(skb->data,pkt->data,ihl); 586 memcpy(skb->data,pkt->data,ihl);
586 ip_hdr(skb)->protocol = 0; /* Flag to the kernel this is a route add */ 587 ip_hdr(skb)->protocol = 0; /* Flag to the kernel this is a route add */
@@ -1544,7 +1545,7 @@ ipmr_fill_mroute(struct sk_buff *skb, struct mfc_cache *c, struct rtmsg *rtm)
1544 int ct; 1545 int ct;
1545 struct rtnexthop *nhp; 1546 struct rtnexthop *nhp;
1546 struct net_device *dev = vif_table[c->mfc_parent].dev; 1547 struct net_device *dev = vif_table[c->mfc_parent].dev;
1547 u8 *b = skb->tail; 1548 u8 *b = skb_tail_pointer(skb);
1548 struct rtattr *mp_head; 1549 struct rtattr *mp_head;
1549 1550
1550 if (dev) 1551 if (dev)
@@ -1564,7 +1565,7 @@ ipmr_fill_mroute(struct sk_buff *skb, struct mfc_cache *c, struct rtmsg *rtm)
1564 } 1565 }
1565 } 1566 }
1566 mp_head->rta_type = RTA_MULTIPATH; 1567 mp_head->rta_type = RTA_MULTIPATH;
1567 mp_head->rta_len = skb->tail - (u8*)mp_head; 1568 mp_head->rta_len = skb_tail_pointer(skb) - (u8 *)mp_head;
1568 rtm->rtm_type = RTN_MULTICAST; 1569 rtm->rtm_type = RTN_MULTICAST;
1569 return 1; 1570 return 1;
1570 1571