From: Ian Campbell Date: Thu, 6 Aug 2009 19:53:27 +0000 (-0700) Subject: datapath: Only call skb_checksum_setup on 2.6.18 && Xen. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b2f460c72dc738302adf44b988e9dc4b44c4c621;p=openvswitch datapath: Only call skb_checksum_setup on 2.6.18 && Xen. For newer kernels the checksum setup is done at the point the skb is received in netback or netfront so there is no more need to sprinkle skb_checksum_setup calls throughout the kernel. --- diff --git a/datapath/actions.c b/datapath/actions.c index 9b82f9e3..8a3e8abb 100644 --- a/datapath/actions.c +++ b/datapath/actions.c @@ -96,7 +96,7 @@ modify_vlan_tci(struct datapath *dp, struct sk_buff *skb, * when we send the packet out on the wire, and it will fail at * that point because skb_checksum_setup() will not look inside * an 802.1Q header. */ - skb_checksum_setup(skb); + vswitch_skb_checksum_setup(skb); /* GSO is not implemented for packets with an 802.1Q header, so * we have to do segmentation before we add that header. diff --git a/datapath/datapath.c b/datapath/datapath.c index 3edba7ce..926f278f 100644 --- a/datapath/datapath.c +++ b/datapath/datapath.c @@ -568,8 +568,7 @@ static int dp_frame_hook(struct net_bridge_port *p, struct sk_buff **pskb) #error #endif -#ifdef CONFIG_XEN -#if LINUX_VERSION_CODE == KERNEL_VERSION(2,6,18) +#if defined(CONFIG_XEN) && LINUX_VERSION_CODE == KERNEL_VERSION(2,6,18) /* This code is copied verbatim from net/dev/core.c in Xen's * linux-2.6.18-92.1.10.el5.xs5.0.0.394.644. We can't call those functions * directly because they aren't exported. */ @@ -585,7 +584,7 @@ static int skb_pull_up_to(struct sk_buff *skb, void *ptr) } } -int skb_checksum_setup(struct sk_buff *skb) +int vswitch_skb_checksum_setup(struct sk_buff *skb) { if (skb->proto_csum_blank) { if (skb->protocol != htons(ETH_P_IP)) @@ -616,8 +615,9 @@ int skb_checksum_setup(struct sk_buff *skb) out: return -EPROTO; } -#endif /* linux == 2.6.18 */ -#endif /* CONFIG_XEN */ +#else +int vswitch_skb_checksum_setup(struct sk_buff *skb) { return 0; } +#endif /* CONFIG_XEN && linux == 2.6.18 */ int dp_output_control(struct datapath *dp, struct sk_buff *skb, int queue_no, @@ -643,7 +643,7 @@ dp_output_control(struct datapath *dp, struct sk_buff *skb, int queue_no, * the non-Xen case, but it is difficult to trigger or test this case * there, hence the WARN_ON_ONCE(). */ - err = skb_checksum_setup(skb); + err = vswitch_skb_checksum_setup(skb); if (err) goto err_kfree_skb; #ifndef CHECKSUM_HW diff --git a/datapath/datapath.h b/datapath/datapath.h index 989dcd4b..c6ec86a3 100644 --- a/datapath/datapath.h +++ b/datapath/datapath.h @@ -144,4 +144,6 @@ static inline int skb_checksum_setup(struct sk_buff *skb) } #endif +int vswitch_skb_checksum_setup(struct sk_buff *skb); + #endif /* datapath.h */