Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp6269313imu; Mon, 21 Jan 2019 06:08:32 -0800 (PST) X-Google-Smtp-Source: ALg8bN4SbSyJSH328Q9fb7C94M39l2orBI920C9/U/jkAc0twaqih9nDseghE48GGWdWqtKnYI9g X-Received: by 2002:a65:5c02:: with SMTP id u2mr28015490pgr.13.1548079712691; Mon, 21 Jan 2019 06:08:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548079712; cv=none; d=google.com; s=arc-20160816; b=rNGCEYpGPim3KDLpksYwCvhHe3suhhUcIPyhGK8rPP7ekaoC+JcCUTKLFpv3nEsuyZ m+vA9uhyJG7sd0QJIy0swXNeSMy14OcbMPpbiwx0ecGRVUauMTYDMiwaxV3Y6N4FQ8Zn jkldc5jvySRWb6ustXPzE0b9QYxAFIpmDsq/QI73R6x0JW/ZKEbYDIZBUEi9ULV/KD73 wae7GrAvIgMVuahOKmTeJV1gRMbQvaqkUHnTazOnZvu3Zb7WeCIR+TyISvsqyNqKrB62 26x56zmVvFclTmFB8jjaRM+E/d5yq6Y1LMLBfFkQk4uPrE3XyfIW7a+ASirRMQ5cw0ZO FQJQ== 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=Oo4Ms0+SqgOIkl0V+iOFxlhRVLO6bFSgNVRI8YdhKu4=; b=W7kjMxl+Y/PzMQ19bnS2Z2CGXqApDsovM85G7L0hhUkn3CSUONIVPIGQL+inU9yizo GcwZQfWFlxY7nuneYSQDOM4khtDnvsbZsfER0YD1n93z8VFhbVFZ2snkLd4Tfbc8Sdli DoTirNLZmlkMqATCcThafnCo2l/LqYsT9j9eRzES5xPCp2DnYETeDxx0GbuRkIiIY1fF uFsW/Mi3YJkbcx+QwuobIW1uuxyYLtriGeyVi0hx+nlvdv0pl79KQ0MxOCIetTZ475Ox vr1/ezq9RHVpwXZtCA6Ev3u23SfhSekDCNHFPZJyEd63mWsHlpGPJx1KpAT9sbbwBSrM P8Xg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=qC8qYOGR; 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 z13si7529068pgi.438.2019.01.21.06.08.17; Mon, 21 Jan 2019 06:08:32 -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=qC8qYOGR; 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 S1732425AbfAUOAh (ORCPT + 99 others); Mon, 21 Jan 2019 09:00:37 -0500 Received: from mail.kernel.org ([198.145.29.99]:47082 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732377AbfAUOA3 (ORCPT ); Mon, 21 Jan 2019 09:00:29 -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 30D752084C; Mon, 21 Jan 2019 14:00:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1548079228; bh=Hyr52HWY0REzzh2+QQXDQIv1HKaTxOMzkxqCjelinuM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qC8qYOGRxiiXuJJvjwPhw9lIt/StVwS814N3JTQI6Go34HLqk0F9uJkOzmITwjsum d6fsW6/1B2cGQRPS9IXHIbpBfZ5y1I0Eyz9FkBMPHC+Xj25VlA1R+re1UUN5/nog0D ed44Afg75QQMlcAPXE75g3WTIaEmB7flpuTCR/KM= 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.19 53/99] RDMA/vmw_pvrdma: Return the correct opcode when creating WR Date: Mon, 21 Jan 2019 14:48:45 +0100 Message-Id: <20190121134915.994367264@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190121134913.924726465@linuxfoundation.org> References: <20190121134913.924726465@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.19-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 {