[ovs-dev] [PATCH] Bug fixed: User space tunneling doesn't support setting tunnel key by flow

Li, Ricky ricky.li at intel.com
Fri Mar 27 00:59:11 UTC 2015


Hi,

I have sent the patch again, with my signed-off-by:
Subject: [PATCH] Bug fixed: User space tunneling doesn't support setting tunnel key by flow
Date: Fri, 27 Mar 2015 08:55:19 +0800

And this time there is only one patch, the test case is also included in this patch.

Regards,
Ricky

-----Original Message-----
From: Pravin Shelar [mailto:pshelar at nicira.com] 
Sent: Friday, March 27, 2015 8:29 AM
To: Li, Ricky
Cc: dev at openvswitch.org
Subject: Re: [ovs-dev] [PATCH] Bug fixed: User space tunneling doesn't support setting tunnel key by flow

On Thu, Mar 26, 2015 at 6:11 AM, Ricky Li <ricky.li at intel.com> wrote:
> e.g. Set tunnel id for encapsulated VxLAN packet (out_key=flow):
>
> ovs-vsctl add-port int-br vxlan0 -- set interface vxlan0 \
>     type=vxlan options:remote_ip=172.168.1.2 options:out_key=flow
>
> ovs-ofctl add-flow int-br in_port=LOCAL, icmp,\
>     actions=set_tunnel:3, output:1 (1 is the port# of vxlan0)
>
> Output tunnel ID should be modified to 3 with this patch.
Patch looks good. But I need your Signed-off-by for both patches.

> ---
>  lib/netdev-provider.h |  2 +-
>  lib/netdev-vport.c    | 10 ++++++----
>  lib/netdev.c          |  5 +++--
>  lib/netdev.h          |  3 ++-
>  ofproto/tunnel.c      |  2 +-
>  5 files changed, 13 insertions(+), 9 deletions(-)
>
> diff --git a/lib/netdev-provider.h b/lib/netdev-provider.h
> index 915e54a..14072ce 100644
> --- a/lib/netdev-provider.h
> +++ b/lib/netdev-provider.h
> @@ -257,7 +257,7 @@ struct netdev_class {
>
>      /* Build Partial Tunnel header.  Ethernet and ip header is already built,
>       * build_header() is suppose build protocol specific part of header. */
> -    int (*build_header)(const struct netdev *, struct ovs_action_push_tnl *data);
> +    int (*build_header)(const struct netdev *, struct ovs_action_push_tnl *data, const struct flow *tnl_flow);
>
>      /* build_header() can not build entire header for all packets for given
>       * flow.  Push header is called for packet to build header specific to
> diff --git a/lib/netdev-vport.c b/lib/netdev-vport.c
> index 954ab9b..c7f3437 100644
> --- a/lib/netdev-vport.c
> +++ b/lib/netdev-vport.c
> @@ -1011,7 +1011,8 @@ netdev_gre_push_header(const struct netdev *netdev OVS_UNUSED,
>
>  static int
>  netdev_gre_build_header(const struct netdev *netdev,
> -                        struct ovs_action_push_tnl *data)
> +                        struct ovs_action_push_tnl *data,
> +                        const struct flow *tnl_flow)
>  {
>      struct netdev_vport *dev = netdev_vport_cast(netdev);
>      struct netdev_tunnel_config *tnl_cfg;
> @@ -1041,7 +1042,7 @@ netdev_gre_build_header(const struct netdev *netdev,
>      if (tnl_cfg->out_key_present) {
>          greh->flags |= htons(GRE_KEY);
>          put_16aligned_be32(options, (OVS_FORCE ovs_be32)
> -                                    ((OVS_FORCE uint64_t) tnl_cfg->out_key >> 32));
> +                                    ((OVS_FORCE uint64_t) tnl_flow->tunnel.tun_id >> 32));
>          options++;
>      }
>
> @@ -1103,7 +1104,8 @@ netdev_vxlan_pop_header(struct netdev *netdev_ OVS_UNUSED,
>
>  static int
>  netdev_vxlan_build_header(const struct netdev *netdev,
> -                          struct ovs_action_push_tnl *data)
> +                          struct ovs_action_push_tnl *data,
> +                          const struct flow *tnl_flow)
>  {
>      struct netdev_vport *dev = netdev_vport_cast(netdev);
>      struct netdev_tunnel_config *tnl_cfg;
> @@ -1123,7 +1125,7 @@ netdev_vxlan_build_header(const struct netdev *netdev,
>
>      vxh = (struct vxlanhdr *) (udp + 1);
>      put_16aligned_be32(&vxh->vx_flags, htonl(VXLAN_FLAGS));
> -    put_16aligned_be32(&vxh->vx_vni, htonl(ntohll(tnl_cfg->out_key) << 8));
> +    put_16aligned_be32(&vxh->vx_vni, htonl(ntohll(tnl_flow->tunnel.tun_id) << 8));
>
>      ovs_mutex_unlock(&dev->mutex);
>      data->header_len = VXLAN_HLEN;
> diff --git a/lib/netdev.c b/lib/netdev.c
> index 149b39a..79b4c4a 100644
> --- a/lib/netdev.c
> +++ b/lib/netdev.c
> @@ -43,6 +43,7 @@
>  #include "sset.h"
>  #include "svec.h"
>  #include "openvswitch/vlog.h"
> +#include "flow.h"
>
>  VLOG_DEFINE_THIS_MODULE(netdev);
>
> @@ -740,10 +741,10 @@ netdev_pop_header(struct netdev *netdev, struct dp_packet **buffers, int cnt)
>  }
>
>  int
> -netdev_build_header(const struct netdev *netdev, struct ovs_action_push_tnl *data)
> +netdev_build_header(const struct netdev *netdev, struct ovs_action_push_tnl *data, const struct flow *tnl_flow)
>  {
>      if (netdev->netdev_class->build_header) {
> -        return netdev->netdev_class->build_header(netdev, data);
> +        return netdev->netdev_class->build_header(netdev, data, tnl_flow);
>      }
>      return EOPNOTSUPP;
>  }
> diff --git a/lib/netdev.h b/lib/netdev.h
> index 9a647f0..05b196d 100644
> --- a/lib/netdev.h
> +++ b/lib/netdev.h
> @@ -22,6 +22,7 @@
>  #include <stdint.h>
>  #include "openvswitch/types.h"
>  #include "packets.h"
> +#include "flow.h"
>
>  #ifdef  __cplusplus
>  extern "C" {
> @@ -184,7 +185,7 @@ int netdev_send(struct netdev *, int qid, struct dp_packet **, int cnt,
>                  bool may_steal);
>  void netdev_send_wait(struct netdev *, int qid);
>
> -int netdev_build_header(const struct netdev *, struct ovs_action_push_tnl *data);
> +int netdev_build_header(const struct netdev *, struct ovs_action_push_tnl *data, const struct flow *tnl_flow);
>  int netdev_push_header(const struct netdev *netdev,
>                         struct dp_packet **buffers, int cnt,
>                         const struct ovs_action_push_tnl *data);
> diff --git a/ofproto/tunnel.c b/ofproto/tunnel.c
> index f621efb..3ea0eb4 100644
> --- a/ofproto/tunnel.c
> +++ b/ofproto/tunnel.c
> @@ -709,7 +709,7 @@ tnl_port_build_header(const struct ofport_dpif *ofport,
>      put_16aligned_be32(&ip->ip_src, ip_src);
>      put_16aligned_be32(&ip->ip_dst, tnl_flow->tunnel.ip_dst);
>
> -    res = netdev_build_header(tnl_port->netdev, data);
> +    res = netdev_build_header(tnl_port->netdev, data, tnl_flow);
>      ip->ip_csum = csum(ip, sizeof *ip);
>      fat_rwlock_unlock(&rwlock);
>
> --
> 1.9.5.msysgit.0
>
> _______________________________________________
> dev mailing list
> dev at openvswitch.org
> http://openvswitch.org/mailman/listinfo/dev


More information about the dev mailing list