Commit 30aad417 authored by Danit Goldberg's avatar Danit Goldberg Committed by Leon Romanovsky

net/core: Add support for getting VF GUIDs

Introduce a new ndo: ndo_get_vf_guid, to get from the net
device the port and node GUID.

New applications can choose to use this interface to show
GUIDs with iproute2 with commands such as:

- ip link show ib4
ib4: <BROADCAST,MULTICAST> mtu 4092 qdisc noop state DOWN mode DEFAULT group default qlen 256
link/infiniband 00:00:0a:2d:fe:80:00:00:00:00:00:00:ec:0d:9a:03:00:44:36:8d brd 00:ff:ff:ff:ff:12:40:1b:ff:ff:00:00:00:00:00:00:ff:ff:ff:ff
vf 0     link/infiniband 00:00:0a:2d:fe:80:00:00:00:00:00:00:ec:0d:9a:03:00:44:36:8d brd 00:ff:ff:ff:ff:12:40:1b:ff:ff:00:00:00:00:00:00:ff:ff:ff:ff,
spoof checking off, NODE_GUID 22:44:33:00:33:11:00:33, PORT_GUID 10:21:33:12:00:11:22:10, link-state disable, trust off, query_rss off
Signed-off-by: default avatarDanit Goldberg <danitg@mellanox.com>
Acked-by: default avatarDavid Ahern <dsahern@gmail.com>
Signed-off-by: default avatarLeon Romanovsky <leonro@mellanox.com>
parent 975b992f
...@@ -1316,6 +1316,10 @@ struct net_device_ops { ...@@ -1316,6 +1316,10 @@ struct net_device_ops {
struct nlattr *port[]); struct nlattr *port[]);
int (*ndo_get_vf_port)(struct net_device *dev, int (*ndo_get_vf_port)(struct net_device *dev,
int vf, struct sk_buff *skb); int vf, struct sk_buff *skb);
int (*ndo_get_vf_guid)(struct net_device *dev,
int vf,
struct ifla_vf_guid *node_guid,
struct ifla_vf_guid *port_guid);
int (*ndo_set_vf_guid)(struct net_device *dev, int (*ndo_set_vf_guid)(struct net_device *dev,
int vf, u64 guid, int vf, u64 guid,
int guid_type); int guid_type);
......
...@@ -1204,6 +1204,8 @@ static noinline_for_stack int rtnl_fill_vfinfo(struct sk_buff *skb, ...@@ -1204,6 +1204,8 @@ static noinline_for_stack int rtnl_fill_vfinfo(struct sk_buff *skb,
struct ifla_vf_mac vf_mac; struct ifla_vf_mac vf_mac;
struct ifla_vf_broadcast vf_broadcast; struct ifla_vf_broadcast vf_broadcast;
struct ifla_vf_info ivi; struct ifla_vf_info ivi;
struct ifla_vf_guid node_guid;
struct ifla_vf_guid port_guid;
memset(&ivi, 0, sizeof(ivi)); memset(&ivi, 0, sizeof(ivi));
...@@ -1270,6 +1272,18 @@ static noinline_for_stack int rtnl_fill_vfinfo(struct sk_buff *skb, ...@@ -1270,6 +1272,18 @@ static noinline_for_stack int rtnl_fill_vfinfo(struct sk_buff *skb,
nla_put(skb, IFLA_VF_TRUST, nla_put(skb, IFLA_VF_TRUST,
sizeof(vf_trust), &vf_trust)) sizeof(vf_trust), &vf_trust))
goto nla_put_vf_failure; goto nla_put_vf_failure;
memset(&node_guid, 0, sizeof(node_guid));
memset(&port_guid, 0, sizeof(port_guid));
if (dev->netdev_ops->ndo_get_vf_guid &&
!dev->netdev_ops->ndo_get_vf_guid(dev, vfs_num, &node_guid,
&port_guid)) {
if (nla_put(skb, IFLA_VF_IB_NODE_GUID, sizeof(node_guid),
&node_guid) ||
nla_put(skb, IFLA_VF_IB_PORT_GUID, sizeof(port_guid),
&port_guid))
goto nla_put_vf_failure;
}
vfvlanlist = nla_nest_start_noflag(skb, IFLA_VF_VLAN_LIST); vfvlanlist = nla_nest_start_noflag(skb, IFLA_VF_VLAN_LIST);
if (!vfvlanlist) if (!vfvlanlist)
goto nla_put_vf_failure; goto nla_put_vf_failure;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment