if_link : add support for VF privileges
Subsystems (2)
RFC 1/2 if_link : add support for VF privileges
--- include/linux/if_link.h | 21 +++++++++++++++++++++ include/linux/netdevice.h | 3 +++ net/core/rtnetlink.c | 17 ++++++++++++++++- 3 files changed, 40 insertions(+), 1 deletions(-)
include/linux/if_link.h +21 -0
@@ -280,11 +280,26 @@ enum { IFLA_VF_VLAN,IFLA_VF_TX_RATE ,/* TX Bandwidth Allocation */ IFLA_VF_SPOOFCHK ,/* Spoof Checking on/off switch */ +IFLA_VF_PRIVILEGE ,/* VF Privilege level setting */ __IFLA_VF_MAX, };#define IFLA_VF_MAX (__IFLA_VF_MAX - 1) +enum { +IFLA_VF_PRIVILEGE_DEFAULT =1 ,/* Default privileges */ +IFLA_VF_PRIVILEGE_STATS =2 ,/* Privilege to gather statistics */ +IFLA_VF_PRIVILEGE_LNK_MGMT =4 ,/* Privilege to manage link params */ +IFLA_VF_PRIVILEGE_DIAG =8 ,/* Privilege to perform diagnostics */ +IFLA_VF_PRIVILEGE_MAC =16 ,/* Privilege to modify MAC address */ +IFLA_VF_PRIVILEGE_VLAN =32 ,/* Privilege to add or remove VLANs */ +IFLA_VF_PRIVILEGE_DEV_CFG =64 ,/* Unrestricted admin access privlege */ +IFLA_VF_PRIVILEGE_SECURE =128 ,/* Privilege to access secure content */ + __IFLA_VF_PRIVILEGE_MAX, +}; + +#define IFLA_VF_PRIVILEGE_MAX (__IFLA_VF_PRIVILEGE_MAX - 1) +struct ifla_vf_mac {__u32 vf;__u8 mac[32 ];/* MAX_ADDR_LEN */
@@ -305,6 +320,11 @@ struct ifla_vf_spoofchk {__u32 vf;__u32 setting; }; + +struct ifla_vf_privilege { +__u32 vf; +__u32 privilege; +};#ifdef __KERNEL__/* We don't want this structure exposed to user space */
@@ -315,6 +335,7 @@ struct ifla_vf_info {__u32 qos;__u32 tx_rate;__u32 spoofchk; + __u32 privilege; };#endif
include/linux/netdevice.h +3 -0
@@ -823,6 +823,7 @@ struct netdev_fcoe_hbainfo {* 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_set_vf_spoofchk)(struct net_device *dev, int vf, bool setting); +* int (*ndo_set_vf_privilege)(struct net_device *dev, int vf, u32 privilege); * int (*ndo_get_vf_config)(struct net_device *dev, * int vf, struct ifla_vf_info *ivf); * int (*ndo_set_vf_port)(struct net_device *dev, int vf,
@@ -952,6 +953,8 @@ struct net_device_ops { int vf, int rate);int (*ndo_set_vf_spoofchk)(struct net_device *dev,int vf,bool setting); +int (*ndo_set_vf_privilege)(struct net_device *dev, +int vf,u32 privilege);int (*ndo_get_vf_config)(struct net_device *dev,int vf,struct ifla_vf_info *ivf);
net/core/rtnetlink.c +16 -1
@@ -959,6 +959,7 @@ static int rtnl_fill_ifinfo(struct sk_buff *skb, struct net_device *dev,struct ifla_vf_vlan vf_vlan;struct ifla_vf_tx_rate vf_tx_rate;struct ifla_vf_spoofchk vf_spoofchk; +struct ifla_vf_privilege vf_privilege;/* * Not all SR-IOV capable drivers support the
@@ -967,18 +968,21 @@ static int rtnl_fill_ifinfo(struct sk_buff *skb, struct net_device *dev,* report anything. */ ivi.spoofchk =-1 ; + ivi.privilege =-1 ;if (dev->netdev_ops->ndo_get_vf_config (dev, i, &ivi))break ; vf_mac.vf = vf_vlan.vf = vf_tx_rate.vf = - vf_spoofchk.vf = ivi.vf; + vf_spoofchk.vf = + vf_privilege.vf = ivi.vf;memcpy (vf_mac.mac, ivi.mac,sizeof (ivi.mac)); vf_vlan.vlan = ivi.vlan; vf_vlan.qos = ivi.qos; vf_tx_rate.rate = ivi.tx_rate; vf_spoofchk.setting = ivi.spoofchk; + vf_privilege.privilege = ivi.privilege; vf =nla_nest_start (skb,IFLA_VF_INFO );if (!vf) {nla_nest_cancel (skb, vfinfo);
@@ -990,6 +994,8 @@ static int rtnl_fill_ifinfo(struct sk_buff *skb, struct net_device *dev, &vf_tx_rate);NLA_PUT (skb,IFLA_VF_SPOOFCHK ,sizeof (vf_spoofchk), &vf_spoofchk); +NLA_PUT (skb,IFLA_VF_PRIVILEGE ,sizeof (vf_privilege), + &vf_privilege);nla_nest_end (skb, vf); }nla_nest_end (skb, vfinfo);
@@ -1232,6 +1238,15 @@ static int do_setvfinfo(struct net_device *dev, struct nlattr *attr) ivs->setting);break ; } +case IFLA_VF_PRIVILEGE : { +struct ifla_vf_privilege *ivp; + ivp =nla_data (vf); + err = -EOPNOTSUPP ; +if (ops->ndo_set_vf_privilege) + err = ops->ndo_set_vf_privilege (dev, ivp->vf, + ivp->privilege); +break ; + }default : err = -EINVAL ;break ;
Signature · 1 line
1.7.1
Quoted 13 lines · Ajit Khaparde
Signed-off-by Ajit Khaparde <[email protected]>--- include/linux/if_link.h | 21 +++++++++++++++++++++ include/linux/netdevice.h | 3 +++ net/core/rtnetlink.c | 17 ++++++++++++++++- 3 files changed, 40 insertions(+), 1 deletions(-)include/linux/if_link.h +0
-0@@ -280,11 +280,26 @@ enum { IFLA_VF_VLAN,
include/linux/if_link.h enum { · line 290
Quoted 10 lines
include/linux/if_link.h +3
-0IFLA_VF_TX_RATE ,/* TX Bandwidth Allocation */ IFLA_VF_SPOOFCHK ,/* Spoof Checking on/off switch */ +IFLA_VF_PRIVILEGE ,/* VF Privilege level setting */ __IFLA_VF_MAX, };#define IFLA_VF_MAX (__IFLA_VF_MAX - 1) +enum { + IFLA_VF_PRIVILEGE_DEFAULT = 1, /* Default privileges */
What are the default privileges? Should existing drivers report that their VFs have this?
include/linux/if_link.h enum { · line 291
Quoted 1 line
include/linux/if_link.h +1
-0+ IFLA_VF_PRIVILEGE_STATS = 2, /* Privilege to gather statistics */
I assume that means port or board statistics as opposed to statistics for the VF?
include/linux/if_link.h enum { · line 295
Quoted 4 lines
include/linux/if_link.h +4
-0+IFLA_VF_PRIVILEGE_LNK_MGMT =4 ,/* Privilege to manage link params */ +IFLA_VF_PRIVILEGE_DIAG =8 ,/* Privilege to perform diagnostics */ +IFLA_VF_PRIVILEGE_MAC =16 ,/* Privilege to modify MAC address */ + IFLA_VF_PRIVILEGE_VLAN = 32, /* Privilege to add or remove VLANs */
I assume these two apply to RX filtering of the VF itself. How about control over TX filtering?
include/linux/if_link.h enum { · line 296
Quoted 1 line
include/linux/if_link.h +1
-0+ IFLA_VF_PRIVILEGE_DEV_CFG = 64, /* Unrestricted admin access privlege */
Does that include all the other privileges, or does it mean 'everything else'?
include/linux/if_link.h enum { · line 297
Quoted 1 line
include/linux/if_link.h +1
-0+ IFLA_VF_PRIVILEGE_SECURE = 128, /* Privilege to access secure content */
What does that mean?
include/linux/if_link.h enum { · line 301
Quoted 4 lines
include/linux/if_link.h +4
-0+ __IFLA_VF_PRIVILEGE_MAX, +}; + +#define IFLA_VF_PRIVILEGE_MAX (__IFLA_VF_PRIVILEGE_MAX - 1)
[...]
This doesn't seem to make sense for an enumeration of flags.
Ben.
Signature · 3 lines
Ben Hutchings, Staff Engineer, Solarflare Not speaking for my employer; that's the marketing department's job. They asked us to note that Solarflare product names are trademarked.
Quoted 28 lines
-----Original Message-----
From: Ben Hutchings [mailto:[email protected]]
Sent: Tuesday, February 14, 2012 5:25 PM
To: Khaparde, Ajit
Cc: [email protected]; [email protected]; [email protected]
Subject: Re: [RFC net-next 1/2]if_link: add support for VF privilegesQuoted 19 lines · Ajit Khaparde
Signed-off-by Ajit Khaparde <[email protected]>--- include/linux/if_link.h | 21 +++++++++++++++++++++ include/linux/netdevice.h | 3 +++ net/core/rtnetlink.c | 17 ++++++++++++++++- 3 files changed, 40 insertions(+), 1 deletions(-)include/linux/if_link.h +1
-0@@ -280,11 +280,26 @@ enum {IFLA_VF_VLAN ,IFLA_VF_TX_RATE ,/* TX Bandwidth Allocation */ IFLA_VF_SPOOFCHK ,/* Spoof Checking on/off switch */ +IFLA_VF_PRIVILEGE ,/* VF Privilege level setting */ __IFLA_VF_MAX, };
Quoted 7 lines
include/linux/if_link.h enum { · line 290
Quoted 4 lines
include/linux/if_link.h +2
-0#define IFLA_VF_MAX (__IFLA_VF_MAX - 1) +enum { +IFLA_VF_PRIVILEGE_DEFAULT =1 ,/* Default privileges */ What are the default privileges? Should existing drivers report that their VFs have this?
Yes. Vendors can decide what privileges they want to grant for VFs by default.
Quoted 5 lines
include/linux/if_link.h enum { · line 291
Quoted 2 lines
include/linux/if_link.h +1
-0+ IFLA_VF_PRIVILEGE_STATS = 2, /* Privilege to gather statistics */I assume that means port or board statistics as opposed to statistics for the VF?
Yes, Port statistics.
Quoted 5 lines
include/linux/if_link.h enum { · line 292
Quoted 2 lines
include/linux/if_link.h +1
-0+ IFLA_VF_PRIVILEGE_LNK_MGMT = 4, /* Privilege to manage linkparams */
include/linux/if_link.h enum { · line 293
Quoted 1 line
include/linux/if_link.h +1
-0+ IFLA_VF_PRIVILEGE_DIAG = 8, /* Privilege to performdiagnostics */
Quoted 7 lines
include/linux/if_link.h enum { · line 294
Quoted 1 line
include/linux/if_link.h +1
-0+ IFLA_VF_PRIVILEGE_MAC = 16, /* Privilege to modify MACaddress */
include/linux/if_link.h enum { · line 295
Quoted 1 line
include/linux/if_link.h +1
-0+ IFLA_VF_PRIVILEGE_VLAN = 32, /* Privilege to add or removeVLANs */
I assume these two apply to RX filtering of the VF itself. How about control over TX filtering?
Yes. This is for Rx filtering. Tx filtering privileges can be added if needed.
Quoted 6 lines
include/linux/if_link.h enum { · line 296
Quoted 2 lines
include/linux/if_link.h +1
-0+ IFLA_VF_PRIVILEGE_DEV_CFG = 64, /* Unrestricted admin accessprivlege */
Does that include all the other privileges, or does it mean 'everything else'?
All other privileges with the exception of "secure content" (defined below).
Quoted 5 lines
include/linux/if_link.h enum { · line 297
Quoted 2 lines
include/linux/if_link.h +1
-0+ IFLA_VF_PRIVILEGE_SECURE = 128, /* Privilege to access securecontent */
What does that mean?
Privilege to access secure information on the ASIC like debug registers, dump information.
Quoted 8 lines
include/linux/if_link.h enum { · line 301
Quoted 5 lines
include/linux/if_link.h +4
-0+ __IFLA_VF_PRIVILEGE_MAX, +}; + +#define IFLA_VF_PRIVILEGE_MAX (__IFLA_VF_PRIVILEGE_MAX - 1)[...]
This doesn't seem to make sense for an enumeration of flags.
Yes. Will take care.
Thanks
Quoted 7 lines
Ben.
--
Ben Hutchings, Staff Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job. They asked us to note that Solarflare product names are trademarked.
David Miller
maintainerFrom: <[email protected]>
Date: Tue, 21 Feb 2012 14:02:27 -0800
Quoted 8 lines
Quoted 8 lines
-----Original Message-----
From: Ben Hutchings [mailto:[email protected]]
Sent: Tuesday, February 14, 2012 5:25 PM
To: Khaparde, Ajit
Cc: [email protected]; [email protected]; [email protected]
Subject: Re: [RFC net-next 1/2]if_link: add support for VF privileges
Quoted 7 lines
Quoted 6 lines · Ajit Khaparde
include/linux/if_link.h enum { · line 290
Quoted 2 lines
include/linux/if_link.h +2
-0+enum { +IFLA_VF_PRIVILEGE_DEFAULT =1 ,/* Default privileges */ What are the default privileges? Should existing drivers report that their VFs have this?
Yes. Vendors can decide what privileges they want to grant for VFs by default.
That's terrible and a very bad interface for users. It means every system can have different defaults, from which we'll derive zero consistency.
Quoted 17 lines · David Miller
From: <[email protected]>
Date: Tue, 21 Feb 2012 14:02:27 -0800Quoted 14 lines
Quoted 14 lines
-----Original Message-----
From: Ben Hutchings [mailto:[email protected]]
Sent: Tuesday, February 14, 2012 5:25 PM
To: Khaparde, Ajit
Cc: [email protected]; [email protected]; [email protected]
Subject: Re: [RFC net-next 1/2]if_link: add support for VF privilegesinclude/linux/if_link.h enum { · line 290
Quoted 2 lines · Ajit Khaparde
include/linux/if_link.h +2
-0+enum { +IFLA_VF_PRIVILEGE_DEFAULT =1 ,/* Default privileges */ What are the default privileges? Should existing drivers report that their VFs have this?
Quoted 4 lines
Quoted 1 line
Yes. Vendors can decide what privileges they want to grant for VFs by default.
That's terrible and a very bad interface for users. It means every system can have different defaults, from which we'll derive zero consistency.
Aside from this, my concern is that if we assign privilege flags to capabilities that VFs normally have now then the value reported where the driver doesn't support this new operation should not be 0.
(Also, if a privilege is assigned by default, is it really a privilege? Wouldn't 'capability' or 'permission' be a better term?)
Ben.
Signature · 3 lines
Ben Hutchings, Staff Engineer, Solarflare Not speaking for my employer; that's the marketing department's job. They asked us to note that Solarflare product names are trademarked.
Quoted 25 lines
-----Original Message-----
From: David Miller [mailto:[email protected]]
Sent: Tuesday, February 21, 2012 4:05 PM
To: Khaparde, Ajit
Cc: [email protected]; [email protected]; [email protected]
Subject: Re: [RFC net-next 1/2]if_link: add support for VF privilegesFrom: <[email protected]>
Date: Tue, 21 Feb 2012 14:02:27 -0800Quoted 14 lines
Quoted 14 lines
-----Original Message-----
From: Ben Hutchings [mailto:[email protected]]
Sent: Tuesday, February 14, 2012 5:25 PM
To: Khaparde, Ajit
Cc: [email protected]; [email protected]; [email protected]
Subject: Re: [RFC net-next 1/2]if_link: add support for VF privilegesinclude/linux/if_link.h enum { · line 290
Quoted 2 lines · Ajit Khaparde
include/linux/if_link.h +2
-0+enum { +IFLA_VF_PRIVILEGE_DEFAULT =1 ,/* Default privileges */ What are the default privileges? Should existing drivers report that their VFs have this?
Quoted 4 lines
Quoted 1 line
Yes. Vendors can decide what privileges they want to grant for VFs by default.
That's terrible and a very bad interface for users. It means every system can have different defaults, from which we'll derive zero consistency.
Since different hardware devices can have different capabilities this possibility exists. Do you suggest indicating the individual capabilities in the bit mask rather than just a single bit? That way every VF driver will get to indicate its capabilities.
Quoted 27 lines
-----Original Message-----
From: Ben Hutchings [mailto:[email protected]]
Sent: Tuesday, February 21, 2012 4:43 PM
To: David Miller
Cc: Khaparde, Ajit; [email protected]; [email protected]
Subject: Re: [RFC net-next 1/2]if_link: add support for VF privilegesQuoted 17 lines · David Miller
From: <[email protected]>
Date: Tue, 21 Feb 2012 14:02:27 -0800Quoted 14 lines
Quoted 14 lines
-----Original Message-----
From: Ben Hutchings [mailto:[email protected]]
Sent: Tuesday, February 14, 2012 5:25 PM
To: Khaparde, Ajit
Cc: [email protected]; [email protected]; [email protected]
Subject: Re: [RFC net-next 1/2]if_link: add support for VF privilegesinclude/linux/if_link.h enum { · line 290
Quoted 2 lines · Ajit Khaparde
include/linux/if_link.h +2
-0+enum { +IFLA_VF_PRIVILEGE_DEFAULT =1 ,/* Default privileges */ What are the default privileges? Should existing drivers report that their VFs have this?
Quoted 8 lines
Quoted 4 lines
Quoted 1 line
Yes. Vendors can decide what privileges they want to grant for VFs by default.
That's terrible and a very bad interface for users. It means every system can have different defaults, from which we'll derive zero consistency.
Aside from this, my concern is that if we assign privilege flags to capabilities that VFs normally have now then the value reported where the driver doesn't support this new operation should not be 0.
Agree.
Quoted 3 lines
(Also, if a privilege is assigned by default, is it really a privilege? Wouldn't 'capability' or 'permission' be a better term?)
Sure. Anything is fine.
Quoted 7 lines
Ben.
--
Ben Hutchings, Staff Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job. They asked us to note that Solarflare product names are trademarked.