[ovs-dev] [PATCH V2 17/41] compat: Fixups for some compile warnings and errors
Greg Rose
gvrose8192 at gmail.com
Fri May 18 01:57:30 UTC 2018
A lot of code has been pulled in. Fix it up to make sure it compiles
correctly.
Signed-off-by: Greg Rose <gvrose8192 at gmail.com>
---
datapath/linux/compat/gre.c | 23 ----------------
datapath/linux/compat/include/net/gre.h | 47 ++++++++++++++++++++++++++++++++-
datapath/linux/compat/ip_gre.c | 9 ++++---
3 files changed, 51 insertions(+), 28 deletions(-)
diff --git a/datapath/linux/compat/gre.c b/datapath/linux/compat/gre.c
index 08a5a30..7d16aee 100644
--- a/datapath/linux/compat/gre.c
+++ b/datapath/linux/compat/gre.c
@@ -82,29 +82,6 @@ static __sum16 check_checksum(struct sk_buff *skb)
return csum;
}
-#define gre_flags_to_tnl_flags rpl_gre_flags_to_tnl_flags
-static __be16 gre_flags_to_tnl_flags(__be16 flags)
-{
- __be16 tflags = 0;
-
- if (flags & GRE_CSUM)
- tflags |= TUNNEL_CSUM;
- if (flags & GRE_ROUTING)
- tflags |= TUNNEL_ROUTING;
- if (flags & GRE_KEY)
- tflags |= TUNNEL_KEY;
- if (flags & GRE_SEQ)
- tflags |= TUNNEL_SEQ;
- if (flags & GRE_STRICT)
- tflags |= TUNNEL_STRICT;
- if (flags & GRE_REC)
- tflags |= TUNNEL_REC;
- if (flags & GRE_VERSION)
- tflags |= TUNNEL_VERSION;
-
- return tflags;
-}
-
static int parse_gre_header(struct sk_buff *skb, struct tnl_ptk_info *tpi,
bool *csum_err)
{
diff --git a/datapath/linux/compat/include/net/gre.h b/datapath/linux/compat/include/net/gre.h
index e2473f2..78422c8 100644
--- a/datapath/linux/compat/include/net/gre.h
+++ b/datapath/linux/compat/include/net/gre.h
@@ -31,7 +31,52 @@ static inline struct net_device *rpl_gretap_fb_dev_create(
#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)
+static inline __be16 rpl_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;
+}
+
+#define gre_flags_to_tnl_flags rpl_gre_flags_to_tnl_flags
+static inline __be16 rpl_gre_flags_to_tnl_flags(__be16 flags)
+{
+ __be16 tflags = 0;
+
+ if (flags & GRE_CSUM)
+ tflags |= TUNNEL_CSUM;
+ if (flags & GRE_ROUTING)
+ tflags |= TUNNEL_ROUTING;
+ if (flags & GRE_KEY)
+ tflags |= TUNNEL_KEY;
+ if (flags & GRE_SEQ)
+ tflags |= TUNNEL_SEQ;
+ if (flags & GRE_STRICT)
+ tflags |= TUNNEL_STRICT;
+ if (flags & GRE_REC)
+ tflags |= TUNNEL_REC;
+ if (flags & GRE_VERSION)
+ tflags |= TUNNEL_VERSION;
+
+ return tflags;
+}
+#define gre_tnl_flags_to_gre_flags rpl_gre_tnl_flags_to_gre_flags
+static inline __be16 rpl_gre_tnl_flags_to_gre_flags(__be16 tflags)
{
__be16 flags = 0;
diff --git a/datapath/linux/compat/ip_gre.c b/datapath/linux/compat/ip_gre.c
index b1493e0..8060097 100644
--- a/datapath/linux/compat/ip_gre.c
+++ b/datapath/linux/compat/ip_gre.c
@@ -190,7 +190,7 @@ static int erspan_rcv(struct sk_buff *skb, struct tnl_ptk_info *tpi,
int gre_hdr_len)
{
struct net *net = dev_net(skb->dev);
- struct metadata_dst tun_dst = NULL;
+ struct metadata_dst *tun_dst = NULL;
struct erspan_base_hdr *ershdr;
struct erspan_metadata *pkt_md;
struct ip_tunnel_net *itn;
@@ -200,16 +200,15 @@ static int erspan_rcv(struct sk_buff *skb, struct tnl_ptk_info *tpi,
int len;
itn = net_generic(net, erspan_net_id);
- iph = ip_hdr(skb);
len = gre_hdr_len + sizeof(*ershdr);
/* Check based hdr len */
if (unlikely(!pskb_may_pull(skb, len)))
- return -ENOMEM;
+ return PACKET_REJECT;
iph = ip_hdr(skb);
ershdr = (struct erspan_base_hdr *)(skb->data + gre_hdr_len);
- ver = (ntohs(ershdr->ver_vlan) & VER_MASK) >> VER_OFFSET;
+ ver = ershdr->ver;
/* The original GRE header does not have key field,
* Use ERSPAN 10-bit session ID as key.
@@ -1183,7 +1182,9 @@ static void ipgre_tunnel_setup(struct net_device *dev)
static void ipgre_tap_setup(struct net_device *dev)
{
ether_setup(dev);
+#ifdef HAVE_NET_DEVICE_MAX_MTU
dev->max_mtu = 0;
+#endif
dev->netdev_ops = &gre_tap_netdev_ops;
dev->priv_flags |= IFF_LIVE_ADDR_CHANGE;
ip_tunnel_setup(dev, gre_tap_net_id);
--
1.8.3.1
More information about the dev
mailing list