From patchwork Fri Mar 4 18:38:56 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: 8506961 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 B3DE1C0554 for ; Fri, 4 Mar 2016 18:39:24 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id EE04120268 for ; Fri, 4 Mar 2016 18:39:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 0A6422024D for ; Fri, 4 Mar 2016 18:39:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759549AbcCDSjO (ORCPT ); Fri, 4 Mar 2016 13:39:14 -0500 Received: from resqmta-ch2-08v.sys.comcast.net ([69.252.207.40]:59164 "EHLO resqmta-ch2-08v.sys.comcast.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757489AbcCDSjN (ORCPT ); Fri, 4 Mar 2016 13:39:13 -0500 Received: from resomta-ch2-08v.sys.comcast.net ([69.252.207.104]) by resqmta-ch2-08v.sys.comcast.net with comcast id RueA1s0042Fh1PH01ufCaT; Fri, 04 Mar 2016 18:39:12 +0000 Received: from gentwo.org ([98.222.162.64]) by resomta-ch2-08v.sys.comcast.net with comcast id RufB1s00J1PgSZ601ufBhc; Fri, 04 Mar 2016 18:39:12 +0000 Received: by gentwo.org (Postfix, from userid 1001) id C27FE1060; Fri, 4 Mar 2016 12:39:09 -0600 (CST) Message-Id: <20160304183909.703201393@linux.com> Date: Fri, 04 Mar 2016 12:38:56 -0600 From: Christoph Lameter To: dledford@redhat.com Cc: linux-rdma@vger.kernel.org, Mark Bloch Cc: Jason Gunthorpe Cc: Steve Wise Subject: [RFC 2/2] mlx5: Sample code to exercise new device statistics References: <20160304183854.551339866@linux.com> Content-Disposition: inline; filename=mlx5_sample_code DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=comcast.net; s=q20140121; t=1457116752; bh=Du9TY7+hS1+gxnHA3Iw7aHqCHuW40McbnawFtRtQhEw=; h=Received:Received:Received:Message-Id:Date:From:To:Subject: Content-Type; b=mnoUr89h/+Y3zH1qayyYMEfKjP0HKrkCEQSS+kCMNJOMwm+Z083CDA+JOzSkSTg+O Yw6BuDJOEYwlHIl231KXsqBGUX6X5OSd9ksttyva81PUlU4NkoUw1kb6sl7t/wkDrT VeDQfpCaoQ4229VVbCL8aIzH2bsKXO0gbDq92D4ZOqp67iOlWuqyn6H/5hXHAPHCQd BDXBKe5wyVZfxLS1j1HGO+FGcnriQBWWlqBhWhssSv18oVNJT9MAkqh46FQZN927Ss 9LCq7XKwFw82c+pazFlA0xBJJea0Dq3HjGf/U7JdsNbEka+LQ9hxuKArAhQa9WQN5g Uh/GkZFcpVpdA== 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 Just put some counters out to allow the testing of the new ib statistics. Signed-off-by: Mark Bloch --- drivers/infiniband/core/sysfs.c | 298 ++++++++++++++++------------ drivers/infiniband/hw/cxgb3/iwch_provider.c | 136 +++++++++---- drivers/infiniband/hw/cxgb4/provider.c | 26 ++- drivers/infiniband/hw/mlx5/main.c | 35 ++++ include/rdma/ib_verbs.h | 60 +----- 5 files changed, 335 insertions(+), 220 deletions(-) -- 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 2016-03-03 13:13:50.471454368 -0600 +++ linux/drivers/infiniband/hw/mlx5/main.c 2016-03-03 13:13:50.469454440 -0600 @@ -2122,6 +2122,40 @@ static int mlx5_port_immutable(struct ib return 0; } +static char *names[] = { + "tcpInSegs", + "tcpOutSegs", + "tcpRetransSegs", + "tcpOutRsts", + NULL +}; + +static char *port_names[] = { + "p1", + NULL +}; + +static int mlx5_get_protocol_stats(struct ib_device *ibdev, + struct rdma_protocol_stats *stats, + u8 port) +{ + if (port != 0) { + stats->name = port_names; + stats->dirname = "ib_stats"; + stats->value[0] = 1; + return 0; + } + stats->value[0] = 1; + stats->value[1] = 2; + stats->value[2] = 3; + stats->value[3] = 4; + + stats->name = names; + stats->dirname = "ib_stats"; + + return 0; +} + static int mlx5_enable_roce(struct mlx5_ib_dev *dev) { int err; @@ -2266,6 +2300,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);