Skip to contentSkip to conversation

openvswitch: fix VxLAN-gpe port can't be created in ovs compat mode

PATCH In review Yi Yang 4 participants 7 messages Dec 8, 2016 – Dec 9, 2016 2 messages not in the archive

Subsystems (4)
lore
Share & tools
lore

Yi Yang

author
#0 lore raw

PATCH 1/1 openvswitch: fix VxLAN-gpe port can't be created in ovs compat mode

In ovs compat mode, ovs won't use LWT in current kernel, this is to make sure ovs can work on the old kernels, Linux kernel v4.7 includes VxLAN-gpe support but many Linux distributions' kernels are odler than v4.7, this fix will ensure that ovs can create VxLAN-gpe port correctly on old kernels, it has been verified on Ubuntu 16.04 x86_64 with Linux kernel 4.4.0-53-generic.

This does touch compat code, but it is necessary as Pravin commented.

Without this fix, ovs can't create VxLAN-gpe port, it is still a VxLAN port.

vxlan_sys_4790 Link encap:Ethernet HWaddr 72:23:60:c2:8b:8d
inet6 addr: fe80::7023:60ff:fec2:8b8d/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 with this fix applied, a real L3 port is created

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)

---
 include/uapi/linux/openvswitch.h |  1 +
 net/openvswitch/vport-vxlan.c    | 15 +++++++++++++++
 2 files changed, 16 insertions(+)
include/uapi/linux/openvswitch.h +1 -0
index 375d812..b0e27b3 100644
@@ -265,6 +265,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,
 };
 
net/openvswitch/vport-vxlan.c +15 -0
index 7eb955e..42e46af 100644
@@ -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;
 }
Signature · 1 line
1.9.3

A message that is not in the archive (sent off-list or not yet received): 1481185210-13056-1-git-send-email-yi.y.yang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org

#2 lore raw
Quoted 6 lines · Yi Yang

In ovs compat mode, ovs won't use LWT in current kernel, this is to make sure ovs can work on the old kernels, Linux kernel v4.7 includes VxLAN-gpe support but many Linux distributions' kernels are odler than v4.7, this fix will ensure that ovs can create VxLAN-gpe port correctly on old kernels, it has been verified on Ubuntu 16.04 x86_64 with Linux kernel 4.4.0-53-generic.

NAK. We do have a way to configure this and that's rtnetlink. Open vSwitch should use that to configure tunnels. Out of tree modules are on their own. Upstream kernel does not accommodate out of tree modules.

Jiri

#3 lore raw
Quoted 8 lines · Jiri Benc
Quoted 6 lines · Yi Yang

In ovs compat mode, ovs won't use LWT in current kernel, this is to make sure ovs can work on the old kernels, Linux kernel v4.7 includes VxLAN-gpe support but many Linux distributions' kernels are odler than v4.7, this fix will ensure that ovs can create VxLAN-gpe port correctly on old kernels, it has been verified on Ubuntu 16.04 x86_64 with Linux kernel 4.4.0-53-generic.

Quoted 4 lines

NAK. We do have a way to configure this and that's rtnetlink. Open vSwitch should use that to configure tunnels. Out of tree modules are on their own. Upstream kernel does not accommodate out of tree modules.

Jiri, this has used rtnetlink to confgiure, te below is my test code in ovs. As Pravin mentioned, in compat mode, ovs won't use current in-kernel module which is vxlan in upstream kernel, but ovs has its own vport_vxlan module for this, it has different behaviour from LWT in upstream kernel. If you try this in the kernels below v4.7, you will clearly know this.

ovs will port this patch into the below files in ovs soure code
datapath/linux/compat/include/linux/openvswitch.h and datapath/vport-vxlan.c once it is accepted,this is ovs upstream process, if Linux kernel doesn't include this, ovs won't accept it.

So ovs out of tree modules need to adapt to upstream kernel, any kernel-related changes must be accepted by Linux kernel at first. Pravin is a dedicated person doing such work, your L3 patches merged into net-next will be ported into ovs out of tree modules by Pravin in the same way.

lib/dpif-netlink.c +4 -0
index 0d03334..7d8a0f4 100644
@@ -1006,7 +1006,11 @@ netdev_vxlan_create(struct netdev *netdev)
     nl_msg_put_string(&request, IFLA_IFNAME, name);
     nl_msg_put_u32(&request, IFLA_MTU, UINT16_MAX);
     linkinfo_off = nl_msg_start_nested(&request, IFLA_LINKINFO);
