From patchwork Tue Oct 27 16:51:40 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matan Barak X-Patchwork-Id: 7498821 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 B29A1BEEA4 for ; Tue, 27 Oct 2015 16:54:52 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C5BA820661 for ; Tue, 27 Oct 2015 16:54:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id CC2ED2081F for ; Tue, 27 Oct 2015 16:54:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S964999AbbJ0Qym (ORCPT ); Tue, 27 Oct 2015 12:54:42 -0400 Received: from [193.47.165.129] ([193.47.165.129]:51671 "EHLO mellanox.co.il" rhost-flags-FAIL-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S964990AbbJ0Qyl (ORCPT ); Tue, 27 Oct 2015 12:54:41 -0400 Received: from Internal Mail-Server by MTLPINE1 (envelope-from matanb@mellanox.com) with ESMTPS (AES256-SHA encrypted); 27 Oct 2015 18:54:01 +0200 Received: from rsws33.mtr.labs.mlnx (dev-r-vrt-064.mtr.labs.mlnx [10.212.64.1]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id t9RGs0aT018446; Tue, 27 Oct 2015 18:54:01 +0200 From: Matan Barak To: Doug Ledford Cc: linux-rdma@vger.kernel.org, Matan Barak , Eran Ben Elisha , Jason Gunthorpe , Christoph Lameter Subject: [PATCH libibverbs 5/5] Add ibv_query_values_ex Date: Tue, 27 Oct 2015 18:51:40 +0200 Message-Id: <1445964700-13235-6-git-send-email-matanb@mellanox.com> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1445964700-13235-1-git-send-email-matanb@mellanox.com> References: <1445964700-13235-1-git-send-email-matanb@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 Add an extension verb to query certain values of device. Currently, only IBV_VALUES_HW_CLOCK is supported, but this verb could support other flags like IBV_VALUES_TEMP_SENSOR, IBV_VALUES_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 --- include/infiniband/verbs.h | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/include/infiniband/verbs.h b/include/infiniband/verbs.h index 3d66726..4829dac 100644 --- a/include/infiniband/verbs.h +++ b/include/infiniband/verbs.h @@ -1234,6 +1234,16 @@ struct ibv_create_cq_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, @@ -1250,6 +1260,8 @@ struct ibv_poll_cq_ex_attr { struct verbs_context { /* "grows up" - new fields go here */ + int (*query_values)(struct ibv_context *context, + struct ibv_values_ex *values); struct ibv_cq *(*create_cq_ex)(struct ibv_context *context, struct ibv_create_cq_attr_ex *); void *priv; @@ -1730,6 +1742,27 @@ ibv_create_qp_ex(struct ibv_context *context, struct ibv_qp_init_attr_ex *qp_ini } /** + * ibv_query_values_ex - Get current @q_values of device, + * @q_values is mask (Or's bits of enum ibv_values_mask) of the attributes + * we need to query. + */ +static inline int +ibv_query_values_ex(struct ibv_context *context, + struct ibv_values_ex *values) +{ + struct verbs_context *vctx; + + vctx = verbs_get_ctx_op(context, query_values); + if (!vctx) + return ENOSYS; + + if (values->comp_mask & ~(IBV_VALUES_MASK_RESERVED - 1)) + return EINVAL; + + return vctx->query_values(context, values); +} + +/** * ibv_query_device_ex - Get extended device properties */ static inline int