Skip to contentSkip to conversation

iovnl netlink ops + enic dynamic vnics

PATCH In review Scott Feldman 6 participants 53 messages Apr 19, 2010 – Apr 24, 2010

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover iovnl netlink ops + enic dynamic vnics

Patch 1/2 adds new I/O Virtualization netlink ops:

IOV netlink (IOVNL) adds I/O Virtualization control support to a master device (MD) netdev interface. The MD (e.g. SR-IOV PF) will set/get control settings on behalf of a slave netdevice (e.g. SR-IOV VF). The design allows for the case where master and slave are the same netdev interface.

The ops currently defined are:
set_mac_vlan: set mac+vlan on VF
set_port_profile: set port-profile on VF
unset_port_profile: unset port-profile on VF

Patch 2/2 adds IOV netlink ops support to enic dynamic vnics:

Add enic iovnl ops to support setting port-profile for dynamic vnics. Enic dynamic vnics are just like normal enic eth vnics except dynamic vnics require an extra configuration step to assign a port-profile identifier to the interface before the interface is useable. Once assigned, link comes up on the interface and is ready for I/O. The port-profile is used to configure the network port assigned to the interface. The network port configuration includes VLAN membership, QoS policies, and port security settings typical of a data center network.

#1 lore raw

PATCH 1/2 add iovnl netlink support

From: Scott Feldman <[email protected]>

IOV netlink (IOVNL) adds I/O Virtualization control support to a master device (MD) netdev interface. The MD (e.g. SR-IOV PF) will set/get control settings on behalf of a slave netdevice (e.g. SR-IOV VF). The design allows for the case where master and slave are the same netdev interface.

One control setting example is MAC/VLAN settings for a VF. Another example control setting is a port-profile for a VF. A port-profile is an identifier that defines policy-based settings on the network port backing the VF. The network port settings examples are VLAN membership, QoS settings, and L2 security settings, typical of a data center network.

This patch adds the iovnl interface definitions and an iovnl module.

---
 include/linux/iovnl.h     |  124 +++++++++++++++++++++
 include/linux/netdevice.h |    4 +
 include/linux/rtnetlink.h |    5 +
 include/net/iovnl.h       |   36 ++++++
 net/Kconfig               |    1 
 net/Makefile              |    3 +
 net/iovnl/Kconfig         |   10 ++
 net/iovnl/Makefile        |    1 
 net/iovnl/iovnl.c         |  260 +++++++++++++++++++++++++++++++++++++++++++++
 9 files changed, 444 insertions(+), 0 deletions(-)
include/linux/iovnl.h new file +124 -0
new file mode 100644
index 0000000..ac5fcd3
@@ -0,0 +1,124 @@
+/*
+ * Copyright 2010 Cisco Systems, Inc.  All rights reserved.
+ *
+ * This program is free software; you may redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ */
+
+#ifndef __LINUX_IOVNL_H__
+#define __LINUX_IOVNL_H__
+
+#include <linux/types.h>
+
+#define IOVNL_PROTO_VERSION 1
+
+/**
+ * IOV netlink (IOVNL) adds I/O Virtualization control support to a master
+ * device (MD) netdev interface.  The MD (e.g. SR-IOV PF) will set/get
+ * control settings on behalf of a slave netdevice (e.g. SR-IOV VF).  The
+ * design allows for the degenerative case where master and slave are the
+ * same netdev interface.
+ *
+ * One control setting example is MAC/VLAN settings for a VF.  Another
+ * example control setting is a port-profile for a VF.  A port-profile is an
+ * identifier that defines policy-based settings on the network port
+ * backing the VF.  The network port settings examples are VLAN membership,
+ * QoS settings, and L2 security settings, typical of a data center network.
+ *
+ * This file defines an rtnetlink interface to allow setting of IOVNL
+ * on capable netdev devices.
+ */
+
+struct iovnlmsg {
+	__u8	family;
+	__u8	cmd;
+	__u16	pad;
+};
+
+/**
+ * enum iovnl_cmds - supported IOV commands
+ *
+ * @IOV_CMD_UNDEFINED: unspecified command to catch errors
+ * @IOV_CMD_SET_PORT_PROFILE: set the port-profile on the device
+ * @IOV_CMD_UNSET_PORT_PROFILE: clear port-profile on the device
+ * @IOV_CMD_GET_PORT_PROFILE_STATUS: return status of last
+ *   IOV_CMD_SET_PORT_PROFILE command
+ * @IOV_SET_MAC_VLAN: Set the MAC address and VLAN on the device
+ */
+enum iovnl_cmds {
+	IOV_CMD_UNDEFINED,
+
+	IOV_CMD_SET_PORT_PROFILE,
+	IOV_CMD_UNSET_PORT_PROFILE,
+	IOV_CMD_GET_PORT_PROFILE_STATUS,
+
+	IOV_CMD_SET_MAC_VLAN,
+
+	__IOV_CMD_ENUM_MAX,
+	IOV_CMD_MAX = __IOV_CMD_ENUM_MAX - 1,
+};
+
+/**
+ * enum iovnl_attrs - IOV top-level netlink attributes
+ *
+ * @IOV_ATTR_UNDEFINED: unspecified attribute to catch errors
+ * @IOV_ATTR_IFNAME: interface name of master (PF) net device (NLA_NUL_STRING)
+ * @IOV_ATTR_VF_IFNAME: interface name of target VF device (NLA_NUL_STRING)
+ * @IOV_ATTR_PORT_PROFILE: port-profile name to assign to device
+ *   (NLA_NUL_STRING)
+ * @IOV_ATTR_CLIENT_NAME: client name (NLA_NUL_STRING)
+ * @IOV_ATTR_HOST_UUID: host UUID (NLA_NUL_STRING)
+ * @IOV_ATTR_PORT_PROFILE_STATUS: status of last IOV_CMD_SET_PORT_PROFILE
+ *   command (NLA_U8)
+ * @IOV_ATTR_MAC_ADDR: device station MAC address (NLA_U8[6])
+ * @IOV_ATTR_VLAN: device 8021q VLAN ID (NLA_U16)
+ # @IOV_ATTR_STATUS: cmd return status code
+ */
+enum iovnl_attrs {
+	IOV_ATTR_UNDEFINED,
+
+	IOV_ATTR_IFNAME,
+	IOV_ATTR_VF_IFNAME,
+
+	IOV_ATTR_PORT_PROFILE,
+	IOV_ATTR_CLIENT_NAME,
+	IOV_ATTR_HOST_UUID,
+	IOV_ATTR_PORT_PROFILE_STATUS,
+
+	IOV_ATTR_MAC_ADDR,
+	IOV_ATTR_VLAN,
+
+	IOV_ATTR_STATUS,
+
+	__IOV_ATTR_ENUM_MAX,
+	IOV_ATTR_MAX = __IOV_ATTR_ENUM_MAX - 1,
+};
+
+/**
+ * enum iovnl_port_profile_status - IOV_ATTR_PORT_PROFILE_STATUS status
+ * return codes
+ *
+ * @IOV_PORT_PROFILE_STATUS_UNKNOWN: unspecified to catch errors
+ * @IOV_PORT_PROFILE_STATUS_SUCCESS:  port-profile aiovlied successfully
+ * @IOV_PORT_PROFILE_STATUS_ERROR: port-profile setting had error
+ * @IOV_PORT_PROFILE_STATUS_INPROGRESS: port-profile setting in-progress
+ */
+enum iovnl_port_profile_status {
+	IOV_PORT_PROFILE_STATUS_UNKNOWN,
+	IOV_PORT_PROFILE_STATUS_SUCCESS,
+	IOV_PORT_PROFILE_STATUS_ERROR,
+	IOV_PORT_PROFILE_STATUS_INPROGRESS,
+};
+
+#endif /* __LINUX_IOVNL_H__ */
include/linux/netdevice.h +4 -0
index 649a025..b531b0d 100644
@@ -50,6 +50,7 @@
 #ifdef CONFIG_DCB
 #include <net/dcbnl.h>
 #endif
+#include <net/iovnl.h>
 
 struct vlan_group;
 struct netpoll_info;
@@ -1048,6 +1049,9 @@ struct net_device {
 	const struct dcbnl_rtnl_ops *dcbnl_ops;
 #endif
 
+	/* IOV netlink ops */
+	const struct iovnl_ops *iovnl_ops;
+
 #if defined(CONFIG_FCOE) || defined(CONFIG_FCOE_MODULE)
 	/* max exchange id for FCoE LRO by ddp */
 	unsigned int		fcoe_ddp_xid;
include/linux/rtnetlink.h +5 -0
index d1c7c90..aafadf7 100644
@@ -113,6 +113,11 @@ enum {
 	RTM_SETDCB,
 #define RTM_SETDCB RTM_SETDCB
 
+	RTM_GETIOV = 82,
+#define RTM_GETIOV RTM_GETIOV
+	RTM_SETIOV,
+#define RTM_SETIOV RTM_SETIOV
+
 	__RTM_MAX,
 #define RTM_MAX		(((__RTM_MAX + 3) & ~3) - 1)
 };
include/net/iovnl.h new file +36 -0
new file mode 100644
index 0000000..c353eee
@@ -0,0 +1,36 @@
+/*
+ * Copyright 2010 Cisco Systems, Inc.  All rights reserved.
+ *
+ * This program is free software; you may redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ */
+
+#ifndef __NET_IOVNL_H__
+#define __NET_IOVNL_H__
+
+/*
+ * Ops struct for the netlink callbacks.  Used by IOVNL-enabled drivers through
+ * the netdevice struct.
+ */
+struct iovnl_ops {
+	int (*set_port_profile)(struct net_device *, struct net_device *,
+		char *, u8 *, char *, char *);
+	int (*unset_port_profile)(struct net_device *, struct net_device *);
+	int (*get_port_profile_status)(struct net_device *,
+		struct net_device *);
+	int (*set_mac_vlan)(struct net_device *, struct net_device *,
+		u8 *, u16);
+};
+
+#endif /* __NET_IOVNL_H__ */
net/Kconfig +1 -0
index 0d68b40..aca5de0 100644
@@ -203,6 +203,7 @@ source "net/phonet/Kconfig"
 source "net/ieee802154/Kconfig"
 source "net/sched/Kconfig"
 source "net/dcb/Kconfig"
+source "net/iovnl/Kconfig"
 
 config RPS
 	boolean
net/Makefile +3 -0
index cb7bdc1..23589e9 100644
@@ -61,6 +61,9 @@ obj-$(CONFIG_CAIF)		+= caif/
 ifneq ($(CONFIG_DCB),)
 obj-y				+= dcb/
 endif
+ifneq ($(CONFIG_IOVNL),)
+obj-y				+= iovnl/
+endif
 obj-y				+= ieee802154/
 
 ifeq ($(CONFIG_NET),y)
net/iovnl/Kconfig new file +10 -0
new file mode 100644
index 0000000..4548417
@@ -0,0 +1,10 @@
+config IOVNL
+	tristate "IOV rtnetlink support"
+	default n
+	---help---
+	  This enables support for configuring IOV
+	  on Ethernet adapters via rtnetlink.  Say 'Y'
+	  if you have a Ethernet adapter which supports network
+	  configuration using IOV rtnetlinl.
+
+	  If unsure, say N.
net/iovnl/Makefile new file +1 -0
new file mode 100644
index 0000000..9256d01
@@ -0,0 +1 @@
+obj-$(CONFIG_IOVNL) += iovnl.o
net/iovnl/iovnl.c new file +260 -0

260 lines not on this page · raw message

#51 lore raw

PATCH 2/2 add enic iovnl ops for dynamic vnics

In reply to Scott Feldman

From: Scott Feldman <[email protected]>

Add enic iovnl ops to support setting port-profile for dynamic vnics. Enic dynamic vnics are just like normal enic eth vnics except dynamic vnics require an extra configuration step to assign a port-profile identifier to the interface before the interface is useable. Once assigned, link comes up on the interface and is ready for I/O. The port-profile is used to configure the network port assigned to the interface. The network port configuration includes VLAN membership, QoS policies, and port security settings typical of a data center network.

---
 drivers/net/enic/Makefile     |    2 -
 drivers/net/enic/enic.h       |    3 +
 drivers/net/enic/enic_iovnl.c |  136 +++++++++++++++++++++++++++++++++++++++++
 drivers/net/enic/enic_main.c  |   67 +++++++++++++++++---
 drivers/net/enic/enic_res.c   |    5 ++
 drivers/net/enic/enic_res.h   |    1 
 drivers/net/enic/vnic_dev.c   |   58 +++++++++++++++++
 drivers/net/enic/vnic_dev.h   |    4 +
 drivers/net/enic/vnic_vic.c   |   73 ++++++++++++++++++++++
 drivers/net/enic/vnic_vic.h   |   58 +++++++++++++++++
 10 files changed, 394 insertions(+), 13 deletions(-)
drivers/net/enic/Makefile +1 -1
index 391c3bc..311613b 100644
@@ -1,5 +1,5 @@
 obj-$(CONFIG_ENIC) := enic.o
 
 enic-y := enic_main.o vnic_cq.o vnic_intr.o vnic_wq.o \
-	enic_res.o vnic_dev.o vnic_rq.o
+	enic_res.o vnic_dev.o vnic_rq.o vnic_vic.o enic_iovnl.o
 
drivers/net/enic/enic.h +3 -0
index 5fa56f1..5790655 100644
@@ -122,4 +122,7 @@ struct enic {
 	unsigned int cq_count;
 };
 
+void enic_set_multicast_list(struct net_device *netdev);
+void enic_set_iovnl_ops(struct net_device *netdev);
+
 #endif /* _ENIC_H_ */
drivers/net/enic/enic_iovnl.c new file +136 -0

136 lines not on this page · raw message

drivers/net/enic/enic_main.c +55 -12

120 lines not on this page · raw message

drivers/net/enic/enic_res.c +5 -0
index 02839bf..9f31f58 100644
@@ -108,6 +108,11 @@ void enic_add_station_addr(struct enic *enic)
 	vnic_dev_add_addr(enic->vdev, enic->mac_addr);
 }
 
