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.y...@intel.com> --- datapath/linux/compat/include/linux/openvswitch.h | 1 + datapath/vport-netdev.c | 3 ++- datapath/vport-vxlan.c | 15 +++++++++++++++ lib/netdev-vport.c | 2 ++ 4 files changed, 20 insertions(+), 1 deletion(-) diff --git a/datapath/linux/compat/include/linux/openvswitch.h b/datapath/linux/compat/include/linux/openvswitch.h index 12260d8..17e21cb 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-netdev.c b/datapath/vport-netdev.c index 970f7d3..73d6053 100644 --- a/datapath/vport-netdev.c +++ b/datapath/vport-netdev.c @@ -102,7 +102,8 @@ struct vport *ovs_netdev_link(struct vport *vport, const char *name) } if (vport->dev->flags & IFF_LOOPBACK || - vport->dev->type != ARPHRD_ETHER || + (vport->dev->type != ARPHRD_ETHER && + vport->dev->type != ARPHRD_NONE) || ovs_is_internal_dev(vport->dev)) { err = -EINVAL; goto error_put; 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 02a246a..0ddf81f 100644 --- a/lib/netdev-vport.c +++ b/lib/netdev-vport.c @@ -497,6 +497,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); } -- 1.9.3 _______________________________________________ dev mailing list d...@openvswitch.org https://mail.openvswitch.org/mailman/listinfo/ovs-dev