[ovs-dev] datapath: compat: provide skb_checksum_start_offset for 2.6.37 and earlier
diff mbox

Message ID 1443581397-18531-1-git-send-email-simon.horman@netronome.com
State Not Applicable
Headers show

Commit Message

Simon Horman Sept. 30, 2015, 2:49 a.m. UTC
skb_checksum_start_offset is not present in 2.6.37 and earlier
but is needed as of a2cf7524787d ("datapath: Backport "skbuff: Fix skb
checksum flag on skb pull"").

Fixes: a2cf7524787d ("datapath: Backport "skbuff: Fix skb checksum flag on skb pull"")
Signed-off-by: Simon Horman <simon.horman@netronome.com>

---

Please consider backporting this to branch-2.4 and branch-2.3.

Compile tested against: 4.2.2, 4.1.9, 4.0.9, 3.19.8, 3.18.21, 3.17.8, 3.16.7,
3.15.10, 3.14.53, 3.13.11, 3.12.48, 3.11.10, 3.10.89, 3.9.11, 3.8.13, 3.7.10,
3.6.11, 3.5.7, 3.4.109, 3.3.8, 3.2.71, 3.1.10, 3.0.101, 2.6.39.4, 2.6.38.8,
2.6.37.6, 2.6.36.4, 2.6.35.14, 2.6.34.15, 2.6.32.68.

Compile tested in conjunction with "Provide this_cpu_{read,inc,dec}
wrappers for v2.6.33" on 2.6.33.20.
---
 datapath/linux/compat/include/linux/skbuff.h | 8 ++++++++
 1 file changed, 8 insertions(+)

Patch
diff mbox

diff --git a/datapath/linux/compat/include/linux/skbuff.h b/datapath/linux/compat/include/linux/skbuff.h
index 23b13b831d74..f80aabc5b1dc 100644
--- a/datapath/linux/compat/include/linux/skbuff.h
+++ b/datapath/linux/compat/include/linux/skbuff.h
@@ -373,6 +373,14 @@  void rpl_kfree_skb_list(struct sk_buff *segs);
 #define kfree_skb_list rpl_kfree_skb_list
 #endif
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,38)
+#define skb_checksum_start_offset rpl_skb_checksum_start_offset
+static inline int skb_checksum_start_offset(const struct sk_buff *skb)
+{
+	return skb->csum_start - skb_headroom(skb);
+}
+#endif
+
 #if LINUX_VERSION_CODE < KERNEL_VERSION(4,3,0)
 #define skb_postpull_rcsum rpl_skb_postpull_rcsum
 static inline void skb_postpull_rcsum(struct sk_buff *skb,