From: Jesse Gross Date: Thu, 1 Apr 2010 21:34:18 +0000 (-0400) Subject: datapath: Add skb_csum_help compatibility function. X-Git-Tag: v1.0.0~133 X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=2d2a0e309f2464fd2cf77a328b15acc62cfc7c09;p=sliver-openvswitch.git datapath: Add skb_csum_help compatibility function. Later kernel versions remove the direction argument from skb_checksum_help. This provides a compatibility function so we can have consistent syntax across versions. Since CHECKSUM_PARTIAL is the same as CHECKSUM_HW on older kernels this allows a unified code path for computing checksums. --- diff --git a/datapath/datapath.c b/datapath/datapath.c index 9b34fcc54..e1320f24d 100644 --- a/datapath/datapath.c +++ b/datapath/datapath.c @@ -757,8 +757,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 @@ -769,17 +770,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 7080d0128..b7fe8deb1 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