All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] ihw/rdma: Implementation of Query QP verb
@ 2018-03-20 19:00 Yuval Shaia
  2018-03-20 19:00 ` [Qemu-devel] [PATCH v1 1/2] hw/rdma: Add Query QP operation Yuval Shaia
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Yuval Shaia @ 2018-03-20 19:00 UTC (permalink / raw)
  To: yuval.shaia, marcel, qemu-devel

Please review implementation of Query QP verb which is needed by some RDMA
applications.

Patch #1: Implementation in rdma backend layer
Patch #2: Add support to pvrdma device

v0 -> v1:
	* Split to two patches, one for rdma and one for pvrdma

[PATCH v1 1/2] hw/rdma: Add Query QP operation
[PATCH v1 2/2] hw/rdma: Add support for Query QP verb to pvrdma

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Qemu-devel] [PATCH v1 1/2] hw/rdma: Add Query QP operation
  2018-03-20 19:00 [Qemu-devel] ihw/rdma: Implementation of Query QP verb Yuval Shaia
@ 2018-03-20 19:00 ` Yuval Shaia
  2018-03-20 19:00 ` [Qemu-devel] [PATCH v1 2/2] hw/rdma: Add support for Query QP verb to pvrdma device Yuval Shaia
  2018-03-21 12:53 ` [Qemu-devel] ihw/rdma: Implementation of Query QP verb Marcel Apfelbaum
  2 siblings, 0 replies; 4+ messages in thread
From: Yuval Shaia @ 2018-03-20 19:00 UTC (permalink / raw)
  To: yuval.shaia, marcel, qemu-devel

This operation is needed by rdma devices - implement it.

Signed-off-by: Yuval Shaia <yuval.shaia@oracle.com>
---
 hw/rdma/rdma_backend.c | 12 ++++++++++++
 hw/rdma/rdma_backend.h |  2 ++
 hw/rdma/rdma_rm.c      | 18 ++++++++++++++++++
 hw/rdma/rdma_rm.h      |  3 +++
 4 files changed, 35 insertions(+)

diff --git a/hw/rdma/rdma_backend.c b/hw/rdma/rdma_backend.c
index ae7589c190..da2c8671e5 100644
--- a/hw/rdma/rdma_backend.c
+++ b/hw/rdma/rdma_backend.c
@@ -646,6 +646,18 @@ int rdma_backend_qp_state_rts(RdmaBackendQP *qp, uint8_t qp_type,
     return 0;
 }
 
