[ovs-dev] [PATCH V3 25/40] userspace: add gre sequence number support.

William Tu u9012063 at gmail.com
Tue May 22 00:38:39 UTC 2018


On Fri, May 18, 2018 at 5:49 PM, Greg Rose <gvrose8192 at gmail.com> wrote:
> From: William Tu <u9012063 at gmail.com>
>
> The patch adds support for gre sequence number.
> Default is disable.  When enable with 'options:seq=true',
> the outgoing gre packet will have its sequence number
> incremented by one.
>
> Signed-off-by: William Tu <u9012063 at gmail.com>
> ---
>  lib/netdev-native-tnl.c  | 19 ++++++++++++++++++-
>  lib/netdev-vport.c       | 11 ++++++++++-
>  lib/netdev.h             |  3 +++
>  tests/tunnel-push-pop.at |  8 ++++----
>  vswitchd/vswitch.xml     |  7 +++++++
>  5 files changed, 42 insertions(+), 6 deletions(-)
>
> diff --git a/lib/netdev-native-tnl.c b/lib/netdev-native-tnl.c
> index 5eb3d22..876718a 100644
> --- a/lib/netdev-native-tnl.c
> +++ b/lib/netdev-native-tnl.c
> @@ -436,10 +436,12 @@ err:
>  }
>
>  void
> -netdev_gre_push_header(const struct netdev *netdev OVS_UNUSED,
> +netdev_gre_push_header(const struct netdev *netdev,
>                         struct dp_packet *packet,
>                         const struct ovs_action_push_tnl *data)
>  {
> +    struct netdev_vport *dev = netdev_vport_cast(netdev);
> +    struct netdev_tunnel_config *tnl_cfg;
>      struct gre_base_hdr *greh;
>      int ip_tot_size;
>
> @@ -449,6 +451,15 @@ netdev_gre_push_header(const struct netdev *netdev OVS_UNUSED,
>          ovs_be16 *csum_opt = (ovs_be16 *) (greh + 1);
>          *csum_opt = csum(greh, ip_tot_size);
>      }
> +
> +    if (greh->flags & htons(GRE_SEQ)) {
> +        /* Last 4 byte is GRE seqno */
> +        int seq_ofs = gre_header_len(greh->flags) - 4;
> +        ovs_16aligned_be32 *seq_opt =
> +            ALIGNED_CAST(ovs_16aligned_be32 *, (char *)greh + seq_ofs);

Thanks for fixing the alignment issues for me.

Regards,
William


More information about the dev mailing list