[ovs-dev] [PATCH V3 17/40] compat: Fixups for some compile warnings and errors

William Tu u9012063 at gmail.com
Mon May 21 22:16:17 UTC 2018


On Fri, May 18, 2018 at 5:49 PM, Greg Rose <gvrose8192 at gmail.com> wrote:
> 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>
> ---

Acked-by: William Tu <u9012063 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;
>

nit: these two functions (rpl_gre_tnl_flags_to_gre_flags and
rpl_tnl_flags_to_gre_flags)
are very similar. We can merger them into one in the future.

<snip>


More information about the dev mailing list