From patchwork Thu Dec 24 14:39:22 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 7918351 Return-Path: X-Original-To: patchwork-linux-rdma@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 618E0BEEE5 for ; Thu, 24 Dec 2015 14:44:41 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A731E20035 for ; Thu, 24 Dec 2015 14:44:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9A856203E3 for ; Thu, 24 Dec 2015 14:44:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754271AbbLXOod (ORCPT ); Thu, 24 Dec 2015 09:44:33 -0500 Received: from bombadil.infradead.org ([198.137.202.9]:37837 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754131AbbLXOoa (ORCPT ); Thu, 24 Dec 2015 09:44:30 -0500 Received: from p4ff2eea3.dip0.t-ipconnect.de ([79.242.238.163] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.80.1 #2 (Red Hat Linux)) id 1aC781-000127-In; Thu, 24 Dec 2015 14:44:30 +0000 From: Christoph Hellwig To: dledford@redhat.com Cc: linux-rdma@vger.kernel.org Subject: [PATCH 1/6] IB/uapi: expose uverbs WR opcodes Date: Thu, 24 Dec 2015 15:39:22 +0100 Message-Id: <1450967967-12479-2-git-send-email-hch@lst.de> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1450967967-12479-1-git-send-email-hch@lst.de> References: <1450967967-12479-1-git-send-email-hch@lst.de> MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org See http://www.infradead.org/rpr.html Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This exposes the WR opcodes supported by uverbs as part of the uapi headers. For this I had to create a new uapi/rdma/ib_verbs.h headers so that we don't have to drag ib_user_verbs.h into the main ib_verbs.h. There are now three tiers of WR opcodes: uapi ones that are fixe? and must not change [1], kernel-wide ones that follow the uapi ones and can be reordered at will, and driver-private ones that follow the kernel-wide ones, and will also be frequently reordered. [1] we also assign explicitly values to them just so that this is obvious! Signed-off-by: Christoph Hellwig --- drivers/infiniband/hw/mlx5/mlx5_ib.h | 2 +- include/rdma/ib_verbs.h | 39 ++++++++++++++++-------------------- include/uapi/rdma/ib_user_verbs.h | 2 ++ include/uapi/rdma/ib_verbs.h | 23 +++++++++++++++++++++ 4 files changed, 43 insertions(+), 23 deletions(-) create mode 100644 include/uapi/rdma/ib_verbs.h diff --git a/drivers/infiniband/hw/mlx5/mlx5_ib.h b/drivers/infiniband/hw/mlx5/mlx5_ib.h index d4b2271..2f82a08 100644 --- a/drivers/infiniband/hw/mlx5/mlx5_ib.h +++ b/drivers/infiniband/hw/mlx5/mlx5_ib.h @@ -122,7 +122,7 @@ struct mlx5_ib_pd { #define MLX5_IB_SEND_UMR_FAIL_IF_FREE (IB_SEND_RESERVED_START << 1) #define MLX5_IB_SEND_UMR_UPDATE_MTT (IB_SEND_RESERVED_START << 2) #define MLX5_IB_QPT_REG_UMR IB_QPT_RESERVED1 -#define MLX5_IB_WR_UMR IB_WR_RESERVED1 +#define MLX5_IB_WR_UMR (IB_WR_END + 0) struct wr_list { u16 opcode; diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h index 75fcc97..94509e0 100644 --- a/include/rdma/ib_verbs.h +++ b/include/rdma/ib_verbs.h @@ -60,6 +60,8 @@ #include #include +#include + extern struct workqueue_struct *ib_wq; extern struct workqueue_struct *ib_comp_wq; @@ -1108,34 +1110,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, + /* opcodes directly passed through from 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_SEND_WITH_INV = IB_UVERBS_WR_SEND_WITH_INV, + + /* kernel-internal opcodes: */ + IB_WR_LSO = IB_UVERBS_WR_END, 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, 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. - */ - IB_WR_RESERVED1 = 0xf0, - IB_WR_RESERVED2, - IB_WR_RESERVED3, - IB_WR_RESERVED4, - IB_WR_RESERVED5, - IB_WR_RESERVED6, - IB_WR_RESERVED7, - IB_WR_RESERVED8, - IB_WR_RESERVED9, - IB_WR_RESERVED10, + + /* drivers may use any value greater or equal to IB_WR_END internally */ + IB_WR_END, }; enum ib_send_flags { diff --git a/include/uapi/rdma/ib_user_verbs.h b/include/uapi/rdma/ib_user_verbs.h index 8126c14..358a656 100644 --- a/include/uapi/rdma/ib_user_verbs.h +++ b/include/uapi/rdma/ib_user_verbs.h @@ -38,6 +38,8 @@ #include +#include + /* * Increment this value if any changes that break userspace ABI * compatibility are made. diff --git a/include/uapi/rdma/ib_verbs.h b/include/uapi/rdma/ib_verbs.h new file mode 100644 index 0000000..330175e --- /dev/null +++ b/include/uapi/rdma/ib_verbs.h @@ -0,0 +1,23 @@ +#ifndef _UAPI_RDMA_IB_VERBS_H +#define _UAPI_RDMA_IB_VERBS_H 1 + +/* + * This file contains constants exposed through the uverbs ABI that are also + * used internall by the RDMA stack. It is separte from ib_user_verbs.h to + * having to pull that into the kernel-internal internal ib_verbs.h + */ + +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, + /* 7 is still available */ + IB_UVERBS_WR_SEND_WITH_INV = 8, + IB_UVERBS_WR_END = 9, +}; + +#endif /* _UAPI_RDMA_IB_VERBS_H */