+void enic_del_station_addr(struct enic *enic)
+{
+	vnic_dev_del_addr(enic->vdev, enic->mac_addr);
+}
+
 void enic_add_multicast_addr(struct enic *enic, u8 *addr)
 {
 	vnic_dev_add_addr(enic->vdev, addr);
drivers/net/enic/enic_res.h +1 -0
index abc1974..0e16ba0 100644
@@ -132,6 +132,7 @@ struct enic;
 
 int enic_get_vnic_config(struct enic *);
 void enic_add_station_addr(struct enic *enic);
+void enic_del_station_addr(struct enic *enic);
 void enic_add_multicast_addr(struct enic *enic, u8 *addr);
 void enic_del_multicast_addr(struct enic *enic, u8 *addr);
 void enic_add_vlan(struct enic *enic, u16 vlanid);
drivers/net/enic/vnic_dev.c +58 -0

64 lines not on this page · raw message

drivers/net/enic/vnic_dev.h +4 -0
index f5be640..bd40045 100644
@@ -124,6 +124,10 @@ int vnic_dev_disable(struct vnic_dev *vdev);
 int vnic_dev_open(struct vnic_dev *vdev, int arg);
 int vnic_dev_open_done(struct vnic_dev *vdev, int *done);
 int vnic_dev_init(struct vnic_dev *vdev, int arg);
+int vnic_dev_init_done(struct vnic_dev *vdev, int *done, int *err);
+int vnic_dev_init_prov(struct vnic_dev *vdev, u8 *buf, u32 len);
+int vnic_dev_logical_uplink(struct vnic_dev *vdev, int enable);
+int vnic_dev_deinit(struct vnic_dev *vdev);
 int vnic_dev_soft_reset(struct vnic_dev *vdev, int arg);
 int vnic_dev_soft_reset_done(struct vnic_dev *vdev, int *done);
 void vnic_dev_set_intr_mode(struct vnic_dev *vdev,
drivers/net/enic/vnic_vic.c new file +73 -0

73 lines not on this page · raw message

drivers/net/enic/vnic_vic.h new file +58 -0

58 lines not on this page · raw message

#52 lore raw
In reply to Scott Feldman
Quoted 15 lines · * Scott Feldman ([email protected]) wrote:

Patch 1/2 adds new I/O Virtualization netlink ops:

IOV netlink (IOVNL) adds I/O Virtualization control support to a master device (MD) netdev interface. The MD (e.g. SR-IOV PF) will set/get control settings on behalf of a slave netdevice (e.g. SR-IOV VF). The design allows for the case where master and slave are the same netdev interface.

The ops currently defined are:
set_mac_vlan: set mac+vlan on VF
set_port_profile: set port-profile on VF
unset_port_profile: unset port-profile on VF

Patch 2/2 adds IOV netlink ops support to enic dynamic vnics:

Quoted 8 lines

Add enic iovnl ops to support setting port-profile for dynamic vnics. Enic dynamic vnics are just like normal enic eth vnics except dynamic vnics require an extra configuration step to assign a port-profile identifier to the interface before the interface is useable. Once assigned, link comes up on the interface and is ready for I/O. The port-profile is used to configure the network port assigned to the interface. The network port configuration includes VLAN membership, QoS policies, and port security settings typical of a data center network.

Note that while these just enable enic, the framework should be generic enough for other drivers and can deliver all the way to userspace daemon for the case of VSI Discovery Protocol.

thanks,
-chris

#2 lore raw

Re: [net-next,1/2] add iovnl netlink support

In reply to Scott Feldman
Quoted 5 lines · Scott Feldman

IOV netlink (IOVNL) adds I/O Virtualization control support to a master device (MD) netdev interface. The MD (e.g. SR-IOV PF) will set/get control settings on behalf of a slave netdevice (e.g. SR-IOV VF). The design allows for the case where master and slave are the same netdev interface.

What is the reason for controlling the slave device through the master, rather than talking to the slave directly? The kernel always knows the master for each slave, so it seems to me that this information is redundant.

Is this new interface only for the case that you have a switch integrated in the NIC, or also for the case where you do an LLDP and EDP exchange with an adjacent bridge and put the device into VEPA mode?

Quoted 7 lines

One control setting example is MAC/VLAN settings for a VF. Another example control setting is a port-profile for a VF. A port-profile is an identifier that defines policy-based settings on the network port backing the VF. The network port settings examples are VLAN membership, QoS settings, and L2 security settings, typical of a data center network.

This patch adds the iovnl interface definitions and an iovnl module.

How does this relate to the existing DCB netlink interface? My feeling is that there is some overlap in how it would get used, and some parts that are very distinct. In particular, I'd guess that you'd want to be able to set DCB parameters for each VF, but not all DCB adapters would support SR-IOV.

Did you consider making this code an extension to the DCB interface instead of a separate one? What was the reason for your decision to keep it separate?

Also, do you expect your interface to be supported by dcbd/lldpad, or is there a good reason to create a new tool for iovnl?

Quoted 2 lines

+ * @IOV_ATTR_IFNAME: interface name of master (PF) net device (NLA_NUL_STRING)
+ * @IOV_ATTR_VF_IFNAME: interface name of target VF device (NLA_NUL_STRING)

As mentioned above, why not drop one of these, and just pass the VF's IFNAME?

Quoted 2 lines

+ * @IOV_ATTR_PORT_PROFILE: port-profile name to assign to device
+ * (NLA_NUL_STRING)

How does the definition of the port profile get into the NIC's switch? Is there any way to list the available port profiles?

Quoted 2 lines

+ * @IOV_ATTR_CLIENT_NAME: client name (NLA_NUL_STRING)
+ * @IOV_ATTR_HOST_UUID: host UUID (NLA_NUL_STRING)

Can you elaborate more on what these do? Who is the 'client' and the 'host' in this case, and why do you need to identify them?

Quoted 1 line

+ * @IOV_ATTR_MAC_ADDR: device station MAC address (NLA_U8[6])

Just one mac address? What happens if we want to assign multiple mac addresses to the VF later? Also, how is this defined specifically? Will a SIOCSIFHWADDR with a different MAC address on the VF fail later, or is this just the default value?

Quoted 1 line

+ * @IOV_ATTR_VLAN: device 8021q VLAN ID (NLA_U16)

Same here: Should you be able to set multiple MAC addresses, or trunk mode? Can the VF override it?
Also, for the new multi-channel VEPA, I'd guess that you also need to supply an 802.1ad S-VLAN ID.

Arnd

#3 lore raw

Re: [net-next,1/2] add iovnl netlink support

Quoted 8 lines · * Arnd Bergmann ([email protected]) wrote:
Quoted 5 lines · Scott Feldman

IOV netlink (IOVNL) adds I/O Virtualization control support to a master device (MD) netdev interface. The MD (e.g. SR-IOV PF) will set/get control settings on behalf of a slave netdevice (e.g. SR-IOV VF). The design allows for the case where master and slave are the same netdev interface.

Quoted 4 lines

What is the reason for controlling the slave device through the master, rather than talking to the slave directly? The kernel always knows the master for each slave, so it seems to me that this information is redundant.

Not all devices have this relationship explicit (i.e. not all are pure sr-iov devices). If there's always a way to discover the master from the device, then I agree we only need the slave.

Quoted 3 lines

Is this new interface only for the case that you have a switch integrated in the NIC, or also for the case where you do an LLDP and EDP exchange with an adjacent bridge and put the device into VEPA mode?

It should be useful for both. That's part of the reason for using netlink, a userspace daemon running the VDP state machine (like lldpad) can listen for these messages and see a set_port_profile request when the user starts up a VM.

Quoted 14 lines
Quoted 7 lines

One control setting example is MAC/VLAN settings for a VF. Another example control setting is a port-profile for a VF. A port-profile is an identifier that defines policy-based settings on the network port backing the VF. The network port settings examples are VLAN membership, QoS settings, and L2 security settings, typical of a data center network.

This patch adds the iovnl interface definitions and an iovnl module.

How does this relate to the existing DCB netlink interface? My feeling is that there is some overlap in how it would get used, and some parts that are very distinct. In particular, I'd guess that you'd want to be able to set DCB parameters for each VF, but not all DCB adapters would support SR-IOV.

Quoted 3 lines

Did you consider making this code an extension to the DCB interface instead of a separate one? What was the reason for your decision to keep it separate?

Well, aside from the fact that DCB and VDP have some low level similarities in the PDU and they are both communication between the host and the switch, they are doing different things.

Quoted 2 lines

Also, do you expect your interface to be supported by dcbd/lldpad, or is there a good reason to create a new tool for iovnl?

lldpad would listen, I don't see why iproute2 couldn't send, and libvirt will send as well.

Quoted 10 lines
Quoted 2 lines

+ * @IOV_ATTR_IFNAME: interface name of master (PF) net device (NLA_NUL_STRING)
+ * @IOV_ATTR_VF_IFNAME: interface name of target VF device (NLA_NUL_STRING)

As mentioned above, why not drop one of these, and just pass the VF's IFNAME?

Quoted 2 lines

+ * @IOV_ATTR_PORT_PROFILE: port-profile name to assign to device
+ * (NLA_NUL_STRING)

How does the definition of the port profile get into the NIC's switch? Is there any way to list the available port profiles?

The port profile is a concept external to the NIC's switch. It's a value that exists in the external physical layer 2 switching infrastructure. So an admin knows this value and is informing the adjacent switch that a new virutal interface is coming up and needs some particular port profile.

Quoted 13 lines
Quoted 2 lines

+ * @IOV_ATTR_CLIENT_NAME: client name (NLA_NUL_STRING)
+ * @IOV_ATTR_HOST_UUID: host UUID (NLA_NUL_STRING)

Can you elaborate more on what these do? Who is the 'client' and the 'host' in this case, and why do you need to identify them?

Quoted 1 line

+ * @IOV_ATTR_MAC_ADDR: device station MAC address (NLA_U8[6])

Just one mac address? What happens if we want to assign multiple mac addresses to the VF later? Also, how is this defined specifically? Will a SIOCSIFHWADDR with a different MAC address on the VF fail later, or is this just the default value?

Quoted 6 lines
Quoted 1 line

+ * @IOV_ATTR_VLAN: device 8021q VLAN ID (NLA_U16)

Same here: Should you be able to set multiple MAC addresses, or trunk mode? Can the VF override it?
Also, for the new multi-channel VEPA, I'd guess that you also need to supply an 802.1ad S-VLAN ID.

Something like set_port_profile() would initiate the negotiation for the s-vlan id for a particular channel, not sure it's needed as part of the netlink interface or not.

thanks,
-chris

#4 lore raw

Re: [net-next,1/2] add iovnl netlink support

Quoted 11 lines · Chris Wright
Quoted 6 lines · * Arnd Bergmann ([email protected]) wrote:

On Monday 19 April 2010, Scott Feldman wrote:

What is the reason for controlling the slave device through the master, rather than talking to the slave directly? The kernel always knows the master for each slave, so it seems to me that this information is redundant.

Not all devices have this relationship explicit (i.e. not all are pure sr-iov devices). If there's always a way to discover the master from the device, then I agree we only need the slave.

Hmm, is there an actual example of a card where the relationship is not known to the kernel?

Quoted 8 lines
Quoted 3 lines

Is this new interface only for the case that you have a switch integrated in the NIC, or also for the case where you do an LLDP and EDP exchange with an adjacent bridge and put the device into VEPA mode?

It should be useful for both. That's part of the reason for using netlink, a userspace daemon running the VDP state machine (like lldpad) can listen for these messages and see a set_port_profile request when the user starts up a VM.

After thinking some more about this case, I now believe we should do it the other way around, and have lldpad in control of this interface from the user space side, and letting user programs (lldptool, libvirt, ...) talk to lldpad in order to set it up.

Quoted 5 lines
Quoted 2 lines

Also, do you expect your interface to be supported by dcbd/lldpad, or is there a good reason to create a new tool for iovnl?

lldpad would listen, I don't see why iproute2 couldn't send, and libvirt will send as well.

Not sure. We need lldpad to do this exchange for the case of VEPA with VDP, so always using lldpad would let us unify the user interface for both cases. We can of course have iproute2 talk to lldpad, in the same way that libvirt does.

Quoted 10 lines
Quoted 5 lines
Quoted 2 lines

+ * @IOV_ATTR_PORT_PROFILE: port-profile name to assign to device
+ * (NLA_NUL_STRING)

How does the definition of the port profile get into the NIC's switch? Is there any way to list the available port profiles?

The port profile is a concept external to the NIC's switch. It's a value that exists in the external physical layer 2 switching infrastructure. So an admin knows this value and is informing the adjacent switch that a new virutal interface is coming up and needs some particular port profile.

But that's only the case if the NIC itself is in VEPA mode. If that were the case, there would be no need for a kernel interface at all, because then we could just drive the port profile selection from user space.

The proposed interface only seems to make sense if you use it to configure the NIC itself! Why should it care about the port profile otherwise?

Quoted 8 lines
Quoted 4 lines

Same here: Should you be able to set multiple MAC addresses, or trunk mode? Can the VF override it?
Also, for the new multi-channel VEPA, I'd guess that you also need to supply an 802.1ad S-VLAN ID.

Something like set_port_profile() would initiate the negotiation for the s-vlan id for a particular channel, not sure it's needed as part of the netlink interface or not.

Well, you have to set up the s-vlan ID in order to have something to set the port profile in.

Arnd

#5 lore raw

Re: [net-next,1/2] add iovnl netlink support

Quoted 25 lines · * Arnd Bergmann ([email protected]) wrote:
Quoted 11 lines · Chris Wright
Quoted 6 lines · * Arnd Bergmann ([email protected]) wrote:

On Monday 19 April 2010, Scott Feldman wrote:

What is the reason for controlling the slave device through the master, rather than talking to the slave directly? The kernel always knows the master for each slave, so it seems to me that this information is redundant.

Not all devices have this relationship explicit (i.e. not all are pure sr-iov devices). If there's always a way to discover the master from the device, then I agree we only need the slave.

Hmm, is there an actual example of a card where the relationship is not known to the kernel?

Quoted 8 lines
Quoted 3 lines

Is this new interface only for the case that you have a switch integrated in the NIC, or also for the case where you do an LLDP and EDP exchange with an adjacent bridge and put the device into VEPA mode?

It should be useful for both. That's part of the reason for using netlink, a userspace daemon running the VDP state machine (like lldpad) can listen for these messages and see a set_port_profile request when the user starts up a VM.

Quoted 4 lines

After thinking some more about this case, I now believe we should do it the other way around, and have lldpad in control of this interface from the user space side, and letting user programs (lldptool, libvirt, ...) talk to lldpad in order to set it up.

lldpad won't be involved in all cases, yet a mgmt tool like libvirt will. so this seems backwards.

Quoted 22 lines
Quoted 5 lines
Quoted 2 lines

Also, do you expect your interface to be supported by dcbd/lldpad, or is there a good reason to create a new tool for iovnl?

lldpad would listen, I don't see why iproute2 couldn't send, and libvirt will send as well.

Not sure. We need lldpad to do this exchange for the case of VEPA with VDP, so always using lldpad would let us unify the user interface for both cases. We can of course have iproute2 talk to lldpad, in the same way that libvirt does.

Quoted 10 lines
Quoted 5 lines
Quoted 2 lines

+ * @IOV_ATTR_PORT_PROFILE: port-profile name to assign to device
+ * (NLA_NUL_STRING)

How does the definition of the port profile get into the NIC's switch? Is there any way to list the available port profiles?

The port profile is a concept external to the NIC's switch. It's a value that exists in the external physical layer 2 switching infrastructure. So an admin knows this value and is informing the adjacent switch that a new virutal interface is coming up and needs some particular port profile.

Quoted 8 lines

But that's only the case if the NIC itself is in VEPA mode. If that were the case, there would be no need for a kernel interface at all, because then we could just drive the port profile selection from user space.

The proposed interface only seems to make sense if you use it to configure the NIC itself! Why should it care about the port profile otherwise?

In the case of devices that can do adjacent switch negotiations directly.

Quoted 11 lines
Quoted 8 lines
Quoted 4 lines

Same here: Should you be able to set multiple MAC addresses, or trunk mode? Can the VF override it?
Also, for the new multi-channel VEPA, I'd guess that you also need to supply an 802.1ad S-VLAN ID.

Something like set_port_profile() would initiate the negotiation for the s-vlan id for a particular channel, not sure it's needed as part of the netlink interface or not.

Well, you have to set up the s-vlan ID in order to have something to set the port profile in.

Right, depends if the use the port profile to establish the channel and negotiate the s-vlan ID. I don't recall the order there.

thanks,
-chris

#6 lore raw

Re: [net-next,1/2] add iovnl netlink support

Quoted 10 lines · Chris Wright
Quoted 6 lines · * Arnd Bergmann ([email protected]) wrote:

On Tuesday 20 April 2010, Chris Wright wrote:

After thinking some more about this case, I now believe we should do it the other way around, and have lldpad in control of this interface from the user space side, and letting user programs (lldptool, libvirt, ...) talk to lldpad in order to set it up.

lldpad won't be involved in all cases, yet a mgmt tool like libvirt will. so this seems backwards.

Well, that part is still the matter of this discussion, as far as I can tell ;-)

Quoted 10 lines
Quoted 8 lines

But that's only the case if the NIC itself is in VEPA mode. If that were the case, there would be no need for a kernel interface at all, because then we could just drive the port profile selection from user space.

The proposed interface only seems to make sense if you use it to configure the NIC itself! Why should it care about the port profile otherwise?

In the case of devices that can do adjacent switch negotiations directly.

I thought the idea to deal with those devices was to beat sense into the respective developers until they do the negotiation in software 8-)

