IB/rdmavt: Add support for rvt_query_device function
authorHarish Chegondi <harish.chegondi@intel.com>
Fri, 22 Jan 2016 20:50:36 +0000 (12:50 -0800)
committerDoug Ledford <dledford@redhat.com>
Fri, 11 Mar 2016 01:37:20 +0000 (20:37 -0500)
With this commit, the drivers using rdmavt need not define query_device
function. But they should fill in the IB device attributes structure
rvt_dev_info.dparms.props

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

index e75eb3d2f8a210f89f97e74a1461bece0e78140a..f2b643843374fda64282393b7299b47bac267ecb 100644 (file)
@@ -68,10 +68,15 @@ static int rvt_query_device(struct ib_device *ibdev,
                            struct ib_device_attr *props,
                            struct ib_udata *uhw)
 {
+       struct rvt_dev_info *rdi = ib_to_rvt(ibdev);
+
+       if (uhw->inlen || uhw->outlen)
+               return -EINVAL;
        /*
-        * Return rvt_dev_info.props contents
+        * Return rvt_dev_info.dparms.props contents
         */
-       return -EOPNOTSUPP;
+       *props = rdi->dparms.props;
+       return 0;
 }
 
 static int rvt_modify_device(struct ib_device *device,
index e412e670e6872efda2569ec425c8c9335c2b6a8d..725778a6781d59f321c33f5104007cfa047a4b97 100644 (file)
@@ -245,7 +245,10 @@ struct rvt_dev_info {
         * allocating space for this structure.
         *
         * The driver will also be responsible for filling in certain members of
-        * dparms.props
+        * dparms.props. The driver needs to fill in dparms exactly as it would
+        * want values reported to a ULP. This will be returned to the caller
+        * in rdmavt's device. The driver should also therefore refrain from
+        * modifying this directly after registration with rdmavt.
         */
 
        /* Driver specific properties */