[ovs-dev] [PATCH 09/16] datapath: Add skb_csum_help compatibility function.
Jesse Gross
jesse at nicira.com
Tue Apr 13 14:41:11 UTC 2010
Later kernel versions remove the direction argument from
skb_checksum_help. This provides a compatibility function so we
can have consistent syntax across versions.
---
datapath/datapath.c | 11 +++--------
.../linux-2.6/compat-2.6/include/linux/netdevice.h | 4 ++++
2 files changed, 7 insertions(+), 8 deletions(-)
diff --git a/datapath/datapath.c b/datapath/datapath.c
index 601eedd..48adf25 100644
--- a/datapath/datapath.c
+++ b/datapath/datapath.c
@@ -761,8 +761,9 @@ queue_control_packets(struct sk_buff *skb, struct sk_buff_head *queue,
err = vswitch_skb_checksum_setup(skb);
if (err)
goto err_kfree_skbs;
-#ifndef CHECKSUM_HW
+
if (skb->ip_summed == CHECKSUM_PARTIAL) {
+
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22)
/* Until 2.6.22, the start of the transport header was
* also the start of data to be checksummed. Linux
@@ -773,17 +774,11 @@ queue_control_packets(struct sk_buff *skb, struct sk_buff_head *queue,
skb_set_transport_header(skb, skb->csum_start -
skb_headroom(skb));
#endif
+
err = skb_checksum_help(skb);
if (err)
goto err_kfree_skbs;
}
-#else
- if (skb->ip_summed == CHECKSUM_HW) {
- err = skb_checksum_help(skb, 0);
- if (err)
- goto err_kfree_skbs;
- }
-#endif
err = skb_cow(skb, sizeof *header);
if (err)
diff --git a/datapath/linux-2.6/compat-2.6/include/linux/netdevice.h b/datapath/linux-2.6/compat-2.6/include/linux/netdevice.h
index 7080d01..b7fe8de 100644
--- a/datapath/linux-2.6/compat-2.6/include/linux/netdevice.h
+++ b/datapath/linux-2.6/compat-2.6/include/linux/netdevice.h
@@ -85,4 +85,8 @@ dev_get_stats(struct net_device *dev)
}
#endif
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
+#define skb_checksum_help(skb) skb_checksum_help((skb), 0)
+#endif
+
#endif
--
1.6.3.3
More information about the dev
mailing list