aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorScott Feldman <scofeldm@cisco.com>2010-05-18 01:49:55 -0400
committerDavid S. Miller <davem@davemloft.net>2010-05-18 01:49:55 -0400
commit57b610805ce92dbd79fc97509f80fa5391b99623 (patch)
tree0d022d63c81d73b51e6001758d4353d0518a01e1 /include
parentee289b6440c3b0ccb9459495783e8c299bec6604 (diff)
net: Add netlink support for virtual port management (was iovnl)
Add new netdev ops ndo_{set|get}_vf_port to allow setting of port-profile on a netdev interface. Extends netlink socket RTM_SETLINK/ RTM_GETLINK with two new sub msgs called IFLA_VF_PORTS and IFLA_PORT_SELF (added to end of IFLA_cmd list). These are both nested atrtibutes using this layout: [IFLA_NUM_VF] [IFLA_VF_PORTS] [IFLA_VF_PORT] [IFLA_PORT_*], ... [IFLA_VF_PORT] [IFLA_PORT_*], ... ... [IFLA_PORT_SELF] [IFLA_PORT_*], ... These attributes are design to be set and get symmetrically. VF_PORTS is a list of VF_PORTs, one for each VF, when dealing with an SR-IOV device. PORT_SELF is for the PF of the SR-IOV device, in case it wants to also have a port-profile, or for the case where the VF==PF, like in enic patch 2/2 of this patch set. A port-profile is used to configure/enable the external switch virtual port backing the netdev interface, not to configure the host-facing side of the netdev. A port-profile is an identifier known to the switch. How port- profiles are installed on the switch or how available port-profiles are made know to the host is outside the scope of this patch. There are two types of port-profiles specs in the netlink msg. The first spec is for 802.1Qbg (pre-)standard, VDP protocol. The second spec is for devices that run a similar protocol as VDP but in firmware, thus hiding the protocol details. In either case, the specs have much in common and makes sense to define the netlink msg as the union of the two specs. For example, both specs have a notition of associating/deassociating a port-profile. And both specs require some information from the hypervisor manager, such as client port instance ID. The general flow is the port-profile is applied to a host netdev interface using RTM_SETLINK, the receiver of the RTM_SETLINK msg communicates with the switch, and the switch virtual port backing the host netdev interface is configured/enabled based on the settings defined by the port-profile. What those settings comprise, and how those settings are managed is again outside the scope of this patch, since this patch only deals with the first step in the flow. Signed-off-by: Scott Feldman <scofeldm@cisco.com> Signed-off-by: Roopa Prabhu <roprabhu@cisco.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include')
-rw-r--r--include/linux/if_link.h75
-rw-r--r--include/linux/netdevice.h8
2 files changed, 83 insertions, 0 deletions
diff --git a/include/linux/if_link.h b/include/linux/if_link.h
index c3af67fce3f2..85c812db5a3f 100644
--- a/include/linux/if_link.h
+++ b/include/linux/if_link.h
@@ -113,6 +113,8 @@ enum {
113 IFLA_NUM_VF, /* Number of VFs if device is SR-IOV PF */ 113 IFLA_NUM_VF, /* Number of VFs if device is SR-IOV PF */
114 IFLA_VFINFO_LIST, 114 IFLA_VFINFO_LIST,
115 IFLA_STATS64, 115 IFLA_STATS64,
116 IFLA_VF_PORTS,
117 IFLA_PORT_SELF,
116 __IFLA_MAX 118 __IFLA_MAX
117}; 119};
118 120
@@ -274,4 +276,77 @@ struct ifla_vf_info {
274 __u32 qos; 276 __u32 qos;
275 __u32 tx_rate; 277 __u32 tx_rate;
276}; 278};
279
280/* VF ports management section
281 *
282 * Nested layout of set/get msg is:
283 *
284 * [IFLA_NUM_VF]
285 * [IFLA_VF_PORTS]
286 * [IFLA_VF_PORT]
287 * [IFLA_PORT_*], ...
288 * [IFLA_VF_PORT]
289 * [IFLA_PORT_*], ...
290 * ...
291 * [IFLA_PORT_SELF]
292 * [IFLA_PORT_*], ...
293 */
294
295enum {
296 IFLA_VF_PORT_UNSPEC,
297 IFLA_VF_PORT, /* nest */
298 __IFLA_VF_PORT_MAX,
299};
300
301#define IFLA_VF_PORT_MAX (__IFLA_VF_PORT_MAX - 1)
302
303enum {
304 IFLA_PORT_UNSPEC,
305 IFLA_PORT_VF, /* __u32 */
306 IFLA_PORT_PROFILE, /* string */
307 IFLA_PORT_VSI_TYPE, /* 802.1Qbg (pre-)standard VDP */
308 IFLA_PORT_INSTANCE_UUID, /* binary UUID */
309 IFLA_PORT_HOST_UUID, /* binary UUID */
310 IFLA_PORT_REQUEST, /* __u8 */
311 IFLA_PORT_RESPONSE, /* __u16, output only */
312 __IFLA_PORT_MAX,
313};
314
315#define IFLA_PORT_MAX (__IFLA_PORT_MAX - 1)
316
317#define PORT_PROFILE_MAX 40
318#define PORT_UUID_MAX 16
319#define PORT_SELF_VF -1
320
321enum {
322 PORT_REQUEST_PREASSOCIATE = 0,
323 PORT_REQUEST_PREASSOCIATE_RR,
324 PORT_REQUEST_ASSOCIATE,
325 PORT_REQUEST_DISASSOCIATE,
326};
327
328enum {
329 PORT_VDP_RESPONSE_SUCCESS = 0,
330 PORT_VDP_RESPONSE_INVALID_FORMAT,
331 PORT_VDP_RESPONSE_INSUFFICIENT_RESOURCES,
332 PORT_VDP_RESPONSE_UNUSED_VTID,
333 PORT_VDP_RESPONSE_VTID_VIOLATION,
334 PORT_VDP_RESPONSE_VTID_VERSION_VIOALTION,
335 PORT_VDP_RESPONSE_OUT_OF_SYNC,
336 /* 0x08-0xFF reserved for future VDP use */
337 PORT_PROFILE_RESPONSE_SUCCESS = 0x100,
338 PORT_PROFILE_RESPONSE_INPROGRESS,
339 PORT_PROFILE_RESPONSE_INVALID,
340 PORT_PROFILE_RESPONSE_BADSTATE,
341 PORT_PROFILE_RESPONSE_INSUFFICIENT_RESOURCES,
342 PORT_PROFILE_RESPONSE_ERROR,
343};
344
345struct ifla_port_vsi {
346 __u8 vsi_mgr_id;
347 __u8 vsi_type_id[3];
348 __u8 vsi_type_version;
349 __u8 pad[3];
350};
351
277#endif /* _LINUX_IF_LINK_H */ 352#endif /* _LINUX_IF_LINK_H */
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index c1b2341897c2..c3487a6bdf99 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -686,6 +686,9 @@ struct netdev_rx_queue {
686 * int (*ndo_set_vf_tx_rate)(struct net_device *dev, int vf, int rate); 686 * int (*ndo_set_vf_tx_rate)(struct net_device *dev, int vf, int rate);
687 * int (*ndo_get_vf_config)(struct net_device *dev, 687 * int (*ndo_get_vf_config)(struct net_device *dev,
688 * int vf, struct ifla_vf_info *ivf); 688 * int vf, struct ifla_vf_info *ivf);
689 * int (*ndo_set_vf_port)(struct net_device *dev, int vf,
690 * struct nlattr *port[]);
691 * int (*ndo_get_vf_port)(struct net_device *dev, int vf, struct sk_buff *skb);
689 */ 692 */
690#define HAVE_NET_DEVICE_OPS 693#define HAVE_NET_DEVICE_OPS
691struct net_device_ops { 694struct net_device_ops {
@@ -735,6 +738,11 @@ struct net_device_ops {
735 int (*ndo_get_vf_config)(struct net_device *dev, 738 int (*ndo_get_vf_config)(struct net_device *dev,
736 int vf, 739 int vf,
737 struct ifla_vf_info *ivf); 740 struct ifla_vf_info *ivf);
741 int (*ndo_set_vf_port)(struct net_device *dev,
742 int vf,
743 struct nlattr *port[]);
744 int (*ndo_get_vf_port)(struct net_device *dev,
745 int vf, struct sk_buff *skb);
738#if defined(CONFIG_FCOE) || defined(CONFIG_FCOE_MODULE) 746#if defined(CONFIG_FCOE) || defined(CONFIG_FCOE_MODULE)
739 int (*ndo_fcoe_enable)(struct net_device *dev); 747 int (*ndo_fcoe_enable)(struct net_device *dev);
740 int (*ndo_fcoe_disable)(struct net_device *dev); 748 int (*ndo_fcoe_disable)(struct net_device *dev);