From patchwork Wed Jan 14 06:53:51 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Devesh Sharma X-Patchwork-Id: 5627341 Return-Path: X-Original-To: patchwork-linux-rdma@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id BA0FE9F358 for ; Wed, 14 Jan 2015 07:42:22 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C77EC201F4 for ; Wed, 14 Jan 2015 07:42:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7DD472017D for ; Wed, 14 Jan 2015 07:42:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932895AbbANHmQ (ORCPT ); Wed, 14 Jan 2015 02:42:16 -0500 Received: from cmexedge2.emulex.com ([138.239.224.100]:51154 "EHLO CMEXEDGE2.ext.emulex.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754411AbbANHmP (ORCPT ); Wed, 14 Jan 2015 02:42:15 -0500 Received: from CMEXHTCAS2.ad.emulex.com (138.239.115.218) by CMEXEDGE2.ext.emulex.com (138.239.224.100) with Microsoft SMTP Server (TLS) id 14.3.174.1; Tue, 13 Jan 2015 23:41:51 -0800 Received: from neo01-el64.lab.bg.emulex.com (10.192.204.8) by smtp.emulex.com (138.239.115.208) with Microsoft SMTP Server id 14.3.174.1; Tue, 13 Jan 2015 23:41:46 -0800 From: Devesh Sharma To: CC: Padmanabh Ratnakar , Devesh Sharma Subject: [PATCH 1/2] RDMA/libocrdma: return positive error codes Date: Wed, 14 Jan 2015 12:23:51 +0530 X-Mailer: git-send-email 1.7.1 In-Reply-To: <1421218432-17812-1-git-send-email-devesh.sharma@emulex.com> References: <1421218432-17812-1-git-send-email-devesh.sharma@emulex.com> MIME-Version: 1.0 Message-ID: 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 As per the standard practice if any faiulre encountered in the library code, the library should return a positive error code to the user. A bug has been reported in a used case scenario of KVM migration as well. This patch fixs the return code problem. Signed-off-by: Padmanabh Ratnakar Signed-off-by: Devesh Sharma --- src/ocrdma_verbs.c | 32 ++++++++++++++++---------------- 1 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/ocrdma_verbs.c b/src/ocrdma_verbs.c index edff8b6..c089a5f 100644 --- a/src/ocrdma_verbs.c +++ b/src/ocrdma_verbs.c @@ -778,7 +778,7 @@ static int ocrdma_qp_state_machine(struct ocrdma_qp *qp, ocrdma_del_flush_qp(qp); break; default: - status = -EINVAL; + status = EINVAL; break; }; break; @@ -794,7 +794,7 @@ static int ocrdma_qp_state_machine(struct ocrdma_qp *qp, break; default: /* invalid state change. */ - status = -EINVAL; + status = EINVAL; break; }; break; @@ -808,7 +808,7 @@ static int ocrdma_qp_state_machine(struct ocrdma_qp *qp, break; default: /* invalid state change. */ - status = -EINVAL; + status = EINVAL; break; }; break; @@ -823,7 +823,7 @@ static int ocrdma_qp_state_machine(struct ocrdma_qp *qp, break; default: /* invalid state change. */ - status = -EINVAL; + status = EINVAL; break; }; break; @@ -836,7 +836,7 @@ static int ocrdma_qp_state_machine(struct ocrdma_qp *qp, break; default: /* invalid state change. */ - status = -EINVAL; + status = EINVAL; break; }; break; @@ -847,7 +847,7 @@ static int ocrdma_qp_state_machine(struct ocrdma_qp *qp, break; default: /* invalid state change. */ - status = -EINVAL; + status = EINVAL; break; }; break; @@ -857,12 +857,12 @@ static int ocrdma_qp_state_machine(struct ocrdma_qp *qp, case OCRDMA_QPS_RST: break; default: - status = -EINVAL; + status = EINVAL; break; }; break; default: - status = -EINVAL; + status = EINVAL; break; }; if (!status) @@ -1226,7 +1226,7 @@ static inline int ocrdma_build_inline_sges(struct ocrdma_qp *qp, ocrdma_err ("%s() supported_len=0x%x, unspported len req=0x%x\n", __func__, qp->max_inline_data, hdr->total_len); - return -EINVAL; + return EINVAL; } dpp_addr = (char *)sge; @@ -1391,7 +1391,7 @@ int ocrdma_post_send(struct ibv_qp *ib_qp, struct ibv_send_wr *wr, if (qp->state != OCRDMA_QPS_RTS && qp->state != OCRDMA_QPS_SQD) { pthread_spin_unlock(&qp->q_lock); *bad_wr = wr; - return -EINVAL; + return EINVAL; } while (wr) { @@ -1399,14 +1399,14 @@ int ocrdma_post_send(struct ibv_qp *ib_qp, struct ibv_send_wr *wr, if (qp->qp_type == IBV_QPT_UD && (wr->opcode != IBV_WR_SEND && wr->opcode != IBV_WR_SEND_WITH_IMM)) { *bad_wr = wr; - status = -EINVAL; + status = EINVAL; break; } if (ocrdma_hwq_free_cnt(&qp->sq) == 0 || wr->num_sge > qp->sq.max_sges) { *bad_wr = wr; - status = -ENOMEM; + status = ENOMEM; break; } hdr = ocrdma_hwq_head(&qp->sq); @@ -1441,7 +1441,7 @@ int ocrdma_post_send(struct ibv_qp *ib_qp, struct ibv_send_wr *wr, ocrdma_build_read(qp, hdr, wr); break; default: - status = -EINVAL; + status = EINVAL; break; } if (status) { @@ -1509,13 +1509,13 @@ int ocrdma_post_recv(struct ibv_qp *ibqp, struct ibv_recv_wr *wr, if (qp->state == OCRDMA_QPS_RST || qp->state == OCRDMA_QPS_ERR) { pthread_spin_unlock(&qp->q_lock); *bad_wr = wr; - return -EINVAL; + return EINVAL; } while (wr) { if (ocrdma_hwq_free_cnt(&qp->rq) == 0 || wr->num_sge > qp->rq.max_sges) { - status = -ENOMEM; + status = ENOMEM; *bad_wr = wr; break; } @@ -2098,7 +2098,7 @@ int ocrdma_post_srq_recv(struct ibv_srq *ibsrq, struct ibv_recv_wr *wr, while (wr) { if (ocrdma_hwq_free_cnt(&srq->rq) == 0 || wr->num_sge > srq->rq.max_sges) { - status = -ENOMEM; + status = ENOMEM; *bad_wr = wr; break; }