From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM03-BY2-obe.outbound.protection.outlook.com (mail-by2nam03on0071.outbound.protection.outlook.com [104.47.42.71]) by dpdk.org (Postfix) with ESMTP id E8DE07CFC for ; Thu, 30 Nov 2017 14:11:58 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amdcloud.onmicrosoft.com; s=selector1-amd-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=EP91mcZBFoiXqMg/IfG4A8oZ1yEUS6u+HJT0JdYb5gw=; b=i2YIw5lcy9x0nisIMYwaNlfftikIE7RzzBE9gJad/2Zio8ghRzwtGKy7SqOwzmcOgyvnHTWtuZkacSBAX9MzitpiylHG6BR0kJpRrtNy2qZvoHZVD2cKBQbHqI4i7/X/OY9f/Q/2r9OkXPqUh37qF5ynVkcTas8kMID/JqvfYxA= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Ravi1.Kumar@amd.com; Received: from wallaby-smavila.amd.com (202.56.249.162) by DM5PR12MB1514.namprd12.prod.outlook.com (10.172.39.146) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.282.5; Thu, 30 Nov 2017 13:11:56 +0000 From: Ravi Kumar To: dev@dpdk.org Date: Thu, 30 Nov 2017 08:11:09 -0500 Message-Id: <1512047472-118050-13-git-send-email-Ravi1.kumar@amd.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1512047472-118050-1-git-send-email-Ravi1.kumar@amd.com> References: <1512047472-118050-1-git-send-email-Ravi1.kumar@amd.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [202.56.249.162] X-ClientProxiedBy: MA1PR01CA0077.INDPRD01.PROD.OUTLOOK.COM (10.174.56.17) To DM5PR12MB1514.namprd12.prod.outlook.com (10.172.39.146) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 65b0d7b9-9999-4c98-2f9b-08d537f3ef76 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(5600026)(4604075)(4534020)(4602075)(4627115)(201703031133081)(201702281549075)(48565401081)(2017052603286); SRVR:DM5PR12MB1514; X-Microsoft-Exchange-Diagnostics: 1; DM5PR12MB1514; 3:C0KfXuf/Bt3CrrmQL2dSNQkaxmSQOLri+7vhiTfA+H0xN7SH/Fnnc1Eo1TOXrpjl8Q3T/dQoGCIFptXaJ/oHIGGd+STBVEHZz8A1011Sf6YhlpMUvyV/crgSxvhMJoF+pa2Hi+Wx2e65/DrUo+7m7TNb2p3rRPlficsNzrGzF5xSvuTFzHveYqN6z5gz64o14OprKN8d4D/wq34Mlweec7YnGn9XUymJUC1ieIkIwq2ZUaETkFprgH63C+W9BvI/; 25:ukewkM4roqTFnloxe1wAbTUmvY6nsLjuM8gG5Oauu1U6cXRSHCl7C7pse/DiiNJiA+F8NNERDmJRJ+qC3ngPj/Vv4LfbGVvc+uMJ+jkZVPODn5yoj8yTPkQY7uRLG4RGd+05cS/yiDQPpcDWxW98OoQ07T7OnPaMyGurqfwiFMUFs4cVU+m3uLFU+leD31rGatWXz+9aPKI3+HAMbCL3F/nw6rUrig8IKOcA39rtbsb8pJwf9Wgf/RQqnlGV480vsL2ORd5Mr0cs1TyjkJ9Gbq36xJ4QtOJvAx6DTzOYO1hcmwV9sZ8qbYnv/2+7urqVtlnpd/AsABXbO69m/EISqQ==; 31:JSDzZwy6K1ZEDn0Ne+4ClqzC2CEn3pyRJrpc7JsljuvsJOwt+PpoYHjrxKmtESqdYGehRV6j7St+w+lggsmySOkpdAlIZZ9iPJoZF8OSWNm2/YKxNylFIPMYYgii4bFqYH+KJMbKnNejYf6hwvgC8rMN2xRgzTgkVmFPQiOIjvmw40Kl1+5RcZdMitJk48CbIi6gMPzX5k1z1pew6QlxII3koIYInZWzYj122QDwedQ= X-MS-TrafficTypeDiagnostic: DM5PR12MB1514: X-Microsoft-Exchange-Diagnostics: 1; DM5PR12MB1514; 20:501t5As8Wl9M/BLnapas5BGPRtXxm4Xuhl3hBc0TtsakB9S7GNmWD/C7Yv1KNtC6qfaPyKM9GsLgmJ1b9wSxiaWCrndizBR4CmX41sTlknx9v1Az4qpZW8IJn1IM6TZjxEmg/7E8twmqWiUMgPSYKjYuR0Yq/ujW7bRG3lT++iJJ/JvO4b35J8oz2OZiYqPjbqI2aVz5z1a2rG1D9TWyjQTb9w7q0bivIevgJSXTjEUJbqM16HKEMh0HZBnQ7Ve9q71hG0BfbQmI3/yAfreiFPN2Vcyd/C5hH1Gp9YYLEBEQSmivV63wzJbxzf187MK95wFX3MLWOMLfsU+A0D9BTBlW5nkLiefJPtVbPCL3CjpbPxAM7pDqtQqGcmQrSk0GVY8fqVVaUFSlXrbpHautmhYkrhR0kpJPXgz6KAv8iMD2FA9GRI4pU8lxZtvT0H+QVKYhzHRdP3f0FNZmT+Psmuazz+/dahVnZMZ/QOYswGrFIwEqawSenOObgU32zehg; 4:CWKQelv64eZ/8eB0HKLx6dpk3sQqn2CqREj4c5QUMmkt/YrWRH92SSU0jrk+lYDi0JFrGZ64+aLtYteOKZeYJa1li7o+g3fD/RIAnLecsDvECjEUtwFXDWFdB7bd3vHDGhupzHp24jV/QHNS9B6Bjvahv8LZHEg7EkfSuH7WMOxXF75ihGJpiT3hRgy7pwCIprs8joc2y+g94S0jPBTc7KUQayI4LtXWdHs1JsNleqVKPU9OuFLXZ3AkRBdHOD6v4nl7kRG8MxvVPTVgJv7rzuV9sPWYbPRaVFwYvEnSzPw3beeyga0/2fh1nwj7WBVr X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(767451399110); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040450)(2401047)(5005006)(8121501046)(93006095)(93001095)(3231022)(3002001)(10201501046)(6055026)(6041248)(20161123555025)(20161123562025)(20161123564025)(20161123558100)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123560025)(6072148)(201708071742011); SRVR:DM5PR12MB1514; BCL:0; PCL:0; RULEID:(100000803101)(100110400095); SRVR:DM5PR12MB1514; X-Forefront-PRVS: 05079D8470 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(6009001)(366004)(346002)(39860400002)(376002)(199003)(189002)(48376002)(16586007)(6666003)(68736007)(86362001)(316002)(101416001)(2906002)(50466002)(8676002)(51416003)(6486002)(72206003)(50226002)(16526018)(50986010)(76176010)(53416004)(189998001)(7696005)(52116002)(97736004)(53936002)(6916009)(2351001)(2950100002)(105586002)(66066001)(106356001)(3846002)(25786009)(2361001)(81156014)(5660300001)(36756003)(6116002)(47776003)(305945005)(478600001)(8936002)(7736002)(81166006)(41533002); DIR:OUT; SFP:1101; SCL:1; SRVR:DM5PR12MB1514; H:wallaby-smavila.amd.com; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DM5PR12MB1514; 23:BO21q0aTcw+jCWu9PMZOFdKXbP8vUdY9hqKzFm2ky?= =?us-ascii?Q?FMt3qnNpG64eGOmZzSzztRNk6cMG/fXnTBeL7Cepz4ZXnyvbDdYrhICNwfYT?= =?us-ascii?Q?B2IsCmJuyqaWLXCecMJROj1kIBtv/wyatSsIRyhezzZ3xdHu9jlnoP9gB93R?= =?us-ascii?Q?+HdnqcAqvyWW3cr/OCYoccO8WxUeliXzVF0aNDqpWH5XepyvgqBgPrYWmuCP?= =?us-ascii?Q?SUGmDGQtM85Phf2KdaHtaUo9fmDPzS5na/7Y7E4rrPzn7kBwNbcp7TLLYiN6?= =?us-ascii?Q?elDBaU8IVbfNbI/ZpoN+J1Km9aT3/A7LsEBYPStFW14DN5EsL6hdwC8mP68a?= =?us-ascii?Q?8TfRwmnPXNFyBaO+oQt1lSPziBgtgpk/OhMMrnCBlkN7hJFgyBdVftIIMBMH?= =?us-ascii?Q?gclfiIGs4YZrebe6ZeeQLoHxFrKimfvxLoueiuV2y8rJp9CZPSH9cvv8ewMv?= =?us-ascii?Q?duvhvHFZR/y5UViLeJLIUWSDSeWYrWbFHozGXANHiheYRk/+43d2QTudKC6P?= =?us-ascii?Q?UINetNoo8maS7TavWz/HHzv7Km+a6h9L4EIJbGw5u9yQEStOKWVZYU60Y+dU?= =?us-ascii?Q?7ry0kkVazs+4QgokfWkVr+83VG2EwkTQ4cIshyPqIJc7is3BF3UE+38yk6gx?= =?us-ascii?Q?b9BK0vkyP64QX+Sil0zSthzyzDor8ECc9Z24E/pPm/B/YYKLpxrrZYYtmhnu?= =?us-ascii?Q?47wgwx4NgxxCc0mCZrctmovomd/8b3WKIvOLyFUdHqRyF91OtgAwN7iIfqoG?= =?us-ascii?Q?AZ1IgcfpaWuRsX5d1qfdF663fSh3pFR1LKjlUINWq9lyJjmriL/oIlP+gSf8?= =?us-ascii?Q?W1N80W8A2khh/qfhN02rC4hN6WRJG1wzP7yfTffrqnyi6PxUJ+GFnfrod/J3?= =?us-ascii?Q?ZBPGOSacHiC7VejJd8oeghsLqKXOej2kBNJaRMFdOWwRgkk1qwJpR1BSNwlX?= =?us-ascii?Q?gacO9lfHpOYwcrt296oLWZyslXtaE10R9Z5HQdYf3O85WZBIItKiMyLVdr77?= =?us-ascii?Q?NCbY/qGXtjzBhR944BvMC+UWx06tuDOn+z685LB8h5UToEdfP1gy48u4pRUI?= =?us-ascii?Q?JU8OY9IcGM6JZ3Ofawx2IzTeRhMvFKpUCi4lkA10p1I6JIW05FN4a6+N9Fz2?= =?us-ascii?Q?IM6ur+1X1yQ36MoYM/whRNXXfmjzNhIIkA93Zs5I/u+k2y44FLUbA=3D=3D?= X-Microsoft-Exchange-Diagnostics: 1; DM5PR12MB1514; 6:6KHLsQseXt1w0v0evyLCCGQxvArDjZ1U6dC68fpcGnsPfc7fCDTjOH9NMlQmotn6sHV+OPTOKE9vC1JRNdeZVd551PMYj5NDGD5rTnktWVBaE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MF5Xz3z7be0Sg+q4+bQLx2dQw2svdheYmemG0GJZ8qnWfKhsddSE6+JSmqRPJutdaTC2kJ8CKDz X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Nov 2017 13:11:56.8905 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 65b0d7b9-9999-4c98-2f9b-08d537f3ef76 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR12MB1514 Subject: [dpdk-dev] [PATCH 13/16] net/axgbe: add generic transmit and receive stats support X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Nov 2017 13:11:59 -0000 Signed-off-by: Ravi Kumar --- drivers/net/axgbe/axgbe_ethdev.c | 51 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/drivers/net/axgbe/axgbe_ethdev.c b/drivers/net/axgbe/axgbe_ethdev.c index d476632..84adf96 100644 --- a/drivers/net/axgbe/axgbe_ethdev.c +++ b/drivers/net/axgbe/axgbe_ethdev.c @@ -142,6 +142,9 @@ static void axgbe_dev_allmulticast_enable(struct rte_eth_dev *dev); static void axgbe_dev_allmulticast_disable(struct rte_eth_dev *dev); static int axgbe_dev_link_update(struct rte_eth_dev *dev, int wait_to_complete); +static int axgbe_dev_stats_get(struct rte_eth_dev *dev, + struct rte_eth_stats *stats); +static void axgbe_dev_stats_reset(struct rte_eth_dev *dev); static void axgbe_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info); static void axgbe_dev_interrupt_handler(void *param); @@ -201,6 +204,8 @@ static const struct eth_dev_ops axgbe_eth_dev_ops = { .allmulticast_enable = axgbe_dev_allmulticast_enable, .allmulticast_disable = axgbe_dev_allmulticast_disable, .link_update = axgbe_dev_link_update, + .stats_get = axgbe_dev_stats_get, + .stats_reset = axgbe_dev_stats_reset, .dev_infos_get = axgbe_dev_info_get, .rx_queue_setup = axgbe_dev_rx_queue_setup, .rx_queue_release = axgbe_dev_rx_queue_release, @@ -413,6 +418,52 @@ axgbe_dev_link_update(struct rte_eth_dev *dev, return old_link_status == dev->data->dev_link.link_status ? -1 : 0; } +static int +axgbe_dev_stats_get(struct rte_eth_dev *dev, + struct rte_eth_stats *stats) +{ + struct axgbe_rx_queue *rxq; + struct axgbe_tx_queue *txq; + unsigned int i; + + for (i = 0; i < dev->data->nb_rx_queues; i++) { + rxq = dev->data->rx_queues[i]; + stats->q_ipackets[i] = rxq->pkts; + stats->ipackets += rxq->pkts; + stats->q_ibytes[i] = rxq->bytes; + stats->ibytes += rxq->bytes; + } + for (i = 0; i < dev->data->nb_tx_queues; i++) { + txq = dev->data->tx_queues[i]; + stats->q_opackets[i] = txq->pkts; + stats->opackets += txq->pkts; + stats->q_obytes[i] = txq->bytes; + stats->obytes += txq->bytes; + } + + return 0; +} + +static void +axgbe_dev_stats_reset(struct rte_eth_dev *dev) +{ + struct axgbe_rx_queue *rxq; + struct axgbe_tx_queue *txq; + unsigned int i; + + for (i = 0; i < dev->data->nb_rx_queues; i++) { + rxq = dev->data->rx_queues[i]; + rxq->pkts = 0; + rxq->bytes = 0; + rxq->errors = 0; + } + for (i = 0; i < dev->data->nb_tx_queues; i++) { + txq = dev->data->tx_queues[i]; + txq->pkts = 0; + txq->bytes = 0; + txq->errors = 0; + } +} static void axgbe_dev_info_get(struct rte_eth_dev *dev, -- 2.7.4