From patchwork Tue Sep 12 12:53:04 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yishai Hadas X-Patchwork-Id: 9949135 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 3E407603F3 for ; Tue, 12 Sep 2017 12:53:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2FEFF28F34 for ; Tue, 12 Sep 2017 12:53:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2509828F3A; Tue, 12 Sep 2017 12:53:29 +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=-6.9 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY 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 BC87F28F6E for ; Tue, 12 Sep 2017 12:53:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751289AbdILMxY (ORCPT ); Tue, 12 Sep 2017 08:53:24 -0400 Received: from mail-il-dmz.mellanox.com ([193.47.165.129]:52394 "EHLO mellanox.co.il" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751379AbdILMxX (ORCPT ); Tue, 12 Sep 2017 08:53:23 -0400 Received: from Internal Mail-Server by MTLPINE1 (envelope-from yishaih@mellanox.com) with ESMTPS (AES256-SHA encrypted); 12 Sep 2017 15:53:19 +0300 Received: from vnc17.mtl.labs.mlnx (vnc17.mtl.labs.mlnx [10.7.2.17]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id v8CCrJ6u031219; Tue, 12 Sep 2017 15:53:19 +0300 Received: from vnc17.mtl.labs.mlnx (vnc17.mtl.labs.mlnx [127.0.0.1]) by vnc17.mtl.labs.mlnx (8.13.8/8.13.8) with ESMTP id v8CCrJF3023909; Tue, 12 Sep 2017 15:53:19 +0300 Received: (from yishaih@localhost) by vnc17.mtl.labs.mlnx (8.13.8/8.13.8/Submit) id v8CCrJQ1023908; Tue, 12 Sep 2017 15:53:19 +0300 From: Yishai Hadas To: linux-rdma@vger.kernel.org Cc: yishaih@mellanox.com, guyle@mellanox.com, majd@mellanox.com Subject: [PATCH rdma-core 2/6] mlx4: Introduce the direct verb mlx4dv_set_ctx_attr Date: Tue, 12 Sep 2017 15:53:04 +0300 Message-Id: <1505220788-23849-3-git-send-email-yishaih@mellanox.com> X-Mailer: git-send-email 1.8.2.3 In-Reply-To: <1505220788-23849-1-git-send-email-yishaih@mellanox.com> References: <1505220788-23849-1-git-send-email-yishaih@mellanox.com> 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: Guy Levi mlx4dv_set_ctx_attr lets the user application to set for a mlx4 context varied attributes which are exposed in mlx4dv.h. First attribute type which is introduced here is used to set the WQs range size. Signed-off-by: Guy Levi Reviewed-by: Yishai Hadas --- debian/ibverbs-providers.symbols | 1 + providers/mlx4/libmlx4.map | 1 + providers/mlx4/mlx4.c | 17 +++++++++++++++++ providers/mlx4/mlx4dv.h | 13 ++++++++++++- 4 files changed, 31 insertions(+), 1 deletion(-) diff --git a/debian/ibverbs-providers.symbols b/debian/ibverbs-providers.symbols index 34d1315..cb21dc5 100644 --- a/debian/ibverbs-providers.symbols +++ b/debian/ibverbs-providers.symbols @@ -3,6 +3,7 @@ libmlx4.so.1 ibverbs-providers #MINVER# mlx4dv_init_obj@MLX4_1.0 15 mlx4dv_query_device@MLX4_1.0 15 mlx4dv_create_qp@MLX4_1.0 15 + mlx4dv_set_context_attr@MLX4_1.0 15 libmlx5.so.1 ibverbs-providers #MINVER# MLX5_1.0@MLX5_1.0 13 MLX5_1.1@MLX5_1.1 14 diff --git a/providers/mlx4/libmlx4.map b/providers/mlx4/libmlx4.map index 6de4348..ac2c772 100644 --- a/providers/mlx4/libmlx4.map +++ b/providers/mlx4/libmlx4.map @@ -5,5 +5,6 @@ MLX4_1.0 { mlx4dv_init_obj; mlx4dv_query_device; mlx4dv_create_qp; + mlx4dv_set_context_attr; local: *; }; diff --git a/providers/mlx4/mlx4.c b/providers/mlx4/mlx4.c index 600daea..6158924 100644 --- a/providers/mlx4/mlx4.c +++ b/providers/mlx4/mlx4.c @@ -443,3 +443,20 @@ int mlx4dv_query_device(struct ibv_context *ctx_in, return 0; } + +int mlx4dv_set_context_attr(struct ibv_context *context, + enum mlx4dv_set_ctx_attr_type attr_type, + void *attr) +{ + struct mlx4_context *ctx = to_mctx(context); + + switch (attr_type) { + case MLX4DV_SET_CTX_ATTR_LOG_WQS_RANGE_SZ: + ctx->log_wqs_range_sz = *((uint8_t *)attr); + break; + default: + return ENOTSUP; + } + + return 0; +} diff --git a/providers/mlx4/mlx4dv.h b/providers/mlx4/mlx4dv.h index 5a47e65..453de55 100644 --- a/providers/mlx4/mlx4dv.h +++ b/providers/mlx4/mlx4dv.h @@ -498,5 +498,16 @@ void mlx4dv_set_data_seg(struct mlx4_wqe_data_seg *seg, int mlx4dv_query_device(struct ibv_context *ctx_in, struct mlx4dv_context *attrs_out); -#endif /* _MLX4DV_H_ */ +enum mlx4dv_set_ctx_attr_type { + /* Attribute type uint8_t */ + MLX4DV_SET_CTX_ATTR_LOG_WQS_RANGE_SZ = 0, +}; +/* + * Returns 0 on success, or the value of errno on failure + * (which indicates the failure reason). + */ +int mlx4dv_set_context_attr(struct ibv_context *context, + enum mlx4dv_set_ctx_attr_type attr_type, + void *attr); +#endif /* _MLX4DV_H_ */