From patchwork Wed Feb 24 09:42:02 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yishai Hadas X-Patchwork-Id: 8403421 Return-Path: X-Original-To: patchwork-linux-rdma@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id E1A2A9F2F0 for ; Wed, 24 Feb 2016 09:43:50 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0F403202EC for ; Wed, 24 Feb 2016 09:43:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1C1A9202EB for ; Wed, 24 Feb 2016 09:43:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751413AbcBXJns (ORCPT ); Wed, 24 Feb 2016 04:43:48 -0500 Received: from [193.47.165.129] ([193.47.165.129]:33215 "EHLO mellanox.co.il" rhost-flags-FAIL-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1751155AbcBXJnr (ORCPT ); Wed, 24 Feb 2016 04:43:47 -0500 Received: from Internal Mail-Server by MTLPINE1 (envelope-from yishaih@mellanox.com) with ESMTPS (AES256-SHA encrypted); 24 Feb 2016 11:42:46 +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 u1O9gkCs026474; Wed, 24 Feb 2016 11:42:46 +0200 Received: from vnc17.mtl.labs.mlnx (localhost.localdomain [127.0.0.1]) by vnc17.mtl.labs.mlnx (8.13.8/8.13.8) with ESMTP id u1O9gkA3031512; Wed, 24 Feb 2016 11:42:46 +0200 Received: (from yishaih@localhost) by vnc17.mtl.labs.mlnx (8.13.8/8.13.8/Submit) id u1O9gk6Z031510; Wed, 24 Feb 2016 11:42:46 +0200 From: Yishai Hadas To: dledford@redhat.com Cc: linux-rdma@vger.kernel.org, yishaih@mellanox.com, matanb@mellanox.com, majd@mellanox.com, talal@mellanox.com, ogerlitz@mellanox.com Subject: [PATCH V1 libibverbs 6/8] Add ibv_query_rt_values_ex Date: Wed, 24 Feb 2016 11:42:02 +0200 Message-Id: <1456306924-31298-7-git-send-email-yishaih@mellanox.com> X-Mailer: git-send-email 1.7.11.3 In-Reply-To: <1456306924-31298-1-git-send-email-yishaih@mellanox.com> References: <1456306924-31298-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-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham 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 From: Matan Barak Add an extension verb to query certain real time values of a device. Currently, only IBV_VALUES_MASK_RAW_CLOCK is supported, but this verb could support other flags like IBV_VALUES_MASK_TEMP_SENSOR, IBV_VALUES_MASK_CORE_FREQ, etc. This extension verb only calls the provider. The provider has to query this value somehow and mark the queried values in comp_mask. Signed-off-by: Matan Barak Reviewed-by: Yishai Hadas --- include/infiniband/verbs.h | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/include/infiniband/verbs.h b/include/infiniband/verbs.h index 67a2cb1..49de86c 100644 --- a/include/infiniband/verbs.h +++ b/include/infiniband/verbs.h @@ -1267,6 +1267,16 @@ struct ibv_cq_init_attr_ex { uint32_t flags; }; +enum ibv_values_mask { + IBV_VALUES_MASK_RAW_CLOCK = 1 << 0, + IBV_VALUES_MASK_RESERVED = 1 << 1 +}; + +struct ibv_values_ex { + uint32_t comp_mask; + struct timespec raw_clock; +}; + enum verbs_context_mask { VERBS_CONTEXT_XRCD = 1 << 0, VERBS_CONTEXT_SRQ = 1 << 1, @@ -1283,6 +1293,8 @@ struct ibv_poll_cq_ex_attr { struct verbs_context { /* "grows up" - new fields go here */ + int (*query_rt_values)(struct ibv_context *context, + struct ibv_values_ex *values); struct ibv_cq *(*create_cq_ex)(struct ibv_context *context, struct ibv_cq_init_attr_ex *); struct verbs_ex_private *priv; @@ -1817,6 +1829,27 @@ ibv_create_qp_ex(struct ibv_context *context, struct ibv_qp_init_attr_ex *qp_ini } /** + * ibv_query_rt_values_ex - Get current real time @values of a device. + * @values - in/out - defines the attributes we need to query/queried. + * (Or's bits of enum ibv_values_mask on values->comp_mask field) + */ +static inline int +ibv_query_rt_values_ex(struct ibv_context *context, + struct ibv_values_ex *values) +{ + struct verbs_context *vctx; + + vctx = verbs_get_ctx_op(context, query_rt_values); + if (!vctx) + return ENOSYS; + + if (values->comp_mask & ~(IBV_VALUES_MASK_RESERVED - 1)) + return EINVAL; + + return vctx->query_rt_values(context, values); +} + +/** * ibv_query_device_ex - Get extended device properties */ static inline int