From patchwork Thu Oct 4 10:17:25 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yishai Hadas X-Patchwork-Id: 10625853 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 8D82115E8 for ; Thu, 4 Oct 2018 10:20:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 745B628C30 for ; Thu, 4 Oct 2018 10:20:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 61F3028CD3; Thu, 4 Oct 2018 10:20:28 +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=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, 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 070DC28C6E for ; Thu, 4 Oct 2018 10:20:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727234AbeJDRMo (ORCPT ); Thu, 4 Oct 2018 13:12:44 -0400 Received: from mail-il-dmz.mellanox.com ([193.47.165.129]:48517 "EHLO mellanox.co.il" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727256AbeJDRMo (ORCPT ); Thu, 4 Oct 2018 13:12:44 -0400 Received: from Internal Mail-Server by MTLPINE1 (envelope-from yishaih@mellanox.com) with ESMTPS (AES256-SHA encrypted); 4 Oct 2018 12:22:32 +0200 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 w94AHnE2007373; Thu, 4 Oct 2018 13:17:49 +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 w94AHnvr021117; Thu, 4 Oct 2018 13:17:49 +0300 Received: (from yishaih@localhost) by vnc17.mtl.labs.mlnx (8.13.8/8.13.8/Submit) id w94AHnsA021116; Thu, 4 Oct 2018 13:17:49 +0300 From: Yishai Hadas To: linux-rdma@vger.kernel.org Cc: yishaih@mellanox.com, markb@mellanox.com, jgg@mellanox.com, majd@mellanox.com, guyle@mellanox.com Subject: [PATCH rdma-core 3/5] verbs: Add IDRs array attribute type to ioctl() interface Date: Thu, 4 Oct 2018 13:17:25 +0300 Message-Id: <1538648247-21003-4-git-send-email-yishaih@mellanox.com> X-Mailer: git-send-email 1.8.2.3 In-Reply-To: <1538648247-21003-1-git-send-email-yishaih@mellanox.com> References: <1538648247-21003-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 Methods sometimes need to get a flexible set of idrs and not a strict set as can be achieved today by the conventional idr attribute. This is an idrs-array-like behavior. Since this may be popular used, we add a new IDRS_ARRAY attribute to the generic uverbs ioctl layer. This attribute is embedded in methods, like any other attributes we currently have. We align the user-space code with the respected changes in the kernel. Signed-off-by: Guy Levi Signed-off-by: Yishai Hadas --- libibverbs/cmd_ioctl.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/libibverbs/cmd_ioctl.h b/libibverbs/cmd_ioctl.h index d58d890..df3dc41 100644 --- a/libibverbs/cmd_ioctl.h +++ b/libibverbs/cmd_ioctl.h @@ -394,4 +394,13 @@ fill_attr_in_enum(struct ibv_command_buffer *cmd, uint16_t attr_id, return attr; } +/* Send attributes of kernel type UVERBS_ATTR_TYPE_IDRS_ARRAY */ +static inline struct ib_uverbs_attr * +fill_attr_in_objs_arr(struct ibv_command_buffer *cmd, uint16_t attr_id, + const uint32_t *idrs_arr, size_t nelems) +{ + return fill_attr_in(cmd, attr_id, idrs_arr, + _array_len(sizeof(*idrs_arr), nelems)); +} + #endif