summaryrefslogtreecommitdiff
path: root/drivers/infiniband/hw/mlx5/ib_virt.c
diff options
context:
space:
mode:
authorDanit Goldberg <danitg@mellanox.com>2019-11-06 16:18:12 +0300
committerLeon Romanovsky <leonro@mellanox.com>2019-11-22 19:17:24 +0300
commit9c0015ef092879f61129cdffbbe22fd30201d39b (patch)
treeb17ae95ad5e4e097c45a37c3a087d2a081fc5045 /drivers/infiniband/hw/mlx5/ib_virt.c
parent2446887ed226786fcf9b3ece8d89e6b22551411b (diff)
downloadlinux-9c0015ef092879f61129cdffbbe22fd30201d39b.tar.xz
IB/mlx5: Implement callbacks for getting VFs GUID attributes
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>
Diffstat (limited to 'drivers/infiniband/hw/mlx5/ib_virt.c')
-rw-r--r--drivers/infiniband/hw/mlx5/ib_virt.c24
1 files changed, 24 insertions, 0 deletions
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;
+}