From patchwork Tue Mar 15 15:54:44 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Christoph Lameter (Ampere)" X-Patchwork-Id: 8590001 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 13BC1C0553 for ; Tue, 15 Mar 2016 15:55:07 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 30B2B202AE for ; Tue, 15 Mar 2016 15:55:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 90C70202EC for ; Tue, 15 Mar 2016 15:55:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965097AbcCOPzA (ORCPT ); Tue, 15 Mar 2016 11:55:00 -0400 Received: from resqmta-ch2-04v.sys.comcast.net ([69.252.207.36]:43093 "EHLO resqmta-ch2-04v.sys.comcast.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965102AbcCOPy7 (ORCPT ); Tue, 15 Mar 2016 11:54:59 -0400 Received: from resomta-ch2-04v.sys.comcast.net ([69.252.207.100]) by resqmta-ch2-04v.sys.comcast.net with comcast id WFtw1s0052AWL2D01Fuybr; Tue, 15 Mar 2016 15:54:58 +0000 Received: from gentwo.org ([98.222.162.64]) by resomta-ch2-04v.sys.comcast.net with comcast id WFux1s00J1PgSZ601Fuynz; Tue, 15 Mar 2016 15:54:58 +0000 Received: by gentwo.org (Postfix, from userid 1001) id 7A01F4CFA6; Tue, 15 Mar 2016 10:54:55 -0500 (CDT) Message-Id: <20160315155455.397561811@linux.com> Date: Tue, 15 Mar 2016 10:54:44 -0500 From: Christoph Lameter To: dledford@redhat.com Cc: linux-rdma@vger.kernel.org, Mark Bloch Cc: Jason Gunthorpe Cc: Steve Wise Cc: Majd Dibbiny Cc: alonvi@mellanox.com Subject: [PATCH 3/3] mlx5: Implement new counter infrastructure References: <20160315155441.222586021@linux.com> Content-Disposition: inline; filename=mlx5_sample_stats DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=comcast.net; s=q20140121; t=1458057298; bh=3BM9XWEs0QmtTwvBNYNP2ttUgyrp1kr7YVTurUPmabM=; h=Received:Received:Received:Message-Id:Date:From:To:Subject: Content-Type; b=KJv/rEwK2LVAeUPaU4kPMx/Me2E7qTbKnbojeRrbkD8ZaULP8PwXIBrURWhdQL8fi Jd6/4tJLvvjEMKLXzGVmP4Nc/ViZ8iKcPeuP6nAL2qYQ4S6TuV3yyDHvufcCwzP7L6 40b3j7H5sJVotOUsQ54bRxmhJkOg3t6G+lr6DsWnBUn/Eo5dnl5i+Rgax0dUV3DtPC TVRtC6eieIYzgbL+0MNfMjhLn2KIkHDGtBiJnLBDZXRmZ2k5TSm8tgE/Oftsm2s4jA JHcRI0uZ9+bj6ZSp4ipdS+7aHf5EII1zGxhIv11Xff6/e49pZuqAlxmJa6dg/di/4G 6pMJJVNaQCpSA== 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.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID,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 This provides the proper infrastructure to add counters to mlx5 and shows some constant integer values in sysfs. It lacks the actual access to the hardware counters. This is a vendor specific issue so I hope that Mellanox can add that. Signed-off-by: Mark Bloch Signed-off-by: Christoph Lameter --- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Index: linux/drivers/infiniband/hw/mlx5/main.c =================================================================== --- linux.orig/drivers/infiniband/hw/mlx5/main.c +++ linux/drivers/infiniband/hw/mlx5/main.c @@ -2122,6 +2122,76 @@ static int mlx5_port_immutable(struct ib return 0; } +#define MLX5_NUM_COUNTERS 28 + +static char *mlx5_counter_names[MLX5_NUM_COUNTERS + 1] = { + "rq_num_lle", + "sq_num_lle", + "rq_num_lqpoe", + "sq_num_lqpoe", + "rq_num_lpe", + "sq_num_lpe", + "rq_num_wrfe", + "sq_num_wrfe", + "sq_num_mwbe", + "sq_num_bre", + "rq_num_lae", + "sq_num_rire", + "rq_num_rire", + "sq_num_rae", + "rq_num_rae", + "sq_num_roe", + "sq_num_tree", + "sq_num_rree", + "rq_num_rnr", + "sq_num_rnr", + "rq_num_oos", + "sq_num_oos", + "rq_num_mce", + "rq_num_udsdprd", + "rq_num_ucsdprd", + "num_cqovf", + "num_eqovf", + "num_baddb", + NULL }; + +#define MLX5_NUM_PORT_COUNTERS 1 +static char *mlx5_port_counter_names[MLX5_NUM_PORT_COUNTERS + 1] = { + "p1", + NULL +}; + +static int mlx5_get_protocol_stats(struct ib_device *ibdev, + struct rdma_protocol_stats *stats, + u8 port) +{ + if (port != 0) { + /* Port Counters */ + stats->name = mlx5_port_counter_names; + stats->dirname = "stats"; + /* + * Just one value for testing. Insert the right + * way to retrieve all the counters here + */ + stats->value[0] = 1; + return 0; + } + + + /* Device Counters */ + + /* No idea how to retrieve the actual counters. Just some values */ + stats->value[0] = 1; + stats->value[1] = 2; + stats->value[2] = 3; + stats->value[3] = 4; + + stats->name = mlx5_counter_names; + stats->dirname = "ib_stats"; + + return 0; +} + static int mlx5_enable_roce(struct mlx5_ib_dev *dev) { int err; @@ -2266,6 +2336,7 @@ static void *mlx5_ib_add(struct mlx5_cor dev->ib_dev.map_mr_sg = mlx5_ib_map_mr_sg; dev->ib_dev.check_mr_status = mlx5_ib_check_mr_status; dev->ib_dev.get_port_immutable = mlx5_port_immutable; + dev->ib_dev.get_protocol_stats = mlx5_get_protocol_stats; mlx5_ib_internal_fill_odp_caps(dev);