aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv6/ndisc.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/ipv6/ndisc.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/ipv6/ndisc.c')
-rw-r--r--net/ipv6/ndisc.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c
index f8e619772fb4..b1cf70816477 100644
--- a/net/ipv6/ndisc.c
+++ b/net/ipv6/ndisc.c
@@ -492,7 +492,7 @@ static void ndisc_send_na(struct net_device *dev, struct neighbour *neigh,
492 skb_reserve(skb, LL_RESERVED_SPACE(dev)); 492 skb_reserve(skb, LL_RESERVED_SPACE(dev));
493 ip6_nd_hdr(sk, skb, dev, src_addr, daddr, IPPROTO_ICMPV6, len); 493 ip6_nd_hdr(sk, skb, dev, src_addr, daddr, IPPROTO_ICMPV6, len);
494 494
495 skb_set_transport_header(skb, skb->tail - skb->data); 495 skb->transport_header = skb->tail;
496 skb_put(skb, len); 496 skb_put(skb, len);
497 msg = (struct nd_msg *)skb_transport_header(skb); 497 msg = (struct nd_msg *)skb_transport_header(skb);
498 498
@@ -584,7 +584,7 @@ void ndisc_send_ns(struct net_device *dev, struct neighbour *neigh,
584 skb_reserve(skb, LL_RESERVED_SPACE(dev)); 584 skb_reserve(skb, LL_RESERVED_SPACE(dev));
585 ip6_nd_hdr(sk, skb, dev, saddr, daddr, IPPROTO_ICMPV6, len); 585 ip6_nd_hdr(sk, skb, dev, saddr, daddr, IPPROTO_ICMPV6, len);
586 586
587 skb_set_transport_header(skb, skb->tail - skb->data); 587 skb->transport_header = skb->tail;
588 skb_put(skb, len); 588 skb_put(skb, len);
589 msg = (struct nd_msg *)skb_transport_header(skb); 589 msg = (struct nd_msg *)skb_transport_header(skb);
590 msg->icmph.icmp6_type = NDISC_NEIGHBOUR_SOLICITATION; 590 msg->icmph.icmp6_type = NDISC_NEIGHBOUR_SOLICITATION;
@@ -685,7 +685,7 @@ void ndisc_send_rs(struct net_device *dev, struct in6_addr *saddr,
685 skb_reserve(skb, LL_RESERVED_SPACE(dev)); 685 skb_reserve(skb, LL_RESERVED_SPACE(dev));
686 ip6_nd_hdr(sk, skb, dev, saddr, daddr, IPPROTO_ICMPV6, len); 686 ip6_nd_hdr(sk, skb, dev, saddr, daddr, IPPROTO_ICMPV6, len);
687 687
688 skb_set_transport_header(skb, skb->tail - skb->data); 688 skb->transport_header = skb->tail;
689 skb_put(skb, len); 689 skb_put(skb, len);
690 hdr = icmp6_hdr(skb); 690 hdr = icmp6_hdr(skb);
691 hdr->icmp6_type = NDISC_ROUTER_SOLICITATION; 691 hdr->icmp6_type = NDISC_ROUTER_SOLICITATION;
@@ -767,7 +767,8 @@ static void ndisc_recv_ns(struct sk_buff *skb)
767 struct in6_addr *saddr = &ipv6_hdr(skb)->saddr; 767 struct in6_addr *saddr = &ipv6_hdr(skb)->saddr;
768 struct in6_addr *daddr = &ipv6_hdr(skb)->daddr; 768 struct in6_addr *daddr = &ipv6_hdr(skb)->daddr;
769 u8 *lladdr = NULL; 769 u8 *lladdr = NULL;
770 u32 ndoptlen = skb->tail - msg->opt; 770 u32 ndoptlen = skb->tail - (skb->transport_header +
771 offsetof(struct nd_msg, opt));
771 struct ndisc_options ndopts; 772 struct ndisc_options ndopts;
772 struct net_device *dev = skb->dev; 773 struct net_device *dev = skb->dev;
773 struct inet6_ifaddr *ifp; 774 struct inet6_ifaddr *ifp;
@@ -945,7 +946,8 @@ static void ndisc_recv_na(struct sk_buff *skb)
945 struct in6_addr *saddr = &ipv6_hdr(skb)->saddr; 946 struct in6_addr *saddr = &ipv6_hdr(skb)->saddr;
946 struct in6_addr *daddr = &ipv6_hdr(skb)->daddr; 947 struct in6_addr *daddr = &ipv6_hdr(skb)->daddr;
947 u8 *lladdr = NULL; 948 u8 *lladdr = NULL;
948 u32 ndoptlen = skb->tail - msg->opt; 949 u32 ndoptlen = skb->tail - (skb->transport_header +
950 offsetof(struct nd_msg, opt));
949 struct ndisc_options ndopts; 951 struct ndisc_options ndopts;
950 struct net_device *dev = skb->dev; 952 struct net_device *dev = skb->dev;
951 struct inet6_ifaddr *ifp; 953 struct inet6_ifaddr *ifp;
@@ -1111,8 +1113,7 @@ static void ndisc_router_discovery(struct sk_buff *skb)
1111 1113
1112 __u8 * opt = (__u8 *)(ra_msg + 1); 1114 __u8 * opt = (__u8 *)(ra_msg + 1);
1113 1115
1114 optlen = (skb->tail - skb_transport_header(skb)) - 1116 optlen = (skb->tail - skb->transport_header) - sizeof(struct ra_msg);
1115 sizeof(struct ra_msg);
1116 1117
1117 if (!(ipv6_addr_type(&ipv6_hdr(skb)->saddr) & IPV6_ADDR_LINKLOCAL)) { 1118 if (!(ipv6_addr_type(&ipv6_hdr(skb)->saddr) & IPV6_ADDR_LINKLOCAL)) {
1118 ND_PRINTK2(KERN_WARNING 1119 ND_PRINTK2(KERN_WARNING
@@ -1361,7 +1362,7 @@ static void ndisc_redirect_rcv(struct sk_buff *skb)
1361 return; 1362 return;
1362 } 1363 }
1363 1364
1364 optlen = skb->tail - skb_transport_header(skb); 1365 optlen = skb->tail - skb->transport_header;
1365 optlen -= sizeof(struct icmp6hdr) + 2 * sizeof(struct in6_addr); 1366 optlen -= sizeof(struct icmp6hdr) + 2 * sizeof(struct in6_addr);
1366 1367
1367 if (optlen < 0) { 1368 if (optlen < 0) {
@@ -1522,7 +1523,7 @@ void ndisc_send_redirect(struct sk_buff *skb, struct neighbour *neigh,
1522 ip6_nd_hdr(sk, buff, dev, &saddr_buf, &ipv6_hdr(skb)->saddr, 1523 ip6_nd_hdr(sk, buff, dev, &saddr_buf, &ipv6_hdr(skb)->saddr,
1523 IPPROTO_ICMPV6, len); 1524 IPPROTO_ICMPV6, len);
1524 1525
1525 skb_set_transport_header(buff, buff->tail - buff->data); 1526 skb_set_transport_header(buff, skb_tail_pointer(buff) - buff->data);
1526 skb_put(buff, len); 1527 skb_put(buff, len);
1527 icmph = icmp6_hdr(buff); 1528 icmph = icmp6_hdr(buff);
1528 1529