Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3412510imu; Sun, 11 Nov 2018 14:29:06 -0800 (PST) X-Google-Smtp-Source: AJdET5cC4+IW1YnKlhTCMteW6LnfiW0DNnmuQGtDrGcHxI70jG68e+mXFMUwXH2bjBEUssASgZ3z X-Received: by 2002:a17:902:3a3:: with SMTP id d32-v6mr17746397pld.304.1541975346561; Sun, 11 Nov 2018 14:29:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541975346; cv=none; d=google.com; s=arc-20160816; b=OeTAauAk5XsOksVQ8r0PkfEXd9HPIefM6TgW+jOMe1IvUSswqQcIShH7lAAQmBU3Rm GJkEUtoalTY6UE/S/mmYOADuVL7Q/uwyjug0Ut2Ma5IPFlBkad5jd0Xlo73Ykd6DYf5T 7cjy6AWKXviwhLtoLaGPBeMd6j6h1clWPwehqFWEfd/Nf8sLb4AZ85WshFbOxkUGYrt0 jKsPVd7IZnsbqqTbVPgQvnhtRWkZDM2IU4VVLn0jvEOvsM4SpgBkg9Ch3E+wjtj1LAyb IG4lNuWcYNQjWExPwLaDD1e1YpttN/3foa0uAnUbGDDNUj2LsewK/go7c+hE26iDlMQh WXNg== 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=eS3TLCuEd6qgO49tQoy0zbIxtuKVcA9U/zHBvco1qAU=; b=D0q6OdQ/mHv5LiqWmpUF14FzkrsWwMje6082g34mgbuiFKBzDHa5dUHs0EW2JrjF0e gwETeXE1JxroK69Be6nN6jHRYmmu3Cua6lNuxf4YX2uVCgfah0m77bZB0E+cLgw87r7m p57W/tr8T3JhZyPa/HkkrKx+p1tEKrsNcGPCD78gliYgqBxLNswfcj8Smd26xWoZZ79p bQjtNhdsXnLjLBdCbMcX/1Ct0PNnGiQwx6iWOMFeKTUQFPoKsVDeEwWKVPDFY3dtDPTO RyXFEwGuJdKxKuEJmRCo1zmZjsXWSNwNn2fb2IXJ9X/GJm5sR9Dys800FbiQVa0v9LCg JJfA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=JquOaq8Y; 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 f126-v6si12729700pfa.1.2018.11.11.14.28.51; Sun, 11 Nov 2018 14:29:06 -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=JquOaq8Y; 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 S1732432AbeKLISH (ORCPT + 99 others); Mon, 12 Nov 2018 03:18:07 -0500 Received: from mail.kernel.org ([198.145.29.99]:35336 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732359AbeKLISD (ORCPT ); Mon, 12 Nov 2018 03:18:03 -0500 Received: from localhost (unknown [206.108.79.134]) (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 D161C21707; Sun, 11 Nov 2018 22:28:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1541975287; bh=wBceG6ebtHTZDdroTWjRZodJU2SLFAnSTMrudbnOQzU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JquOaq8YQ9Vu8jm+9KvhCaihf69JP/PIxh8twizlLe98Kd/JSs5DrFVyJN1dOJUKV m3DDmZoYKUQ7MY8zP/thNbvH1Qd43iyOELI2FVuGIFA+ECTVPRLOvZSFnHWgKxYZJv OY2pleqBSgbxOJYPFBFaMKBVaHJOwed9vPdRW1KU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Seth Howell , Jason Gunthorpe Subject: [PATCH 4.19 223/361] IB/rxe: Revise the ib_wr_opcode enum Date: Sun, 11 Nov 2018 14:19:30 -0800 Message-Id: <20181111221650.895302485@linuxfoundation.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181111221619.915519183@linuxfoundation.org> References: <20181111221619.915519183@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review 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: Jason Gunthorpe commit 9a59739bd01f77db6fbe2955a4fce165f0f43568 upstream. 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 Tested-by: Seth Howell Fixes: 8700e3e7c485 ("Soft RoCE driver") Cc: Signed-off-by: Jason Gunthorpe Signed-off-by: Greg Kroah-Hartman --- include/rdma/ib_verbs.h | 34 ++++++++++++++++++++-------------- include/uapi/rdma/ib_user_verbs.h | 20 +++++++++++++++++++- 2 files changed, 39 insertions(+), 15 deletions(-) --- 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. */ --- 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;