[PATCH v2 6/7] IB/rdmavt: Add support for rvt_query_device function

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Harish Chegondi <harish.chegondi@xxxxxxxxx>

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@xxxxxxxxx>
Signed-off-by: Harish Chegondi <harish.chegondi@xxxxxxxxx>
---
 drivers/infiniband/sw/rdmavt/vt.c |    9 +++++++--
 include/rdma/rdma_vt.h            |    5 ++++-
 2 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/drivers/infiniband/sw/rdmavt/vt.c b/drivers/infiniband/sw/rdmavt/vt.c
index e75eb3d..f2b6438 100644
--- a/drivers/infiniband/sw/rdmavt/vt.c
+++ b/drivers/infiniband/sw/rdmavt/vt.c
@@ -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,
diff --git a/include/rdma/rdma_vt.h b/include/rdma/rdma_vt.h
index e412e67..725778a 100644
--- a/include/rdma/rdma_vt.h
+++ b/include/rdma/rdma_vt.h
@@ -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 */

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux