]> git.proxmox.com Git - ovs.git/commitdiff
compat: Move function to header
authorGreg Rose <gvrose8192@gmail.com>
Tue, 27 Feb 2018 16:36:28 +0000 (08:36 -0800)
committerBen Pfaff <blp@ovn.org>
Tue, 22 May 2018 03:33:29 +0000 (20:33 -0700)
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@gmail.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: William Tu <u9012063@gmail.com>
datapath/linux/compat/include/net/gre.h

index ead86f623cc07fbc37bc536d9862ac6485c718f0..e2473f201cd192291c76185766afe522027a17ef 100644 (file)
@@ -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. */