From patchwork Wed Jan 9 23:08:49 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adit Ranadive X-Patchwork-Id: 10754975 X-Patchwork-Delegate: jgg@ziepe.ca Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id CEE636C2 for ; Wed, 9 Jan 2019 23:08:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B95B128F2D for ; Wed, 9 Jan 2019 23:08:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A7B2F28F3C; Wed, 9 Jan 2019 23:08:55 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 28B9028F2D for ; Wed, 9 Jan 2019 23:08:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726433AbfAIXIz (ORCPT ); Wed, 9 Jan 2019 18:08:55 -0500 Received: from mail-eopbgr730064.outbound.protection.outlook.com ([40.107.73.64]:42205 "EHLO NAM05-DM3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726072AbfAIXIy (ORCPT ); Wed, 9 Jan 2019 18:08:54 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vmware.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=w9N/A89yjkGofxnfACCp1VMHKs33Y5WSbasEHTMDAmI=; b=ej6xS+y87gY1I7DqpCRYP5f9dlRzjRcLcbFg5k9nH0p+nOyP/b+1ssB70ZyZ8O7/kTmPq5Sto8/rv6El0U5cXWjkfQH3+N0gHz/3PjbWJrRQCCEVOMgiRcyglT7A94l7MOOL2TVdMfDpMwxsJf5mbal6imjcfd7FbwWaF+yubPY= Received: from MWHPR05MB3648.namprd05.prod.outlook.com (10.174.251.22) by MWHPR05MB3615.namprd05.prod.outlook.com (10.174.251.13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1516.6; Wed, 9 Jan 2019 23:08:49 +0000 Received: from MWHPR05MB3648.namprd05.prod.outlook.com ([fe80::2077:8b33:a166:25be]) by MWHPR05MB3648.namprd05.prod.outlook.com ([fe80::2077:8b33:a166:25be%2]) with mapi id 15.20.1516.010; Wed, 9 Jan 2019 23:08:49 +0000 From: Adit Ranadive To: "jgg@mellanox.com" , "dledford@redhat.com" CC: Adit Ranadive , "linux-rdma@vger.kernel.org" , Pv-drivers , "stable@vger.kernel.org" Subject: [PATCH v2 for-rc] RDMA/vmw_pvrdma: Return the correct opcode when creating WR Thread-Topic: [PATCH v2 for-rc] RDMA/vmw_pvrdma: Return the correct opcode when creating WR Thread-Index: AQHUqHBHtNcuNsu1KUWsPmTarZ1how== Date: Wed, 9 Jan 2019 23:08:49 +0000 Message-ID: <1547075310-8751-1-git-send-email-aditr@vmware.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: BYAPR01CA0055.prod.exchangelabs.com (2603:10b6:a03:94::32) To MWHPR05MB3648.namprd05.prod.outlook.com (2603:10b6:301:46::22) x-mailer: git-send-email 1.8.3.1 authentication-results: spf=none (sender IP is ) smtp.mailfrom=aditr@vmware.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [66.170.99.1] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;MWHPR05MB3615;20:7i3W5bYKEQ68PpfpZFAvnrAdltptEVIM2he0DdYdJsASPjX5IA833xCN3L7y1sM9FlRc3PP3UOrOWVpRE0khJLTnxgvenEkImCq2YgkY0P7L4PgigPWQHjeOeDMHKpDK1MDD/sKu9EY7eUrQPTIM4cxYqHeYIz5LYXq/yTWkIDc= x-ms-office365-filtering-correlation-id: 58b648be-ff1f-4a8e-4dd3-08d6768769a1 x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600109)(711020)(2017052603328)(7153060)(7193020);SRVR:MWHPR05MB3615; x-ms-traffictypediagnostic: MWHPR05MB3615: x-ld-processed: b39138ca-3cee-4b4a-a4d6-cd83d9dd62f0,ExtAddr x-microsoft-antispam-prvs: x-forefront-prvs: 0912297777 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(366004)(376002)(346002)(396003)(39860400002)(136003)(189003)(199004)(52116002)(4720700003)(86362001)(66066001)(6506007)(386003)(102836004)(26005)(186003)(36756003)(54906003)(50226002)(8936002)(110136005)(81156014)(5660300001)(81166006)(316002)(8676002)(6486002)(14454004)(478600001)(6436002)(256004)(14444005)(2501003)(486006)(6116002)(97736004)(3846002)(105586002)(7736002)(305945005)(4326008)(68736007)(2906002)(476003)(2616005)(71200400001)(71190400001)(25786009)(106356001)(99286004)(6512007)(53936002);DIR:OUT;SFP:1101;SCL:1;SRVR:MWHPR05MB3615;H:MWHPR05MB3648.namprd05.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A:1; received-spf: None (protection.outlook.com: vmware.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: jm3XTVenmHFIQO7loOt8FuJnhcc5P+/BR7wEdr40m1emwuMKw0z2SXG9a0P2u9Nn4Ai6tmO1mRUpsIX8PMVi+ysHfW05ZllttuEX0t/XfUB240v/KvB2jG/Au7tASGUAthJMENew+C8ZShudySlaxHznZIef8JMtxf7CGu24z27jAQGXlPb2FNYq8jtp2pQKH2yFdgKYSqijsTEAuvRuFQKi8vi3FnDKhr0X0pP++wEEX+B6u9dPH/ZeDHNA2ldrriWmooCCwzL4twaV4ORm0yuMmeEJ2PnaZ38z9iHa6IlAfAmTGoJ9Gm9mRzgXmNUV spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: vmware.com X-MS-Exchange-CrossTenant-Network-Message-Id: 58b648be-ff1f-4a8e-4dd3-08d6768769a1 X-MS-Exchange-CrossTenant-originalarrivaltime: 09 Jan 2019 23:08:49.2380 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: b39138ca-3cee-4b4a-a4d6-cd83d9dd62f0 X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR05MB3615 Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Adit Ranadive 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 --- 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(-) diff --git a/drivers/infiniband/hw/vmw_pvrdma/pvrdma.h b/drivers/infiniband/hw/vmw_pvrdma/pvrdma.h index 42b8685c997e..3c633ab58052 100644 --- 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_state_to_ib(enum pvrdma_qp_state state) 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( diff --git a/drivers/infiniband/hw/vmw_pvrdma/pvrdma_qp.c b/drivers/infiniband/hw/vmw_pvrdma/pvrdma_qp.c index 3acf74cbe266..1ec3646087ba 100644 --- 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, const struct ib_send_wr *wr, 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: diff --git a/include/uapi/rdma/vmw_pvrdma-abi.h b/include/uapi/rdma/vmw_pvrdma-abi.h index d13fd490b66d..6e73f0274e41 100644 --- 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 {