diff mbox

[ovs-dev,RFC] datapath: allow tunnels to be created with rtnetlink

Message ID 20161207033927.GA118745@cran64.bj.intel.com
State RFC
Headers show

Commit Message

Yang, Yi Dec. 7, 2016, 3:39 a.m. UTC
On Tue, Dec 06, 2016 at 03:51:03PM +0100, Jiri Benc wrote:
> On Tue, 6 Dec 2016 07:17:20 +0000, Yang, Yi Y wrote:
> > So my advice about this is we can push patch [2] to Linux net-next
> > first, then apply patch series
> > https://mail.openvswitch.org/pipermail/ovs-dev/2016-June/316879.html
> > from Cascardo and apply [1], that can cover all the cases Pravin
> > mentioned.
> 
> There's no reason to add this to the genetlink interface when we're
> going to switch to rtnetlink for tunnel configuration.
> 
> NACKed-by: Jiri Benc <jbenc@redhat.com>

Hi, Jiri

I find vxlan (datapath/linux/compat/vxlan.c) in ovs used kind
"ovs_vxlan" when it registers rtnetlink, but vxlan in kernel
(drivers/net/vxlan.c) used kind "ovs", so we can send rtnetlink
message to different module per requirement.

But I can't create vxlangpe port yet without patch [2], the result
is 

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)

If I have patch [2]  applied, the result is:

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)

So I think patch [2] is still necessary even if we use rtnetlink.

[1]:
From 370dfdda439bd9e517bffb5e0b31ac3d1cff5e73 Mon Sep 17 00:00:00 2001
From: Yi Yang <yi.y.yang@intel.com>
Date: Tue, 6 Dec 2016 12:39:41 +0800
Subject: [PATCH] Use ovs_vxlan compat modules if USE_UPSTREAM_TUNNEL is
 defined

Signed-off-by: Yi Yang <yi.y.yang@intel.com>
---
 lib/dpif-netlink.c | 4 ++++
 1 file changed, 4 insertions(+)

 static int vxlan_configure_exts(struct vport *vport, struct nlattr
*attr,
@@ -76,6 +91,8 @@ static int vxlan_configure_exts(struct vport *vport,
struct nlattr *attr,

        if (exts[OVS_VXLAN_EXT_GBP])
                conf->flags |= VXLAN_F_GBP;
+       if (exts[OVS_VXLAN_EXT_GPE])
+               conf->flags |= VXLAN_F_GPE;

        return 0;
 }
diff mbox

Patch

diff --git a/lib/dpif-netlink.c b/lib/dpif-netlink.c
index 0d03334..7d8a0f4 100644
--- a/lib/dpif-netlink.c
+++ b/lib/dpif-netlink.c
@@ -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);
--
2.1.0


[2]
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-vxlan.c b/datapath/vport-vxlan.c
index 11965c0..a5882ed 100644
--- a/datapath/vport-vxlan.c
+++ b/datapath/vport-vxlan.c
@@ -54,11 +54,26 @@  static int vxlan_get_options(const struct vport
*vport, struct sk_buff *skb)
                nla_nest_end(skb, exts);
        }

+       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;
 }

 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, },
 };