@@ -116,6 +116,7 @@ enum {
IFLA_VF_TX_RATE, /* TX Bandwidth Allocation */
IFLA_VFINFO,
IFLA_STATS64,
+ IFLA_VF_PORT_PROFILE,
__IFLA_MAX
};
@@ -259,4 +260,28 @@ struct ifla_vf_info {
__u32 qos;
__u32 tx_rate;
};
+
+enum {
+ IFLA_VF_PORT_PROFILE_STATUS_UNKNOWN,
+ IFLA_VF_PORT_PROFILE_STATUS_SUCCESS,
+ IFLA_VF_PORT_PROFILE_STATUS_INPROGRESS,
+ IFLA_VF_PORT_PROFILE_STATUS_ERROR,
+};
+
+#define IFLA_VF_PORT_PROFILE_MAX 40
+#define IFLA_VF_UUID_MAX 40
+#define IFLA_VF_CLIENT_NAME_MAX 40
+
+struct ifla_vf_port_profile {
+ __u32 vf;
+ __u32 flags;
+ __u32 status;
+ __u8 port_profile[IFLA_VF_PORT_PROFILE_MAX];
+ __u8 mac[32]; /* MAX_ADDR_LEN */
+ /* UUID e.g. "CEEFD3B1-9E11-11DE-BDFD-000BAB01C0FB" */
+ __u8 host_uuid[IFLA_VF_UUID_MAX];
+ __u8 client_uuid[IFLA_VF_UUID_MAX];
+ __u8 client_name[IFLA_VF_CLIENT_NAME_MAX]; /* e.g. "vm0-eth1" */
+};
+
#endif /* _LINUX_IF_LINK_H */
@@ -696,6 +696,10 @@ struct netdev_rx_queue {
* 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);
+ * int (*ndo_set_vf_port_profile)(struct net_device *dev, int vf,
+ * struct ifla_vf_port_profile *ivp);
+ * int (*ndo_get_vf_port_profile)(struct net_device *dev, int vf,
+ * struct ifla_vf_port_profile *ivp);
*/
#define HAVE_NET_DEVICE_OPS
struct net_device_ops {
@@ -744,6 +748,12 @@ struct net_device_ops {
int (*ndo_get_vf_config)(struct net_device *dev,
int vf,
struct ifla_vf_info *ivf);
+ int (*ndo_set_vf_port_profile)(
+ struct net_device *dev, int vf,
+ struct ifla_vf_port_profile *ivp);
+ int (*ndo_get_vf_port_profile)(
+ struct net_device *dev, int vf,
+ struct ifla_vf_port_profile *ivp);
#if defined(CONFIG_FCOE) || defined(CONFIG_FCOE_MODULE)
int (*ndo_fcoe_enable)(struct net_device *dev);
int (*ndo_fcoe_disable)(struct net_device *dev);
@@ -747,17 +747,40 @@ static int rtnl_fill_ifinfo(struct sk_buff *skb, struct net_device *dev,
goto nla_put_failure;
copy_rtnl_link_stats64(nla_data(attr), stats);
+ if (dev->dev.parent)
+ NLA_PUT_U32(skb, IFLA_NUM_VF, dev_num_vf(dev->dev.parent));
+
if (dev->netdev_ops->ndo_get_vf_config && dev->dev.parent) {
int i;
struct ifla_vf_info ivi;
- NLA_PUT_U32(skb, IFLA_NUM_VF, dev_num_vf(dev->dev.parent));
for (i = 0; i < dev_num_vf(dev->dev.parent); i++) {
if (dev->netdev_ops->ndo_get_vf_config(dev, i, &ivi))
break;
NLA_PUT(skb, IFLA_VFINFO, sizeof(ivi), &ivi);
}
}
+
+ if (dev->netdev_ops->ndo_get_vf_port_profile && dev->dev.parent) {
+ struct ifla_vf_port_profile ivp;
+
+ if (dev_num_vf(dev->dev.parent)) {
+ int i;
+
+ for (i = 0; i < dev_num_vf(dev->dev.parent); i++) {
+ if (dev->netdev_ops->ndo_get_vf_port_profile(
+ dev, i, &ivp))
+ break;
+ NLA_PUT(skb, IFLA_VF_PORT_PROFILE,
+ sizeof(ivp), &ivp);
+ }
+ } else if (!dev->netdev_ops->ndo_get_vf_port_profile(dev,
+ 0, &ivp)) {
+ NLA_PUT(skb, IFLA_VF_PORT_PROFILE,
+ sizeof(ivp), &ivp);
+ }
+ }
+
if (dev->rtnl_link_ops) {
if (rtnl_link_fill(skb, dev) < 0)
goto nla_put_failure;
@@ -824,6 +847,8 @@ const struct nla_policy ifla_policy[IFLA_MAX+1] = {
.len = sizeof(struct ifla_vf_vlan) },
[IFLA_VF_TX_RATE] = { .type = NLA_BINARY,
.len = sizeof(struct ifla_vf_tx_rate) },
+ [IFLA_VF_PORT_PROFILE] = { .type = NLA_BINARY,
+ .len = sizeof(struct ifla_vf_port_profile)},
};
EXPORT_SYMBOL(ifla_policy);
@@ -1028,6 +1053,18 @@ static int do_setlink(struct net_device *dev, struct ifinfomsg *ifm,
}
err = 0;
+ if (tb[IFLA_VF_PORT_PROFILE]) {
+ struct ifla_vf_port_profile *ivp;
+ ivp = nla_data(tb[IFLA_VF_PORT_PROFILE]);
+ err = -EOPNOTSUPP;
+ if (ops->ndo_set_vf_port_profile)
+ err = ops->ndo_set_vf_port_profile(dev, ivp->vf, ivp);
+ if (err < 0)
+ goto errout;
+ modified = 1;
+ }
+ err = 0;
+
errout:
if (err < 0 && modified && net_ratelimit())
printk(KERN_WARNING "A link change request failed with "