[openib-general] libibverbs + libmthca changes for query SRQ

Dotan Barak dotanb at mellanox.co.il
Thu Feb 9 07:05:07 PST 2006


libibverbs and libmthca changes to handle quering SRQs.  Essentially just adding
API and support for passing the call through to provider plug-ins.

Signed-off-by: Dotan Barak <dotanb at mellanox.co.il>

Index: last_stable/src/userspace/libibverbs/include/infiniband/driver.h
===================================================================
--- last_stable.orig/src/userspace/libibverbs/include/infiniband/driver.h	2006-02-07 17:00:24.000000000 +0200
+++ last_stable/src/userspace/libibverbs/include/infiniband/driver.h	2006-02-08 09:38:24.000000000 +0200
@@ -107,6 +108,9 @@ int ibv_cmd_modify_srq(struct ibv_srq *s
 		       struct ibv_srq_attr *srq_attr,
 		       enum ibv_srq_attr_mask srq_attr_mask,
 		       struct ibv_modify_srq *cmd, size_t cmd_size);
+int ibv_cmd_query_srq(struct ibv_srq *srq,
+			     struct ibv_srq_attr *srq_attr,
+			     struct ibv_query_srq *cmd, size_t cmd_size);
 int ibv_cmd_destroy_srq(struct ibv_srq *srq);
 
 int ibv_cmd_create_qp(struct ibv_pd *pd,
Index: last_stable/src/userspace/libibverbs/include/infiniband/kern-abi.h
===================================================================
--- last_stable.orig/src/userspace/libibverbs/include/infiniband/kern-abi.h	2006-02-07 17:00:24.000000000 +0200
+++ last_stable/src/userspace/libibverbs/include/infiniband/kern-abi.h	2006-02-08 09:25:29.000000000 +0200
@@ -676,6 +677,23 @@ struct ibv_modify_srq {
 	__u64 driver_data[0];
 };
 
+struct ibv_query_srq {
+	__u32 command;
+	__u16 in_words;
+	__u16 out_words;
+	__u64 response;
+	__u32 srq_handle;
+	__u32 reserved;
+	__u64 driver_data[0];
+};
+
+struct ibv_query_srq_resp {
+	__u32 max_wr;
+	__u32 max_sge;
+	__u32 srq_limit;
+	__u32 reserved;
+};
+
 struct ibv_destroy_srq {
 	__u32 command;
 	__u16 in_words;
Index: last_stable/src/userspace/libibverbs/include/infiniband/verbs.h
===================================================================
--- last_stable.orig/src/userspace/libibverbs/include/infiniband/verbs.h	2006-02-07 17:00:24.000000000 +0200
+++ last_stable/src/userspace/libibverbs/include/infiniband/verbs.h	2006-02-08 09:27:38.000000000 +0200
@@ -556,6 +557,8 @@ struct ibv_context_ops {
 	int			(*modify_srq)(struct ibv_srq *srq,
 					      struct ibv_srq_attr *srq_attr,
 					      enum ibv_srq_attr_mask srq_attr_mask);
+	int			(*query_srq)(struct ibv_srq *srq,
+					     struct ibv_srq_attr *srq_attr);
 	int			(*destroy_srq)(struct ibv_srq *srq);
 	int			(*post_srq_recv)(struct ibv_srq *srq,
 						 struct ibv_recv_wr *recv_wr,
@@ -815,6 +818,15 @@ int ibv_modify_srq(struct ibv_srq *srq,
 		   enum ibv_srq_attr_mask srq_attr_mask);
 
 /**
+ * ibv_query_srq - Returns the attribute list and current values for the
+ *   specified SRQ.
+ * @srq: The SRQ to query.
+ * @srq_attr: The attributes of the specified SRQ.
+ */
+int ibv_query_srq(struct ibv_srq *srq,
+		  struct ibv_srq_attr *srq_attr);
+
+/**
  * ibv_destroy_srq - Destroys the specified SRQ.
  * @srq: The SRQ to destroy.
  */
Index: last_stable/src/userspace/libibverbs/src/cmd.c
===================================================================
--- last_stable.orig/src/userspace/libibverbs/src/cmd.c	2006-02-07 17:00:24.000000000 +0200
+++ last_stable/src/userspace/libibverbs/src/cmd.c	2006-02-08 09:29:41.000000000 +0200
@@ -488,6 +489,25 @@ int ibv_cmd_modify_srq(struct ibv_srq *s
 	return 0;
 }
 
+int ibv_cmd_query_srq(struct ibv_srq *srq,
+		      struct ibv_srq_attr *srq_attr,
+		      struct ibv_query_srq *cmd, size_t cmd_size)
+{
+	struct ibv_query_srq_resp resp;
+
+	IBV_INIT_CMD_RESP(cmd, cmd_size, QUERY_SRQ, &resp, sizeof resp);
+	cmd->srq_handle = srq->handle;
+
+	if (write(srq->context->cmd_fd, cmd, cmd_size) != cmd_size)
+		return errno;
+
+	srq_attr->max_wr    = resp.max_wr;
+	srq_attr->max_sge   = resp.max_sge;
+	srq_attr->srq_limit = resp.srq_limit;
+
+	return 0;
+}
+
 static int ibv_cmd_destroy_srq_v1(struct ibv_srq *srq)
 {
 	struct ibv_destroy_srq_v1 cmd;
Index: last_stable/src/userspace/libibverbs/src/libibverbs.map
===================================================================
--- last_stable.orig/src/userspace/libibverbs/src/libibverbs.map	2006-02-07 17:00:24.000000000 +0200
+++ last_stable/src/userspace/libibverbs/src/libibverbs.map	2006-02-08 09:30:18.000000000 +0200
@@ -25,6 +25,7 @@ IBVERBS_1.0 {
 		ibv_ack_cq_events;
 		ibv_create_srq;
 		ibv_modify_srq;
+		ibv_query_srq;
 		ibv_destroy_srq;
 		ibv_create_qp;
 		ibv_modify_qp;
@@ -49,6 +50,7 @@ IBVERBS_1.0 {
 		ibv_cmd_destroy_cq;
 		ibv_cmd_create_srq;
 		ibv_cmd_modify_srq;
+		ibv_cmd_query_srq;
 		ibv_cmd_destroy_srq;
 		ibv_cmd_create_qp;
 		ibv_cmd_modify_qp;
Index: last_stable/src/userspace/libibverbs/src/verbs.c
===================================================================
--- last_stable.orig/src/userspace/libibverbs/src/verbs.c	2006-02-07 17:00:24.000000000 +0200
+++ last_stable/src/userspace/libibverbs/src/verbs.c	2006-02-08 09:31:25.000000000 +0200
@@ -280,6 +281,12 @@ int ibv_modify_srq(struct ibv_srq *srq,
 	return srq->context->ops.modify_srq(srq, srq_attr, srq_attr_mask);
 }
 
+int ibv_query_srq(struct ibv_srq *srq,
+		  struct ibv_srq_attr *srq_attr)
+{
+	return srq->context->ops.query_srq(srq, srq_attr);
+}
+
 int ibv_destroy_srq(struct ibv_srq *srq)
 {
 	return srq->context->ops.destroy_srq(srq);
Index: last_stable/src/userspace/libmthca/src/mthca.c
===================================================================
--- last_stable.orig/src/userspace/libmthca/src/mthca.c	2006-02-07 17:00:23.000000000 +0200
+++ last_stable/src/userspace/libmthca/src/mthca.c	2006-02-08 09:32:01.000000000 +0200
@@ -110,6 +111,7 @@ static struct ibv_context_ops mthca_ctx_
 	.destroy_cq    = mthca_destroy_cq,
 	.create_srq    = mthca_create_srq,
 	.modify_srq    = mthca_modify_srq,
+	.query_srq     = mthca_query_srq,
 	.destroy_srq   = mthca_destroy_srq,
 	.create_qp     = mthca_create_qp,
 	.modify_qp     = mthca_modify_qp,
Index: last_stable/src/userspace/libmthca/src/mthca.h
===================================================================
--- last_stable.orig/src/userspace/libmthca/src/mthca.h	2006-02-07 17:00:23.000000000 +0200
+++ last_stable/src/userspace/libmthca/src/mthca.h	2006-02-08 09:46:20.000000000 +0200
@@ -297,6 +298,8 @@ struct ibv_srq *mthca_create_srq(struct 
 int mthca_modify_srq(struct ibv_srq *srq,
 		     struct ibv_srq_attr *attr,
 		     enum ibv_srq_attr_mask mask);
+int mthca_query_srq(struct ibv_srq *srq,
+			   struct ibv_srq_attr *attr);
 int mthca_destroy_srq(struct ibv_srq *srq);
 int mthca_alloc_srq_buf(struct ibv_pd *pd, struct ibv_srq_attr *attr,
 			struct mthca_srq *srq);
Index: last_stable/src/userspace/libmthca/src/verbs.c
===================================================================
--- last_stable.orig/src/userspace/libmthca/src/verbs.c	2006-02-07 17:00:23.000000000 +0200
+++ last_stable/src/userspace/libmthca/src/verbs.c	2006-02-08 09:33:48.000000000 +0200
@@ -439,6 +440,14 @@ int mthca_modify_srq(struct ibv_srq *srq
 	return ibv_cmd_modify_srq(srq, attr, attr_mask, &cmd, sizeof cmd);
 }
 
+int mthca_query_srq(struct ibv_srq *srq,
+		    struct ibv_srq_attr *attr)
+{
+	struct ibv_query_srq cmd;
+
+	return ibv_cmd_query_srq(srq, attr, &cmd, sizeof cmd);
+}
+
 int mthca_destroy_srq(struct ibv_srq *srq)
 {
 	int ret;



Dotan Barak
Software Verification Engineer
Mellanox Technologies
Tel: +972-4-9097200 Ext: 231 Fax: +972-4-9593245
P.O. Box 86 Yokneam 20692 ISRAEL.
Home: +972-77-8841095  Cell: 052-4222383

[ May the fork be with you ]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openfabrics.org/pipermail/general/attachments/20060209/15d0d510/attachment.html>


More information about the general mailing list