Quoted 9 lines
Quoted 9 lines
Quoted 8 lines
Quoted 4 lines

Same here: Should you be able to set multiple MAC addresses, or trunk mode? Can the VF override it?
Also, for the new multi-channel VEPA, I'd guess that you also need to supply an 802.1ad S-VLAN ID.

Something like set_port_profile() would initiate the negotiation for the s-vlan id for a particular channel, not sure it's needed as part of the netlink interface or not.

Quoted 5 lines
Quoted 2 lines

Well, you have to set up the s-vlan ID in order to have something to set the port profile in.

Right, depends if the use the port profile to establish the channel and negotiate the s-vlan ID. I don't recall the order there.

I'm pretty sure that setting up the channel (for 802.1bg) is done before any port profile comes in.

Arnd

#11 lore raw

Re: [net-next,1/2] add iovnl netlink support

In reply to Arnd Bergmann
Quoted 8 lines · Arnd Bergmann
Quoted 5 lines · Scott Feldman

IOV netlink (IOVNL) adds I/O Virtualization control support to a master device (MD) netdev interface. The MD (e.g. SR-IOV PF) will set/get control settings on behalf of a slave netdevice (e.g. SR-IOV VF). The design allows for the case where master and slave are the same netdev interface.

Quoted 4 lines

What is the reason for controlling the slave device through the master, rather than talking to the slave directly? The kernel always knows the master for each slave, so it seems to me that this information is redundant.

The interface would allow talking to the slave directly. In fact, that's the example with enic port-profile in patch 2/2. But, it would be nice not to rule out the case where the master proxies slave control and the master is under exclusively controlled by hypervisor.

Quoted 3 lines

Is this new interface only for the case that you have a switch integrated in the NIC, or also for the case where you do an LLDP and EDP exchange with an adjacent bridge and put the device into VEPA mode?

All of the above. Basing this on netlink give us flexibility to work with user-space mgmt tools or directly with kernel netdev as in the enic case. Not trying to make assumptions about where (user-space, kernel) and by which entity sources or sinks the netlink msg.

Quoted 14 lines
Quoted 7 lines

One control setting example is MAC/VLAN settings for a VF. Another example control setting is a port-profile for a VF. A port-profile is an identifier that defines policy-based settings on the network port backing the VF. The network port settings examples are VLAN membership, QoS settings, and L2 security settings, typical of a data center network.

This patch adds the iovnl interface definitions and an iovnl module.

How does this relate to the existing DCB netlink interface? My feeling is that there is some overlap in how it would get used, and some parts that are very distinct. In particular, I'd guess that you'd want to be able to set DCB parameters for each VF, but not all DCB adapters would support SR-IOV.

Quoted 3 lines

Did you consider making this code an extension to the DCB interface instead of a separate one? What was the reason for your decision to keep it separate?

Considered it but DCB interface is well defined for DCB and it didn't seem right gluing on interfaces not specified within DCB. I agree that there is some overlap in the sense that both interface are used to configure a netdev with some properties interesting for the data center, but the DCB interface is for local setting of the properties on the host whereas iovnl is about pushing the setting of those properties to the network for policy-based control.

Quoted 2 lines

Also, do you expect your interface to be supported by dcbd/lldpad, or is there a good reason to create a new tool for iovnl?

Lldpad supporting this interface would seem right, for those cases where lldpad is responsible for configuring the netdev.

Quoted 5 lines
Quoted 2 lines

+ * @IOV_ATTR_CLIENT_NAME: client name (NLA_NUL_STRING)
+ * @IOV_ATTR_HOST_UUID: host UUID (NLA_NUL_STRING)

Can you elaborate more on what these do? Who is the 'client' and the 'host' in this case, and why do you need to identify them?

Those are optional and useful, for example, by the network mgmt tool for presenting a view such as:

- blade 1/2 // know by host uuid
- vm-rhel5-eth0 // client name
- port-profile: xyz

Something like that.

Quoted 6 lines
Quoted 1 line

+ * @IOV_ATTR_MAC_ADDR: device station MAC address (NLA_U8[6])

Just one mac address? What happens if we want to assign multiple mac addresses to the VF later? Also, how is this defined specifically? Will a SIOCSIFHWADDR with a different MAC address on the VF fail later, or is this just the default value?

Depends on how the VF wants to handle this. For our use-case with enic we only need the port-profile op so I'm not sure what the best design is for mac+vlan on a VF. Looking for advise from folks like yourself. If it's not needed, let's scratch it.

-scott

#7 lore raw

Re: [net-next,1/2] add iovnl netlink support

In reply to Arnd Bergmann
Quoted 5 lines · Arnd Bergmann
Quoted 5 lines
Quoted 5 lines

But that's only the case if the NIC itself is in VEPA mode. If that were the case, there would be no need for a kernel interface at all, because then we could just drive the port profile selection from user space.

Quoted 8 lines
Quoted 5 lines
Quoted 3 lines

The proposed interface only seems to make sense if you use it to configure the NIC itself! Why should it care about the port profile otherwise?

In the case of devices that can do adjacent switch negotiations directly.

I thought the idea to deal with those devices was to beat sense into the respective developers until they do the negotiation in software 8-)

When the device can do the negotiation directly with the switch, why does it make sense to bypass that and use software on the host? I don't think we'd want to give up on link speed/duplex auto-negotiation and punt those setting back to the user/host like in the old days.

-scott

#12 lore raw

Re: [net-next,1/2] add iovnl netlink support

In reply to Scott Feldman
Quoted 15 lines · Scott Feldman
Quoted 8 lines · Arnd Bergmann
Quoted 5 lines · Scott Feldman

IOV netlink (IOVNL) adds I/O Virtualization control support to a master device (MD) netdev interface. The MD (e.g. SR-IOV PF) will set/get control settings on behalf of a slave netdevice (e.g. SR-IOV VF). The design allows for the case where master and slave are the same netdev interface.

Quoted 4 lines

What is the reason for controlling the slave device through the master, rather than talking to the slave directly? The kernel always knows the master for each slave, so it seems to me that this information is redundant.

Quoted 4 lines

The interface would allow talking to the slave directly. In fact, that's the example with enic port-profile in patch 2/2. But, it would be nice not to rule out the case where the master proxies slave control and the master is under exclusively controlled by hypervisor.

Not sure I understand. Do you mean the case where this code runs in the hypervisor (e.g. KVM), or a different scerario with the setup being done in a guest driver?

So far, I have assumed that we would always do the setup on the host side, which always has access to both the master, and a slave proxy. In particular, your interface requires access to the slave AFAICT, because otherwise the VF IFNAME does not have any significance.

Take the case where you use network namespaces and put the VF into a separate namespace. With your interface, the PF is still in the root namespace, but passing both interface names in this interface won't help you because they are never visible in the same namespace (e.g. both might be named eth0 in their respective containers).

Quoted 8 lines
Quoted 3 lines

Is this new interface only for the case that you have a switch integrated in the NIC, or also for the case where you do an LLDP and EDP exchange with an adjacent bridge and put the device into VEPA mode?

All of the above. Basing this on netlink give us flexibility to work with user-space mgmt tools or directly with kernel netdev as in the enic case. Not trying to make assumptions about where (user-space, kernel) and by which entity sources or sinks the netlink msg.

ok.

Quoted 12 lines
Quoted 3 lines

Did you consider making this code an extension to the DCB interface instead of a separate one? What was the reason for your decision to keep it separate?

Considered it but DCB interface is well defined for DCB and it didn't seem right gluing on interfaces not specified within DCB. I agree that there is some overlap in the sense that both interface are used to configure a netdev with some properties interesting for the data center, but the DCB interface is for local setting of the properties on the host whereas iovnl is about pushing the setting of those properties to the network for policy-based control.

Quoted 5 lines
Quoted 2 lines

Also, do you expect your interface to be supported by dcbd/lldpad, or is there a good reason to create a new tool for iovnl?

Lldpad supporting this interface would seem right, for those cases where lldpad is responsible for configuring the netdev.

I believe we meant different things here, because I misunderstood the intention of the code. My question was whether lldpad would send the netlink messages to iovnl, but from what you and Chris write, the real idea was that both lldpad and kernel/iovnl can receive the same messages, right?

Quoted 6 lines
Quoted 5 lines
Quoted 2 lines

+ * @IOV_ATTR_CLIENT_NAME: client name (NLA_NUL_STRING)
+ * @IOV_ATTR_HOST_UUID: host UUID (NLA_NUL_STRING)

Can you elaborate more on what these do? Who is the 'client' and the 'host' in this case, and why do you need to identify them?

Quoted 8 lines

Those are optional and useful, for example, by the network mgmt tool for presenting a view such as:

- blade 1/2 // know by host uuid
- vm-rhel5-eth0 // client name
- port-profile: xyz

Something like that.

Hmm, but how do they get from the device driver to the the network management tool then? Also, these are similar to the attributes that are passed in the 802.1Qbg VDP protocol, but not compatible. If the idea is use the same netlink protocol for both your internal representation and for the standard based protocol, I think we should make them compatible.

Instead of a string identifying the port profile, this needs to pass a four byte field for a VSI type (3 bytes) and VSI manager ID (1 byte).

There is also a UUID in VDP, but it identifies the guest, not the host, so this is really confusing.

VDP also needs a list of MAC addresses and VLAN IDs (normally only one of each), but that would be separate from what you tell the adapter, see below:

Quoted 11 lines
Quoted 6 lines
Quoted 1 line

+ * @IOV_ATTR_MAC_ADDR: device station MAC address (NLA_U8[6])

Just one mac address? What happens if we want to assign multiple mac addresses to the VF later? Also, how is this defined specifically? Will a SIOCSIFHWADDR with a different MAC address on the VF fail later, or is this just the default value?

Depends on how the VF wants to handle this. For our use-case with enic we only need the port-profile op so I'm not sure what the best design is for mac+vlan on a VF. Looking for advise from folks like yourself. If it's not needed, let's scratch it.

In order to make VEPA work, it's absolutely required to impose a hard limit on what MAC+VLAN IDs are visible to the VF, because the switch identifies the guest by those and forwards any frames to/from that address according to the VSI type.

However, I feel that we should strictly separate the steps of configuring the adapter from talking to the switch. When we do the VDP association in user land, we still need to set up the VLAN and MAC configuration for the VF through a kernel interface. If we ignore the port profile stuff for a moment, your netlink interface looks like a good fit for that.

Since it seems what you really want to do is to do the exchange with the switch from here, maybe the hardware configuration part should be moved the DCB interface?

Arnd

#13 lore raw

Selective MD5 Checksum Failuers

I am noticing a strange and a troublesome behavior with tcp md5 checksums. Some selective packets are going out with invalid md5 checksums.

The only thing that is changing is the ack number (between the packets with valid and invalid md5 checksums), so while most packets have correct md5 checksums few 1 in 1000s have md5 checksums errors.

I am on 2.6.26 and I know that there have been significant changes since this version in this area. I have gone thru them but none of issues they address seem like the cause for this problem.

I have the scatter/gather and tcp segmentation disabled in the card.

The packet captures are attached.

Bijay

#8 lore raw

Re: [net-next,1/2] add iovnl netlink support

In reply to Scott Feldman
Quoted 11 lines · Scott Feldman
Quoted 4 lines · Arnd Bergmann
Quoted 1 line

In the case of devices that can do adjacent switch negotiations directly.

I thought the idea to deal with those devices was to beat sense into the respective developers until they do the negotiation in software 8-)

When the device can do the negotiation directly with the switch, why does it make sense to bypass that and use software on the host? I don't think we'd want to give up on link speed/duplex auto-negotiation and punt those setting back to the user/host like in the old days.

For the link negotiation, the card is the right place because it's necessary to get the link working before the OS can talk to the switch. For VDP, that's different because the hypervisor needs to talk to the switch before the guest can communicate, so there is no interdependency.

More importantly, the card cannot possibly do the protocol by itself, because the information that gets exchanged is specific to the hypervisor and the guest, not to the hardware. What you have implemented is another protocol between the hypervisor and the NIC that exchanges the exact same data that then gets sent to the switch. We already need to have an implementation that sends this data to the switch from user space for all cards that don't do it in firmware, so doing an alternative path in the adapter really creates more work for the users, and means that when we fix bugs or add features to the common code, you don't get them ;-).

