diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2007-04-10 23:45:18 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2007-04-26 01:24:46 -0400 |
commit | c1d2bbe1cd6c7bbdc6d532cefebb66c7efb789ce (patch) | |
tree | 03a715961ba576a11cbc0e91c5d465e4c4d95d82 /net/ipv6 | |
parent | 57effc70a5be9f7804e9a99964eb7265367effca (diff) |
[SK_BUFF]: Introduce skb_reset_network_header(skb)
For the common, open coded 'skb->nh.raw = skb->data' operation, so that we can
later turn skb->nh.raw into a offset, reducing the size of struct sk_buff in
64bit land while possibly keeping it as a pointer on 32bit.
This one touches just the most simple case, next will handle the slightly more
"complex" cases.
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6')
-rw-r--r-- | net/ipv6/ip6_output.c | 4 | ||||
-rw-r--r-- | net/ipv6/ip6_tunnel.c | 6 | ||||
-rw-r--r-- | net/ipv6/sit.c | 4 | ||||
-rw-r--r-- | net/ipv6/xfrm6_mode_beet.c | 4 | ||||
-rw-r--r-- | net/ipv6/xfrm6_mode_tunnel.c | 4 | ||||
-rw-r--r-- | net/ipv6/xfrm6_output.c | 2 |
6 files changed, 12 insertions, 12 deletions
diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c index a5f4562b5d29..4406546d3ce8 100644 --- a/net/ipv6/ip6_output.c +++ b/net/ipv6/ip6_output.c | |||
@@ -735,7 +735,7 @@ slow_path: | |||
735 | ip6_copy_metadata(frag, skb); | 735 | ip6_copy_metadata(frag, skb); |
736 | skb_reserve(frag, LL_RESERVED_SPACE(rt->u.dst.dev)); | 736 | skb_reserve(frag, LL_RESERVED_SPACE(rt->u.dst.dev)); |
737 | skb_put(frag, len + hlen + sizeof(struct frag_hdr)); | 737 | skb_put(frag, len + hlen + sizeof(struct frag_hdr)); |
738 | frag->nh.raw = frag->data; | 738 | skb_reset_network_header(frag); |
739 | fh = (struct frag_hdr*)(frag->data + hlen); | 739 | fh = (struct frag_hdr*)(frag->data + hlen); |
740 | frag->h.raw = frag->data + hlen + sizeof(struct frag_hdr); | 740 | frag->h.raw = frag->data + hlen + sizeof(struct frag_hdr); |
741 | 741 | ||
@@ -976,7 +976,7 @@ static inline int ip6_ufo_append_data(struct sock *sk, | |||
976 | skb_put(skb,fragheaderlen + transhdrlen); | 976 | skb_put(skb,fragheaderlen + transhdrlen); |
977 | 977 | ||
978 | /* initialize network header pointer */ | 978 | /* initialize network header pointer */ |
979 | skb->nh.raw = skb->data; | 979 | skb_reset_network_header(skb); |
980 | 980 | ||
981 | /* initialize protocol header pointer */ | 981 | /* initialize protocol header pointer */ |
982 | skb->h.raw = skb->data + fragheaderlen; | 982 | skb->h.raw = skb->data + fragheaderlen; |
diff --git a/net/ipv6/ip6_tunnel.c b/net/ipv6/ip6_tunnel.c index d8c84d8d7cf8..30df8e6c42cc 100644 --- a/net/ipv6/ip6_tunnel.c +++ b/net/ipv6/ip6_tunnel.c | |||
@@ -525,7 +525,7 @@ ip4ip6_err(struct sk_buff *skb, struct inet6_skb_parm *opt, | |||
525 | dst_release(skb2->dst); | 525 | dst_release(skb2->dst); |
526 | skb2->dst = NULL; | 526 | skb2->dst = NULL; |
527 | skb_pull(skb2, offset); | 527 | skb_pull(skb2, offset); |
528 | skb2->nh.raw = skb2->data; | 528 | skb_reset_network_header(skb2); |
529 | eiph = skb2->nh.iph; | 529 | eiph = skb2->nh.iph; |
530 | 530 | ||
531 | /* Try to guess incoming interface */ | 531 | /* Try to guess incoming interface */ |
@@ -599,7 +599,7 @@ ip6ip6_err(struct sk_buff *skb, struct inet6_skb_parm *opt, | |||
599 | dst_release(skb2->dst); | 599 | dst_release(skb2->dst); |
600 | skb2->dst = NULL; | 600 | skb2->dst = NULL; |
601 | skb_pull(skb2, offset); | 601 | skb_pull(skb2, offset); |
602 | skb2->nh.raw = skb2->data; | 602 | skb_reset_network_header(skb2); |
603 | 603 | ||
604 | /* Try to guess incoming interface */ | 604 | /* Try to guess incoming interface */ |
605 | rt = rt6_lookup(&skb2->nh.ipv6h->saddr, NULL, 0, 0); | 605 | rt = rt6_lookup(&skb2->nh.ipv6h->saddr, NULL, 0, 0); |
@@ -704,7 +704,7 @@ static int ip6_tnl_rcv(struct sk_buff *skb, __u16 protocol, | |||
704 | } | 704 | } |
705 | secpath_reset(skb); | 705 | secpath_reset(skb); |
706 | skb->mac.raw = skb->nh.raw; | 706 | skb->mac.raw = skb->nh.raw; |
707 | skb->nh.raw = skb->data; | 707 | skb_reset_network_header(skb); |
708 | skb->protocol = htons(protocol); | 708 | skb->protocol = htons(protocol); |
709 | skb->pkt_type = PACKET_HOST; | 709 | skb->pkt_type = PACKET_HOST; |
710 | memset(skb->cb, 0, sizeof(struct inet6_skb_parm)); | 710 | memset(skb->cb, 0, sizeof(struct inet6_skb_parm)); |
diff --git a/net/ipv6/sit.c b/net/ipv6/sit.c index 08d6ed3396e4..0477728578fe 100644 --- a/net/ipv6/sit.c +++ b/net/ipv6/sit.c | |||
@@ -340,7 +340,7 @@ out: | |||
340 | dst_release(skb2->dst); | 340 | dst_release(skb2->dst); |
341 | skb2->dst = NULL; | 341 | skb2->dst = NULL; |
342 | skb_pull(skb2, skb->data - (u8*)iph6); | 342 | skb_pull(skb2, skb->data - (u8*)iph6); |
343 | skb2->nh.raw = skb2->data; | 343 | skb_reset_network_header(skb2); |
344 | 344 | ||
345 | /* Try to guess incoming interface */ | 345 | /* Try to guess incoming interface */ |
346 | rt6i = rt6_lookup(&iph6->saddr, NULL, NULL, 0); | 346 | rt6i = rt6_lookup(&iph6->saddr, NULL, NULL, 0); |
@@ -383,7 +383,7 @@ static int ipip6_rcv(struct sk_buff *skb) | |||
383 | if ((tunnel = ipip6_tunnel_lookup(iph->saddr, iph->daddr)) != NULL) { | 383 | if ((tunnel = ipip6_tunnel_lookup(iph->saddr, iph->daddr)) != NULL) { |
384 | secpath_reset(skb); | 384 | secpath_reset(skb); |
385 | skb->mac.raw = skb->nh.raw; | 385 | skb->mac.raw = skb->nh.raw; |
386 | skb->nh.raw = skb->data; | 386 | skb_reset_network_header(skb); |
387 | IPCB(skb)->flags = 0; | 387 | IPCB(skb)->flags = 0; |
388 | skb->protocol = htons(ETH_P_IPV6); | 388 | skb->protocol = htons(ETH_P_IPV6); |
389 | skb->pkt_type = PACKET_HOST; | 389 | skb->pkt_type = PACKET_HOST; |
diff --git a/net/ipv6/xfrm6_mode_beet.c b/net/ipv6/xfrm6_mode_beet.c index 79364b1e965a..c015bfde2b1c 100644 --- a/net/ipv6/xfrm6_mode_beet.c +++ b/net/ipv6/xfrm6_mode_beet.c | |||
@@ -45,7 +45,7 @@ static int xfrm6_beet_output(struct xfrm_state *x, struct sk_buff *skb) | |||
45 | skb->h.raw = skb->data + hdr_len; | 45 | skb->h.raw = skb->data + hdr_len; |
46 | memmove(skb->data, iph, hdr_len); | 46 | memmove(skb->data, iph, hdr_len); |
47 | 47 | ||
48 | skb->nh.raw = skb->data; | 48 | skb_reset_network_header(skb); |
49 | top_iph = skb->nh.ipv6h; | 49 | top_iph = skb->nh.ipv6h; |
50 | skb->nh.raw = &top_iph->nexthdr; | 50 | skb->nh.raw = &top_iph->nexthdr; |
51 | skb->h.ipv6h = top_iph + 1; | 51 | skb->h.ipv6h = top_iph + 1; |
@@ -68,7 +68,7 @@ static int xfrm6_beet_input(struct xfrm_state *x, struct sk_buff *skb) | |||
68 | 68 | ||
69 | skb_push(skb, size); | 69 | skb_push(skb, size); |
70 | memmove(skb->data, skb->nh.raw, size); | 70 | memmove(skb->data, skb->nh.raw, size); |
71 | skb->nh.raw = skb->data; | 71 | skb_reset_network_header(skb); |
72 | 72 | ||
73 | old_mac = skb_mac_header(skb); | 73 | old_mac = skb_mac_header(skb); |
74 | skb_set_mac_header(skb, -skb->mac_len); | 74 | skb_set_mac_header(skb, -skb->mac_len); |
diff --git a/net/ipv6/xfrm6_mode_tunnel.c b/net/ipv6/xfrm6_mode_tunnel.c index 5bb0677d3730..8ce5ef2d0b1c 100644 --- a/net/ipv6/xfrm6_mode_tunnel.c +++ b/net/ipv6/xfrm6_mode_tunnel.c | |||
@@ -53,7 +53,7 @@ static int xfrm6_tunnel_output(struct xfrm_state *x, struct sk_buff *skb) | |||
53 | skb_push(skb, x->props.header_len); | 53 | skb_push(skb, x->props.header_len); |
54 | iph = skb->nh.ipv6h; | 54 | iph = skb->nh.ipv6h; |
55 | 55 | ||
56 | skb->nh.raw = skb->data; | 56 | skb_reset_network_header(skb); |
57 | top_iph = skb->nh.ipv6h; | 57 | top_iph = skb->nh.ipv6h; |
58 | skb->nh.raw = &top_iph->nexthdr; | 58 | skb->nh.raw = &top_iph->nexthdr; |
59 | skb->h.ipv6h = top_iph + 1; | 59 | skb->h.ipv6h = top_iph + 1; |
@@ -111,7 +111,7 @@ static int xfrm6_tunnel_input(struct xfrm_state *x, struct sk_buff *skb) | |||
111 | old_mac = skb_mac_header(skb); | 111 | old_mac = skb_mac_header(skb); |
112 | skb_set_mac_header(skb, -skb->mac_len); | 112 | skb_set_mac_header(skb, -skb->mac_len); |
113 | memmove(skb_mac_header(skb), old_mac, skb->mac_len); | 113 | memmove(skb_mac_header(skb), old_mac, skb->mac_len); |
114 | skb->nh.raw = skb->data; | 114 | skb_reset_network_header(skb); |
115 | err = 0; | 115 | err = 0; |
116 | 116 | ||
117 | out: | 117 | out: |
diff --git a/net/ipv6/xfrm6_output.c b/net/ipv6/xfrm6_output.c index c52e9d6c75ec..56364a5f676a 100644 --- a/net/ipv6/xfrm6_output.c +++ b/net/ipv6/xfrm6_output.c | |||
@@ -82,7 +82,7 @@ static int xfrm6_output_one(struct sk_buff *skb) | |||
82 | 82 | ||
83 | spin_unlock_bh(&x->lock); | 83 | spin_unlock_bh(&x->lock); |
84 | 84 | ||
85 | skb->nh.raw = skb->data; | 85 | skb_reset_network_header(skb); |
86 | 86 | ||
87 | if (!(skb->dst = dst_pop(dst))) { | 87 | if (!(skb->dst = dst_pop(dst))) { |
88 | err = -EHOSTUNREACH; | 88 | err = -EHOSTUNREACH; |