From patchwork Thu May 17 10:39:36 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yishai Hadas X-Patchwork-Id: 10406323 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 8AAB360230 for ; Thu, 17 May 2018 10:40:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7520428A78 for ; Thu, 17 May 2018 10:40:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 675D528A5E; Thu, 17 May 2018 10:40: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 AFCFC28A5E for ; Thu, 17 May 2018 10:40:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751815AbeEQKkI (ORCPT ); Thu, 17 May 2018 06:40:08 -0400 Received: from mail-il-dmz.mellanox.com ([193.47.165.129]:45011 "EHLO mellanox.co.il" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751804AbeEQKkD (ORCPT ); Thu, 17 May 2018 06:40:03 -0400 Received: from Internal Mail-Server by MTLPINE1 (envelope-from yishaih@mellanox.com) with ESMTPS (AES256-SHA encrypted); 17 May 2018 13:41:47 +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 w4HAduAd002348; Thu, 17 May 2018 13:39:56 +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 w4HAdujK032428; Thu, 17 May 2018 13:39:56 +0300 Received: (from yishaih@localhost) by vnc17.mtl.labs.mlnx (8.13.8/8.13.8/Submit) id w4HAduOF032427; Thu, 17 May 2018 13:39:56 +0300 From: Yishai Hadas To: linux-rdma@vger.kernel.org Cc: yishaih@mellanox.com, raeds@mellanox.com Subject: [PATCH rdma-core 10/11] mlx5: Add support for counters read Date: Thu, 17 May 2018 13:39:36 +0300 Message-Id: <1526553577-32273-11-git-send-email-yishaih@mellanox.com> X-Mailer: git-send-email 1.8.2.3 In-Reply-To: <1526553577-32273-1-git-send-email-yishaih@mellanox.com> References: <1526553577-32273-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: Raed Salem Reads the hardware counters values and writes them to the output index location in the user supplied array. All counters values are represented as uint64_t types. The read counter values in the array are defined according to the configuration defined by user in the ibv_attach_counters_point_xxx functions. Signed-off-by: Raed Salem Signed-off-by: Yishai Hadas --- providers/mlx5/mlx5.c | 1 + providers/mlx5/mlx5.h | 4 ++++ providers/mlx5/verbs.c | 15 +++++++++++++++ 3 files changed, 20 insertions(+) diff --git a/providers/mlx5/mlx5.c b/providers/mlx5/mlx5.c index 24a69f3..814f7a6 100644 --- a/providers/mlx5/mlx5.c +++ b/providers/mlx5/mlx5.c @@ -144,6 +144,7 @@ static const struct verbs_context_ops mlx5_ctx_common_ops = { .post_srq_ops = mlx5_post_srq_ops, .query_device_ex = mlx5_query_device_ex, .query_rt_values = mlx5_query_rt_values, + .read_counters = mlx5_read_counters, .reg_dm_mr = mlx5_reg_dm_mr, }; diff --git a/providers/mlx5/mlx5.h b/providers/mlx5/mlx5.h index c975dff..4890e65 100644 --- a/providers/mlx5/mlx5.h +++ b/providers/mlx5/mlx5.h @@ -858,6 +858,10 @@ int mlx5_destroy_counters(struct ibv_counters *counters); int mlx5_attach_counters_point_flow(struct ibv_counters *counters, struct ibv_counter_attach_attr *attr, struct ibv_flow *flow); +int mlx5_read_counters(struct ibv_counters *counters, + uint64_t *counters_value, + uint32_t ncounters, + uint32_t flags); static inline void *mlx5_find_uidx(struct mlx5_context *ctx, uint32_t uidx) { diff --git a/providers/mlx5/verbs.c b/providers/mlx5/verbs.c index 780f093..63701b8 100644 --- a/providers/mlx5/verbs.c +++ b/providers/mlx5/verbs.c @@ -3323,3 +3323,18 @@ int mlx5_attach_counters_point_flow(struct ibv_counters *counters, return 0; } + +int mlx5_read_counters(struct ibv_counters *counters, + uint64_t *counters_value, + uint32_t ncounters, + uint32_t flags) +{ + struct mlx5_counters *mcntrs = to_mcounters(counters); + + return ibv_cmd_read_counters(&mcntrs->vcounters, + counters_value, + ncounters, + flags, + NULL); + +}