Arnd

#14 lore raw

Re: [net-next,1/2] add iovnl netlink support

In reply to Arnd Bergmann
Quoted 5 lines · * Arnd Bergmann ([email protected]) wrote:
Quoted 4 lines · Scott Feldman
Quoted 2 lines · Arnd Bergmann

Also, do you expect your interface to be supported by dcbd/lldpad, or is there a good reason to create a new tool for iovnl?

Quoted 8 lines
Quoted 2 lines

Lldpad supporting this interface would seem right, for those cases where lldpad is responsible for configuring the netdev.

I believe we meant different things here, because I misunderstood the intention of the code. My question was whether lldpad would send the netlink messages to iovnl, but from what you and Chris write, the real idea was that both lldpad and kernel/iovnl can receive the same messages, right?

Correct. An example set of steps for initiating host to switch negotiation and subsequently launching a VM would be (expect user below to be a mgmt tool like libvirt):

1) user sends netlink message w/ relevant host interface and port profile id
2) recipient picks this up (enic, lldpad, whatever)
3) recipient does negotiation w/ adjacent switch
4) user creates macvtap associated w/ relevant host interface
5) user launches guest

Quoted 13 lines
Quoted 13 lines
Quoted 5 lines
Quoted 2 lines

+ * @IOV_ATTR_CLIENT_NAME: client name (NLA_NUL_STRING)
+ * @IOV_ATTR_HOST_UUID: host UUID (NLA_NUL_STRING)

Can you elaborate more on what these do? Who is the 'client' and the 'host' in this case, and why do you need to identify them?

Those are optional and useful, for example, by the network mgmt tool for presenting a view such as:

- blade 1/2 // know by host uuid
- vm-rhel5-eth0 // client name
- port-profile: xyz

Quoted 8 lines
Quoted 1 line

Something like that.

Hmm, but how do they get from the device driver to the the network management tool then? Also, these are similar to the attributes that are passed in the 802.1Qbg VDP protocol, but not compatible. If the idea is use the same netlink protocol for both your internal representation and for the standard based protocol, I think we should make them compatible.

Indeed, that's my expectation.

Quoted 2 lines

Instead of a string identifying the port profile, this needs to pass a four byte field for a VSI type (3 bytes) and VSI manager ID (1 byte).

I think we just need a u8 array, 4 bytes for VDP, some maxlen that is at least as large as enic expects.

Quoted 2 lines

There is also a UUID in VDP, but it identifies the guest, not the host, so this is really confusing.

Yes, I had same confusion. I expected guest, enic wants to send host as well.

Quoted 27 lines

VDP also needs a list of MAC addresses and VLAN IDs (normally only one of each), but that would be separate from what you tell the adapter, see below:

Quoted 11 lines
Quoted 6 lines
Quoted 1 line

+ * @IOV_ATTR_MAC_ADDR: device station MAC address (NLA_U8[6])

Just one mac address? What happens if we want to assign multiple mac addresses to the VF later? Also, how is this defined specifically? Will a SIOCSIFHWADDR with a different MAC address on the VF fail later, or is this just the default value?

Depends on how the VF wants to handle this. For our use-case with enic we only need the port-profile op so I'm not sure what the best design is for mac+vlan on a VF. Looking for advise from folks like yourself. If it's not needed, let's scratch it.

In order to make VEPA work, it's absolutely required to impose a hard limit on what MAC+VLAN IDs are visible to the VF, because the switch identifies the guest by those and forwards any frames to/from that address according to the VSI type.

However, I feel that we should strictly separate the steps of configuring the adapter from talking to the switch. When we do the VDP association in user land, we still need to set up the VLAN and MAC configuration for the VF through a kernel interface. If we ignore the port profile stuff for a moment, your netlink interface looks like a good fit for that.

Quoted 3 lines

Since it seems what you really want to do is to do the exchange with the switch from here, maybe the hardware configuration part should be moved the DCB interface?

I suppose this would work (although it's a bit odd being out of scope of DCB spec). I don't expect mgmt app to care about the implementation specifics of an adapter, so it will always send this and iovnl message too. All as part of same setup.

thanks,
-chris

#9 lore raw

Re: [net-next,1/2] add iovnl netlink support

In reply to Arnd Bergmann
Quoted 18 lines · Arnd Bergmann
Quoted 11 lines · Scott Feldman
Quoted 4 lines · Arnd Bergmann
Quoted 1 line

In the case of devices that can do adjacent switch negotiations directly.

I thought the idea to deal with those devices was to beat sense into the respective developers until they do the negotiation in software 8-)

When the device can do the negotiation directly with the switch, why does it make sense to bypass that and use software on the host? I don't think we'd want to give up on link speed/duplex auto-negotiation and punt those setting back to the user/host like in the old days.

For the link negotiation, the card is the right place because it's necessary to get the link working before the OS can talk to the switch. For VDP, that's different because the hypervisor needs to talk to the switch before the guest can communicate, so there is no interdependency.

Quoted 9 lines

More importantly, the card cannot possibly do the protocol by itself, because the information that gets exchanged is specific to the hypervisor and the guest, not to the hardware. What you have implemented is another protocol between the hypervisor and the NIC that exchanges the exact same data that then gets sent to the switch. We already need to have an implementation that sends this data to the switch from user space for all cards that don't do it in firmware, so doing an alternative path in the adapter really creates more work for the users, and means that when we fix bugs or add features to the common code, you don't get them ;-).

But the point of iovnl was to provide a single mechanism for both types of adapters (w/ or w/o firmware assist) to exchange this data with the switch, therefore making the difference in the adapters transparent to the user. So I'm missing your point about more work for the users.

-scott

#15 lore raw

Re: [net-next,1/2] add iovnl netlink support

In reply to Chris Wright
Quoted 12 lines · Chris Wright
Quoted 6 lines · * Arnd Bergmann ([email protected]) wrote:

On Tuesday 20 April 2010, Scott Feldman wrote:
I believe we meant different things here, because I misunderstood the intention of the code. My question was whether lldpad would send the netlink messages to iovnl, but from what you and Chris write, the real idea was that both lldpad and kernel/iovnl can receive the same messages, right?

Correct. An example set of steps for initiating host to switch negotiation and subsequently launching a VM would be (expect user below to be a mgmt tool like libvirt):

Quoted 5 lines

1) user sends netlink message w/ relevant host interface and port profile id
2) recipient picks this up (enic, lldpad, whatever)
3) recipient does negotiation w/ adjacent switch
4) user creates macvtap associated w/ relevant host interface
5) user launches guest

I'd move point 4 before 1, but otherwise it makes sense and it would still work either way.

Quoted 11 lines
Quoted 3 lines

If the idea is use the same netlink protocol for both your internal representation and for the standard based protocol, I think we should make them compatible.

Indeed, that's my expectation.

[...]

Quoted 2 lines

Instead of a string identifying the port profile, this needs to pass a four byte field for a VSI type (3 bytes) and VSI manager ID (1 byte).

Quoted 8 lines

I think we just need a u8 array, 4 bytes for VDP, some maxlen that is at least as large as enic expects.

Quoted 2 lines

There is also a UUID in VDP, but it identifies the guest, not the host, so this is really confusing.

Yes, I had same confusion. I expected guest, enic wants to send host as well.

So given all these differences, how compatible can we make them?

With the current definition, most of fields are at least slightly different. The differences seem to stem mostly from the fact that Cisco switches use a nonstandard protocol, rather than the difference between the firmware and userland implementations of the protocol, and of course we shouldn't confuse the two.

Quoted 11 lines
Quoted 11 lines

In order to make VEPA work, it's absolutely required to impose a hard limit on what MAC+VLAN IDs are visible to the VF, because the switch identifies the guest by those and forwards any frames to/from that address according to the VSI type.

However, I feel that we should strictly separate the steps of configuring the adapter from talking to the switch. When we do the VDP association in user land, we still need to set up the VLAN and MAC configuration for the VF through a kernel interface. If we ignore the port profile stuff for a moment, your netlink interface looks like a good fit for that.

Quoted 6 lines
Quoted 3 lines

Since it seems what you really want to do is to do the exchange with the switch from here, maybe the hardware configuration part should be moved the DCB interface?

I suppose this would work (although it's a bit odd being out of scope of DCB spec).

It could be anywhere, it doesn't have to be the DCB interface, but could be anything ranging from ethtool to iplink I guess. And we should define it in a way that works for any SR-IOV card, whether it's using Cisco's protocol in firmware, 802.1Qbg VDP in firmware, lldpad to do VDP or none of the above and just provides an internal switch like all the existing NICs.

Quoted 3 lines

I don't expect mgmt app to care about the implementation specifics of an adapter, so it will always send this and iovnl message too. All as part of same setup.

Why? I really see these things as separate. Obviously a management tool like libvirt would need to do both these things eventually, but each of them has multiple options that can be combined in various ways:

1. Setting up the slave device
a) create an SR-IOV VF to assign to a guest
b) create a macvtap device to pass to qemu or vhost
c) attach a tap device to a bridge
d) create a macvlan device and put it into a container
e) create a virtual interface for a VMDq adapter

2) Registering the slave with the switch
a) use Cisco protocol in enic firmware (see patch 2/2)
b) use standard VDP in lldpad
c) use reverse-engineered cisco protocol in some user tool for non-enic adapters.
d) use standard VDP in firmware (hopefully this never happens)
e) do nothing at all (as we do today)

Some of the cases can be treated identically, e.g. 1d) and 1e), or 2a) and 2c), but in general the management app needs to have some idea of which combination it's going to set up.

Arnd

#10 lore raw

Re: [net-next,1/2] add iovnl netlink support

In reply to Scott Feldman
Quoted 11 lines · Scott Feldman
Quoted 9 lines · Arnd Bergmann

More importantly, the card cannot possibly do the protocol by itself, because the information that gets exchanged is specific to the hypervisor and the guest, not to the hardware. What you have implemented is another protocol between the hypervisor and the NIC that exchanges the exact same data that then gets sent to the switch. We already need to have an implementation that sends this data to the switch from user space for all cards that don't do it in firmware, so doing an alternative path in the adapter really creates more work for the users, and means that when we fix bugs or add features to the common code, you don't get them ;-).

Quoted 4 lines

But the point of iovnl was to provide a single mechanism for both types of adapters (w/ or w/o firmware assist) to exchange this data with the switch, therefore making the difference in the adapters transparent to the user. So I'm missing your point about more work for the users.

It creates an extra step: Normally we'd simply implement the network protocol in user space, e.g. in lldpad and have other code use the lldptool command line interface to start the negotiation.

Now we have a user protocol based on netlink that is about as complex as the wire protocol itself, at least if you want to implement both the standard VDP and the Cisco variant, and do all the interesting parts like guest migration and synchronously waiting for the negotiation to complete.

Arnd

#16 lore raw

Re: [net-next,1/2] add iovnl netlink support

In reply to Arnd Bergmann
Quoted 9 lines · * Arnd Bergmann ([email protected]) wrote:
Quoted 7 lines · Chris Wright
Quoted 3 lines · * Arnd Bergmann ([email protected]) wrote:

Since it seems what you really want to do is to do the exchange with the switch from here, maybe the hardware configuration part should be moved the DCB interface?

I suppose this would work (although it's a bit odd being out of scope of DCB spec).

Quoted 6 lines

It could be anywhere, it doesn't have to be the DCB interface, but could be anything ranging from ethtool to iplink I guess. And we should define it in a way that works for any SR-IOV card, whether it's using Cisco's protocol in firmware, 802.1Qbg VDP in firmware, lldpad to do VDP or none of the above and just provides an internal switch like all the existing NICs.

Heh, that's exactly what iovnl does ;-)

Quoted 9 lines
Quoted 3 lines

I don't expect mgmt app to care about the implementation specifics of an adapter, so it will always send this and iovnl message too. All as part of same setup.

Why? I really see these things as separate. Obviously a management tool like libvirt would need to do both these things eventually, but each of them has multiple options that can be combined in various ways:

Quoted 6 lines

1. Setting up the slave device
a) create an SR-IOV VF to assign to a guest
b) create a macvtap device to pass to qemu or vhost
c) attach a tap device to a bridge
d) create a macvlan device and put it into a container
e) create a virtual interface for a VMDq adapter

OK, but iovnl isn't doing this.

Quoted 7 lines

2) Registering the slave with the switch
a) use Cisco protocol in enic firmware (see patch 2/2)
b) use standard VDP in lldpad
c) use reverse-engineered cisco protocol in some user tool for non-enic adapters.
d) use standard VDP in firmware (hopefully this never happens)
e) do nothing at all (as we do today)

And this is the step that is the main purpose of iovnl.

Here's the simplest snippet of libvirt to show this. It sends set_port_profile netlink messages and then creates macvtap. As simple as it gets...

src/qemu/qemu_conf.c +5 -0
@@ -1470,6 +1470,11 @@ qemudPhysIfaceConnect(virConnectPtr conn,
         net->model && STREQ(net->model, "virtio"))
         vnet_hdr = 1;
 
+    setPortProfileId(net->data.direct.linkdev,
+                      net->data.direct.mode,
+                      net->data.direct.profileid,
+                      net->mac);
+
     rc = openMacvtapTap(net->ifname, net->mac, linkdev, brmode,
                         &res_ifname, vnet_hdr);
#17 lore raw

Re: [net-next,1/2] add iovnl netlink support

Quoted 10 lines · Chris Wright
Quoted 9 lines · * Arnd Bergmann ([email protected]) wrote:
Quoted 7 lines · Chris Wright
Quoted 3 lines · * Arnd Bergmann ([email protected]) wrote:

Since it seems what you really want to do is to do the exchange with the switch from here, maybe the hardware configuration part should be moved the DCB interface?

I suppose this would work (although it's a bit odd being out of scope of DCB spec).

Quoted 8 lines
Quoted 6 lines

It could be anywhere, it doesn't have to be the DCB interface, but could be anything ranging from ethtool to iplink I guess. And we should define it in a way that works for any SR-IOV card, whether it's using Cisco's protocol in firmware, 802.1Qbg VDP in firmware, lldpad to do VDP or none of the above and just provides an internal switch like all the existing NICs.

Heh, that's exactly what iovnl does ;-)

No, according to what you write below, it's exactly what iovnl does *not* do, i.e. part 1 in my list.

Quoted 8 lines
Quoted 6 lines

1. Setting up the slave device
a) create an SR-IOV VF to assign to a guest
b) create a macvtap device to pass to qemu or vhost
c) attach a tap device to a bridge
d) create a macvlan device and put it into a container
e) create a virtual interface for a VMDq adapter

