IB/qib: Support query gid in rdmavt
authorDennis Dalessandro <dennis.dalessandro@intel.com>
Wed, 3 Feb 2016 22:20:44 +0000 (14:20 -0800)
committerDoug Ledford <dledford@redhat.com>
Fri, 11 Mar 2016 01:37:34 +0000 (20:37 -0500)
Query gid is in rdmavt, but still relies on the driver to maintain the
guid table. Add the necessary driver call back and remove the existing
verb handler.

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/hw/qib/qib_verbs.c

index e534355c37db92fd2fbe524d1d7d9fc570adf5ad..a3a13a52876d29edaa3b8a23c4b0ff1e537281c7 100644 (file)
@@ -1421,28 +1421,20 @@ static int qib_modify_port(struct ib_device *ibdev, u8 port,
        return 0;
 }
 
-static int qib_query_gid(struct ib_device *ibdev, u8 port,
-                        int index, union ib_gid *gid)
+static int qib_get_guid_be(struct rvt_dev_info *rdi, struct rvt_ibport *rvp,
+                          int guid_index, __be64 *guid)
 {
-       struct qib_devdata *dd = dd_from_ibdev(ibdev);
-       int ret = 0;
-
-       if (!port || port > dd->num_pports)
-               ret = -EINVAL;
-       else {
-               struct qib_ibport *ibp = to_iport(ibdev, port);
-               struct qib_pportdata *ppd = ppd_from_ibp(ibp);
+       struct qib_ibport *ibp = container_of(rvp, struct qib_ibport, rvp);
+       struct qib_pportdata *ppd = ppd_from_ibp(ibp);
 
-               gid->global.subnet_prefix = ibp->rvp.gid_prefix;
-               if (index == 0)
-                       gid->global.interface_id = ppd->guid;
-               else if (index < QIB_GUIDS_PER_PORT)
-                       gid->global.interface_id = ibp->guids[index - 1];
-               else
-                       ret = -EINVAL;
-       }
+       if (guid_index == 0)
+               *guid = ppd->guid;
+       else if (guid_index < QIB_GUIDS_PER_PORT)
+               *guid = ibp->guids[guid_index - 1];
+       else
+               return -EINVAL;
 
-       return ret;
+       return 0;
 }
 
 int qib_check_ah(struct ib_device *ibdev, struct ib_ah_attr *ah_attr)
@@ -1696,7 +1688,6 @@ int qib_register_ib_device(struct qib_devdata *dd)
        ibdev->modify_device = qib_modify_device;
        ibdev->query_port = qib_query_port;
        ibdev->modify_port = qib_modify_port;
-       ibdev->query_gid = qib_query_gid;
        ibdev->process_mad = qib_process_mad;
        ibdev->get_port_immutable = qib_port_immutable;
 
@@ -1727,6 +1718,7 @@ int qib_register_ib_device(struct qib_devdata *dd)
        dd->verbs_dev.rdi.driver_f.get_pmtu_from_attr = get_pmtu_from_attr;
 
        dd->verbs_dev.rdi.dparms.max_rdma_atomic = QIB_MAX_RDMA_ATOMIC;
+       dd->verbs_dev.rdi.driver_f.get_guid_be = qib_get_guid_be;
        dd->verbs_dev.rdi.dparms.lkey_table_size = qib_lkey_table_size;
        dd->verbs_dev.rdi.dparms.qp_table_size = ib_qib_qp_table_size;
        dd->verbs_dev.rdi.dparms.qpn_start = 1;