For kernel version 3.12 to 3.18, GRE uses compat code to
transmit packets which used fix_segment to segment packets.
but ovs_gso_cb->fix_segment is not initialized for GRE tunnels.
Following patches fixes it by resetting fix_segment.

Signed-off-by: Pravin B Shelar <pshe...@nicira.com>
---
 datapath/linux/compat/gre.c             |   15 +++++++++++++++
 datapath/linux/compat/include/net/gre.h |   18 +++---------------
 2 files changed, 18 insertions(+), 15 deletions(-)

diff --git a/datapath/linux/compat/gre.c b/datapath/linux/compat/gre.c
index e2a7591..b2b75b6 100644
--- a/datapath/linux/compat/gre.c
+++ b/datapath/linux/compat/gre.c
@@ -287,6 +287,7 @@ static void gre_csum_fix(struct sk_buff *skb)
                                                     skb->len - gre_offset, 0));
 }
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,12,0)
 struct sk_buff *rpl_gre_handle_offloads(struct sk_buff *skb, bool gre_csum)
 {
        int type = gre_csum ? SKB_GSO_GRE_CSUM : SKB_GSO_GRE;
@@ -299,6 +300,20 @@ struct sk_buff *rpl_gre_handle_offloads(struct sk_buff 
*skb, bool gre_csum)
 
        return ovs_iptunnel_handle_offloads(skb, gre_csum, type, fix_segment);
 }
+#else
+static inline struct sk_buff *rpl_gre_handle_offloads(struct sk_buff *skb,
+                                                     bool gre_csum)
+{
+       if (skb_is_gso(skb) && skb_is_encapsulated(skb)) {
+               kfree_skb(skb);
+               return ERR_PTR(-ENOSYS);
+       }
+       skb_clear_ovs_gso_cb(skb);
+#undef gre_handle_offloads
+       return gre_handle_offloads(skb, gre_csum);
+}
+#endif
+
 EXPORT_SYMBOL_GPL(rpl_gre_handle_offloads);
 
 static bool is_gre_gso(struct sk_buff *skb)
diff --git a/datapath/linux/compat/include/net/gre.h 
b/datapath/linux/compat/include/net/gre.h
index f572ac9..6e0df0f 100644
--- a/datapath/linux/compat/include/net/gre.h
+++ b/datapath/linux/compat/include/net/gre.h
@@ -81,15 +81,15 @@ static inline __be16 tnl_flags_to_gre_flags(__be16 tflags)
 #endif /* LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0) */
 #endif /* HAVE_GRE_CISCO_REGISTER */
 
+#define gre_handle_offloads rpl_gre_handle_offloads
+struct sk_buff *rpl_gre_handle_offloads(struct sk_buff *skb, bool gre_csum);
+
 #if LINUX_VERSION_CODE < KERNEL_VERSION(3,12,0)
 
 #define gre_build_header rpl_gre_build_header
 void rpl_gre_build_header(struct sk_buff *skb, const struct tnl_ptk_info *tpi,
                          int hdr_len);
 
-#define gre_handle_offloads rpl_gre_handle_offloads
-struct sk_buff *rpl_gre_handle_offloads(struct sk_buff *skb, bool gre_csum);
-
 #define ip_gre_calc_hlen rpl_ip_gre_calc_hlen
 static inline int ip_gre_calc_hlen(__be16 o_flags)
 {
@@ -103,18 +103,6 @@ static inline int ip_gre_calc_hlen(__be16 o_flags)
                addend += 4;
        return addend;
 }
-#else
-
-static inline struct sk_buff *rpl_gre_handle_offloads(struct sk_buff *skb,
-                                                 bool gre_csum)
-{
-       if (skb_is_gso(skb) && skb_is_encapsulated(skb)) {
-               kfree_skb(skb);
-               return ERR_PTR(-ENOSYS);
-       }
-       return gre_handle_offloads(skb, gre_csum);
-}
-#define gre_handle_offloads rpl_gre_handle_offloads
 #endif
 
 #endif
-- 
1.7.1

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

Reply via email to