OK, but iovnl isn't doing this.

The set_mac_vlan that Scott's patch adds seems to implement 1a), as far as I can tell. Interestingly, this is not actually implemented in the enic driver in patch 2/2. So if we all agree that this is out of the scope of iovnl, let's just remove it from the interface and find another way for it (ethtool, iplink, ..., as listed above).

Note that we still need to pass the MAC address and VLAN ID (or a list of these) to the external switch, my point is just that this should be separate from enforcing it in the hypervisor.

Quoted 17 lines
Quoted 7 lines

2) Registering the slave with the switch
a) use Cisco protocol in enic firmware (see patch 2/2)
b) use standard VDP in lldpad
c) use reverse-engineered cisco protocol in some user tool for non-enic adapters.
d) use standard VDP in firmware (hopefully this never happens)
e) do nothing at all (as we do today)

And this is the step that is the main purpose of iovnl.

Here's the simplest snippet of libvirt to show this. It sends set_port_profile netlink messages and then creates macvtap. As simple as it gets...

src/qemu/qemu_conf.c qemudPhysIfaceConnect(virConnectPtr conn, · line 1479

Quoted 10 lines
src/qemu/qemu_conf.c +5 -0
@@ -1470,6 +1470,11 @@ qemudPhysIfaceConnect(virConnectPtr conn,
         net->model && STREQ(net->model, "virtio"))
         vnet_hdr = 1;
 
+    setPortProfileId(net->data.direct.linkdev,
+                      net->data.direct.mode,
+                      net->data.direct.profileid,
+                      net->mac);
+
     rc = openMacvtapTap(net->ifname, net->mac, linkdev, brmode,
                         &res_ifname, vnet_hdr);

Ok. In case of VDP, I guess this needs to be extended with the vlan ID that has been configured, and possibly with a UUID, because we need to pass the same one on the target machine if we migrate it.

Alternatively, the setPortProfileId could figure out the MAC address and VLAN ID from the device itself, but then we don't need to pass either of them.

Arnd

#18 lore raw

Re: [net-next,1/2] add iovnl netlink support

Quoted 7 lines · Arnd Bergmann
Quoted 7 lines
Quoted 6 lines

1. Setting up the slave device
a) create an SR-IOV VF to assign to a guest
b) create a macvtap device to pass to qemu or vhost
c) attach a tap device to a bridge
d) create a macvlan device and put it into a container
e) create a virtual interface for a VMDq adapter

Quoted 7 lines
Quoted 1 line

OK, but iovnl isn't doing this.

The set_mac_vlan that Scott's patch adds seems to implement 1a), as far as I can tell. Interestingly, this is not actually implemented in the enic driver in patch 2/2. So if we all agree that this is out of the scope of iovnl, let's just remove it from the interface and find another way for it (ethtool, iplink, ..., as listed above).

You're right, not needed for enic since mac addr is included with port-profile push and vlan membership is implied by port-profile. So I put set_mac_vlan in there basically to elicit feedback.

There really wouldn't be much different between iplink and iovnl since they're both rtnetlink...seems we should keep IOV-related APIs in one place. Maybe there are other IOV APIs to add to iovnl in the future like:

    vf <- add_vf(pf)
    del_vf(pf, vf)

Ethtool doesn't seem the right place for this.

-scott

#19 lore raw

Re: [net-next,1/2] add iovnl netlink support

Quoted 17 lines · Scott Feldman
Quoted 7 lines · Arnd Bergmann
Quoted 7 lines
Quoted 6 lines

1. Setting up the slave device
a) create an SR-IOV VF to assign to a guest
b) create a macvtap device to pass to qemu or vhost
c) attach a tap device to a bridge
d) create a macvlan device and put it into a container
e) create a virtual interface for a VMDq adapter

Quoted 7 lines
Quoted 1 line

OK, but iovnl isn't doing this.

The set_mac_vlan that Scott's patch adds seems to implement 1a), as far as I can tell. Interestingly, this is not actually implemented in the enic driver in patch 2/2. So if we all agree that this is out of the scope of iovnl, let's just remove it from the interface and find another way for it (ethtool, iplink, ..., as listed above).

Quoted 3 lines

You're right, not needed for enic since mac addr is included with port-profile push and vlan membership is implied by port-profile. So I put set_mac_vlan in there basically to elicit feedback.

Ok. Two points though:

- when you say that the mac address is included in the port-profile push, does that imply that the VF does not have a mac address prior to this? This would again mix the NIC configuration phase with the switch association, which I think we really need to avoid if we want to be able to implement the association in user space!

- The VLAN ID being implied in the port profile seems to be another difference between what enic is doing and the current draft VDP that will eventually become 802.1Qbg, and I fear that this difference will be visible in the iovnl protocol.

Quoted 8 lines

There really wouldn't be much different between iplink and iovnl since they're both rtnetlink...seems we should keep IOV-related APIs in one place. Maybe there are other IOV APIs to add to iovnl in the future like:

    vf <- add_vf(pf)
    del_vf(pf, vf)

Ethtool doesn't seem the right place for this.

Right. My preference would probably be make these a subcategory of the if_link, and use the existing RTM_NEWLINK/RTM_DELLINK commands. This would make it resemble the existing interfaces and mean you can use

ip link add link eth0 type macvlan    # for a container
ip link add link eth0 type macvtap    # for qemu/vhost
ip link add link eth0 type vf         # for device assignment

There are obviously significant differences between these three, but they also share enough of their properties to let us treat them in similar ways.

If we integrate the iovnl client into iproute2, the sequence for setting up an enic VF and associating it to the port profile could be

# create vf0, pass mac and vlan id to HW, no association yet
ip link add link eth0 name vf0 type vf mac fe:dc:ba:12:34:56 vlan 78
# associate vf with port profile, mac address must match the one assigned
#  to the interface before.
ip iov assoc eth0 port-profile "general" host-uuid "dcf2a873-f5ee-41dd-a7ad-802a544e48c2" \
	 mac fe:dc:ba:12:34:56

Arnd

#32 lore raw

Re: [net-next,1/2] add iovnl netlink support

In reply to Arnd Bergmann
Quoted 5 lines · Arnd Bergmann
Quoted 2 lines

+ * @IOV_ATTR_IFNAME: interface name of master (PF) net device (NLA_NUL_STRING)
+ * @IOV_ATTR_VF_IFNAME: interface name of target VF device (NLA_NUL_STRING)

As mentioned above, why not drop one of these, and just pass the VF's IFNAME?

Coming back to this point, I now think it would be ideal if we could actually leave out IOV_ATTR_VF_IFNAME and just pass the master IFNAME and the slave MAC address. Since we're not actually doing anything with the slave itself but really talking the switch, it should not be needed at all.

That would solve all problems with the slave having moved to another namespace already, and make it totally clear that this is not about configuring the slave but about registering it.

Scott, would that still work with your driver?

Arnd

#30 lore raw

Re: [net-next,1/2] add iovnl netlink support

In reply to Arnd Bergmann
Quoted 18 lines · * Arnd Bergmann ([email protected]) wrote:
Quoted 17 lines · Chris Wright
Quoted 15 lines · * Arnd Bergmann ([email protected]) wrote:
Quoted 7 lines · Chris Wright
Quoted 3 lines · * Arnd Bergmann ([email protected]) wrote:

Since it seems what you really want to do is to do the exchange with the switch from here, maybe the hardware configuration part should be moved the DCB interface?

I suppose this would work (although it's a bit odd being out of scope of DCB spec).

It could be anywhere, it doesn't have to be the DCB interface, but could be anything ranging from ethtool to iplink I guess. And we should define it in a way that works for any SR-IOV card, whether it's using Cisco's protocol in firmware, 802.1Qbg VDP in firmware, lldpad to do VDP or none of the above and just provides an internal switch like all the existing NICs.

Quoted 4 lines
Quoted 1 line

Heh, that's exactly what iovnl does ;-)

No, according to what you write below, it's exactly what iovnl does *not* do, i.e. part 1 in my list.

OK, I see...in this case to me hw setup was the port profile for the enic to initiate host<->switch negotiation, sorry for confusion.

Quoted 7 lines
Quoted 7 lines
Quoted 6 lines

1. Setting up the slave device
a) create an SR-IOV VF to assign to a guest
b) create a macvtap device to pass to qemu or vhost
c) attach a tap device to a bridge
d) create a macvlan device and put it into a container
e) create a virtual interface for a VMDq adapter

Quoted 7 lines
Quoted 1 line

OK, but iovnl isn't doing this.

The set_mac_vlan that Scott's patch adds seems to implement 1a), as far as I can tell. Interestingly, this is not actually implemented in the enic driver in patch 2/2. So if we all agree that this is out of the scope of iovnl, let's just remove it from the interface and find another way for it (ethtool, iplink, ..., as listed above).

Scott, any objection? At least a way to keep moving forward on the port profile bit.

Quoted 3 lines

Note that we still need to pass the MAC address and VLAN ID (or a list of these) to the external switch, my point is just that this should be separate from enforcing it in the hypervisor.

Yup, we should focus on reconciling the diff of enic vs vpd port profile needs.

Quoted 35 lines
Quoted 17 lines
Quoted 7 lines

2) Registering the slave with the switch
a) use Cisco protocol in enic firmware (see patch 2/2)
b) use standard VDP in lldpad
c) use reverse-engineered cisco protocol in some user tool for non-enic adapters.
d) use standard VDP in firmware (hopefully this never happens)
e) do nothing at all (as we do today)

And this is the step that is the main purpose of iovnl.

Here's the simplest snippet of libvirt to show this. It sends set_port_profile netlink messages and then creates macvtap. As simple as it gets...

src/qemu/qemu_conf.c qemudPhysIfaceConnect(virConnectPtr conn, · line 1479

Quoted 10 lines
src/qemu/qemu_conf.c +5 -0
@@ -1470,6 +1470,11 @@ qemudPhysIfaceConnect(virConnectPtr conn,
         net->model && STREQ(net->model, "virtio"))
         vnet_hdr = 1;
 
+    setPortProfileId(net->data.direct.linkdev,
+                      net->data.direct.mode,
+                      net->data.direct.profileid,
+                      net->mac);
+
     rc = openMacvtapTap(net->ifname, net->mac, linkdev, brmode,
                         &res_ifname, vnet_hdr);

Ok. In case of VDP, I guess this needs to be extended with the vlan ID that has been configured, and possibly with a UUID, because we need to pass the same one on the target machine if we migrate it.

Alternatively, the setPortProfileId could figure out the MAC address and VLAN ID from the device itself, but then we don't need to pass either of them.

#20 lore raw

Re: [net-next,1/2] add iovnl netlink support

In reply to Arnd Bergmann
Quoted 44 lines · * Arnd Bergmann ([email protected]) wrote:
Quoted 17 lines · Scott Feldman
Quoted 7 lines · Arnd Bergmann
Quoted 7 lines
Quoted 6 lines

1. Setting up the slave device
a) create an SR-IOV VF to assign to a guest
b) create a macvtap device to pass to qemu or vhost
c) attach a tap device to a bridge
d) create a macvlan device and put it into a container
e) create a virtual interface for a VMDq adapter

Quoted 7 lines
Quoted 1 line

OK, but iovnl isn't doing this.

The set_mac_vlan that Scott's patch adds seems to implement 1a), as far as I can tell. Interestingly, this is not actually implemented in the enic driver in patch 2/2. So if we all agree that this is out of the scope of iovnl, let's just remove it from the interface and find another way for it (ethtool, iplink, ..., as listed above).

Quoted 3 lines

You're right, not needed for enic since mac addr is included with port-profile push and vlan membership is implied by port-profile. So I put set_mac_vlan in there basically to elicit feedback.

Ok. Two points though:

- when you say that the mac address is included in the port-profile push, does that imply that the VF does not have a mac address prior to this? This would again mix the NIC configuration phase with the switch association, which I think we really need to avoid if we want to be able to implement the association in user space!

- The VLAN ID being implied in the port profile seems to be another difference between what enic is doing and the current draft VDP that will eventually become 802.1Qbg, and I fear that this difference will be visible in the iovnl protocol.

Quoted 8 lines

There really wouldn't be much different between iplink and iovnl since they're both rtnetlink...seems we should keep IOV-related APIs in one place. Maybe there are other IOV APIs to add to iovnl in the future like:

    vf <- add_vf(pf)
    del_vf(pf, vf)

Ethtool doesn't seem the right place for this.

Quoted 8 lines

Right. My preference would probably be make these a subcategory of the if_link, and use the existing RTM_NEWLINK/RTM_DELLINK commands. This would make it resemble the existing interfaces and mean you can use

ip link add link eth0 type macvlan    # for a container
ip link add link eth0 type macvtap    # for qemu/vhost
ip link add link eth0 type vf         # for device assignment

BTW, what do you mean by device assignment?

Quoted 9 lines

There are obviously significant differences between these three, but they also share enough of their properties to let us treat them in similar ways.

If we integrate the iovnl client into iproute2, the sequence for setting up an enic VF and associating it to the port profile could be

# create vf0, pass mac and vlan id to HW, no association yet
ip link add link eth0 name vf0 type vf mac fe:dc:ba:12:34:56 vlan 78

Just to clarify...right now, the normal SR-IOV VF is already there. And, or course, can have its mac addr/vlan set already.

Quoted 4 lines
# associate vf with port profile, mac address must match the one assigned
#  to the interface before.
ip iov assoc eth0 port-profile "general" host-uuid "dcf2a873-f5ee-41dd-a7ad-802a544e48c2" \
	 mac fe:dc:ba:12:34:56

At that point you could just do s/mac fe:.*/link vf0/

thanks,
-chris

#27 lore raw

Re: [net-next,1/2] add iovnl netlink support

In reply to Arnd Bergmann
Quoted 18 lines · Arnd Bergmann
Quoted 17 lines · Scott Feldman
Quoted 14 lines · Arnd Bergmann
Quoted 8 lines
Quoted 6 lines

1. Setting up the slave device
a) create an SR-IOV VF to assign to a guest
b) create a macvtap device to pass to qemu or vhost
c) attach a tap device to a bridge
d) create a macvlan device and put it into a container
e) create a virtual interface for a VMDq adapter

OK, but iovnl isn't doing this.

The set_mac_vlan that Scott's patch adds seems to implement 1a), as far as I can tell. Interestingly, this is not actually implemented in the enic driver in patch 2/2. So if we all agree that this is out of the scope of iovnl, let's just remove it from the interface and find another way for it (ethtool, iplink, ..., as listed above).

Quoted 8 lines
Quoted 3 lines

