Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp1390910imm; Wed, 15 Aug 2018 17:10:50 -0700 (PDT) X-Google-Smtp-Source: AA+uWPxdW2HwMkG9GE6L2mDgYmnafkj5Bd6+b5NjcK6Z6V12PC2NeuaE+BF6bWTNe7Jqrm1ll9rY X-Received: by 2002:a17:902:528a:: with SMTP id a10-v6mr26698481pli.199.1534378250450; Wed, 15 Aug 2018 17:10:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1534378250; cv=none; d=google.com; s=arc-20160816; b=egro+9srWh3ldHV8hKednvB1dSAmxvsvkze9WPaoftTOjSEa94z59pU2S2iwOVkUHi FOZEXksSyrE5B3mSHRxSaT0kj78pds4PRSCFBtH63ApOgt9JvVRKxXQdC/d+vRphdbOF 7In72+O6KjPq+lqcJLmg20Sps+9Y5JPb/mEMq5L19PkRfTMNr2Q0wUiHjB4poawWlG0F XvDY2dZhsJMUXY3f9vlR1B2TZS1dXObl27UKcndmEsiZa+CEj/rU/xbdxwyC6AU5Q0lM OXPGRP5gU3rQHT9UEtVFh9tYQE1idEzJWVYMxboN34Idx19HaMBeMSGFk00ikm9MWH/l QBhA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :dlp-reaction:dlp-version:dlp-product:content-language :accept-language:in-reply-to:references:message-id:date:thread-index :thread-topic:subject:cc:to:from:arc-authentication-results; bh=4jL16xRvDcFh4m9BEqGABZW52bxw6utddqUW7INI4Mk=; b=bxCM41LIVj4RtPAradNA43JsWvNUEm8X2z9zZVvR8KkaozK2xTqzHxdlE7fyt9guZf InPlziyygg2XteyTR4knwSeNsds0CvP6aRVYbuITCpfuZi2Dmi9DGIBVTXiu11agOdiZ oLMUF83/b6tQGPkA8hwWtXmHk+/DY8Sl0g/g6NGqvDlgZD36ZZ80AgUZAho11pxkOvbz +6xcd0DNXh/92VW/5qk+eHL9Q5zQrB+R36k9hXmd9NuwlHlNB33CO7pjYPOE/J7ur/Ya YISgqXLHDodkeuOlOQiz4VvgkSNTJIcl2NE6nHVZt18VeFNorFENvrAcb97HHWhfWBvA 0NbA== ARC-Authentication-Results: i=1; mx.google.com; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t188-v6si22860203pfd.148.2018.08.15.17.10.34; Wed, 15 Aug 2018 17:10:50 -0700 (PDT) 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; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727794AbeHPCWP convert rfc822-to-8bit (ORCPT + 99 others); Wed, 15 Aug 2018 22:22:15 -0400 Received: from mga02.intel.com ([134.134.136.20]:22225 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726185AbeHPCWP (ORCPT ); Wed, 15 Aug 2018 22:22:15 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 15 Aug 2018 16:27:52 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.53,245,1531810800"; d="scan'208";a="65502426" Received: from fmsmsx103.amr.corp.intel.com ([10.18.124.201]) by orsmga008.jf.intel.com with ESMTP; 15 Aug 2018 16:27:37 -0700 Received: from fmsmsx112.amr.corp.intel.com (10.18.116.6) by FMSMSX103.amr.corp.intel.com (10.18.124.201) with Microsoft SMTP Server (TLS) id 14.3.319.2; Wed, 15 Aug 2018 16:27:36 -0700 Received: from fmsmsx105.amr.corp.intel.com ([169.254.4.225]) by FMSMSX112.amr.corp.intel.com ([169.254.5.84]) with mapi id 14.03.0319.002; Wed, 15 Aug 2018 16:27:36 -0700 From: "Howell, Seth" To: Jason Gunthorpe CC: "Walker, Benjamin" , Doug Ledford , "linux-rdma@vger.kernel.org" , "linux-kernel@vger.kernel.org" , Moni Shoua Subject: RE: [PATCH] rdma: move the ib_wr_opcode enum to include/uapi Thread-Topic: [PATCH] rdma: move the ib_wr_opcode enum to include/uapi Thread-Index: AQHUNB7XmXOwV8047EKXXIqMnpdlHaTB4cuA//+UiKA= Date: Wed, 15 Aug 2018 23:27:36 +0000 Message-ID: References: <20180814223303.83556-1-seth.howell@intel.com> <20180815225021.GB31799@ziepe.ca> In-Reply-To: <20180815225021.GB31799@ziepe.ca> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-version: 11.0.400.15 dlp-reaction: no-action x-ctpclassification: CTP_NT x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiZTE5NGNkNjktM2VlOC00YTg4LTk1MTMtYWJhYWU3ZWI1MzljIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiQnRMQmNLa1FsZEc2Y2V3MWxUTnNcL2VERDkxeVRVRzNmVWdQaWhlY01JaW1aMUVjQ1VRMVlLWUlTbFZPelJ1OW4ifQ== x-originating-ip: [10.1.200.108] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Thank you for taking the time to review this issue. The patch you submitted will definitely fix the problem I was facing. -----Original Message----- From: Jason Gunthorpe [mailto:jgg@ziepe.ca] Sent: Wednesday, August 15, 2018 3:50 PM To: Howell, Seth Cc: Walker, Benjamin ; Doug Ledford ; linux-rdma@vger.kernel.org; linux-kernel@vger.kernel.org; Moni Shoua Subject: Re: [PATCH] rdma: move the ib_wr_opcode enum to include/uapi On Tue, Aug 14, 2018 at 03:33:02PM -0700, Seth Howell wrote: > By making this enum accessible to the userspace API, we can avoid > conflicts between the kernel-space ib_wr_opcode and the user-space > ibv_wr_opcode enums. > > When using the rxe software driver interface between kernel and user > space, the enum value IBV_WR_SEND_WITH_INV was being improperly > translated to IB_WR_READ_WITH_INV causing the userspace application to > fail. > > Signed-off-by: Seth Howell > include/rdma/ib_verbs.h | 31 ------------------------------- > include/uapi/rdma/ib_user_verbs.h | 31 > +++++++++++++++++++++++++++++++ > 2 files changed, 31 insertions(+), 31 deletions(-) I've looked at this for a bit now, and I think we should just do the below and not change userspace: From e3c1b1b81373601fa6cbad2ba5fadd2c8cfdfaed Mon Sep 17 00:00:00 2001 From: Seth Howell Date: Tue, 14 Aug 2018 15:33:02 -0700 Subject: [PATCH] IB/rxe: Revise the ib_wr_opcode enum This enum has become part of the uABI, as both RXE and the ib_uverbs_post_send() command expect userspace to supply values from this enum. So it should be properly placed in include/uapi/rdma. In userspace this enum is called 'enum ibv_wr_opcode' as part of libibverbs.h. That enum defines different values for IB_WR_LOCAL_INV, IB_WR_SEND_WITH_INV, and IB_WR_LSO. These were introduced (incorrectly, it turns out) into libiberbs in 2015. The kernel has changed its mind on the numbering for several of the IB_WC values over the years, but has remained stable on IB_WR_LOCAL_INV and below. Based on this we can conclude that there is no real user space user of the values beyond IB_WR_ATOMIC_FETCH_AND_ADD, as they have never worked via rdma-core. This is confirmed by inspection, only rxe uses the kernel enum and implements the latter operations. rxe has clearly never worked with these attributes from userspace. Other drivers that support these opcodes implement the functionality without calling out to the kernel. To make IB_WR_SEND_WITH_INV and related work for RXE in userspace we choose to renumber the IB_WR enum in the kernel to match the uABI that userspace has bee using since before Soft RoCE was merged. This is an overall simpler configuration for the whole software stack, and obviously can't break anything existing. Reported-by: Seth Howell Fixes: 8700e3e7c485 ("Soft RoCE driver") Cc: Signed-off-by: Jason Gunthorpe --- include/rdma/ib_verbs.h | 34 ++++++++++++++++++------------- include/uapi/rdma/ib_user_verbs.h | 20 +++++++++++++++++- 2 files changed, 39 insertions(+), 15 deletions(-) diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h index 5d404c20b49f27..5e51ea9832a0c8 100644 --- a/include/rdma/ib_verbs.h +++ b/include/rdma/ib_verbs.h @@ -1278,21 +1278,27 @@ struct ib_qp_attr { }; enum ib_wr_opcode { - IB_WR_RDMA_WRITE, - IB_WR_RDMA_WRITE_WITH_IMM, - IB_WR_SEND, - IB_WR_SEND_WITH_IMM, - IB_WR_RDMA_READ, - IB_WR_ATOMIC_CMP_AND_SWP, - IB_WR_ATOMIC_FETCH_AND_ADD, - IB_WR_LSO, - IB_WR_SEND_WITH_INV, - IB_WR_RDMA_READ_WITH_INV, - IB_WR_LOCAL_INV, - IB_WR_REG_MR, - IB_WR_MASKED_ATOMIC_CMP_AND_SWP, - IB_WR_MASKED_ATOMIC_FETCH_AND_ADD, + /* These are shared with userspace */ + IB_WR_RDMA_WRITE = IB_UVERBS_WR_RDMA_WRITE, + IB_WR_RDMA_WRITE_WITH_IMM = IB_UVERBS_WR_RDMA_WRITE_WITH_IMM, + IB_WR_SEND = IB_UVERBS_WR_SEND, + IB_WR_SEND_WITH_IMM = IB_UVERBS_WR_SEND_WITH_IMM, + IB_WR_RDMA_READ = IB_UVERBS_WR_RDMA_READ, + IB_WR_ATOMIC_CMP_AND_SWP = IB_UVERBS_WR_ATOMIC_CMP_AND_SWP, + IB_WR_ATOMIC_FETCH_AND_ADD = IB_UVERBS_WR_ATOMIC_FETCH_AND_ADD, + IB_WR_LSO = IB_UVERBS_WR_TSO, + IB_WR_SEND_WITH_INV = IB_UVERBS_WR_SEND_WITH_INV, + IB_WR_RDMA_READ_WITH_INV = IB_UVERBS_WR_RDMA_READ_WITH_INV, + IB_WR_LOCAL_INV = IB_UVERBS_WR_LOCAL_INV, + IB_WR_MASKED_ATOMIC_CMP_AND_SWP = + IB_UVERBS_WR_MASKED_ATOMIC_CMP_AND_SWP, + IB_WR_MASKED_ATOMIC_FETCH_AND_ADD = + IB_UVERBS_WR_MASKED_ATOMIC_FETCH_AND_ADD, + + /* These are kernel only and can not be issued by userspace */ + IB_WR_REG_MR = 0x20, IB_WR_REG_SIG_MR, + /* reserve values for low level drivers' internal use. * These values will not be used at all in the ib core layer. */ diff --git a/include/uapi/rdma/ib_user_verbs.h b/include/uapi/rdma/ib_user_verbs.h index 25a16760de2ad1..1254b51a551a1c 100644 --- a/include/uapi/rdma/ib_user_verbs.h +++ b/include/uapi/rdma/ib_user_verbs.h @@ -763,10 +763,28 @@ struct ib_uverbs_sge { __u32 lkey; }; +enum ib_uverbs_wr_opcode { + IB_UVERBS_WR_RDMA_WRITE = 0, + IB_UVERBS_WR_RDMA_WRITE_WITH_IMM = 1, + IB_UVERBS_WR_SEND = 2, + IB_UVERBS_WR_SEND_WITH_IMM = 3, + IB_UVERBS_WR_RDMA_READ = 4, + IB_UVERBS_WR_ATOMIC_CMP_AND_SWP = 5, + IB_UVERBS_WR_ATOMIC_FETCH_AND_ADD = 6, + IB_UVERBS_WR_LOCAL_INV = 7, + IB_UVERBS_WR_BIND_MW = 8, + IB_UVERBS_WR_SEND_WITH_INV = 9, + IB_UVERBS_WR_TSO = 10, + IB_UVERBS_WR_RDMA_READ_WITH_INV = 11, + IB_UVERBS_WR_MASKED_ATOMIC_CMP_AND_SWP = 12, + IB_UVERBS_WR_MASKED_ATOMIC_FETCH_AND_ADD = 13, + /* Review enum ib_wr_opcode before modifying this */ }; + struct ib_uverbs_send_wr { __aligned_u64 wr_id; __u32 num_sge; - __u32 opcode; + __u32 opcode; /* see enum ib_uverbs_wr_opcode */ __u32 send_flags; union { __be32 imm_data; -- 2.18.0