From: Kyle Mestery Date: Wed, 31 Jul 2013 21:18:19 +0000 (-0400) Subject: datapath: Support for Linux kernel 3.9. X-Git-Tag: sliver-openvswitch-2.0.90-1~33^2~63 X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=7ceda296fa574aa0d2077306cf6311e88d6bb521;p=sliver-openvswitch.git datapath: Support for Linux kernel 3.9. In certain cases we need to ensure we save off skb->cb before calling __skb_gso_segment() since in kernels >= 3.9 skb->cb is used by this routine. Signed-off-by: Pravin B Shelar Signed-off-by: Kyle Mestery Signed-off-by: Jesse Gross --- diff --git a/FAQ b/FAQ index 6b5d8dafc..810803e6d 100644 --- a/FAQ +++ b/FAQ @@ -148,7 +148,7 @@ A: The following table lists the Linux kernel versions against which the 1.9.x 2.6.18 to 3.8 1.10.x 2.6.18 to 3.8 1.11.x 2.6.18 to 3.8 - 1.12.x 2.6.18 to 3.8 + 1.12.x 2.6.18 to 3.9 Open vSwitch userspace should also work with the Linux kernel module built into Linux 3.3 and later. diff --git a/NEWS b/NEWS index 3bf442182..c0a3ecbbf 100644 --- a/NEWS +++ b/NEWS @@ -19,6 +19,7 @@ v1.12.0 - xx xxx xxxx through database paths (e.g. Private key option with the database name should look like "--private-key=db:Open_vSwitch,SSL,private_key"). - Added ovs-dev.py, a utility script helpful for Open vSwitch developers. + - Support for Linux kernels up to 3.9 v1.11.0 - xx xxx xxxx diff --git a/datapath/datapath.c b/datapath/datapath.c index 4330ce332..e5e06163a 100644 --- a/datapath/datapath.c +++ b/datapath/datapath.c @@ -63,8 +63,8 @@ #include "vport-netdev.h" #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,18) || \ - LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0) -#error Kernels before 2.6.18 or after 3.8 are not supported by this version of Open vSwitch. + LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0) +#error Kernels before 2.6.18 or after 3.9 are not supported by this version of Open vSwitch. #endif #define REHASH_FLOW_INTERVAL (10 * 60 * HZ) diff --git a/datapath/linux/compat/gso.c b/datapath/linux/compat/gso.c index 43418d399..30332a2dc 100644 --- a/datapath/linux/compat/gso.c +++ b/datapath/linux/compat/gso.c @@ -65,6 +65,7 @@ static struct sk_buff *tnl_skb_gso_segment(struct sk_buff *skb, struct sk_buff *skb1 = skb; struct sk_buff *segs; __be16 proto = skb->protocol; + char cb[sizeof(skb->cb)]; /* setup whole inner packet to get protocol. */ __skb_pull(skb, mac_offset); @@ -76,6 +77,10 @@ static struct sk_buff *tnl_skb_gso_segment(struct sk_buff *skb, skb_reset_network_header(skb); skb_reset_transport_header(skb); + /* From 3.9 kernel skb->cb is used by skb gso. Therefore + * make copy of it to restore it back. */ + memcpy(cb, skb->cb, sizeof(cb)); + segs = __skb_gso_segment(skb, 0, tx_path); if (!segs || IS_ERR(segs)) goto free; @@ -89,6 +94,7 @@ static struct sk_buff *tnl_skb_gso_segment(struct sk_buff *skb, skb->mac_len = 0; memcpy(ip_hdr(skb), iph, pkt_hlen); + memcpy(skb->cb, cb, sizeof(cb)); if (OVS_GSO_CB(skb)->fix_segment) OVS_GSO_CB(skb)->fix_segment(skb); diff --git a/datapath/tunnel.c b/datapath/tunnel.c index ef46a69de..bd63da555 100644 --- a/datapath/tunnel.c +++ b/datapath/tunnel.c @@ -144,6 +144,9 @@ static struct sk_buff *handle_offloads(struct sk_buff *skb) if (skb_is_gso(skb)) { struct sk_buff *nskb; + char cb[sizeof(skb->cb)]; + + memcpy(cb, skb->cb, sizeof(cb)); nskb = __skb_gso_segment(skb, 0, false); if (IS_ERR(nskb)) { @@ -153,6 +156,10 @@ static struct sk_buff *handle_offloads(struct sk_buff *skb) consume_skb(skb); skb = nskb; + while (nskb) { + memcpy(nskb->cb, cb, sizeof(cb)); + nskb = nskb->next; + } } else if (get_ip_summed(skb) == OVS_CSUM_PARTIAL) { /* Pages aren't locked and could change at any time. * If this happens after we compute the checksum, the diff --git a/debian/changelog b/debian/changelog index 09b97f8fe..10068fae6 100644 --- a/debian/changelog +++ b/debian/changelog @@ -23,6 +23,7 @@ openvswitch (1.12.0-1) unstable; urgency=low through database paths (e.g. Private key option with the database name should look like "--private-key=db:Open_vSwitch,SSL,private_key"). - Added ovs-dev.py, a utility script helpful for Open vSwitch developers. + - Support for Linux kernels up to 3.9 -- Open vSwitch team Tue, 03 Jul 2013 15:02:34 -0700