You're right, not needed for enic since mac addr is included with port-profile push and vlan membership is implied by port-profile. So I put set_mac_vlan in there basically to elicit feedback.

Ok. Two points though:

- when you say that the mac address is included in the port-profile push, does that imply that the VF does not have a mac address prior to this?

Correct, VF has no mac addr prior to port-profile being applied. The mac_addr is the mac_addr of the VM guest interface that's to use the VF. If the port-profile defines L2 mac spoofing, for example, the switch wants to
know the mac address before i/o starts. I/o doesn't start until
port-profile is applied and the switch virtual port is setup.

Quoted 8 lines

This would again mix the NIC configuration phase with the switch association, which I think we really need to avoid if we want to be able to implement the association in user space!

- The VLAN ID being implied in the port profile seems to be another difference between what enic is doing and the current draft VDP that will eventually become 802.1Qbg, and I fear that this difference will be visible in the iovnl protocol.

It's not just a VLAN ID, but the entire VLAN membership for the switch virtual port. The port-profile may define a single native VLAN for access mode on the switch port, or a trunk mode with a list of allowed vlans, with on native vlan.

The key is the port-profile. The port-profile resolves the configuration of the switch virtual port. The configuration of the switch virtual port includes many setting like I mentioned earlier: VLAN membership, QoS (rate limits, priority class, L2 security, etc).

Quoted 14 lines
Quoted 8 lines

There really wouldn't be much different between iplink and iovnl since they're both rtnetlink...seems we should keep IOV-related APIs in one place. Maybe there are other IOV APIs to add to iovnl in the future like:

    vf <- add_vf(pf)
    del_vf(pf, vf)

Ethtool doesn't seem the right place for this.

Right. My preference would probably be make these a subcategory of the if_link, and use the existing RTM_NEWLINK/RTM_DELLINK commands. This would make it resemble the existing interfaces and mean you can use

Quoted 8 lines
ip link add link eth0 type macvlan    # for a container
ip link add link eth0 type macvtap    # for qemu/vhost
ip link add link eth0 type vf         # for device assignment

There are obviously significant differences between these three, but they also share enough of their properties to let us treat them in similar ways.

I don't have strong preference for iovnl vs. extending if_link. I thought I had a reason against if_link, but I can't recall that now...it'll probably come to me when I look at it again. Let me look again...

Quoted 11 lines

If we integrate the iovnl client into iproute2, the sequence for setting up an enic VF and associating it to the port profile could be

# create vf0, pass mac and vlan id to HW, no association yet
ip link add link eth0 name vf0 type vf mac fe:dc:ba:12:34:56 vlan 78
# associate vf with port profile, mac address must match the one assigned
#  to the interface before.
ip iov assoc eth0 port-profile "general" host-uuid
"dcf2a873-f5ee-41dd-a7ad-802a544e48c2" \
mac fe:dc:ba:12:34:56

Ya, that sounds pretty close. I still want the flexibility to direct ops to a PF link for a VF link.

-scott

#31 lore raw

Re: [net-next,1/2] add iovnl netlink support

In reply to Chris Wright
Quoted 8 lines · Chris Wright
Quoted 5 lines

The set_mac_vlan that Scott's patch adds seems to implement 1a), as far as I can tell. Interestingly, this is not actually implemented in the enic driver in patch 2/2. So if we all agree that this is out of the scope of iovnl, let's just remove it from the interface and find another way for it (ethtool, iplink, ..., as listed above).

Scott, any objection? At least a way to keep moving forward on the port profile bit.

Yes, that's fine with me, port-profile bit is the most important part.

Quoted 6 lines
Quoted 3 lines

Note that we still need to pass the MAC address and VLAN ID (or a list of these) to the external switch, my point is just that this should be separate from enforcing it in the hypervisor.

Yup, we should focus on reconciling the diff of enic vs vpd port profile needs.

-scott

maintainer
#33 lore raw

Re: [net-next PATCH 1/2] add iovnl netlink support

In reply to Scott Feldman

From: Scott Feldman <[email protected]>
Date: Mon, 19 Apr 2010 12:18:07 -0700

Review

Quoted 2 lines
(quoted diff) +2 -0
+#define IOVNL_PROTO_VERSION 1
+

Please delete this in the final version, the macro isn't even used by the code.

We don't do protocol versioning in netlink. Instead we get the base stuff solid from the beginning, and then if something needs fixing up we handle this using new attributes in a way which is both backward and forward compatible.

Thanks.

#21 lore raw

Re: [net-next,1/2] add iovnl netlink support

In reply to Chris Wright
Quoted 6 lines · Chris Wright
Quoted 4 lines
ip link add link eth0 type macvlan    # for a container
ip link add link eth0 type macvtap    # for qemu/vhost
ip link add link eth0 type vf         # for device assignment

BTW, what do you mean by device assignment?

I mean giving an SR-IOV VF to the guest as a native PCI device rather than having qemu or vhost present a virtio-net to the guest.

Quoted 4 lines
Quoted 4 lines

There are obviously significant differences between these three, but they also share enough of their properties to let us treat them in similar ways.

Quoted 8 lines
Quoted 5 lines

If we integrate the iovnl client into iproute2, the sequence for setting up an enic VF and associating it to the port profile could be

# create vf0, pass mac and vlan id to HW, no association yet
ip link add link eth0 name vf0 type vf mac fe:dc:ba:12:34:56 vlan 78

Just to clarify...right now, the normal SR-IOV VF is already there. And, or course, can have its mac addr/vlan set already.

I don't have an SR-IOV card available for testing yet. How is this configured now?

Quoted 6 lines
Quoted 4 lines
# associate vf with port profile, mac address must match the one assigned
#  to the interface before.
ip iov assoc eth0 port-profile "general" host-uuid "dcf2a873-f5ee-41dd-a7ad-802a544e48c2" \
       mac fe:dc:ba:12:34:56

At that point you could just do s/mac fe:.*/link vf0/

My point was that this information should be irrelevant to the code doing the association with the switch. It sort of makes sense when the receiver is enic, but when we send the same data to lldpad, it doesn't care about the slave device name but only about the mac address. Especially since the slave device might not be in the root name space any more, meaning we have no way to find it.

Arnd

maintainer
#47 lore raw

Re: [net-next PATCH 1/2] add iovnl netlink support

In reply to Scott Feldman

From: Scott Feldman <[email protected]>
Date: Mon, 19 Apr 2010 12:18:07 -0700

net/iovnl/iovnl.c line 211

Quoted 3 lines
net/iovnl/iovnl.c new file +3 -0
+	if (tb[IOV_ATTR_VF_IFNAME])
+		vf_dev = dev_get_by_name(&init_net,
+			nla_data(tb[IOV_ATTR_VF_IFNAME]));

It's probably best to check this for NULL and notify the user with an error in that case (don't forget to put 'dev' in that error path :-)

As things stand it looks like if we can't find vf_dev, we'll just send NULL down to the vf_dev arg of the various operations and possibly silently succeed.

That's not desirable, semantically.

maintainer
#29 lore raw

Re: [net-next,1/2] add iovnl netlink support

In reply to Arnd Bergmann

From: Arnd Bergmann <[email protected]>
Date: Wed, 21 Apr 2010 23:13:04 +0200

Quoted 2 lines

My preference would probably be make these a subcategory of the if_link, and use the existing RTM_NEWLINK/RTM_DELLINK commands.

I was going to suggest this as well.

#48 lore raw

Re: [net-next PATCH 1/2] add iovnl netlink support

In reply to David Miller
Quoted 10 lines · David Miller

From: Scott Feldman <[email protected]>
Date: Mon, 19 Apr 2010 12:18:07 -0700

net/iovnl/iovnl.c line 211

Quoted 3 lines
net/iovnl/iovnl.c new file +3 -0
+     if (tb[IOV_ATTR_VF_IFNAME])
+             vf_dev = dev_get_by_name(&init_net,
+                     nla_data(tb[IOV_ATTR_VF_IFNAME]));

It's probably best to check this for NULL and notify the user with an error in that case (don't forget to put 'dev' in that error path :-)

Since you brought up that hunk: shouldn't the namespace better be current->nsproxy->net_ns instead of init_ns? If the sender is confined in a separate network namespace, I would expect that it should be able to modify devices in its own namespace but none that are in the root namespace.

Arnd

maintainer
#49 lore raw

Re: [net-next PATCH 1/2] add iovnl netlink support

From: Arnd Bergmann <[email protected]>
Date: Thu, 22 Apr 2010 12:53:11 +0200

Quoted 12 lines · David Miller
Quoted 10 lines

From: Scott Feldman <[email protected]>
Date: Mon, 19 Apr 2010 12:18:07 -0700

net/iovnl/iovnl.c line 211

Quoted 3 lines
net/iovnl/iovnl.c new file +3 -0
+     if (tb[IOV_ATTR_VF_IFNAME])
+             vf_dev = dev_get_by_name(&init_net,
+                     nla_data(tb[IOV_ATTR_VF_IFNAME]));

It's probably best to check this for NULL and notify the user with an error in that case (don't forget to put 'dev' in that error path :-)

Quoted 5 lines

Since you brought up that hunk: shouldn't the namespace better be current->nsproxy->net_ns instead of init_ns? If the sender is confined in a separate network namespace, I would expect that it should be able to modify devices in its own namespace but none that are in the root namespace.

Yes, the namespace needs to be handled better.

But reading other parts of the discussion it seems that IOV_ATTR_VF_IFNAME and some other bits will likely be removed in the initial implementation of this stuff.

#50 lore raw

Re: [net-next PATCH 1/2] add iovnl netlink support

Quoted 3 lines · David Miller

But reading other parts of the discussion it seems that IOV_ATTR_VF_IFNAME and some other bits will likely be removed in the initial implementation of this stuff.

That's what I suggested, yes. However, I'm still waiting for a reply from Scott wether it's actually possibly to remove it based on the way that the enic firmware works.

Arnd

#28 lore raw

Re: [net-next,1/2] add iovnl netlink support

In reply to Scott Feldman
Quoted 9 lines · Scott Feldman
Quoted 8 lines · Arnd Bergmann
Quoted 4 lines · Scott Feldman

On 4/21/10 12:39 PM, "Arnd Bergmann" <[email protected]> wrote:
You're right, not needed for enic since mac addr is included with port-profile push and vlan membership is implied by port-profile. So I put set_mac_vlan in there basically to elicit feedback.

Ok. Two points though:

Quoted 8 lines
Quoted 2 lines

- when you say that the mac address is included in the port-profile push, does that imply that the VF does not have a mac address prior to this?

Correct, VF has no mac addr prior to port-profile being applied. The mac_addr is the mac_addr of the VM guest interface that's to use the VF. If the port-profile defines L2 mac spoofing, for example, the switch wants to
know the mac address before i/o starts. I/o doesn't start until
port-profile is applied and the switch virtual port is setup.

Is it possible to split this this process, in order to make it more closely resemble what we have when the registration is in user space? This would mean that you assign a MAC address to the interface when the interface gets created, and register the same MAC address at the switch independent from the creation.

Obviously, if the port-profile (for enic) or the VSI list in the switch enforces a the mac address and you pass one that's different from the one that's set in the VF, it won't be able to send any data, but it remains the job of the switch to enforce that case.

Quoted 9 lines

It's not just a VLAN ID, but the entire VLAN membership for the switch virtual port. The port-profile may define a single native VLAN for access mode on the switch port, or a trunk mode with a list of allowed vlans, with on native vlan.

The key is the port-profile. The port-profile resolves the configuration of the switch virtual port. The configuration of the switch virtual port includes many setting like I mentioned earlier: VLAN membership, QoS (rate limits, priority class, L2 security, etc).

Ok, I see.

Quoted 6 lines
Quoted 6 lines

If we integrate the iovnl client into iproute2, the sequence for setting up an enic VF and associating it to the port profile could be

# create vf0, pass mac and vlan id to HW, no association yet
ip link add link eth0 name vf0 type vf mac fe:dc:ba:12:34:56 vlan 78
Quoted 8 lines
Quoted 5 lines
# associate vf with port profile, mac address must match the one assigned
#  to the interface before.
ip iov assoc eth0 port-profile "general" host-uuid
"dcf2a873-f5ee-41dd-a7ad-802a544e48c2" \
mac fe:dc:ba:12:34:56

Ya, that sounds pretty close. I still want the flexibility to direct ops to a PF link for a VF link.

Does that mean you require passing both the PF and the VF name?

Arnd

#22 lore raw

Re: [net-next,1/2] add iovnl netlink support

In reply to Arnd Bergmann
Quoted 11 lines · * Arnd Bergmann ([email protected]) wrote:
Quoted 6 lines · Chris Wright
Quoted 4 lines
ip link add link eth0 type macvlan    # for a container
ip link add link eth0 type macvtap    # for qemu/vhost
ip link add link eth0 type vf         # for device assignment

BTW, what do you mean by device assignment?

I mean giving an SR-IOV VF to the guest as a native PCI device rather than having qemu or vhost present a virtio-net to the guest.

OK, wasn't clear if you meant that or simply 100% dedicating the interface via something like virtio. The add_vf() idea, while neat, doesn't really match how VF's are allocated.

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

There are obviously significant differences between these three, but they also share enough of their properties to let us treat them in similar ways.

If we integrate the iovnl client into iproute2, the sequence for setting up an enic VF and associating it to the port profile could be

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
# create vf0, pass mac and vlan id to HW, no association yet
ip link add link eth0 name vf0 type vf mac fe:dc:ba:12:34:56 vlan 78

Just to clarify...right now, the normal SR-IOV VF is already there. And, or course, can have its mac addr/vlan set already.

I don't have an SR-IOV card available for testing yet. How is this configured now?

The device shows up in the host as a normal network device, so mgmt tools currently treat it as if it's no different from a PF. So that's just plain old:

SIOCSIFHWADDR or RTM_SETLINK (i.e. normal ->ndo_set_mac_addr)

There's also the possiblity of configuring through the PF (although this isn't really widely used ATM, and has the disadvantage of exposing the VF number to userspace in a way that's difficult to use). This is also done via RTM_SETLINK (on the PF this time), and will result in ->ndo_set_vf_mac().

Quoted 5 lines
Quoted 5 lines
Quoted 4 lines
# associate vf with port profile, mac address must match the one assigned
#  to the interface before.
ip iov assoc eth0 port-profile "general" host-uuid "dcf2a873-f5ee-41dd-a7ad-802a544e48c2" \
       mac fe:dc:ba:12:34:56
Quoted 7 lines
Quoted 1 line

At that point you could just do s/mac fe:.*/link vf0/

