Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp6249995imu; Mon, 21 Jan 2019 05:50:50 -0800 (PST) X-Google-Smtp-Source: ALg8bN4RnStHxIyT1u+WXOpG8RKsb6maSwKNdxNco8V7tFTSBOs5j++LfM78FJutS7Yl0nlnSPIV X-Received: by 2002:a17:902:be0e:: with SMTP id r14mr28657095pls.124.1548078650738; Mon, 21 Jan 2019 05:50:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548078650; cv=none; d=google.com; s=arc-20160816; b=OUlWqjKsPF4h4yo3nQV0fxqkc/YFLNeFdj/90mB65aqLL5HpznlKT9hM+NX49qcTLB rWj5eVJPP6LrZ6+pO0ayZLtTP65Qo9mlv6J4tgDmXG4dNdHacerby+twrFWHr845EtO6 8MbrOKmRDwqxg5GDMIGuCFhsDyFC0T3tPI5SNBlRjdInsLdcNJ8JmlJxSUPnjz/LaDbd +zD07SBjqbxE6u4rL5LmGlMZ+5uvAK9gvvevXClXa6UqtvvG4ZPN2jBze1lLVLKk06NA mUKXdvaTXczbcWZ5aEBqKZ7U7HBkZWrZOGX35O7u1uYeqy48vpuvD3DdtPzM4U+ddVFw NN3Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=4hhkiNcKuuSmh2EzK0hKdKQoIH2GPS6dTmV5TcY5dS8=; b=Wf26vFvjxSeC0cCWZ6mGSy39d8uU490siFdqE8vbW/qphG174ec5aEgXXvaiW2i9fB DoU61yOZ0rgL8xxuJgRUcLKsx9mxgqqbrR2JPTqdSbfC1zqYKDVFcgSqoR4NLs7N5W/Q Onv1Wldg7Gdq7EWVqwDd7tsaiG+pEOopaMDC2KtpgeLyos8ubrs0sJ7DQFMl9M2gpBjL b6vTd0P18eef+kYVLwojnCXb2ebJJaQoPASGlZdzZNhCC6uAvDqofZFpGx3ZlZn0l3J/ owPJCbTBkwbn5t7R5nF+MIBeOuXIqUukyprr8JtjMK5p7G5Wn+b2/M59vWdX5A9YB9m4 PYuQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="yGQH2Bd/"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u22si8403815pgk.335.2019.01.21.05.50.33; Mon, 21 Jan 2019 05:50:50 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="yGQH2Bd/"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729984AbfAUNsh (ORCPT + 99 others); Mon, 21 Jan 2019 08:48:37 -0500 Received: from mail.kernel.org ([198.145.29.99]:58570 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729970AbfAUNse (ORCPT ); Mon, 21 Jan 2019 08:48:34 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id E44B120861; Mon, 21 Jan 2019 13:48:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1548078513; bh=fgq0UORjTfIQ+gtYjmuItDwJToMdaiaoj2Zc+S0soRw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yGQH2Bd/it3hF0kzj6kO8TjL4piaNuHQwU0MuhAtbeHSfZmbsP5kvUtECQOnl1XF9 7Ds+OHmfS60BtCdHS5vDiBrj45y/JKJo8vN8IeV+3jslekfB5nCv2xoZqDRH5i/Wiv RzQ39GJ+w2qNBktfHi6kgFqlB/3BtoqUKcqoIZEM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ruishuang Wang , Bryan Tan , Vishnu Dasa , Adit Ranadive , Jason Gunthorpe Subject: [PATCH 4.20 059/111] RDMA/vmw_pvrdma: Return the correct opcode when creating WR Date: Mon, 21 Jan 2019 14:42:53 +0100 Message-Id: <20190121122502.405508184@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190121122455.819406896@linuxfoundation.org> References: <20190121122455.819406896@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.20-stable review patch. If anyone has any objections, please let me know. ------------------ From: Adit Ranadive commit 6325e01b6cdf4636b721cf7259c1616e3cf28ce2 upstream. Since the IB_WR_REG_MR opcode value changed, let's set the PVRDMA device opcodes explicitly. Reported-by: Ruishuang Wang Fixes: 9a59739bd01f ("IB/rxe: Revise the ib_wr_opcode enum") Cc: stable@vger.kernel.org Reviewed-by: Bryan Tan Reviewed-by: Ruishuang Wang Reviewed-by: Vishnu Dasa Signed-off-by: Adit Ranadive Signed-off-by: Jason Gunthorpe Signed-off-by: Greg Kroah-Hartman --- drivers/infiniband/hw/vmw_pvrdma/pvrdma.h | 35 ++++++++++++++++++++++++++- drivers/infiniband/hw/vmw_pvrdma/pvrdma_qp.c | 6 ++++ include/uapi/rdma/vmw_pvrdma-abi.h | 1 3 files changed, 41 insertions(+), 1 deletion(-) --- a/drivers/infiniband/hw/vmw_pvrdma/pvrdma.h +++ b/drivers/infiniband/hw/vmw_pvrdma/pvrdma.h @@ -427,7 +427,40 @@ static inline enum ib_qp_state pvrdma_qp static inline enum pvrdma_wr_opcode ib_wr_opcode_to_pvrdma(enum ib_wr_opcode op) { - return (enum pvrdma_wr_opcode)op; + switch (op) { + case IB_WR_RDMA_WRITE: + return PVRDMA_WR_RDMA_WRITE; + case IB_WR_RDMA_WRITE_WITH_IMM: + return PVRDMA_WR_RDMA_WRITE_WITH_IMM; + case IB_WR_SEND: + return PVRDMA_WR_SEND; + case IB_WR_SEND_WITH_IMM: + return PVRDMA_WR_SEND_WITH_IMM; + case IB_WR_RDMA_READ: + return PVRDMA_WR_RDMA_READ; + case IB_WR_ATOMIC_CMP_AND_SWP: + return PVRDMA_WR_ATOMIC_CMP_AND_SWP; + case IB_WR_ATOMIC_FETCH_AND_ADD: + return PVRDMA_WR_ATOMIC_FETCH_AND_ADD; + case IB_WR_LSO: + return PVRDMA_WR_LSO; + case IB_WR_SEND_WITH_INV: + return PVRDMA_WR_SEND_WITH_INV; + case IB_WR_RDMA_READ_WITH_INV: + return PVRDMA_WR_RDMA_READ_WITH_INV; + case IB_WR_LOCAL_INV: + return PVRDMA_WR_LOCAL_INV; + case IB_WR_REG_MR: + return PVRDMA_WR_FAST_REG_MR; + case IB_WR_MASKED_ATOMIC_CMP_AND_SWP: + return PVRDMA_WR_MASKED_ATOMIC_CMP_AND_SWP; + case IB_WR_MASKED_ATOMIC_FETCH_AND_ADD: + return PVRDMA_WR_MASKED_ATOMIC_FETCH_AND_ADD; + case IB_WR_REG_SIG_MR: + return PVRDMA_WR_REG_SIG_MR; + default: + return PVRDMA_WR_ERROR; + } } static inline enum ib_wc_status pvrdma_wc_status_to_ib( --- a/drivers/infiniband/hw/vmw_pvrdma/pvrdma_qp.c +++ b/drivers/infiniband/hw/vmw_pvrdma/pvrdma_qp.c @@ -721,6 +721,12 @@ int pvrdma_post_send(struct ib_qp *ibqp, wr->opcode == IB_WR_RDMA_WRITE_WITH_IMM) wqe_hdr->ex.imm_data = wr->ex.imm_data; + if (unlikely(wqe_hdr->opcode == PVRDMA_WR_ERROR)) { + *bad_wr = wr; + ret = -EINVAL; + goto out; + } + switch (qp->ibqp.qp_type) { case IB_QPT_GSI: case IB_QPT_UD: --- a/include/uapi/rdma/vmw_pvrdma-abi.h +++ b/include/uapi/rdma/vmw_pvrdma-abi.h @@ -78,6 +78,7 @@ enum pvrdma_wr_opcode { PVRDMA_WR_MASKED_ATOMIC_FETCH_AND_ADD, PVRDMA_WR_BIND_MW, PVRDMA_WR_REG_SIG_MR, + PVRDMA_WR_ERROR, }; enum pvrdma_wc_status {