From patchwork Wed Dec 5 13:24:47 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yishai Hadas X-Patchwork-Id: 10714193 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 D66B117DB for ; Wed, 5 Dec 2018 13:25:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C7C772CF37 for ; Wed, 5 Dec 2018 13:25:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B98AE2CF38; Wed, 5 Dec 2018 13:25:17 +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 141FA2CF33 for ; Wed, 5 Dec 2018 13:25:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727520AbeLENZQ (ORCPT ); Wed, 5 Dec 2018 08:25:16 -0500 Received: from mail-il-dmz.mellanox.com ([193.47.165.129]:36137 "EHLO mellanox.co.il" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727468AbeLENZP (ORCPT ); Wed, 5 Dec 2018 08:25:15 -0500 Received: from Internal Mail-Server by MTLPINE1 (envelope-from yishaih@mellanox.com) with ESMTPS (AES256-SHA encrypted); 5 Dec 2018 15:31:10 +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 wB5DP92I000825; Wed, 5 Dec 2018 15:25:09 +0200 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 wB5DP9oY011308; Wed, 5 Dec 2018 15:25:09 +0200 Received: (from yishaih@localhost) by vnc17.mtl.labs.mlnx (8.13.8/8.13.8/Submit) id wB5DP9sc011307; Wed, 5 Dec 2018 15:25:09 +0200 From: Yishai Hadas To: linux-rdma@vger.kernel.org Cc: yishaih@mellanox.com, monis@mellanox.com, guyle@mellanox.com, aviadye@mellanox.com, jgg@mellanox.com, majd@mellanox.com Subject: [PATCH rdma-core 2/6] verbs: Add helper for command interface Date: Wed, 5 Dec 2018 15:24:47 +0200 Message-Id: <1544016291-10815-3-git-send-email-yishaih@mellanox.com> X-Mailer: git-send-email 1.8.2.3 In-Reply-To: <1544016291-10815-1-git-send-email-yishaih@mellanox.com> References: <1544016291-10815-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: Moni Shoua Add fill_attr_in_ptr_array() to store array of elements in a command buffer. Signed-off-by: Moni Shoua Reviewed-by: Guy Levi Signed-off-by: Yishai Hadas --- libibverbs/cmd_ioctl.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libibverbs/cmd_ioctl.h b/libibverbs/cmd_ioctl.h index df3dc41..5587b86 100644 --- a/libibverbs/cmd_ioctl.h +++ b/libibverbs/cmd_ioctl.h @@ -376,6 +376,9 @@ static inline size_t _array_len(size_t size, size_t nelems) #define fill_attr_out_ptr_array(cmd, attr_id, ptr, nelems) \ fill_attr_out(cmd, attr_id, ptr, _array_len(sizeof(*ptr), nelems)) +#define fill_attr_in_ptr_array(cmd, attr_id, ptr, nelems) \ + fill_attr_in(cmd, attr_id, ptr, _array_len(sizeof(*ptr), nelems)) + static inline size_t __check_divide(size_t val, unsigned int div) { assert(val % div == 0);