My point was that this information should be irrelevant to the code doing the association with the switch. It sort of makes sense when the receiver is enic, but when we send the same data to lldpad, it doesn't care about the slave device name but only about the mac address. Especially since the slave device might not be in the root name space any more, meaning we have no way to find it.

Yeah, w/ namespace I think you'd normally do all setup before handing into a new namespace.

thanks,
-chris

#23 lore raw

Re: [net-next,1/2] add iovnl netlink support

Quoted 3 lines · On Thursday 22 April 2010 19:47:29 Chris Wright wrote:

OK, wasn't clear if you meant that or simply 100% dedicating the interface via something like virtio. The add_vf() idea, while neat, doesn't really match how VF's are allocated.

But we still need something like that for allocating queues in VMDq and similar cases where we do not have pass-through, right?

As far as I can tell we don't have an interface for that yet, but we have drivers for a number of cards that could do this.

Quoted 8 lines
Quoted 2 lines

I don't have an SR-IOV card available for testing yet. How is this configured now?

The device shows up in the host as a normal network device, so mgmt tools currently treat it as if it's no different from a PF. So that's just plain old:

SIOCSIFHWADDR or RTM_SETLINK (i.e. normal ->ndo_set_mac_addr)

Ok, but that only works for a fixed number of VFs and you can only configure the VF before it's assigned to the guest, right?

Both are not serious limitations, but it would be nice to have an easy way around them. In particular, for assigning the mac address and vlan id (VF in access mode), there needs to be some interface that allows the host but not the guest to change the settings after assigning the card to the guest.

This is a fundamental requirement for VEPA, because the switch applied its forwarding rules based on the mac address and trusts the hypervisor to make sure it cannot be faked by the guest.

Arnd

#24 lore raw

Re: [net-next,1/2] add iovnl netlink support

Quoted 7 lines · * Arnd Bergmann ([email protected]) wrote:
Quoted 3 lines · On Thursday 22 April 2010 19:47:29 Chris Wright wrote:

OK, wasn't clear if you meant that or simply 100% dedicating the interface via something like virtio. The add_vf() idea, while neat, doesn't really match how VF's are allocated.

But we still need something like that for allocating queues in VMDq and similar cases where we do not have pass-through, right?

Iff we care about VMDq w/out SR-IOV (since SR-IOV hardware is VMDq capable and already has a queue-pair + interrupt + net_dev), yes.

And it's not just VMDq, it's any multi-queue card that can do mac/vlan filter in hw + header/data split (for direct data DMA to guest buffers).

Quoted 6 lines

As far as I can tell we don't have an interface for that yet, but we have drivers for a number of cards that could do this.

Quoted 3 lines
Quoted 2 lines

I don't have an SR-IOV card available for testing yet. How is this configured now?

Quoted 8 lines
Quoted 5 lines

The device shows up in the host as a normal network device, so mgmt tools currently treat it as if it's no different from a PF. So that's just plain old:

SIOCSIFHWADDR or RTM_SETLINK (i.e. normal ->ndo_set_mac_addr)

Ok, but that only works for a fixed number of VFs and you can only configure the VF before it's assigned to the guest, right?

Depends on assign.

Assign meaning it's still visible in host, but only one guest is using it via virtio (e.g. vhost-net)....then no, can change anytime (although it's not typically changed during VM lifecycle).

Assign meaning direct PCI device assignment of the VF to the guest, then yes, only while the device has driver in host.

Quoted 9 lines

Both are not serious limitations, but it would be nice to have an easy way around them. In particular, for assigning the mac address and vlan id (VF in access mode), there needs to be some interface that allows the host but not the guest to change the settings after assigning the card to the guest.

This is a fundamental requirement for VEPA, because the switch applied its forwarding rules based on the mac address and trusts the hypervisor to make sure it cannot be faked by the guest.

Sure, but the VF (when directly assigned to the guest) is going to (at least it should, for security reasons) always trap to a privileged code if the guest tries to do something like set mac or vlan id. All the SR-IOV cards I've seen do this. The "set VF mac addr" is really a message to the PF.

thanks,
-chris

#25 lore raw

Re: [net-next,1/2] add iovnl netlink support

Quoted 6 lines · On Thursday 22 April 2010 21:02:30 Chris Wright wrote:
Quoted 5 lines · * Arnd Bergmann ([email protected]) wrote:
Quoted 3 lines · On Thursday 22 April 2010 19:47:29 Chris Wright wrote:

OK, wasn't clear if you meant that or simply 100% dedicating the interface via something like virtio. The add_vf() idea, while neat, doesn't really match how VF's are allocated.

Quoted 8 lines
Quoted 2 lines

But we still need something like that for allocating queues in VMDq and similar cases where we do not have pass-through, right?

Iff we care about VMDq w/out SR-IOV (since SR-IOV hardware is VMDq capable and already has a queue-pair + interrupt + net_dev), yes.

And it's not just VMDq, it's any multi-queue card that can do mac/vlan filter in hw + header/data split (for direct data DMA to guest buffers).

Right, that's what I meant by VMDq. Do we have a better term to describe this class of devices, i.e. VMDq and other cards that also have the features you listed?

Arnd

#26 lore raw

Re: [net-next,1/2] add iovnl netlink support

Quoted 13 lines · * Arnd Bergmann ([email protected]) wrote:
Quoted 12 lines · On Thursday 22 April 2010 21:02:30 Chris Wright wrote:
Quoted 7 lines · * Arnd Bergmann ([email protected]) wrote:
Quoted 3 lines · On Thursday 22 April 2010 19:47:29 Chris Wright wrote:

OK, wasn't clear if you meant that or simply 100% dedicating the interface via something like virtio. The add_vf() idea, while neat, doesn't really match how VF's are allocated.

But we still need something like that for allocating queues in VMDq and similar cases where we do not have pass-through, right?

Iff we care about VMDq w/out SR-IOV (since SR-IOV hardware is VMDq capable and already has a queue-pair + interrupt + net_dev), yes.

Quoted 6 lines
Quoted 2 lines

And it's not just VMDq, it's any multi-queue card that can do mac/vlan filter in hw + header/data split (for direct data DMA to guest buffers).

Right, that's what I meant by VMDq. Do we have a better term to describe this class of devices, i.e. VMDq and other cards that also have the features you listed?

I don't have a good term. Some of these devices can already surface multiple netdevs.

thanks,
-chris

#34 lore raw

Re: [net-next PATCH 1/2] add iovnl netlink support

In reply to David Miller
Quoted 9 lines · David Miller

From: Scott Feldman <[email protected]>
Date: Mon, 19 Apr 2010 12:18:07 -0700

Review

Quoted 2 lines
(quoted diff) +2 -0
+#define IOVNL_PROTO_VERSION 1
+

Please delete this in the final version, the macro isn't even used by the code.

Quoted 4 lines

We don't do protocol versioning in netlink. Instead we get the base stuff solid from the beginning, and then if something needs fixing up we handle this using new attributes in a way which is both backward and forward compatible.

Sounds good to me, was a cut-and-paste from dcbnl.h. How about:

include/linux/dcbnl.h +0 -2
index b7cdbb4..8723491 100644
@@ -22,8 +22,6 @@
 
 #include <linux/types.h>
 
-#define DCB_PROTO_VERSION 1
-
 struct dcbmsg {
        __u8               dcb_family;
        __u8               cmd;

-scott

maintainer
#35 lore raw

Re: [net-next PATCH 1/2] add iovnl netlink support

From: Scott Feldman <[email protected]>
Date: Thu, 22 Apr 2010 14:23:30 -0700

Quoted 11 lines · David Miller
Quoted 10 lines

From: Scott Feldman <[email protected]>
Date: Mon, 19 Apr 2010 12:18:07 -0700

Review

Quoted 2 lines
(quoted diff) +2 -0
+#define IOVNL_PROTO_VERSION 1
+

Please delete this in the final version, the macro isn't even used by the code.

Quoted 6 lines
Quoted 4 lines

We don't do protocol versioning in netlink. Instead we get the base stuff solid from the beginning, and then if something needs fixing up we handle this using new attributes in a way which is both backward and forward compatible.

Sounds good to me, was a cut-and-paste from dcbnl.h. How about:

This is perfectly fine except it got whitespace damanged by your email client and needs a proper commit message and signoff :-)

#36 lore raw

eSwitch management

In reply to Scott Feldman

Hi All,

I am following the discussions on iovnl patch closely. While it is going to take some time for iovnl patch to be reviewed and accepted, what would be the interim approach to manage the eswitch in NIC? We need to add support in qlcnic driver to configure the eswitch in our 10G NIC. Some of the things that we need to set to the switch are setting a port's VLAN, tx bandwidth etc. We would like to set these parameters for a bunch of ports at the start of the day and set it to the eswitch. Can we expose sysfs nodes to manage the eswitch or should we have a netlink/ioctl support put in the driver? Not sure if we can do it via sysfs in a clean way. Netlink seems to be the ideal candidate for this. What is an acceptable solution? Any suggesstion, advice will be highly appreciated.

thanks much,
Anirban Chakraborty

#37 lore raw

Re: eSwitch management

Quoted 7 lines · Anirban Chakraborty

I am following the discussions on iovnl patch closely. While it is going to take some time for iovnl patch to be reviewed and accepted, what would be the interim approach to manage the eswitch in NIC? We need to add support in qlcnic driver to configure the eswitch in our 10G NIC. Some of the things that we need to set to the switch are setting a port's VLAN, tx bandwidth etc. We would like to set these parameters for a bunch of ports at the start of the day and set it to the eswitch.

Are any of these settings covered in DCB? (net/dcb/dcbnl.c). Maybe you can get a start there? Not sure not knowing your device requirements.

-scott

#38 lore raw

Re: eSwitch management

Quoted 12 lines · Scott Feldman
Quoted 8 lines · Anirban Chakraborty

I am following the discussions on iovnl patch closely. While it is going to take some time for iovnl patch to be reviewed and accepted, what would be the interim approach to manage the eswitch in NIC? We need to add support in qlcnic driver to configure the eswitch in our 10G NIC. Some of the things that
we need to set to the switch are setting a port's VLAN, tx bandwidth etc. We would like to set these parameters for a bunch of ports at the start of the day and set it to the eswitch.

Quoted 2 lines

Are any of these settings covered in DCB? (net/dcb/dcbnl.c). Maybe you can get a start there? Not sure not knowing your device requirements.

Or maybe the RTM_SETLINK IFLA_VF_* ops in include/linux/if_link.h? Those seem like what you're looking for. I'm looking at moving iovnl here as well for port-profile.

-scott

#39 lore raw

Re: eSwitch management

Quoted 14 lines · Scott Feldman
Quoted 12 lines · Scott Feldman
Quoted 8 lines · Anirban Chakraborty

I am following the discussions on iovnl patch closely. While it is going to take some time for iovnl patch to be reviewed and accepted, what would be the interim approach to manage the eswitch in NIC? We need to add support in qlcnic driver to configure the eswitch in our 10G NIC. Some of the things that
we need to set to the switch are setting a port's VLAN, tx bandwidth etc. We would like to set these parameters for a bunch of ports at the start of the day and set it to the eswitch.

Quoted 6 lines
Quoted 2 lines

Are any of these settings covered in DCB? (net/dcb/dcbnl.c). Maybe you can get a start there? Not sure not knowing your device requirements.

Or maybe the RTM_SETLINK IFLA_VF_* ops in include/linux/if_link.h? Those seem like what you're looking for. I'm looking at moving iovnl here as well for port-profile.

It looks like ifla_vf_info does contain most of the data set. But if I use it, what NETLINK protocol family should I use in my driver to receive netlink messages? Do I need to create a private protocol family?

Thanks a lot,
Anirban

#40 lore raw

Re: eSwitch management

Quoted 6 lines · Anirban Chakraborty
Quoted 5 lines · Scott Feldman
Quoted 3 lines · Scott Feldman

Are any of these settings covered in DCB? (net/dcb/dcbnl.c). Maybe you can get a start there? Not sure not knowing your device requirements.

Quoted 7 lines
Quoted 3 lines

Or maybe the RTM_SETLINK IFLA_VF_* ops in include/linux/if_link.h? Those seem like what you're looking for. I'm looking at moving iovnl here as well for port-profile.

It looks like ifla_vf_info does contain most of the data set. But if I use it, what NETLINK protocol family should I use in my driver to receive netlink messages? Do I need to create a private protocol family?

Your driver should implement the ndo_set_vf_*/ndo_get_vf_* callbacks, not implement the netlink protocol itself. If there is anything missing in the existing callbacks that you require for the operation of your driver, you should send patches to extend the implementation in net/core/rtnetlink.c.

Arnd

#41 lore raw

Re: eSwitch management

In reply to Anirban Chakraborty
Quoted 17 lines · * Anirban Chakraborty ([email protected]) wrote:
Quoted 14 lines · Scott Feldman
Quoted 12 lines · Scott Feldman
Quoted 8 lines · Anirban Chakraborty

I am following the discussions on iovnl patch closely. While it is going to take some time for iovnl patch to be reviewed and accepted, what would be the interim approach to manage the eswitch in NIC? We need to add support in qlcnic driver to configure the eswitch in our 10G NIC. Some of the things that
we need to set to the switch are setting a port's VLAN, tx bandwidth etc. We would like to set these parameters for a bunch of ports at the start of the day and set it to the eswitch.

Quoted 8 lines
Quoted 6 lines
Quoted 2 lines

Are any of these settings covered in DCB? (net/dcb/dcbnl.c). Maybe you can get a start there? Not sure not knowing your device requirements.

Or maybe the RTM_SETLINK IFLA_VF_* ops in include/linux/if_link.h? Those seem like what you're looking for. I'm looking at moving iovnl here as well for port-profile.

It looks like ifla_vf_info does contain most of the data set. But if I use it, what NETLINK protocol family should I use in my driver to receive netlink messages? Do I need to create a private protocol family?

No, you don't need to use netlink in your driver. You just need to fill in the relevant net_device_ops in your driver init. Specifically:

* SR-IOV management functions.
* int (*ndo_set_vf_mac)(struct net_device *dev, int vf, u8* mac);
* int (*ndo_set_vf_vlan)(struct net_device *dev, int vf, u16 vlan, u8 qos);
* int (*ndo_set_vf_tx_rate)(struct net_device *dev, int vf, int rate);
* int (*ndo_get_vf_config)(struct net_device *dev,
* int vf, struct ifla_vf_info *ivf);

These are all operating on a VF indexed internally w/in the driver, so it's a little cumbersome to use from userspace.

thanks,
-chris

#42 lore raw

Re: eSwitch management

Quoted 37 lines · Chris Wright
Quoted 17 lines · * Anirban Chakraborty ([email protected]) wrote:
Quoted 14 lines · Scott Feldman
Quoted 12 lines · Scott Feldman
Quoted 8 lines · Anirban Chakraborty

