Message ID | 1482927990-74764-16-git-send-email-yi.y.yang@intel.com |
---|---|
State | Superseded |
Delegated to: | pravin shelar |
Headers | show |
On Wed, 28 Dec 2016 20:26:28 +0800, Yi Yang wrote: > --- a/datapath/linux/compat/include/linux/openvswitch.h > +++ b/datapath/linux/compat/include/linux/openvswitch.h > @@ -291,6 +291,7 @@ enum ovs_vport_attr { > enum { > OVS_VXLAN_EXT_UNSPEC, > OVS_VXLAN_EXT_GBP, /* Flag or __u32 */ > + OVS_VXLAN_EXT_GPE, /* Flag or __u32 */ Please leave several free slots between OVS_VXLAN_EXT_GBP and OVS_VXLAN_EXT_GPE. Although it's not expected that we add more values to this enum upstream, we should not rule it out completely. Having a buffer here allows to prevent nasty problems with attribute conflicts between the upstream kernel and the compat code. Jiri
Make sense, will change it in v3. -----Original Message----- From: Jiri Benc [mailto:jbenc@redhat.com] Sent: Wednesday, January 18, 2017 12:37 AM To: Yang, Yi Y <yi.y.yang@intel.com> Cc: dev@openvswitch.org Subject: Re: [ovs-dev] [PATCH v2 15/17] datapath: enable vxlangpe creation in compat mode On Wed, 28 Dec 2016 20:26:28 +0800, Yi Yang wrote: > --- a/datapath/linux/compat/include/linux/openvswitch.h > +++ b/datapath/linux/compat/include/linux/openvswitch.h > @@ -291,6 +291,7 @@ enum ovs_vport_attr { enum { > OVS_VXLAN_EXT_UNSPEC, > OVS_VXLAN_EXT_GBP, /* Flag or __u32 */ > + OVS_VXLAN_EXT_GPE, /* Flag or __u32 */ Please leave several free slots between OVS_VXLAN_EXT_GBP and OVS_VXLAN_EXT_GPE. Although it's not expected that we add more values to this enum upstream, we should not rule it out completely. Having a buffer here allows to prevent nasty problems with attribute conflicts between the upstream kernel and the compat code. Jiri
diff --git a/datapath/linux/compat/include/linux/openvswitch.h b/datapath/linux/compat/include/linux/openvswitch.h index e477d35..93aa8e5 100644 --- a/datapath/linux/compat/include/linux/openvswitch.h +++ b/datapath/linux/compat/include/linux/openvswitch.h @@ -291,6 +291,7 @@ enum ovs_vport_attr { enum { OVS_VXLAN_EXT_UNSPEC, OVS_VXLAN_EXT_GBP, /* Flag or __u32 */ + OVS_VXLAN_EXT_GPE, /* Flag or __u32 */ __OVS_VXLAN_EXT_MAX, }; diff --git a/datapath/vport-vxlan.c b/datapath/vport-vxlan.c index 11965c0..9e8db09 100644 --- a/datapath/vport-vxlan.c +++ b/datapath/vport-vxlan.c @@ -52,6 +52,18 @@ static int vxlan_get_options(const struct vport *vport, struct sk_buff *skb) return -EMSGSIZE; nla_nest_end(skb, exts); + } else if (vxlan->flags & VXLAN_F_GPE) { + struct nlattr *exts; + + exts = nla_nest_start(skb, OVS_TUNNEL_ATTR_EXTENSION); + if (!exts) + return -EMSGSIZE; + + if (vxlan->flags & VXLAN_F_GPE && + nla_put_flag(skb, OVS_VXLAN_EXT_GPE)) + return -EMSGSIZE; + + nla_nest_end(skb, exts); } return 0; @@ -59,6 +71,7 @@ static int vxlan_get_options(const struct vport *vport, struct sk_buff *skb) static const struct nla_policy exts_policy[OVS_VXLAN_EXT_MAX + 1] = { [OVS_VXLAN_EXT_GBP] = { .type = NLA_FLAG, }, + [OVS_VXLAN_EXT_GPE] = { .type = NLA_FLAG, }, }; static int vxlan_configure_exts(struct vport *vport, struct nlattr *attr, @@ -76,6 +89,8 @@ static int vxlan_configure_exts(struct vport *vport, struct nlattr *attr, if (exts[OVS_VXLAN_EXT_GBP]) conf->flags |= VXLAN_F_GBP; + else if (exts[OVS_VXLAN_EXT_GPE]) + conf->flags |= VXLAN_F_GPE; return 0; } diff --git a/lib/netdev-vport.c b/lib/netdev-vport.c index 9fcdc64..9dd38fc 100644 --- a/lib/netdev-vport.c +++ b/lib/netdev-vport.c @@ -503,6 +503,8 @@ set_tunnel_config(struct netdev *dev_, const struct smap *args) while (ext) { if (!strcmp(type, "vxlan") && !strcmp(ext, "gbp")) { tnl_cfg.exts |= (1 << OVS_VXLAN_EXT_GBP); + } else if (!strcmp(type, "vxlan") && !strcmp(ext, "gpe")) { + tnl_cfg.exts |= (1 << OVS_VXLAN_EXT_GPE); } else { VLOG_WARN("%s: unknown extension '%s'", name, ext); }
Current out-of-tree ovs vxlan module has included vxlangpe code, but it can't create vxlangpe port, this patch enables out-of-tree ovs vxlan module to create vxlangpe port without Linux kernel v4.7 or above needed, this can ensure we can create vxlangpe port on any Linux system as long as Linux kernel isn't older than 3.10. When you run the cmd sudo ovs-vsctl add-port br-int vxlan_gpe1 -- set interface vxlan_gpe1 type=vxlan options:remote_ip=flow options:key=flow options:dst_port=4790 options:exts=gpe in current ovs, you will see the below warning netdev_vport|WARN|vxlan_gpe1: unknown extension 'gpe' , and you will see a vxlan port but not vxlangpe port vxlan_sys_4790 Link encap:Ethernet HWaddr 6a:f6:6e:cb:75:fc inet6 addr: fe80::68f6:6eff:fecb:75fc/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:65485 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:0 errors:0 dropped:8 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:0 (0.0 B) TX bytes:0 (0.0 B) But after you apply this patch, you won't see any warning, and a vxlangpe port will be created successfully. vxlan_sys_4790 Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00 UP POINTOPOINT RUNNING NOARP MULTICAST MTU:65485 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:0 (0.0 B) TX bytes:0 (0.0 B) $ sudo ovs-vsctl show fc8eaac4-e16e-47e0-a5bb-9fc8475ada0a Bridge br-int Port br-int Interface br-int type: internal Port "vxlan_gpe1" Interface "vxlan_gpe1" type: vxlan options: {dst_port="4790", exts=gpe, key=flow, remote_ip=flow} Signed-off-by: Yi Yang <yi.y.yang@intel.com> --- datapath/linux/compat/include/linux/openvswitch.h | 1 + datapath/vport-vxlan.c | 15 +++++++++++++++ lib/netdev-vport.c | 2 ++ 3 files changed, 18 insertions(+)