Skip to content

Commit 30aad41

Browse files
Danit GoldbergLeon Romanovsky
Danit Goldberg
authored and
Leon Romanovsky
committed
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: Danit Goldberg <[email protected]> Acked-by: David Ahern <[email protected]> Signed-off-by: Leon Romanovsky <[email protected]>
1 parent 975b992 commit 30aad41

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

include/linux/netdevice.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1316,6 +1316,10 @@ struct net_device_ops {
13161316
struct nlattr *port[]);
13171317
int (*ndo_get_vf_port)(struct net_device *dev,
13181318
int vf, struct sk_buff *skb);
1319+
int (*ndo_get_vf_guid)(struct net_device *dev,
1320+
int vf,
1321+
struct ifla_vf_guid *node_guid,
1322+
struct ifla_vf_guid *port_guid);
13191323
int (*ndo_set_vf_guid)(struct net_device *dev,
13201324
int vf, u64 guid,
13211325
int guid_type);

net/core/rtnetlink.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1204,6 +1204,8 @@ static noinline_for_stack int rtnl_fill_vfinfo(struct sk_buff *skb,
12041204
struct ifla_vf_mac vf_mac;
12051205
struct ifla_vf_broadcast vf_broadcast;
12061206
struct ifla_vf_info ivi;
1207+
struct ifla_vf_guid node_guid;
1208+
struct ifla_vf_guid port_guid;
12071209

12081210
memset(&ivi, 0, sizeof(ivi));
12091211

@@ -1270,6 +1272,18 @@ static noinline_for_stack int rtnl_fill_vfinfo(struct sk_buff *skb,
12701272
nla_put(skb, IFLA_VF_TRUST,
12711273
sizeof(vf_trust), &vf_trust))
12721274
goto nla_put_vf_failure;
1275+
1276+
memset(&node_guid, 0, sizeof(node_guid));
1277+
memset(&port_guid, 0, sizeof(port_guid));
1278+
if (dev->netdev_ops->ndo_get_vf_guid &&
1279+
!dev->netdev_ops->ndo_get_vf_guid(dev, vfs_num, &node_guid,
1280+
&port_guid)) {
1281+
if (nla_put(skb, IFLA_VF_IB_NODE_GUID, sizeof(node_guid),
1282+
&node_guid) ||
1283+
nla_put(skb, IFLA_VF_IB_PORT_GUID, sizeof(port_guid),
1284+
&port_guid))
1285+
goto nla_put_vf_failure;
1286+
}
12731287
vfvlanlist = nla_nest_start_noflag(skb, IFLA_VF_VLAN_LIST);
12741288
if (!vfvlanlist)
12751289
goto nla_put_vf_failure;

0 commit comments

Comments
 (0)