* [PATCH iproute2-next] ip link: Add support to get SR-IOV VF node GUID and port GUID
2019-11-14 13:31 [PATCH rdma-next 0/4] Get IB port and node GUIDs through rtnetlink Leon Romanovsky
@ 2019-11-14 13:31 ` Leon Romanovsky
2019-11-14 20:35 ` David Ahern
2019-11-14 13:31 ` [PATCH rdma-next 1/4] net/core: Add support for getting VF GUIDs Leon Romanovsky
` (5 subsequent siblings)
6 siblings, 1 reply; 14+ messages in thread
From: Leon Romanovsky @ 2019-11-14 13:31 UTC (permalink / raw)
To: Doug Ledford, Jason Gunthorpe, David S . Miller, David Ahern
Cc: Leon Romanovsky, RDMA mailing list, Danit Goldberg, linux-netdev,
Stephen Hemminger
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>
---
ip/ipaddress.c | 23 +++++++++++++++++++++++
1 file changed, 23 insertions(+)
diff --git a/ip/ipaddress.c b/ip/ipaddress.c
index b72eb7a1..ed72d0bd 100644
--- a/ip/ipaddress.c
+++ b/ip/ipaddress.c
@@ -484,6 +484,29 @@ static void print_vfinfo(FILE *fp, struct ifinfomsg *ifi, struct rtattr *vfinfo)
vf_spoofchk->setting);
}
+#define GUID_STR_LEN 24
+ if (vf[IFLA_VF_IB_NODE_GUID]) {
+ char buf[GUID_STR_LEN];
+ 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,
+ RTA_PAYLOAD(vf[IFLA_VF_IB_NODE_GUID]),
+ ARPHRD_INFINIBAND,
+ buf, sizeof(buf)));
+ }
+ if (vf[IFLA_VF_IB_PORT_GUID]) {
+ char buf[GUID_STR_LEN];
+ 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,
+ RTA_PAYLOAD(vf[IFLA_VF_IB_PORT_GUID]),
+ ARPHRD_INFINIBAND,
+ buf, sizeof(buf)));
+ }
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] 14+ messages in thread
* Re: [PATCH iproute2-next] ip link: Add support to get SR-IOV VF node GUID and port GUID
2019-11-14 13:31 ` [PATCH iproute2-next] ip link: Add support to get SR-IOV VF node GUID and port GUID Leon Romanovsky
@ 2019-11-14 20:35 ` David Ahern
2019-11-15 15:24 ` Leon Romanovsky
0 siblings, 1 reply; 14+ messages in thread
From: David Ahern @ 2019-11-14 20:35 UTC (permalink / raw)
To: Leon Romanovsky, Doug Ledford, Jason Gunthorpe, David S . Miller
Cc: Leon Romanovsky, RDMA mailing list, Danit Goldberg, linux-netdev,
Stephen Hemminger
On 11/14/19 6:31 AM, Leon Romanovsky wrote:
> diff --git a/ip/ipaddress.c b/ip/ipaddress.c
> index b72eb7a1..ed72d0bd 100644
> --- a/ip/ipaddress.c
> +++ b/ip/ipaddress.c
> @@ -484,6 +484,29 @@ static void print_vfinfo(FILE *fp, struct ifinfomsg *ifi, struct rtattr *vfinfo)
> vf_spoofchk->setting);
> }
>
> +#define GUID_STR_LEN 24
> + if (vf[IFLA_VF_IB_NODE_GUID]) {
> + char buf[GUID_STR_LEN];
buf should be declared with SPRINT_BUF; see other users of ll_addr_n2a.
And, print_vfinfo already has b1 declared so you do not need a new one;
just change buf to b1.
> + 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,
> + RTA_PAYLOAD(vf[IFLA_VF_IB_NODE_GUID]),
> + ARPHRD_INFINIBAND,
> + buf, sizeof(buf)));
> + }
> + if (vf[IFLA_VF_IB_PORT_GUID]) {
> + char buf[GUID_STR_LEN];
> + 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,
> + RTA_PAYLOAD(vf[IFLA_VF_IB_PORT_GUID]),
> + ARPHRD_INFINIBAND,
> + buf, sizeof(buf)));
> + }
> if (vf[IFLA_VF_LINK_STATE]) {
> struct ifla_vf_link_state *vf_linkstate =
> RTA_DATA(vf[IFLA_VF_LINK_STATE]);
>
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH iproute2-next] ip link: Add support to get SR-IOV VF node GUID and port GUID
2019-11-14 20:35 ` David Ahern
@ 2019-11-15 15:24 ` Leon Romanovsky
0 siblings, 0 replies; 14+ messages in thread
From: Leon Romanovsky @ 2019-11-15 15:24 UTC (permalink / raw)
To: David Ahern
Cc: Doug Ledford, Jason Gunthorpe, David S . Miller,
RDMA mailing list, Danit Goldberg, linux-netdev,
Stephen Hemminger
On Thu, Nov 14, 2019 at 01:35:11PM -0700, David Ahern wrote:
> On 11/14/19 6:31 AM, Leon Romanovsky wrote:
> > diff --git a/ip/ipaddress.c b/ip/ipaddress.c
> > index b72eb7a1..ed72d0bd 100644
> > --- a/ip/ipaddress.c
> > +++ b/ip/ipaddress.c
> > @@ -484,6 +484,29 @@ static void print_vfinfo(FILE *fp, struct ifinfomsg *ifi, struct rtattr *vfinfo)
> > vf_spoofchk->setting);
> > }
> >
> > +#define GUID_STR_LEN 24
> > + if (vf[IFLA_VF_IB_NODE_GUID]) {
> > + char buf[GUID_STR_LEN];
>
> buf should be declared with SPRINT_BUF; see other users of ll_addr_n2a.
> And, print_vfinfo already has b1 declared so you do not need a new one;
> just change buf to b1.
Thanks, I posted v1.
https://lore.kernel.org/linux-rdma/20191115152155.246821-1-leon@kernel.org
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH rdma-next 1/4] net/core: Add support for getting VF GUIDs
2019-11-14 13:31 [PATCH rdma-next 0/4] Get IB port and node GUIDs through rtnetlink Leon Romanovsky
2019-11-14 13:31 ` [PATCH iproute2-next] ip link: Add support to get SR-IOV VF node GUID and port GUID Leon Romanovsky
@ 2019-11-14 13:31 ` Leon Romanovsky
2019-11-22 0:54 ` David Ahern
2019-11-14 13:31 ` [PATCH rdma-next 2/4] IB/core: Add interfaces to get VF node and port GUIDs Leon Romanovsky
` (4 subsequent siblings)
6 siblings, 1 reply; 14+ messages in thread
From: Leon Romanovsky @ 2019-11-14 13:31 UTC (permalink / raw)
To: Doug Ledford, Jason Gunthorpe, David S . Miller
Cc: Leon Romanovsky, RDMA mailing list, Danit Goldberg, linux-netdev
From: Danit Goldberg <danitg@mellanox.com>
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 <danitg@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
---
include/linux/netdevice.h | 4 ++++
net/core/rtnetlink.c | 11 +++++++++++
2 files changed, 15 insertions(+)
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 9eda1c31d1f7..379338239e49 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -1316,6 +1316,10 @@ struct net_device_ops {
struct nlattr *port[]);
int (*ndo_get_vf_port)(struct net_device *dev,
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 vf, u64 guid,
int guid_type);
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
index 1ee6460f8275..b8d152f55a21 100644
--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -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_broadcast vf_broadcast;
struct ifla_vf_info ivi;
+ struct ifla_vf_guid node_guid;
+ struct ifla_vf_guid port_guid;
memset(&ivi, 0, sizeof(ivi));
@@ -1270,6 +1272,15 @@ static noinline_for_stack int rtnl_fill_vfinfo(struct sk_buff *skb,
nla_put(skb, IFLA_VF_TRUST,
sizeof(vf_trust), &vf_trust))
goto nla_put_vf_failure;
+ 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);
if (!vfvlanlist)
goto nla_put_vf_failure;
--
2.20.1
^ permalink raw reply related [flat|nested] 14+ messages in thread
* Re: [PATCH rdma-next 1/4] net/core: Add support for getting VF GUIDs
2019-11-14 13:31 ` [PATCH rdma-next 1/4] net/core: Add support for getting VF GUIDs Leon Romanovsky
@ 2019-11-22 0:54 ` David Ahern
2019-11-22 16:16 ` Leon Romanovsky
0 siblings, 1 reply; 14+ messages in thread
From: David Ahern @ 2019-11-22 0:54 UTC (permalink / raw)
To: Leon Romanovsky, Doug Ledford, Jason Gunthorpe, David S . Miller
Cc: Leon Romanovsky, RDMA mailing list, Danit Goldberg, linux-netdev
On 11/14/19 6:31 AM, Leon Romanovsky wrote:
> From: Danit Goldberg <danitg@mellanox.com>
>
>
> 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 <danitg@mellanox.com>
> Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
> ---
> include/linux/netdevice.h | 4 ++++
> net/core/rtnetlink.c | 11 +++++++++++
> 2 files changed, 15 insertions(+)
>
LGTM
Acked-by: David Ahern <dsahern@gmail.com>
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH rdma-next 1/4] net/core: Add support for getting VF GUIDs
2019-11-22 0:54 ` David Ahern
@ 2019-11-22 16:16 ` Leon Romanovsky
0 siblings, 0 replies; 14+ messages in thread
From: Leon Romanovsky @ 2019-11-22 16:16 UTC (permalink / raw)
To: David Ahern
Cc: Doug Ledford, Jason Gunthorpe, David S . Miller,
RDMA mailing list, Danit Goldberg, linux-netdev
On Thu, Nov 21, 2019 at 05:54:30PM -0700, David Ahern wrote:
> On 11/14/19 6:31 AM, Leon Romanovsky wrote:
> > From: Danit Goldberg <danitg@mellanox.com>
> >
> >
> > 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 <danitg@mellanox.com>
> > Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
> > ---
> > include/linux/netdevice.h | 4 ++++
> > net/core/rtnetlink.c | 11 +++++++++++
> > 2 files changed, 15 insertions(+)
> >
>
>
> LGTM
>
> Acked-by: David Ahern <dsahern@gmail.com>
Thanks a lot.
>
>
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH rdma-next 2/4] IB/core: Add interfaces to get VF node and port GUIDs
2019-11-14 13:31 [PATCH rdma-next 0/4] Get IB port and node GUIDs through rtnetlink Leon Romanovsky
2019-11-14 13:31 ` [PATCH iproute2-next] ip link: Add support to get SR-IOV VF node GUID and port GUID Leon Romanovsky
2019-11-14 13:31 ` [PATCH rdma-next 1/4] net/core: Add support for getting VF GUIDs Leon Romanovsky
@ 2019-11-14 13:31 ` Leon Romanovsky
2019-11-14 13:31 ` [PATCH rdma-next 3/4] IB/ipoib: Add ndo operation for getting VFs GUID attributes Leon Romanovsky
` (3 subsequent siblings)
6 siblings, 0 replies; 14+ messages in thread
From: Leon Romanovsky @ 2019-11-14 13:31 UTC (permalink / raw)
To: Doug Ledford, Jason Gunthorpe, David S . Miller
Cc: Leon Romanovsky, RDMA mailing list, Danit Goldberg, linux-netdev
From: Danit Goldberg <danitg@mellanox.com>
Provide ability to get node and port GUIDs of VFs to be symmetrical
to already existing set option.
Signed-off-by: Danit Goldberg <danitg@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
---
drivers/infiniband/core/device.c | 1 +
drivers/infiniband/core/verbs.c | 10 ++++++++++
include/rdma/ib_verbs.h | 6 ++++++
3 files changed, 17 insertions(+)
diff --git a/drivers/infiniband/core/device.c b/drivers/infiniband/core/device.c
index 1a789d2f7a38..e2229bab304a 100644
--- a/drivers/infiniband/core/device.c
+++ b/drivers/infiniband/core/device.c
@@ -2618,6 +2618,7 @@ void ib_set_device_ops(struct ib_device *dev, const struct ib_device_ops *ops)
SET_DEVICE_OP(dev_ops, get_port_immutable);
SET_DEVICE_OP(dev_ops, get_vector_affinity);
SET_DEVICE_OP(dev_ops, get_vf_config);
+ SET_DEVICE_OP(dev_ops, get_vf_guid);
SET_DEVICE_OP(dev_ops, get_vf_stats);
SET_DEVICE_OP(dev_ops, init_port);
SET_DEVICE_OP(dev_ops, invalidate_range);
diff --git a/drivers/infiniband/core/verbs.c b/drivers/infiniband/core/verbs.c
index 5cf32bf484b7..da77057bfe69 100644
--- a/drivers/infiniband/core/verbs.c
+++ b/drivers/infiniband/core/verbs.c
@@ -2460,6 +2460,16 @@ int ib_set_vf_guid(struct ib_device *device, int vf, u8 port, u64 guid,
}
EXPORT_SYMBOL(ib_set_vf_guid);
+int ib_get_vf_guid(struct ib_device *device, int vf, u8 port,
+ struct ifla_vf_guid *node_guid,
+ struct ifla_vf_guid *port_guid)
+{
+ if (!device->ops.get_vf_guid)
+ return -EOPNOTSUPP;
+
+ return device->ops.get_vf_guid(device, vf, port, node_guid, port_guid);
+}
+EXPORT_SYMBOL(ib_get_vf_guid);
/**
* ib_map_mr_sg_pi() - Map the dma mapped SG lists for PI (protection
* information) and set an appropriate memory region for registration.
diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h
index f9e121b03158..d8b73a89ca1a 100644
--- a/include/rdma/ib_verbs.h
+++ b/include/rdma/ib_verbs.h
@@ -2472,6 +2472,9 @@ struct ib_device_ops {
struct ifla_vf_info *ivf);
int (*get_vf_stats)(struct ib_device *device, int vf, u8 port,
struct ifla_vf_stats *stats);
+ int (*get_vf_guid)(struct ib_device *device, int vf, u8 port,
+ struct ifla_vf_guid *node_guid,
+ struct ifla_vf_guid *port_guid);
int (*set_vf_guid)(struct ib_device *device, int vf, u8 port, u64 guid,
int type);
struct ib_wq *(*create_wq)(struct ib_pd *pd,
@@ -3342,6 +3345,9 @@ int ib_get_vf_config(struct ib_device *device, int vf, u8 port,
struct ifla_vf_info *info);
int ib_get_vf_stats(struct ib_device *device, int vf, u8 port,
struct ifla_vf_stats *stats);
+int ib_get_vf_guid(struct ib_device *device, int vf, u8 port,
+ struct ifla_vf_guid *node_guid,
+ struct ifla_vf_guid *port_guid);
int ib_set_vf_guid(struct ib_device *device, int vf, u8 port, u64 guid,
int type);
--
2.20.1
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH rdma-next 3/4] IB/ipoib: Add ndo operation for getting VFs GUID attributes
2019-11-14 13:31 [PATCH rdma-next 0/4] Get IB port and node GUIDs through rtnetlink Leon Romanovsky
` (2 preceding siblings ...)
2019-11-14 13:31 ` [PATCH rdma-next 2/4] IB/core: Add interfaces to get VF node and port GUIDs Leon Romanovsky
@ 2019-11-14 13:31 ` Leon Romanovsky
2019-11-14 13:31 ` [PATCH rdma-next 4/4] IB/mlx5: Implement callbacks " Leon Romanovsky
` (2 subsequent siblings)
6 siblings, 0 replies; 14+ messages in thread
From: Leon Romanovsky @ 2019-11-14 13:31 UTC (permalink / raw)
To: Doug Ledford, Jason Gunthorpe, David S . Miller
Cc: Leon Romanovsky, RDMA mailing list, Danit Goldberg, linux-netdev
From: Danit Goldberg <danitg@mellanox.com>
Add ndo operation to the network driver that enables configuring
ipoib_get_vf_guid operation. The operation allows to get a VF port
and node GUIDs.
Signed-off-by: Danit Goldberg <danitg@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
---
drivers/infiniband/ulp/ipoib/ipoib_main.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_main.c b/drivers/infiniband/ulp/ipoib/ipoib_main.c
index ac0583ff280d..e5f438ab716c 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib_main.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_main.c
@@ -2019,6 +2019,15 @@ static int ipoib_set_vf_guid(struct net_device *dev, int vf, u64 guid, int type)
return ib_set_vf_guid(priv->ca, vf, priv->port, guid, type);
}
+static int ipoib_get_vf_guid(struct net_device *dev, int vf,
+ struct ifla_vf_guid *node_guid,
+ struct ifla_vf_guid *port_guid)
+{
+ struct ipoib_dev_priv *priv = ipoib_priv(dev);
+
+ return ib_get_vf_guid(priv->ca, vf, priv->port, node_guid, port_guid);
+}
+
static int ipoib_get_vf_stats(struct net_device *dev, int vf,
struct ifla_vf_stats *vf_stats)
{
@@ -2045,6 +2054,7 @@ static const struct net_device_ops ipoib_netdev_ops_pf = {
.ndo_set_vf_link_state = ipoib_set_vf_link_state,
.ndo_get_vf_config = ipoib_get_vf_config,
.ndo_get_vf_stats = ipoib_get_vf_stats,
+ .ndo_get_vf_guid = ipoib_get_vf_guid,
.ndo_set_vf_guid = ipoib_set_vf_guid,
.ndo_set_mac_address = ipoib_set_mac,
.ndo_get_stats64 = ipoib_get_stats,
--
2.20.1
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH rdma-next 4/4] IB/mlx5: Implement callbacks for getting VFs GUID attributes
2019-11-14 13:31 [PATCH rdma-next 0/4] Get IB port and node GUIDs through rtnetlink Leon Romanovsky
` (3 preceding siblings ...)
2019-11-14 13:31 ` [PATCH rdma-next 3/4] IB/ipoib: Add ndo operation for getting VFs GUID attributes Leon Romanovsky
@ 2019-11-14 13:31 ` Leon Romanovsky
2019-11-18 7:25 ` [PATCH rdma-next 0/4] Get IB port and node GUIDs through rtnetlink Leon Romanovsky
2019-11-22 16:21 ` Leon Romanovsky
6 siblings, 0 replies; 14+ messages in thread
From: Leon Romanovsky @ 2019-11-14 13:31 UTC (permalink / raw)
To: Doug Ledford, Jason Gunthorpe, David S . Miller
Cc: Leon Romanovsky, RDMA mailing list, Danit Goldberg, linux-netdev
From: Danit Goldberg <danitg@mellanox.com>
Implement the IB defined callback mlx5_ib_get_vf_guid used to query FW
for VFs attributes and return node and port GUIDs.
Signed-off-by: Danit Goldberg <danitg@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
---
drivers/infiniband/hw/mlx5/ib_virt.c | 24 ++++++++++++++++++++++++
drivers/infiniband/hw/mlx5/main.c | 1 +
drivers/infiniband/hw/mlx5/mlx5_ib.h | 3 +++
3 files changed, 28 insertions(+)
diff --git a/drivers/infiniband/hw/mlx5/ib_virt.c b/drivers/infiniband/hw/mlx5/ib_virt.c
index 649a3364f838..4f0edd4832bd 100644
--- a/drivers/infiniband/hw/mlx5/ib_virt.c
+++ b/drivers/infiniband/hw/mlx5/ib_virt.c
@@ -201,3 +201,27 @@ int mlx5_ib_set_vf_guid(struct ib_device *device, int vf, u8 port,
return -EINVAL;
}
+
+int mlx5_ib_get_vf_guid(struct ib_device *device, int vf, u8 port,
+ struct ifla_vf_guid *node_guid,
+ struct ifla_vf_guid *port_guid)
+{
+ struct mlx5_ib_dev *dev = to_mdev(device);
+ struct mlx5_core_dev *mdev = dev->mdev;
+ struct mlx5_hca_vport_context *rep;
+ int err;
+
+ rep = kzalloc(sizeof(*rep), GFP_KERNEL);
+ if (!rep)
+ return -ENOMEM;
+
+ err = mlx5_query_hca_vport_context(mdev, 1, 1, vf+1, rep);
+ if (err)
+ goto ex;
+
+ port_guid->guid = rep->port_guid;
+ node_guid->guid = rep->node_guid;
+ex:
+ kfree(rep);
+ return err;
+}
diff --git a/drivers/infiniband/hw/mlx5/main.c b/drivers/infiniband/hw/mlx5/main.c
index 2d83f8c1d7ba..7127cdd313c1 100644
--- a/drivers/infiniband/hw/mlx5/main.c
+++ b/drivers/infiniband/hw/mlx5/main.c
@@ -6313,6 +6313,7 @@ static const struct ib_device_ops mlx5_ib_dev_ipoib_enhanced_ops = {
static const struct ib_device_ops mlx5_ib_dev_sriov_ops = {
.get_vf_config = mlx5_ib_get_vf_config,
+ .get_vf_guid = mlx5_ib_get_vf_guid,
.get_vf_stats = mlx5_ib_get_vf_stats,
.set_vf_guid = mlx5_ib_set_vf_guid,
.set_vf_link_state = mlx5_ib_set_vf_link_state,
diff --git a/drivers/infiniband/hw/mlx5/mlx5_ib.h b/drivers/infiniband/hw/mlx5/mlx5_ib.h
index 00fd412ef686..3ad20b120bf4 100644
--- a/drivers/infiniband/hw/mlx5/mlx5_ib.h
+++ b/drivers/infiniband/hw/mlx5/mlx5_ib.h
@@ -1315,6 +1315,9 @@ int mlx5_ib_set_vf_link_state(struct ib_device *device, int vf,
u8 port, int state);
int mlx5_ib_get_vf_stats(struct ib_device *device, int vf,
u8 port, struct ifla_vf_stats *stats);
+int mlx5_ib_get_vf_guid(struct ib_device *device, int vf, u8 port,
+ struct ifla_vf_guid *node_guid,
+ struct ifla_vf_guid *port_guid);
int mlx5_ib_set_vf_guid(struct ib_device *device, int vf, u8 port,
u64 guid, int type);
--
2.20.1
^ permalink raw reply related [flat|nested] 14+ messages in thread
* Re: [PATCH rdma-next 0/4] Get IB port and node GUIDs through rtnetlink
2019-11-14 13:31 [PATCH rdma-next 0/4] Get IB port and node GUIDs through rtnetlink Leon Romanovsky
` (4 preceding siblings ...)
2019-11-14 13:31 ` [PATCH rdma-next 4/4] IB/mlx5: Implement callbacks " Leon Romanovsky
@ 2019-11-18 7:25 ` Leon Romanovsky
2019-11-21 17:36 ` Leon Romanovsky
2019-11-22 16:21 ` Leon Romanovsky
6 siblings, 1 reply; 14+ messages in thread
From: Leon Romanovsky @ 2019-11-18 7:25 UTC (permalink / raw)
To: David S. Miller
Cc: RDMA mailing list, Doug Ledford, Jason Gunthorpe, Danit Goldberg,
linux-netdev
On Thu, Nov 14, 2019 at 03:31:21PM +0200, Leon Romanovsky wrote:
> From: Leon Romanovsky <leonro@mellanox.com>
>
> Hi,
>
> This series from Danit extends RTNETLINK to provide IB port and node
> GUIDs, which were configured for Infiniband VFs.
>
> The functionality to set VF GUIDs already existed for a long time, and here
> we are adding the missing "get" so that netlink will be symmetric
> and various cloud orchestration tools will be able to manage such
> VFs more naturally.
>
> The iproute2 was extended too to present those GUIDs.
>
> - 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
>
> Due to the fact that this series touches both net and RDMA, we assume
> that it needs to be applied to our shared branch (mlx5-next) and pulled
> later by Dave and Doug/Jason.
>
> Thanks
>
> Danit Goldberg (4):
> net/core: Add support for getting VF GUIDs
> IB/core: Add interfaces to get VF node and port GUIDs
> IB/ipoib: Add ndo operation for getting VFs GUID attributes
> IB/mlx5: Implement callbacks for getting VFs GUID attributes
Dave,
I see that you marked these patches as "not applicable" in patchworks.
Can I assume that you are OK with them and we can take them through RDMA
tree? If yes, can you give your Ack on the first patch?
Thanks
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH rdma-next 0/4] Get IB port and node GUIDs through rtnetlink
2019-11-18 7:25 ` [PATCH rdma-next 0/4] Get IB port and node GUIDs through rtnetlink Leon Romanovsky
@ 2019-11-21 17:36 ` Leon Romanovsky
0 siblings, 0 replies; 14+ messages in thread
From: Leon Romanovsky @ 2019-11-21 17:36 UTC (permalink / raw)
To: David S. Miller
Cc: RDMA mailing list, Doug Ledford, Jason Gunthorpe, Danit Goldberg,
linux-netdev
On Mon, Nov 18, 2019 at 07:25:02AM +0000, Leon Romanovsky wrote:
> On Thu, Nov 14, 2019 at 03:31:21PM +0200, Leon Romanovsky wrote:
> > From: Leon Romanovsky <leonro@mellanox.com>
> >
> > Hi,
> >
> > This series from Danit extends RTNETLINK to provide IB port and node
> > GUIDs, which were configured for Infiniband VFs.
> >
> > The functionality to set VF GUIDs already existed for a long time, and here
> > we are adding the missing "get" so that netlink will be symmetric
> > and various cloud orchestration tools will be able to manage such
> > VFs more naturally.
> >
> > The iproute2 was extended too to present those GUIDs.
> >
> > - 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
> >
> > Due to the fact that this series touches both net and RDMA, we assume
> > that it needs to be applied to our shared branch (mlx5-next) and pulled
> > later by Dave and Doug/Jason.
> >
> > Thanks
> >
> > Danit Goldberg (4):
> > net/core: Add support for getting VF GUIDs
> > IB/core: Add interfaces to get VF node and port GUIDs
> > IB/ipoib: Add ndo operation for getting VFs GUID attributes
> > IB/mlx5: Implement callbacks for getting VFs GUID attributes
>
> Dave,
>
> I see that you marked these patches as "not applicable" in patchworks.
>
> Can I assume that you are OK with them and we can take them through RDMA
> tree? If yes, can you give your Ack on the first patch?
Kindly reminder.
Thanks
>
> Thanks
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH rdma-next 0/4] Get IB port and node GUIDs through rtnetlink
2019-11-14 13:31 [PATCH rdma-next 0/4] Get IB port and node GUIDs through rtnetlink Leon Romanovsky
` (5 preceding siblings ...)
2019-11-18 7:25 ` [PATCH rdma-next 0/4] Get IB port and node GUIDs through rtnetlink Leon Romanovsky
@ 2019-11-22 16:21 ` Leon Romanovsky
2019-11-22 20:15 ` Jason Gunthorpe
6 siblings, 1 reply; 14+ messages in thread
From: Leon Romanovsky @ 2019-11-22 16:21 UTC (permalink / raw)
To: Doug Ledford, Jason Gunthorpe, David S . Miller
Cc: RDMA mailing list, Danit Goldberg, linux-netdev
On Thu, Nov 14, 2019 at 03:31:21PM +0200, Leon Romanovsky wrote:
> From: Leon Romanovsky <leonro@mellanox.com>
>
> Hi,
>
> This series from Danit extends RTNETLINK to provide IB port and node
> GUIDs, which were configured for Infiniband VFs.
>
> The functionality to set VF GUIDs already existed for a long time, and here
> we are adding the missing "get" so that netlink will be symmetric
> and various cloud orchestration tools will be able to manage such
> VFs more naturally.
>
> The iproute2 was extended too to present those GUIDs.
>
> - 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
>
> Due to the fact that this series touches both net and RDMA, we assume
> that it needs to be applied to our shared branch (mlx5-next) and pulled
> later by Dave and Doug/Jason.
>
> Thanks
>
> Danit Goldberg (4):
> net/core: Add support for getting VF GUIDs
> IB/core: Add interfaces to get VF node and port GUIDs
> IB/ipoib: Add ndo operation for getting VFs GUID attributes
> IB/mlx5: Implement callbacks for getting VFs GUID attributes
Applied to mlx5-next,
Doug, Jason please pull.
9c0015ef0928 IB/mlx5: Implement callbacks for getting VFs GUID attributes
2446887ed226 IB/ipoib: Add ndo operation for getting VFs GUID attributes
bfcb3c5d1485 IB/core: Add interfaces to get VF node and port GUIDs
30aad41721e0 net/core: Add support for getting VF GUIDs
Thanks
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH rdma-next 0/4] Get IB port and node GUIDs through rtnetlink
2019-11-22 16:21 ` Leon Romanovsky
@ 2019-11-22 20:15 ` Jason Gunthorpe
0 siblings, 0 replies; 14+ messages in thread
From: Jason Gunthorpe @ 2019-11-22 20:15 UTC (permalink / raw)
To: Leon Romanovsky
Cc: Doug Ledford, David S . Miller, RDMA mailing list,
Danit Goldberg, linux-netdev
On Fri, Nov 22, 2019 at 04:21:07PM +0000, Leon Romanovsky wrote:
> On Thu, Nov 14, 2019 at 03:31:21PM +0200, Leon Romanovsky wrote:
> > From: Leon Romanovsky <leonro@mellanox.com>
> >
> > Hi,
> >
> > This series from Danit extends RTNETLINK to provide IB port and node
> > GUIDs, which were configured for Infiniband VFs.
> >
> > The functionality to set VF GUIDs already existed for a long time, and here
> > we are adding the missing "get" so that netlink will be symmetric
> > and various cloud orchestration tools will be able to manage such
> > VFs more naturally.
> >
> > The iproute2 was extended too to present those GUIDs.
> >
> > - 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
> >
> > Due to the fact that this series touches both net and RDMA, we assume
> > that it needs to be applied to our shared branch (mlx5-next) and pulled
> > later by Dave and Doug/Jason.
> >
> > Thanks
> >
> > Danit Goldberg (4):
> > net/core: Add support for getting VF GUIDs
> > IB/core: Add interfaces to get VF node and port GUIDs
> > IB/ipoib: Add ndo operation for getting VFs GUID attributes
> > IB/mlx5: Implement callbacks for getting VFs GUID attributes
>
> Applied to mlx5-next,
> Doug, Jason please pull.
>
> 9c0015ef0928 IB/mlx5: Implement callbacks for getting VFs GUID attributes
> 2446887ed226 IB/ipoib: Add ndo operation for getting VFs GUID attributes
> bfcb3c5d1485 IB/core: Add interfaces to get VF node and port GUIDs
> 30aad41721e0 net/core: Add support for getting VF GUIDs
Okay, done.
Jason
^ permalink raw reply [flat|nested] 14+ messages in thread