linux-rdma.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH iproute2-next v2] ip link: Add support to get SR-IOV VF node GUID and port GUID
@ 2019-11-18  7:49 Leon Romanovsky
  2019-11-20  2:32 ` David Ahern
  0 siblings, 1 reply; 2+ messages in thread
From: Leon Romanovsky @ 2019-11-18  7:49 UTC (permalink / raw)
  To: David Ahern
  Cc: Danit Goldberg, netdev, RDMA mailing list, Stephen Hemminger,
	Leon Romanovsky

From: Danit Goldberg <danitg@mellanox.com>

Extend iplink to show VF GUIDs (IFLA_VF_IB_NODE_GUID, IFLA_VF_IB_PORT_GUID),
giving the ability for user-space application to print GUID values.
This ability is added to the one of setting new node GUID and port GUID values.

Suitable ip link command:
- ip link show <device>

For example:
- ip link set ib4 vf 0 node_guid 22:44:33:00:33:11:00:33
- ip link set ib4 vf 0 port_guid 10:21:33:12:00:11:22:10
- 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 <danitg@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
---
Changelog:
 v1->v2: https://lore.kernel.org/linux-rdma/20191115152155.246821-1-leon@kernel.orga
 * Change to "b1" caused to extra padding in print of GUIDs, use real
   size instead of RTA_PAYLOAD().
 v0->v1: https://lore.kernel.org/linux-rdma/20191114133126.238128-2-leon@kernel.org
 * Use already preallocated "b1" buffer instead of new one.
---
 ip/ipaddress.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/ip/ipaddress.c b/ip/ipaddress.c
index b72eb7a1..fe41bbef 100644
--- a/ip/ipaddress.c
+++ b/ip/ipaddress.c
@@ -484,6 +484,24 @@ static void print_vfinfo(FILE *fp, struct ifinfomsg *ifi, struct rtattr *vfinfo)
 				   vf_spoofchk->setting);
 	}

+	if (vf[IFLA_VF_IB_NODE_GUID]) {
+		struct ifla_vf_guid *guid = RTA_DATA(vf[IFLA_VF_IB_NODE_GUID]);
+		uint64_t node_guid = ntohll(guid->guid);
+
+		print_string(PRINT_ANY, "node guid", ", NODE_GUID %s",
+			     ll_addr_n2a((const unsigned char *)&node_guid,
+					 sizeof(node_guid), ARPHRD_INFINIBAND,
+					 b1, sizeof(b1)));
+	}
+	if (vf[IFLA_VF_IB_PORT_GUID]) {
+		struct ifla_vf_guid *guid = RTA_DATA(vf[IFLA_VF_IB_PORT_GUID]);
+		uint64_t port_guid = ntohll(guid->guid);
+
+		print_string(PRINT_ANY, "port guid", ", PORT_GUID %s",
+			     ll_addr_n2a((const unsigned char *)&port_guid,
+					 sizeof(port_guid), ARPHRD_INFINIBAND,
+					 b1, sizeof(b1)));
+	}
 	if (vf[IFLA_VF_LINK_STATE]) {
 		struct ifla_vf_link_state *vf_linkstate =
 			RTA_DATA(vf[IFLA_VF_LINK_STATE]);
--
2.20.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH iproute2-next v2] ip link: Add support to get SR-IOV VF node GUID and port GUID
  2019-11-18  7:49 [PATCH iproute2-next v2] ip link: Add support to get SR-IOV VF node GUID and port GUID Leon Romanovsky
@ 2019-11-20  2:32 ` David Ahern
  0 siblings, 0 replies; 2+ messages in thread
From: David Ahern @ 2019-11-20  2:32 UTC (permalink / raw)
  To: Leon Romanovsky
  Cc: Danit Goldberg, netdev, RDMA mailing list, Stephen Hemminger,
	Leon Romanovsky

On 11/18/19 12:49 AM, Leon Romanovsky wrote:
> From: Danit Goldberg <danitg@mellanox.com>
> 
> Extend iplink to show VF GUIDs (IFLA_VF_IB_NODE_GUID, IFLA_VF_IB_PORT_GUID),
> giving the ability for user-space application to print GUID values.
> This ability is added to the one of setting new node GUID and port GUID values.
> 
> Suitable ip link command:
> - ip link show <device>
> 
> For example:
> - ip link set ib4 vf 0 node_guid 22:44:33:00:33:11:00:33
> - ip link set ib4 vf 0 port_guid 10:21:33:12:00:11:22:10
> - 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 <danitg@mellanox.com>
> Signed-off-by: Leon Romanovsky <leonro@mellanox.com>

applied to iproute2-next. Thanks

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-11-20  2:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-18  7:49 [PATCH iproute2-next v2] ip link: Add support to get SR-IOV VF node GUID and port GUID Leon Romanovsky
2019-11-20  2:32 ` David Ahern

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).