+int rdma_backend_query_qp(RdmaBackendQP *qp, struct ibv_qp_attr *attr,
+                          int attr_mask, struct ibv_qp_init_attr *init_attr)
+{
+    if (!qp->ibqp) {
+        pr_dbg("QP1\n");
+        attr->qp_state = IBV_QPS_RTS;
+        return 0;
+    }
+
+    return ibv_query_qp(qp->ibqp, attr, attr_mask, init_attr);
+}
+
 void rdma_backend_destroy_qp(RdmaBackendQP *qp)
 {
     if (qp->ibqp) {
diff --git a/hw/rdma/rdma_backend.h b/hw/rdma/rdma_backend.h
index 07f6fed768..6d9b45efe8 100644
--- a/hw/rdma/rdma_backend.h
+++ b/hw/rdma/rdma_backend.h
@@ -83,6 +83,8 @@ int rdma_backend_qp_state_rtr(RdmaBackendDev *backend_dev, RdmaBackendQP *qp,
                               bool use_qkey);
 int rdma_backend_qp_state_rts(RdmaBackendQP *qp, uint8_t qp_type,
                               uint32_t sq_psn, uint32_t qkey, bool use_qkey);
+int rdma_backend_query_qp(RdmaBackendQP *qp, struct ibv_qp_attr *attr,
+                          int attr_mask, struct ibv_qp_init_attr *init_attr);
 void rdma_backend_destroy_qp(RdmaBackendQP *qp);
 
 void rdma_backend_post_send(RdmaBackendDev *backend_dev,
diff --git a/hw/rdma/rdma_rm.c b/hw/rdma/rdma_rm.c
index 296e40518e..a4e1de31fd 100644
--- a/hw/rdma/rdma_rm.c
+++ b/hw/rdma/rdma_rm.c
@@ -453,6 +453,24 @@ int rdma_rm_modify_qp(RdmaDeviceResources *dev_res, RdmaBackendDev *backend_dev,
     return 0;
 }
 
+int rdma_rm_query_qp(RdmaDeviceResources *dev_res, RdmaBackendDev *backend_dev,
+                     uint32_t qp_handle, struct ibv_qp_attr *attr,
+                     int attr_mask, struct ibv_qp_init_attr *init_attr)
+{
+    RdmaRmQP *qp;
+
+    pr_dbg("qpn=%d\n", qp_handle);
+
+    qp = rdma_rm_get_qp(dev_res, qp_handle);
+    if (!qp) {
+        return -EINVAL;
+    }
+
+    pr_dbg("qp_type=%d\n", qp->qp_type);
+
+    return rdma_backend_query_qp(&qp->backend_qp, attr, attr_mask, init_attr);
+}
+
 void rdma_rm_dealloc_qp(RdmaDeviceResources *dev_res, uint32_t qp_handle)
 {
     RdmaRmQP *qp;
diff --git a/hw/rdma/rdma_rm.h b/hw/rdma/rdma_rm.h
index be95c1b0f4..0528c1972b 100644
--- a/hw/rdma/rdma_rm.h
+++ b/hw/rdma/rdma_rm.h
@@ -59,6 +59,9 @@ int rdma_rm_modify_qp(RdmaDeviceResources *dev_res, RdmaBackendDev *backend_dev,
                       union ibv_gid *dgid, uint32_t dqpn,
                       enum ibv_qp_state qp_state, uint32_t qkey,
                       uint32_t rq_psn, uint32_t sq_psn);
+int rdma_rm_query_qp(RdmaDeviceResources *dev_res, RdmaBackendDev *backend_dev,
+                     uint32_t qp_handle, struct ibv_qp_attr *attr,
+                     int attr_mask, struct ibv_qp_init_attr *init_attr);
 void rdma_rm_dealloc_qp(RdmaDeviceResources *dev_res, uint32_t qp_handle);
 
 int rdma_rm_alloc_cqe_ctx(RdmaDeviceResources *dev_res, uint32_t *cqe_ctx_id,
-- 
2.13.6

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [Qemu-devel] [PATCH v1 2/2] hw/rdma: Add support for Query QP verb to pvrdma device
  2018-03-20 19:00 [Qemu-devel] ihw/rdma: Implementation of Query QP verb Yuval Shaia
  2018-03-20 19:00 ` [Qemu-devel] [PATCH v1 1/2] hw/rdma: Add Query QP operation Yuval Shaia
@ 2018-03-20 19:00 ` Yuval Shaia
  2018-03-21 12:53 ` [Qemu-devel] ihw/rdma: Implementation of Query QP verb Marcel Apfelbaum
  2 siblings, 0 replies; 4+ messages in thread
From: Yuval Shaia @ 2018-03-20 19:00 UTC (permalink / raw)
  To: yuval.shaia, marcel, qemu-devel

This IB verb is needed by some applications - implement it.

Signed-off-by: Yuval Shaia <yuval.shaia@oracle.com>
---
 hw/rdma/vmw/pvrdma_cmd.c | 24 +++++++++++++++++++++++-
 1 file changed, 23 insertions(+), 1 deletion(-)

diff --git a/hw/rdma/vmw/pvrdma_cmd.c b/hw/rdma/vmw/pvrdma_cmd.c
index 293dfed29f..cf8c50af31 100644
--- a/hw/rdma/vmw/pvrdma_cmd.c
+++ b/hw/rdma/vmw/pvrdma_cmd.c
@@ -515,6 +515,28 @@ static int modify_qp(PVRDMADev *dev, union pvrdma_cmd_req *req,
     return rsp->hdr.err;
 }
 
+static int query_qp(PVRDMADev *dev, union pvrdma_cmd_req *req,
+                     union pvrdma_cmd_resp *rsp)
+{
+    struct pvrdma_cmd_query_qp *cmd = &req->query_qp;
+    struct pvrdma_cmd_query_qp_resp *resp = &rsp->query_qp_resp;
+    struct ibv_qp_init_attr init_attr;
+
+    pr_dbg("qp_handle=%d\n", cmd->qp_handle);
+
+    memset(rsp, 0, sizeof(*rsp));
+    rsp->hdr.response = cmd->hdr.response;
+    rsp->hdr.ack = PVRDMA_CMD_QUERY_QP_RESP;
+
+    rsp->hdr.err = rdma_rm_query_qp(&dev->rdma_dev_res, &dev->backend_dev,
+                                    cmd->qp_handle,
+                                    (struct ibv_qp_attr *)&resp->attrs, -1,
+                                    &init_attr);
+
+    pr_dbg("ret=%d\n", rsp->hdr.err);
+    return rsp->hdr.err;
+}
+
 static int destroy_qp(PVRDMADev *dev, union pvrdma_cmd_req *req,
                       union pvrdma_cmd_resp *rsp)
 {
@@ -636,7 +658,7 @@ static struct cmd_handler cmd_handlers[] = {
     {PVRDMA_CMD_DESTROY_CQ, destroy_cq},
     {PVRDMA_CMD_CREATE_QP, create_qp},
     {PVRDMA_CMD_MODIFY_QP, modify_qp},
-    {PVRDMA_CMD_QUERY_QP, NULL},
+    {PVRDMA_CMD_QUERY_QP, query_qp},
     {PVRDMA_CMD_DESTROY_QP, destroy_qp},
     {PVRDMA_CMD_CREATE_UC, create_uc},
     {PVRDMA_CMD_DESTROY_UC, destroy_uc},
-- 
2.13.6

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] ihw/rdma: Implementation of Query QP verb
  2018-03-20 19:00 [Qemu-devel] ihw/rdma: Implementation of Query QP verb Yuval Shaia
  2018-03-20 19:00 ` [Qemu-devel] [PATCH v1 1/2] hw/rdma: Add Query QP operation Yuval Shaia
  2018-03-20 19:00 ` [Qemu-devel] [PATCH v1 2/2] hw/rdma: Add support for Query QP verb to pvrdma device Yuval Shaia
@ 2018-03-21 12:53 ` Marcel Apfelbaum
  2 siblings, 0 replies; 4+ messages in thread
From: Marcel Apfelbaum @ 2018-03-21 12:53 UTC (permalink / raw)
  To: Yuval Shaia, qemu-devel; +Cc: Michael Tsirkin

Hi Yuval,

On 20/03/2018 21:00, Yuval Shaia wrote:
> Please review implementation of Query QP verb which is needed by some RDMA
> applications.
> 
> Patch #1: Implementation in rdma backend layer
> Patch #2: Add support to pvrdma device
> 
> v0 -> v1:
> 	* Split to two patches, one for rdma and one for pvrdma
> 

Actually previous version was V1, this one is V2 :)

Next time please add V2 (V3...) prefix and I suggest using --cover-letter
when using git format-patch/send email instead of manually
adding it.


> [PATCH v1 1/2] hw/rdma: Add Query QP operation
> [PATCH v1 2/2] hw/rdma: Add support for Query QP verb to pvrdma

Second patch should have maybe rdma/vmw since is VMware specific (next time)

> 

I am thinking adding it to 2.12, it can be seen as a bug-fix, querying QP
is a basic operation the device should answer to.
Michael, sounds reasonable?


Reviewed-by: Marcel Apfelbaum <marcel@redhat.com>

Thanks,
Marcel

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-03-21 12:53 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-20 19:00 [Qemu-devel] ihw/rdma: Implementation of Query QP verb Yuval Shaia
2018-03-20 19:00 ` [Qemu-devel] [PATCH v1 1/2] hw/rdma: Add Query QP operation Yuval Shaia
2018-03-20 19:00 ` [Qemu-devel] [PATCH v1 2/2] hw/rdma: Add support for Query QP verb to pvrdma device Yuval Shaia
2018-03-21 12:53 ` [Qemu-devel] ihw/rdma: Implementation of Query QP verb Marcel Apfelbaum

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.