From patchwork Mon Nov 2 06:37:22 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Devesh Sharma X-Patchwork-Id: 7534221 Return-Path: X-Original-To: patchwork-linux-rdma@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id E164BBEEA4 for ; Mon, 2 Nov 2015 06:56:14 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 26F0D20320 for ; Mon, 2 Nov 2015 06:56:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id F38F6202EB for ; Mon, 2 Nov 2015 06:56:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752439AbbKBG4L (ORCPT ); Mon, 2 Nov 2015 01:56:11 -0500 Received: from cmrelayp1.emulex.com ([138.239.112.140]:53001 "EHLO CMRELAYP1.ad.emulex.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1752182AbbKBG4L (ORCPT ); Mon, 2 Nov 2015 01:56:11 -0500 X-Greylist: delayed 1021 seconds by postgrey-1.27 at vger.kernel.org; Mon, 02 Nov 2015 01:56:11 EST Received: from neo01-el71.iig.avagotech.net ([10.192.205.132]) by CMRELAYP1.ad.emulex.com with Microsoft SMTPSVC(7.5.7601.17514); Sun, 1 Nov 2015 22:37:30 -0800 From: Devesh Sharma To: linux-rdma@vger.kernel.org Cc: Padmanabh Ratnakar , Devesh Sharma Subject: [PATCH 1/4] RDMA/libocrdma:sync qp-state with hw state Date: Mon, 2 Nov 2015 01:37:22 -0500 Message-Id: <1446446245-534-2-git-send-email-devesh.sharma@avagotech.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1446446245-534-1-git-send-email-devesh.sharma@avagotech.com> References: <1446446245-534-1-git-send-email-devesh.sharma@avagotech.com> X-OriginalArrivalTime: 02 Nov 2015 06:37:31.0056 (UTC) FILETIME=[F30D9300:01D11538] Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Padmanabh Ratnakar 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 Signed-off-by: Devesh Sharma --- 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;