[SK_BUFF]: Introduce skb_network_header_len
For the common sequence "skb->h.raw - skb->nh.raw", similar to skb->mac_len,
that is precalculated tho, don't think we need to bloat skb with one more
member, so just use this new helper, reducing the number of non-skbuff.h
references to the layer headers even more.
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
diff --git a/net/ipv6/exthdrs.c b/net/ipv6/exthdrs.c
index f763409e..f34cc2b 100644
--- a/net/ipv6/exthdrs.c
+++ b/net/ipv6/exthdrs.c
@@ -143,7 +143,7 @@
struct sk_buff *skb = *skbp;
struct tlvtype_proc *curr;
const unsigned char *nh = skb_network_header(skb);
- int off = skb->h.raw - skb->nh.raw;
+ int off = skb_network_header_len(skb);
int len = (skb_transport_header(skb)[1] + 1) << 3;
if (skb_transport_offset(skb) + len > skb_headlen(skb))
@@ -297,7 +297,7 @@
return -1;
}
- opt->lastopt = opt->dst1 = skb->h.raw - skb->nh.raw;
+ opt->lastopt = opt->dst1 = skb_network_header_len(skb);
#ifdef CONFIG_IPV6_MIP6
dstbuf = opt->dst1;
#endif
@@ -443,7 +443,7 @@
break;
}
- opt->lastopt = opt->srcrt = skb->h.raw - skb->nh.raw;
+ opt->lastopt = opt->srcrt = skb_network_header_len(skb);
skb->h.raw += (hdr->hdrlen + 1) << 3;
opt->dst0 = opt->dst1;
opt->dst1 = 0;
@@ -738,7 +738,7 @@
/*
* skb_network_header(skb) is equal to skb->data, and
- * skb->h.raw - skb->nh.raw is always equal to
+ * skb_network_header_len(skb) is always equal to
* sizeof(struct ipv6hdr) by definition of
* hop-by-hop options.
*/