[ovs-dev] [PATCH 15/41] compat: Move function to header
Greg Rose
gvrose8192 at gmail.com
Thu May 17 21:15:07 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 +++++++++++++++++++++++
1 file changed, 23 insertions(+)
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. */
--
1.8.3.1
More information about the dev
mailing list