From: Padmanabh Ratnakar <[email protected]>

This patch sync up the QP state with the underlying h/w
QP state and reports the same to user application.

Signed-off-by: Padmanabh Ratnakar <[email protected]>
Signed-off-by: Devesh Sharma <[email protected]>
---
 src/ocrdma_verbs.c | 33 +++++++++++++++++++--------------
 1 file changed, 19 insertions(+), 14 deletions(-)

diff --git a/src/ocrdma_verbs.c b/src/ocrdma_verbs.c
index cf2ecd2..ab90b4f 100644
--- a/src/ocrdma_verbs.c
+++ b/src/ocrdma_verbs.c
@@ -651,20 +651,6 @@ mbx_err:
        return NULL;
 }
 
-/*
- * ocrdma_query_qp
- */
-int ocrdma_query_qp(struct ibv_qp *qp, struct ibv_qp_attr *attr,
-                   int attr_mask, struct ibv_qp_init_attr *init_attr)
-{
-       struct ibv_query_qp cmd;
-       int status;
-
-       status =
-           ibv_cmd_query_qp(qp, attr, attr_mask, init_attr, &cmd, sizeof(cmd));
-       return status;
-}
-
 enum ocrdma_qp_state get_ocrdma_qp_state(enum ibv_qp_state qps)
 {
        switch (qps) {
@@ -896,6 +882,25 @@ int ocrdma_modify_qp(struct ibv_qp *ibqp, struct 
ibv_qp_attr *attr,
        return status;
 }
 
+/*
+ * ocrdma_query_qp
+ */
+int ocrdma_query_qp(struct ibv_qp *ibqp, struct ibv_qp_attr *attr,
+                   int attr_mask, struct ibv_qp_init_attr *init_attr)
+{
+       struct ibv_query_qp cmd;
+       struct ocrdma_qp *qp = get_ocrdma_qp(ibqp);
+       int status;
+
+       status = ibv_cmd_query_qp(ibqp, attr, attr_mask,
+                                 init_attr, &cmd, sizeof(cmd));
+
+       if (!status)
+               ocrdma_qp_state_machine(qp, attr->qp_state);
+
+       return status;
+}
+
 static void ocrdma_srq_toggle_bit(struct ocrdma_srq *srq, int idx)
 {
        int i = idx / 32;
-- 
1.8.3.1

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

Reply via email to