+#ifdef USE_UPSTREAM_TUNNEL
         nl_msg_put_string(&request, IFLA_INFO_KIND, "vxlan");
+#else
+        nl_msg_put_string(&request, IFLA_INFO_KIND, "ovs_vxlan");
+#endif
         infodata_off = nl_msg_start_nested(&request, IFLA_INFO_DATA);
             nl_msg_put_u8(&request, IFLA_VXLAN_LEARNING, 0);
             nl_msg_put_u8(&request, IFLA_VXLAN_COLLECT_METADATA, 1);

A message that is not in the archive (sent off-list or not yet received): 20161208105750.GA14898-re2EX8HDrk21gSHoDXDV2kEOCMrvLtNR@public.gmane.org

#5 lore raw
Quoted 2 lines · Yi

So ovs out of tree modules need to adapt to upstream kernel, any kernel-related changes must be accepted by Linux kernel at first.

I'm perfectly aware of that and I'm saying that your patch is unacceptable for upstream kernel. This is a long standing policy of the
kernel: there's no way you can get a patch into the kernel to accommodate an out of tree kernel module. The policy is there for good reasons and as paradoxical as it may sound, it benefits the projects that employ out of tree modules in the long run.

If Open vSwitch wants to carry a non-upstream patch, it's its choice and we can have that discussion but that's not something to discuss on netdev@vger nor propose for net-next.

Jiri

author
#6 lore raw
Quoted 11 lines · Jiri Benc
Quoted 2 lines · Yi

So ovs out of tree modules need to adapt to upstream kernel, any kernel-related changes must be accepted by Linux kernel at first.

I'm perfectly aware of that and I'm saying that your patch is unacceptable for upstream kernel. This is a long standing policy of the
kernel: there's no way you can get a patch into the kernel to accommodate an out of tree kernel module. The policy is there for good reasons and as paradoxical as it may sound, it benefits the projects that employ out of tree modules in the long run.

Quoted 4 lines

If Open vSwitch wants to carry a non-upstream patch, it's its choice and we can have that discussion but that's not something to discuss on netdev@vger nor propose for net-next.

Jiri, according to your statement, we have to switch Linux 4.7 or above if we want to use ovs VxLAN-gpe, Ubuntu 16.04 has had new kernel, but it just use Linux kernel 4.4, you know Linux distributuions nerver uses the latest stable Linux kernel because they have their own patches to maintain, that will be a nightmare if they take the latest stable kernel. You know RHEL also follows the same philosophy.

Current ovs master can be built on Ubuntu 14.04 which have Linux kernel 3.13, I think compatibility backward is very important, out of tree modules are very important to ovs. If ovs installation will depend on the latest kernel and force users to switch to new kernel, I believe it nerver will be so popular in the industies.

#7 lore raw
In reply to a message not in the archive
Quoted 30 lines · Yi Yang

In ovs compat mode, ovs won't use LWT in current kernel, this is to make sure ovs can work on the old kernels, Linux kernel v4.7 includes VxLAN-gpe support but many Linux distributions' kernels are odler than v4.7, this fix will ensure that ovs can create VxLAN-gpe port correctly on old kernels, it has been verified on Ubuntu 16.04 x86_64 with Linux kernel 4.4.0-53-generic.

This does touch compat code, but it is necessary as Pravin commented.

Without this fix, ovs can't create VxLAN-gpe port, it is still a VxLAN port.

vxlan_sys_4790 Link encap:Ethernet HWaddr 72:23:60:c2:8b:8d
inet6 addr: fe80::7023:60ff:fec2:8b8d/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 with this fix applied, a real L3 port is created

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)

Quoted 6 lines
---
 include/uapi/linux/openvswitch.h |  1 +
 net/openvswitch/vport-vxlan.c    | 15 +++++++++++++++
 2 files changed, 16 insertions(+)

There is no need for this patch in upstream kernel module. I am open to having such a patch in out of tree kernel if it simplifies feature compatibility code.

#8 lore raw
Quoted 11 lines · Pravin Shelar
Quoted 7 lines · Yi Yang
---
 include/uapi/linux/openvswitch.h |  1 +
 net/openvswitch/vport-vxlan.c    | 15 +++++++++++++++
 2 files changed, 16 insertions(+)

There is no need for this patch in upstream kernel module. I am open to having such a patch in out of tree kernel if it simplifies feature compatibility code.

I'm very glad to hear this :-), the goal is to enable current ovs to create vxlan-gpe port in compat mode without new kernel help, I'll post a patch for ovs, thanks a lot.