IB/rdmavt: Add query gid support.
authorDennis Dalessandro <dennis.dalessandro@intel.com>
Wed, 3 Feb 2016 22:15:11 +0000 (14:15 -0800)
committerDoug Ledford <dledford@redhat.com>
Fri, 11 Mar 2016 01:37:32 +0000 (20:37 -0500)
Addin query gid support. Rdmavt still relies on the driver to maintain
the gid table. Rdmavt simply calls into the driver to retrive the guid
for a particular port.

Reviewed-by: Harish Chegondi <harish.chegondi@intel.com>
Signed-off-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
drivers/infiniband/sw/rdmavt/vt.c
include/rdma/rdma_vt.h

index 9f9cb9ab170b550cd07fd39f9e251417ec4fe3c0..e017117586afa2b0a6b5a80acb0b20ec587cc872 100644 (file)
@@ -210,17 +210,28 @@ static int rvt_query_pkey(struct ib_device *ibdev, u8 port_num, u16 index,
  * Returns 0 on success
  */
 static int rvt_query_gid(struct ib_device *ibdev, u8 port_num,
-                        int index, union ib_gid *gid)
+                        int guid_index, union ib_gid *gid)
 {
+       struct rvt_dev_info *rdi;
+       struct rvt_ibport *rvp;
+       int port_index;
+
        /*
         * Driver is responsible for updating the guid table. Which will be used
         * to craft the return value. This will work similar to how query_pkey()
         * is being done.
         */
-       if (ibport_num_to_idx(ibdev, port_num) < 0)
+       port_index = ibport_num_to_idx(ibdev, port_num);
+       if (port_index < 0)
                return -EINVAL;
 
-       return -EOPNOTSUPP;
+       rdi = ib_to_rvt(ibdev);
+       rvp = rdi->ports[port_index];
+
+       gid->global.subnet_prefix = rvp->gid_prefix;
+
+       return rdi->driver_f.get_guid_be(rdi, rvp, guid_index,
+                                        &gid->global.interface_id);
 }
 
 struct rvt_ucontext {
index 5d1c694a27310f23afd30a1ac6051e05de2d2878..dabf4d52b4fc81dea7c4434895bc2ce18dc5986b 100644 (file)
@@ -248,6 +248,8 @@ struct rvt_driver_provided {
        u32 (*mtu_from_qp)(struct rvt_dev_info *rdi, struct rvt_qp *qp,
                           u32 pmtu);
        int (*mtu_to_path_mtu)(u32 mtu);
+       int (*get_guid_be)(struct rvt_dev_info *rdi, struct rvt_ibport *rvp,
+                          int guid_index, __be64 *guid);
 
        /*--------------------*/
        /* Optional functions */