[ovs-dev] [ERSPAN RFC 16/25] compat: Move function to header

Greg Rose gvrose8192 at gmail.com
Thu Mar 22 22:07:32 UTC 2018


tnl_flags_to_gre_flags is also needed in both ip_gre.c and gre.c on
some kernels.  Move it from ip_gre.c to the common header.

Signed-off-by: Greg Rose <gvrose8192 at gmail.com>
---
 datapath/linux/compat/include/net/gre.h | 23 +++++++++++++++++++++++
 datapath/linux/compat/ip_gre.c          | 23 -----------------------
 2 files changed, 23 insertions(+), 23 deletions(-)

diff --git a/datapath/linux/compat/include/net/gre.h b/datapath/linux/compat/include/net/gre.h
index ead86f6..e2473f2 100644
--- a/datapath/linux/compat/include/net/gre.h
+++ b/datapath/linux/compat/include/net/gre.h
@@ -30,6 +30,29 @@ static inline struct net_device *rpl_gretap_fb_dev_create(
 #else
 #include_next <net/gre.h>
 
+#define tnl_flags_to_gre_flags rpl_tnl_flags_to_gre_flags
+static inline __be16 tnl_flags_to_gre_flags(__be16 tflags)
+{
+	__be16 flags = 0;
+
+	if (tflags & TUNNEL_CSUM)
+		flags |= GRE_CSUM;
+	if (tflags & TUNNEL_ROUTING)
+		flags |= GRE_ROUTING;
+	if (tflags & TUNNEL_KEY)
+		flags |= GRE_KEY;
+	if (tflags & TUNNEL_SEQ)
+		flags |= GRE_SEQ;
+	if (tflags & TUNNEL_STRICT)
+		flags |= GRE_STRICT;
+	if (tflags & TUNNEL_REC)
+		flags |= GRE_REC;
+	if (tflags & TUNNEL_VERSION)
+		flags |= GRE_VERSION;
+
+	return flags;
+}
+
 #ifndef HAVE_GRE_CISCO_REGISTER
 
 /* GRE demux not available, implement our own demux. */
diff --git a/datapath/linux/compat/ip_gre.c b/datapath/linux/compat/ip_gre.c
index e684019..9ed391d 100644
--- a/datapath/linux/compat/ip_gre.c
+++ b/datapath/linux/compat/ip_gre.c
@@ -83,29 +83,6 @@ static int ip_gre_calc_hlen(__be16 o_flags)
 	return addend;
 }
 
-#define tnl_flags_to_gre_flags rpl_tnl_flags_to_gre_flags
-static __be16 tnl_flags_to_gre_flags(__be16 tflags)
-{
-	__be16 flags = 0;
-
-	if (tflags & TUNNEL_CSUM)
-		flags |= GRE_CSUM;
-	if (tflags & TUNNEL_ROUTING)
-		flags |= GRE_ROUTING;
-	if (tflags & TUNNEL_KEY)
-		flags |= GRE_KEY;
-	if (tflags & TUNNEL_SEQ)
-		flags |= GRE_SEQ;
-	if (tflags & TUNNEL_STRICT)
-		flags |= GRE_STRICT;
-	if (tflags & TUNNEL_REC)
-		flags |= GRE_REC;
-	if (tflags & TUNNEL_VERSION)
-		flags |= GRE_VERSION;
-
-	return flags;
-}
-
 static __be64 key_to_tunnel_id(__be32 key)
 {
 #ifdef __BIG_ENDIAN
-- 
1.8.3.1



More information about the dev mailing list