Signed-off-by: Pravin B Shelar <pshe...@nicira.com>
---
 datapath/datapath.c                             |    4 +-
 datapath/linux/compat/include/linux/netdevice.h |    8 ++++++
 datapath/linux/compat/netdevice.c               |   27 +++++++++++++++++++++++
 datapath/vport-netdev.c                         |    2 +-
 4 files changed, 38 insertions(+), 3 deletions(-)

diff --git a/datapath/datapath.c b/datapath/datapath.c
index 42af315..73e0920 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/include/linux/netdevice.h 
b/datapath/linux/compat/include/linux/netdevice.h
index f8240df..5874197 100644
--- a/datapath/linux/compat/include/linux/netdevice.h
+++ b/datapath/linux/compat/include/linux/netdevice.h
@@ -165,6 +165,14 @@ static inline struct sk_buff *__skb_gso_segment(struct 
sk_buff *skb,
 {
        return skb_gso_segment(skb, features);
 }
+#else
+
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0)
+#define __skb_gso_segment rpl___skb_gso_segment
+struct sk_buff *rpl___skb_gso_segment(struct sk_buff *skb,
+                                     netdev_features_t features,
+                                     bool tx_path);
 #endif
 
+#endif /* HAVE___SKB_GSO_SEGMENT */
 #endif
diff --git a/datapath/linux/compat/netdevice.c 
b/datapath/linux/compat/netdevice.c
index d26fb5e..eea4c0f 100644
--- a/datapath/linux/compat/netdevice.c
+++ b/datapath/linux/compat/netdevice.c
@@ -99,4 +99,31 @@ struct sk_buff *rpl_skb_gso_segment(struct sk_buff *skb, u32 
features)
        skb->protocol = skb_proto;
        return skb_gso;
 }
+#else
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0)
+struct sk_buff *rpl___skb_gso_segment(struct sk_buff *skb,
+                                     netdev_features_t features,
+                                     bool tx_path)
+{
+       struct sk_buff *nskb;
+       char cb[sizeof(skb->cb)];
+
+       /* 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));
+
+#undef __skb_gso_segment
+       nskb = __skb_gso_segment(skb, features, tx_path);
+       if (IS_ERR(nskb))
+               return nskb;
+
+       skb = nskb;
+       while (nskb) {
+               memcpy(nskb->cb, cb, sizeof(cb));
+               nskb = nskb->next;
+       }
+       return skb;
+}
+#endif
 #endif /* kernel version < 2.6.38 */
diff --git a/datapath/vport-netdev.c b/datapath/vport-netdev.c
index 4e7342c..c1ee3db 100644
--- a/datapath/vport-netdev.c
+++ b/datapath/vport-netdev.c
@@ -321,7 +321,7 @@ static int netdev_send(struct vport *vport, struct sk_buff 
*skb)
                if (netif_needs_gso(skb, features)) {
                        struct sk_buff *nskb;
 
-                       nskb = skb_gso_segment(skb, features);
+                       nskb = __skb_gso_segment(skb, features, true);
                        if (!nskb) {
                                if (unlikely(skb_cloned(skb) &&
                                    pskb_expand_head(skb, 0, 0, GFP_ATOMIC)))
-- 
1.7.1

_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

Reply via email to