From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM01-SN1-obe.outbound.protection.outlook.com (mail-sn1nam01on0053.outbound.protection.outlook.com [104.47.32.53]) by dpdk.org (Postfix) with ESMTP id 324F6FA83 for ; Tue, 17 Jan 2017 14:20:49 +0100 (CET) Received: from BN3PR0301CA0033.namprd03.prod.outlook.com (10.160.180.171) by BN1PR0301MB0737.namprd03.prod.outlook.com (10.160.78.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.845.12; Tue, 17 Jan 2017 13:20:47 +0000 Received: from BL2FFO11FD013.protection.gbl (2a01:111:f400:7c09::158) by BN3PR0301CA0033.outlook.office365.com (2a01:111:e400:4000::43) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.845.12 via Frontend Transport; Tue, 17 Jan 2017 13:20:47 +0000 Authentication-Results: spf=fail (sender IP is 192.88.168.50) smtp.mailfrom=nxp.com; nxp.com; dkim=none (message not signed) header.d=none;nxp.com; dmarc=fail action=none header.from=nxp.com;nxp.com; dkim=none (message not signed) header.d=none; Received-SPF: Fail (protection.outlook.com: domain of nxp.com does not designate 192.88.168.50 as permitted sender) receiver=protection.outlook.com; client-ip=192.88.168.50; helo=tx30smr01.am.freescale.net; Received: from tx30smr01.am.freescale.net (192.88.168.50) by BL2FFO11FD013.mail.protection.outlook.com (10.173.160.221) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.803.8 via Frontend Transport; Tue, 17 Jan 2017 13:20:44 +0000 Received: from bf-netperf1.idc ([10.232.134.28]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id v0HDJ8mZ021741; Tue, 17 Jan 2017 06:20:41 -0700 From: Hemant Agrawal To: CC: , , , , , , Hemant Agrawal Date: Wed, 18 Jan 2017 00:22:49 +0530 Message-ID: <1484679174-4174-29-git-send-email-hemant.agrawal@nxp.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1484679174-4174-1-git-send-email-hemant.agrawal@nxp.com> References: <1482988612-6638-1-git-send-email-shreyansh.jain@nxp.com> <1484679174-4174-1-git-send-email-hemant.agrawal@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131291328471058342; (91ab9b29-cfa4-454e-5278-08d120cd25b8); () X-Forefront-Antispam-Report: CIP:192.88.168.50; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(336005)(7916002)(39410400002)(39400400002)(39380400002)(39860400002)(39850400002)(39840400002)(39450400003)(2980300002)(1110001)(1109001)(339900001)(189002)(199003)(106466001)(105606002)(77096006)(189998001)(86362001)(76176999)(85426001)(54906002)(50466002)(5003940100001)(2351001)(68736007)(48376002)(47776003)(8656002)(36756003)(38730400001)(110136003)(81156014)(8936002)(33646002)(50986999)(6916009)(8676002)(81166006)(2950100002)(50226002)(626004)(5660300001)(92566002)(97736004)(2906002)(104016004)(305945005)(356003)(30001)(4326007); DIR:OUT; SFP:1101; SCL:1; SRVR:BN1PR0301MB0737; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BL2FFO11FD013; 1:13PfkPGkpcJw9WixFL4JnNtVY//YoYw806TT1K8NIK17MjgN3UfA9lqfw6FF407jROXwajTrOCTQM5sEGYay4nReTPvoqlkHjl7iRWiEg1wt/Lbx2MWyTMYUJ2kDhInjo4d0btocBg9lY+nQXmCE41KfwWVuSkiEu0yAOpjRsdZaEg4FLlPHZdqG6I5ljGabJ32JA4JItryp2EQfCeOzqMsmDfz/1rBZWANUM/Lrzth8MmXB+Cs6G2Uwf0tibU78zySuEDHChH7P8qs7uuF3aNqcGVz/CMvtLTq3PK1TgCsebP5FR+0LgppF9kXvWf0LTbo4rx8W8yTUnT3pXFG68bKcDBLpG8INLIYQS+CWlzcOrj6DjIe340pp5dafk815YsmKcfLByTBTPaTWywA92gYH/4Hl2Pwaz7dZBCuGrwOaPly4Xda2WtuB8Q9VZREUhByt2SXlH8EQgF869c7YNKPDvnyZDI6IUMq2zG13v7xFaV66oj1VAhdtutw9D/oHbLESP6jMRXXexYSi1prbbPohbu+b+4lhLyJ+1+bctxOJfAcUcKEgSQNnh6lN178vS0fpXiux+eVqlz+P9egwLu46NrYgroee9bHGhFuCf+OKQGTuGDFQ1IaznxQAWiQTKtTnnnPpDt5UatLs83CR9d124Tmlf41pygWdDZwQhQmDSACbLyvBTC+UlSfd/80uWS0mdAGWmQT4SthPPw7nwGw3Bw3YLd9yUOjGNEGBRBQa310kszTjG+WOzdUPLZeL MIME-Version: 1.0 Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: 00cee05f-18f2-4678-3cb6-08d43edba5ff X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001); SRVR:BN1PR0301MB0737; X-Microsoft-Exchange-Diagnostics: 1; BN1PR0301MB0737; 3:1GCs49x14eqP/PbEqR5g6XKx/K5fuJ+5FOzF4UaoG77fK499/wVcQ3LNw+GI+PHKC2kphs12pWSOf0H5eXWOpztsd69Guwhnc9qZ9k4qw1X6Psqz1FS2h5YQ1bSyyISLO/wtF+Jk8WcfZbr+laYt9vUjHdiEp3D2+MNkDpvOKyMpyF2TGksG6EUfv7GvFLeqhjrYr96MHE9TpU/p36CEIrwb6ZLx1C7QYcI+f+QWbAfa0jK8DKPaYUmHF9lEJjOLdVqS+K4faWTdPQW8J4UDQcGe32BN+KaosZr9ojbkvkExEc8hTp7YVq+HtvAB8R0i7NcRc45xg8U2zuOAvJGbI/QAlLRfxHLC4CAwHlxWDu1KmsHBO0zq02P2JI1pgVdI X-Microsoft-Exchange-Diagnostics: 1; BN1PR0301MB0737; 25:pVIsJFVjxX65a+fUbV4LP7rKcbe/tYWRvXxzqpyJZyKMVsXLC7W9XQF+HXZ/7xMb3K03mw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UriScan:(185117386973197); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6095060)(601004)(2401047)(5005006)(8121501046)(13017025)(13023025)(13024025)(13015025)(13018025)(10201501046)(3002001)(6055026)(6096035)(20161123565025)(20161123563025)(20161123556025)(20161123561025)(20161123559025); SRVR:BN1PR0301MB0737; BCL:0; PCL:0; RULEID:(400006); SRVR:BN1PR0301MB0737; X-Microsoft-Exchange-Diagnostics: 1; BN1PR0301MB0737; 4:FxS5/A9j6VuMNYGWqI4JUePMcMBKgcF8Ja0w/z2YjH7ZFusQLxoAhzqCTTcxLVDcGK64tnV0RXVxn8i1+NREuNFClVWLGzD/ePY1kKWgZ+91XiMTBUJ1v+Is9lrzD2TNURuL52t/WcpUeYuXEsnJLmgKSb5M7AhMe3gZXNuv/ZvlyKV1ivDlcIOH3OcxSTeXC9cs0X+apA2R/fnRG2Y1VtDpb3Yz41LM3cSHfbWOu1cNIqYqVPQbX3KW2lzQCksP3y8M535WyVtogaC62yaShNerqFSdQvHNT445BM57i8pALZ1S4tTzEYjgbCmqqSqWEKnJxgVLADGYgFEBHj7+trWiwX5tvPxCdqyN6cLMPEEIvazDxLjcMoxuGf+jJDxl9+aKR86zje9xiDT8/fy0fUOJpNo+8oR/5xewrby1nZJRuS0IRsJdp0dTK7YMFnz1q/fwjxRLEtXPSIXEMCvLINJaSzyWC5KJiFL9SfyvpP6riLnUYZ+N/DBwUIbvJI4084teszSeoYIojWon+Lyqqa4Ez96KTb6QU80FpvVf5S5L5Gs+hckHa4u4gk+u5peF5Ka3BNKX3hwmzQ3YmurZcgeRAESiMELiyTNHYaCgMc5YpqWGdPulCuXBY0joC3k2UmcBnuhSCNh4aUdZMiL9xbEnx7HuCOlO09pzTUpQ/F/L3Q63r0iUcf2nEhtFmGXH7Hhvb5eHDyn4aiYMz3kvoSxv6yamjtawW+xODCgefKRrgtBFeOep0wfabXMfIqf2 X-Forefront-PRVS: 01901B3451 X-Microsoft-Exchange-Diagnostics: =?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KCn/YtknUvszAj+AHI1f3TZRzjyZ2DAc/Lowqb2pHFna6102sFrW7DpCmKvhQ+Q3OJNMEoC0RwPtprlhPpB74uUahM/7/8CJ1I2wDRwE9P2HPu9VaZkPUgJ3jrtW3ED36e2aZ5ghGDLGIli4S/4dTdVHBDE3We8Fu6mj5DORR0SQE/G+eDkBuP; 24:Nh58f11PTbOnST99Enq0xCRA0pv2y707Eep0hD4P2ThaSwXSEwwv89+VxcEGUpPNGdkLkDEkyoZsoGyDFFioqtF1JsRUOQgFSzL0JqxrVMI= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BN1PR0301MB0737; 7:6sWLnGULwjUlVPL+zLQlZHnza4uUdTDZP1pCC0FLhGPXUbHx4AxMM1xH7P3hJan4B1rA4guqJhzBjLwLkRGCWMbtVBQLeX/mPHGJcgxzMaxwUHcW/tDV806aZZDe+DO30up7LlvryJ4IFqMxg4HuKHP8jY4zwuL3ALTfDwCQw7iY0Hyj3WolkcU42w6r6xTGrHL7pcHDFl3Q3L8xkgjv+Dwtkiof/4tIv3Y3WHdp/z0HSbrhGBi2c8R0GZ4lHky+w2kTbIRsStNZwn3P/mhN6sNeUb0QuytnMfeQ7u49mo/OTBI27sjA31QSa6NzS8tNSIRcnFy8jIYzJWgmkb9XCIv3TGpsyIwjPiTTqaWaEbUJwo9QvVyYxQqmNC/Jo+cjt8RF7qffAoCT4aF9YsEsBZiNcXyLco+MqG06KCmSoisdl2+TOnqiqw5JVWgV0H0I//75bDe83CDWHy+NFzbJLA== X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jan 2017 13:20:44.7034 (UTC) X-MS-Exchange-CrossTenant-Id: 5afe0b00-7697-4969-b663-5eab37d5f47e X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=5afe0b00-7697-4969-b663-5eab37d5f47e; Ip=[192.88.168.50]; Helo=[tx30smr01.am.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN1PR0301MB0737 Subject: [dpdk-dev] [PATCHv4 28/33] net/dpaa2: basic 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: Tue, 17 Jan 2017 13:20:49 -0000 Signed-off-by: Hemant Agrawal --- doc/guides/nics/features/dpaa2.ini | 1 + drivers/net/dpaa2/dpaa2_ethdev.c | 86 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 87 insertions(+) diff --git a/doc/guides/nics/features/dpaa2.ini b/doc/guides/nics/features/dpaa2.ini index 0660cab..d43f404 100644 --- a/doc/guides/nics/features/dpaa2.ini +++ b/doc/guides/nics/features/dpaa2.ini @@ -12,6 +12,7 @@ RSS hash = Y L3 checksum offload = Y L4 checksum offload = Y Packet type parsing = Y +Basic stats = Y Linux VFIO = Y ARMv8 = Y Usage doc = Y diff --git a/drivers/net/dpaa2/dpaa2_ethdev.c b/drivers/net/dpaa2/dpaa2_ethdev.c index 70264b6..a9d5f10 100644 --- a/drivers/net/dpaa2/dpaa2_ethdev.c +++ b/drivers/net/dpaa2/dpaa2_ethdev.c @@ -589,6 +589,90 @@ return 0; } +static +void dpaa2_dev_stats_get(struct rte_eth_dev *dev, + struct rte_eth_stats *stats) +{ + struct dpaa2_dev_priv *priv = dev->data->dev_private; + struct fsl_mc_io *dpni = (struct fsl_mc_io *)priv->hw; + int32_t retcode; + uint8_t page0 = 0, page1 = 1, page2 = 2; + union dpni_statistics value; + + memset(&value, 0, sizeof(union dpni_statistics)); + + PMD_INIT_FUNC_TRACE(); + + if (!dpni) { + RTE_LOG(ERR, PMD, "dpni is NULL"); + return; + } + + if (!stats) { + RTE_LOG(ERR, PMD, "stats is NULL"); + return; + } + + /*Get Counters from page_0*/ + retcode = dpni_get_statistics(dpni, CMD_PRI_LOW, priv->token, + page0, &value); + if (retcode) + goto err; + + stats->ipackets = value.page_0.ingress_all_frames; + stats->ibytes = value.page_0.ingress_all_bytes; + + /*Get Counters from page_1*/ + retcode = dpni_get_statistics(dpni, CMD_PRI_LOW, priv->token, + page1, &value); + if (retcode) + goto err; + + stats->opackets = value.page_1.egress_all_frames; + stats->obytes = value.page_1.egress_all_bytes; + + /*Get Counters from page_2*/ + retcode = dpni_get_statistics(dpni, CMD_PRI_LOW, priv->token, + page2, &value); + if (retcode) + goto err; + + stats->ierrors = value.page_2.ingress_discarded_frames; + stats->oerrors = value.page_2.egress_discarded_frames; + stats->imissed = value.page_2.ingress_nobuffer_discards; + + return; + +err: + RTE_LOG(ERR, PMD, "Operation not completed:Error Code = %d\n", retcode); + return; +}; + +static +void dpaa2_dev_stats_reset(struct rte_eth_dev *dev) +{ + struct dpaa2_dev_priv *priv = dev->data->dev_private; + struct fsl_mc_io *dpni = (struct fsl_mc_io *)priv->hw; + int32_t retcode; + + PMD_INIT_FUNC_TRACE(); + + if (dpni == NULL) { + RTE_LOG(ERR, PMD, "dpni is NULL"); + return; + } + + retcode = dpni_reset_statistics(dpni, CMD_PRI_LOW, priv->token); + if (retcode) + goto error; + + return; + +error: + RTE_LOG(ERR, PMD, "Operation not completed:Error Code = %d\n", retcode); + return; +}; + /* return 0 means link status changed, -1 means not changed */ static int dpaa2_dev_link_update(struct rte_eth_dev *dev, @@ -646,6 +730,8 @@ .promiscuous_enable = dpaa2_dev_promiscuous_enable, .promiscuous_disable = dpaa2_dev_promiscuous_disable, .link_update = dpaa2_dev_link_update, + .stats_get = dpaa2_dev_stats_get, + .stats_reset = dpaa2_dev_stats_reset, .dev_infos_get = dpaa2_dev_info_get, .dev_supported_ptypes_get = dpaa2_supported_ptypes_get, .mtu_set = dpaa2_dev_mtu_set, -- 1.9.1