]> git.openfabrics.org - ~emulex/libocrdma.git/commitdiff
RDMA/libocrdma:sync qp-state with hw state
authorDevesh Sharma <devesh.sharma@emulex.com>
Thu, 18 Dec 2014 13:13:46 +0000 (18:43 +0530)
committerDevesh Sharma <devesh.sharma@emulex.com>
Sat, 17 Jan 2015 10:42:13 +0000 (16:12 +0530)
This patch sync up the QP state with the underlying h/w
QP state and reports the same to user application

Signed-off-by: Devesh Sharma <devesh.sharma@emulex.com>
Signed-off-by: Padmanabh Ratnakar <padmanabh.ratnakar@emulex.com>
src/ocrdma_verbs.c

index cf2ecd2894e6fc5ff57152196e9fb80324a5fc84..ab90b4fb16b5cc257bae9f5338a53ba768883dca 100644 (file)
@@ -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;