I am following the discussions on iovnl patch closely. While it is going to take some time for iovnl patch to be reviewed and accepted, what would be the interim approach to manage the eswitch in NIC? We need to add support in qlcnic driver to configure the eswitch in our 10G NIC. Some of the things that
we need to set to the switch are setting a port's VLAN, tx bandwidth etc. We would like to set these parameters for a bunch of ports at the start of the day and set it to the eswitch.

Quoted 8 lines
Quoted 6 lines
Quoted 2 lines

Are any of these settings covered in DCB? (net/dcb/dcbnl.c). Maybe you can get a start there? Not sure not knowing your device requirements.

Or maybe the RTM_SETLINK IFLA_VF_* ops in include/linux/if_link.h? Those seem like what you're looking for. I'm looking at moving iovnl here as well for port-profile.

It looks like ifla_vf_info does contain most of the data set. But if I use it, what NETLINK protocol family should I use in my driver to receive netlink messages? Do I need to create a private protocol family?

No, you don't need to use netlink in your driver. You just need to fill in the relevant net_device_ops in your driver init. Specifically:

* SR-IOV management functions.
* int (*ndo_set_vf_mac)(struct net_device *dev, int vf, u8* mac);
* int (*ndo_set_vf_vlan)(struct net_device *dev, int vf, u16 vlan, u8 qos);
* int (*ndo_set_vf_tx_rate)(struct net_device *dev, int vf, int rate);
* int (*ndo_get_vf_config)(struct net_device *dev,
* int vf, struct ifla_vf_info *ivf);

Quoted 2 lines

These are all operating on a VF indexed internally w/in the driver, so it's a little cumbersome to use from userspace.

These are all intended for VFs and are configureable from PF. However, in our case, there are multiple physical NIC function on a port which are configureable by the eswitch. So, what we are setting is essentially switch ports, rather than configuring any setting on the physical functions. If netlink doesn't fly, is sysfs going to work? If we allocate a buffer and fill it up with user space tools that the driver grabs it and does the configuration itself?

thanks,
Anirban

#43 lore raw

Re: eSwitch management

Quoted 14 lines · * Anirban Chakraborty ([email protected]) wrote:
Quoted 13 lines · Chris Wright
Quoted 1 line · * Anirban Chakraborty ([email protected]) wrote:

It looks like ifla_vf_info does contain most of the data set. But if I use it, what NETLINK protocol family should I use in my driver to receive netlink messages? Do I need to create a private protocol family?

No, you don't need to use netlink in your driver. You just need to fill in the relevant net_device_ops in your driver init. Specifically:

* SR-IOV management functions.
* int (*ndo_set_vf_mac)(struct net_device *dev, int vf, u8* mac);
* int (*ndo_set_vf_vlan)(struct net_device *dev, int vf, u16 vlan, u8 qos);
* int (*ndo_set_vf_tx_rate)(struct net_device *dev, int vf, int rate);
* int (*ndo_get_vf_config)(struct net_device *dev,
* int vf, struct ifla_vf_info *ivf);

Quoted 4 lines
Quoted 2 lines

These are all operating on a VF indexed internally w/in the driver, so it's a little cumbersome to use from userspace.

These are all intended for VFs and are configureable from PF.

Yes, and while the set of callbacks can change, they are always tied to some net_device (typically the PF) that knows how to make hardware settings on behalf of a VF.

Quoted 2 lines

However, in our case, there are multiple physical NIC function on a port which are configureable by the eswitch.

Is there a PCI function that represents the switch? Or a special PCI NIC function that has VEB mgmt plane access? And do you have examples of configuration that you'll do here?

Quoted 3 lines

So, what we are setting
is essentially switch ports, rather than configuring any setting on the physical functions. If netlink doesn't fly, is sysfs going to work?

Before we go to implementation specifics (i.e. netlink vs. sysfs, and my guess is sysfs isn't going to be the right fit), let's step back and look at what needs setting.

Quoted 3 lines

If
we allocate a buffer and fill it up with user space tools that the driver grabs it and does the configuration itself?

One idea that has been discussed in the past is to create essentially a pluggable set of bridge_ops. The first step would be purely internal shuffling, to make the existing sw bridge code go through the bridge_ops. The second step would be making your driver for whichever PCI function you have that supports managing the bridge create a net_device which is a bridge during driver init. And now normal brctl can call into your VEB via the bridge_ops callbacks. </handwave>

But this too starts w/ looking at what the management requirements are for your bridge. Can you enumerate those?

thanks,
-chris

#44 lore raw

Re: eSwitch management

Quoted 24 lines · Chris Wright
Quoted 14 lines · * Anirban Chakraborty ([email protected]) wrote:
Quoted 13 lines · Chris Wright
Quoted 1 line · * Anirban Chakraborty ([email protected]) wrote:

It looks like ifla_vf_info does contain most of the data set. But if I use it, what NETLINK protocol family should I use in my driver to receive netlink messages? Do I need to create a private protocol family?

No, you don't need to use netlink in your driver. You just need to fill in the relevant net_device_ops in your driver init. Specifically:

* SR-IOV management functions.
* int (*ndo_set_vf_mac)(struct net_device *dev, int vf, u8* mac);
* int (*ndo_set_vf_vlan)(struct net_device *dev, int vf, u16 vlan, u8 qos);
* int (*ndo_set_vf_tx_rate)(struct net_device *dev, int vf, int rate);
* int (*ndo_get_vf_config)(struct net_device *dev,
* int vf, struct ifla_vf_info *ivf);

Quoted 4 lines
Quoted 2 lines

These are all operating on a VF indexed internally w/in the driver, so it's a little cumbersome to use from userspace.

These are all intended for VFs and are configureable from PF.

Yes, and while the set of callbacks can change, they are always tied to some net_device (typically the PF) that knows how to make hardware settings on behalf of a VF.

Quoted 6 lines
Quoted 2 lines

However, in our case, there are multiple physical NIC function on a port which are configureable by the eswitch.

Is there a PCI function that represents the switch? Or a special PCI NIC function that has VEB mgmt plane access? And do you have examples of configuration that you'll do here?

There is no PCI function that represents the switch. However, one of the NIC functions can act as a privileged function to configure the eswitch. Typically the first NIC function that is enumerated in the bus manages the eswitch. Typical configurations would be to set tx bandwidth, VLAN ID, MAC address, promiscuous mode setting for each of these ports at the start of the day. This is useful in virtualization scenario where we can do PCI passthru of the functions to the guest and these settings for the guest are configured via the driver in the host.

<snip>

Quoted 9 lines

One idea that has been discussed in the past is to create essentially a pluggable set of bridge_ops. The first step would be purely internal shuffling, to make the existing sw bridge code go through the bridge_ops. The second step would be making your driver for whichever PCI function you have that supports managing the bridge create a net_device which is a bridge during driver init. And now normal brctl can call into your VEB via the bridge_ops callbacks. </handwave>

I liked the idea of iovnl as it works by utilizing port profile. That way the eswitch can be configured with the same port profile that a vswitch in a hypervisor has.

thanks,
Anirban

#45 lore raw

Re: eSwitch management

Quoted 34 lines · * Anirban Chakraborty ([email protected]) wrote:
Quoted 24 lines · Chris Wright
Quoted 14 lines · * Anirban Chakraborty ([email protected]) wrote:
Quoted 13 lines · Chris Wright
Quoted 1 line · * Anirban Chakraborty ([email protected]) wrote:

It looks like ifla_vf_info does contain most of the data set. But if I use it, what NETLINK protocol family should I use in my driver to receive netlink messages? Do I need to create a private protocol family?

No, you don't need to use netlink in your driver. You just need to fill in the relevant net_device_ops in your driver init. Specifically:

* SR-IOV management functions.
* int (*ndo_set_vf_mac)(struct net_device *dev, int vf, u8* mac);
* int (*ndo_set_vf_vlan)(struct net_device *dev, int vf, u16 vlan, u8 qos);
* int (*ndo_set_vf_tx_rate)(struct net_device *dev, int vf, int rate);
* int (*ndo_get_vf_config)(struct net_device *dev,
* int vf, struct ifla_vf_info *ivf);

Quoted 4 lines
Quoted 2 lines

These are all operating on a VF indexed internally w/in the driver, so it's a little cumbersome to use from userspace.

These are all intended for VFs and are configureable from PF.

Yes, and while the set of callbacks can change, they are always tied to some net_device (typically the PF) that knows how to make hardware settings on behalf of a VF.

Quoted 6 lines
Quoted 2 lines

However, in our case, there are multiple physical NIC function on a port which are configureable by the eswitch.

Is there a PCI function that represents the switch? Or a special PCI NIC function that has VEB mgmt plane access? And do you have examples of configuration that you'll do here?

Quoted 8 lines

There is no PCI function that represents the switch. However, one of the NIC functions can act as a privileged function to configure the eswitch. Typically the first NIC function that is enumerated in the bus manages the eswitch. Typical configurations would be to set tx bandwidth, VLAN ID, MAC address, promiscuous mode setting for each of these ports at the start of the day. This is useful in virtualization scenario where we can do PCI passthru of the functions to the guest and these settings for the guest are configured via the driver in the host.

(btw, this is not uncommon, there other adapters that have multiple functions for a single physical port that is not SR-IOV based)

How does the privileged function identify the other functions? IOW, the existing SR-IOV ndo callbacks have most of the above (tx bw control, mac, vlan id), and have an 'int vf' which is basically just a driver specific identifier to a non-privileged function or set of hw resources. It looks like you can use the existing bits (just need to expand a little).

So far we have only:

- tx bw control
- set mac addr
- set vlan id

You've additionally identified:

- set promiscuous mode

I'm also aware of:

- setting port aggregation
- issuing a function reset
- setting port mirroring or bcast/mcast replication
- setting anti-spoofing (mac/vlan..)
- setting security/filtering
- getting port statistics
- ...whatever else I'm forgetting

Quoted 11 lines

<snip>

Quoted 9 lines

One idea that has been discussed in the past is to create essentially a pluggable set of bridge_ops. The first step would be purely internal shuffling, to make the existing sw bridge code go through the bridge_ops. The second step would be making your driver for whichever PCI function you have that supports managing the bridge create a net_device which is a bridge during driver init. And now normal brctl can call into your VEB via the bridge_ops callbacks. </handwave>

I liked the idea of iovnl as it works by utilizing port profile. That way the eswitch can be configured with the same port profile that a vswitch in a hypervisor has.

I don't quite follow you here.

thanks,
-chris

#46 lore raw

Re: eSwitch management

Quoted 65 lines · Chris Wright
Quoted 34 lines · * Anirban Chakraborty ([email protected]) wrote:
Quoted 24 lines · Chris Wright
Quoted 14 lines · * Anirban Chakraborty ([email protected]) wrote:
Quoted 13 lines · Chris Wright
Quoted 1 line · * Anirban Chakraborty ([email protected]) wrote:

It looks like ifla_vf_info does contain most of the data set. But if I use it, what NETLINK protocol family should I use in my driver to receive netlink messages? Do I need to create a private protocol family?

No, you don't need to use netlink in your driver. You just need to fill in the relevant net_device_ops in your driver init. Specifically:

* SR-IOV management functions.
* int (*ndo_set_vf_mac)(struct net_device *dev, int vf, u8* mac);
* int (*ndo_set_vf_vlan)(struct net_device *dev, int vf, u16 vlan, u8 qos);
* int (*ndo_set_vf_tx_rate)(struct net_device *dev, int vf, int rate);
* int (*ndo_get_vf_config)(struct net_device *dev,
* int vf, struct ifla_vf_info *ivf);

Quoted 4 lines
Quoted 2 lines

These are all operating on a VF indexed internally w/in the driver, so it's a little cumbersome to use from userspace.

These are all intended for VFs and are configureable from PF.

Yes, and while the set of callbacks can change, they are always tied to some net_device (typically the PF) that knows how to make hardware settings on behalf of a VF.

Quoted 6 lines
Quoted 2 lines

However, in our case, there are multiple physical NIC function on a port which are configureable by the eswitch.

Is there a PCI function that represents the switch? Or a special PCI NIC function that has VEB mgmt plane access? And do you have examples of configuration that you'll do here?

Quoted 8 lines

There is no PCI function that represents the switch. However, one of the NIC functions can act as a privileged function to configure the eswitch. Typically the first NIC function that is enumerated in the bus manages the eswitch. Typical configurations would be to set tx bandwidth, VLAN ID, MAC address, promiscuous mode setting for each of these ports at the start of the day. This is useful in virtualization scenario where we can do PCI passthru of the functions to the guest and these settings for the guest are configured via the driver in the host.

(btw, this is not uncommon, there other adapters that have multiple functions for a single physical port that is not SR-IOV based)

How does the privileged function identify the other functions? IOW, the existing SR-IOV ndo callbacks have most of the above (tx bw control, mac, vlan id), and have an 'int vf' which is basically just a driver specific identifier to a non-privileged function or set of hw resources. It looks like you can use the existing bits (just need to expand a little).

So far we have only:

- tx bw control
- set mac addr
- set vlan id

You've additionally identified:

- set promiscuous mode

I'm also aware of:

Quoted 7 lines

- setting port aggregation
- issuing a function reset
- setting port mirroring or bcast/mcast replication
- setting anti-spoofing (mac/vlan..)
- setting security/filtering
- getting port statistics
- ...whatever else I'm forgetting

Scott's latest patch already addressed some of these. May be we should add the missing pieces, e.g. setting promiscuous mode, port mirroring etc. from the above list to ndo_ops. Function reset should be handled via FLR.

Quoted 11 lines
Quoted 11 lines

<snip>

Quoted 9 lines

One idea that has been discussed in the past is to create essentially a pluggable set of bridge_ops. The first step would be purely internal shuffling, to make the existing sw bridge code go through the bridge_ops. The second step would be making your driver for whichever PCI function you have that supports managing the bridge create a net_device which is a bridge during driver init. And now normal brctl can call into your VEB via the bridge_ops callbacks. </handwave>

Quoted 3 lines
Quoted 1 line

I liked the idea of iovnl as it works by utilizing port profile. That way the eswitch can be configured with the same port profile that a vswitch in a hypervisor has.

I don't quite follow you here.

If I am not mistaken, port profile is supposed to keep configuration data of a NIC port and a software vswitch typically residing at the host uses it. When there are multiple physical NICs (on the same physical port) in the hypervisor, there are multiple vswitches created for each of the pNICs. The inter vm traffic in this case goes via the eswitch and thats where the eswitch configuration for these ports comes into picture.

thanks,
Anirban