aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2007-04-25 20:55:53 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2007-04-26 01:25:16 -0400
commitea2ae17d6443abddc79480dc9f7af8feacabddc4 (patch)
tree2d6f48a5e4a40f761b5b510af9aac1fca55004cb /include
parentbadff6d01a8589a1c828b0bf118903ca38627f4e (diff)
[SK_BUFF]: Introduce skb_transport_offset()
For the quite common 'skb->h.raw - skb->data' sequence. Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include')
-rw-r--r--include/linux/skbuff.h5
-rw-r--r--include/net/udplite.h6
2 files changed, 8 insertions, 3 deletions
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index 7c1f1756e482..64c3c1687e49 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -962,6 +962,11 @@ static inline void skb_reset_transport_header(struct sk_buff *skb)
962 skb->h.raw = skb->data; 962 skb->h.raw = skb->data;
963} 963}
964 964
965static inline int skb_transport_offset(const struct sk_buff *skb)
966{
967 return skb->h.raw - skb->data;
968}
969
965static inline unsigned char *skb_network_header(const struct sk_buff *skb) 970static inline unsigned char *skb_network_header(const struct sk_buff *skb)
966{ 971{
967 return skb->nh.raw; 972 return skb->nh.raw;
diff --git a/include/net/udplite.h b/include/net/udplite.h
index d99df75fe54c..765032036657 100644
--- a/include/net/udplite.h
+++ b/include/net/udplite.h
@@ -101,14 +101,14 @@ static inline int udplite_sender_cscov(struct udp_sock *up, struct udphdr *uh)
101 101
102static inline __wsum udplite_csum_outgoing(struct sock *sk, struct sk_buff *skb) 102static inline __wsum udplite_csum_outgoing(struct sock *sk, struct sk_buff *skb)
103{ 103{
104 int off, len, cscov = udplite_sender_cscov(udp_sk(sk), skb->h.uh); 104 int cscov = udplite_sender_cscov(udp_sk(sk), skb->h.uh);
105 __wsum csum = 0; 105 __wsum csum = 0;
106 106
107 skb->ip_summed = CHECKSUM_NONE; /* no HW support for checksumming */ 107 skb->ip_summed = CHECKSUM_NONE; /* no HW support for checksumming */
108 108
109 skb_queue_walk(&sk->sk_write_queue, skb) { 109 skb_queue_walk(&sk->sk_write_queue, skb) {
110 off = skb->h.raw - skb->data; 110 const int off = skb_transport_offset(skb);
111 len = skb->len - off; 111 const int len = skb->len - off;
112 112
113 csum = skb_checksum(skb, off, (cscov > len)? len : cscov, csum); 113 csum = skb_checksum(skb, off, (cscov > len)? len : cscov, csum);
114 114