From: Devesh Sharma Date: Thu, 18 Dec 2014 13:13:46 +0000 (+0530) Subject: RDMA/libocrdma:sync qp-state with hw state X-Git-Tag: libocrdma-1.0.6~3 X-Git-Url: https://openfabrics.org/gitweb/?a=commitdiff_plain;h=da96ed9c6e71819068545b50f659b8f4db4d8a04;p=~emulex%2Flibocrdma.git RDMA/libocrdma:sync qp-state with hw state 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 Signed-off-by: Padmanabh Ratnakar --- 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;