From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM03-DM3-obe.outbound.protection.outlook.com (mail-dm3nam03on0049.outbound.protection.outlook.com [104.47.41.49]) by dpdk.org (Postfix) with ESMTP id F0603D29E for ; Fri, 24 Mar 2017 14:36:36 +0100 (CET) Received: from CY1PR03CA0032.namprd03.prod.outlook.com (10.174.128.42) by CY1PR03MB2268.namprd03.prod.outlook.com (10.166.207.20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.991.14; Fri, 24 Mar 2017 13:36:35 +0000 Received: from BN1BFFO11FD033.protection.gbl (2a01:111:f400:7c10::1:120) by CY1PR03CA0032.outlook.office365.com (2603:10b6:600::42) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.991.14 via Frontend Transport; Fri, 24 Mar 2017 13:36:35 +0000 Authentication-Results: spf=fail (sender IP is 192.88.168.50) smtp.mailfrom=nxp.com; caviumnetworks.com; dkim=none (message not signed) header.d=none; caviumnetworks.com; dmarc=fail action=none header.from=nxp.com; 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 BN1BFFO11FD033.mail.protection.outlook.com (10.58.144.96) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.977.7 via Frontend Transport; Fri, 24 Mar 2017 13:36:35 +0000 Received: from bf-netperf1.idc ([10.232.134.28]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id v2ODZhg3005481; Fri, 24 Mar 2017 06:36:32 -0700 From: Hemant Agrawal To: CC: , , , , , Date: Fri, 24 Mar 2017 19:05:32 +0530 Message-ID: <1490362538-20854-17-git-send-email-hemant.agrawal@nxp.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1490362538-20854-1-git-send-email-hemant.agrawal@nxp.com> References: <1489756124-10805-1-git-send-email-hemant.agrawal@nxp.com> <1490362538-20854-1-git-send-email-hemant.agrawal@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131348361953042385; (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)(39850400002)(39380400002)(39450400003)(39410400002)(39840400002)(39400400002)(39860400002)(2980300002)(1109001)(1110001)(339900001)(189002)(199003)(9170700003)(8936002)(50226002)(36756003)(53936002)(2351001)(48376002)(2906002)(47776003)(5660300001)(8656002)(77096006)(81166006)(54906002)(189998001)(8676002)(85426001)(356003)(104016004)(110136004)(86362001)(38730400002)(33646002)(76176999)(50466002)(2950100002)(50986999)(6916009)(305945005)(4326008)(105606002)(106466001)(5003940100001); DIR:OUT; SFP:1101; SCL:1; SRVR:CY1PR03MB2268; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; MLV:ovrnspm; MX:1; A:1; PTR:InfoDomainNonexistent; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN1BFFO11FD033; 1:Ri/DyFoz53AoR6wkD7byQ479ifrVuONnu2D/NkEuW8dnZF0ba3iXn8rhSWtgQcqp+MQzrroz927wP+VAmKBnNgWtBVVz/Zb0cm4tiMKTFC+keVEujLRDJnJ2WTfoUqvgE9UeBWox4Mrg4r/XUkY9HPE+3JCjjQGpmEbEHtJ01jYRBt46qJymt72PGfgfepB+CxcesCkB0PkNOctDfmp3dfur3KS4tm43k8mKK2iQ13ZAiSK1bBlWgoGBDDApT0NkJJGd+uL2C12R1rCuhUE620TDdid3NaOYQaQdpu5RGsy3/jTZ9Vp/xw6QPWNqaW41vtgiGeZNNKYxArgIveLdU7vffBbojKw4+Fz8j0u9r1kHHohZY56E7qUQxfN1iXLT743RWoaoB3ORxgQ9f6uXRrZOb1Ha+cGNtNL+uJsEMz1pUWUTWZe37QhotG0KNqflFVxqi7NtFDD6NF+O8+zKPapHndSwfzJy55YoaEwz6AzEB62ARVbriz9/hwdHyfXtUnG9HWMTtzp/aE0Ibq6ufS6urwY7HCROOGA0r7RSS1/I+ghDK4cd5NdjdO0xZ+y1KIx5z4VK390NRdczoeFuRJ8edg1rKqnF61HM+ao/PY+QmDL+mGifNY7Vf39DIpgT2n+4jO0Z0YIPYdilrsoEXA== MIME-Version: 1.0 Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: 07e2236f-9ed7-411e-fe71-08d472baca7e X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001);SRVR:CY1PR03MB2268; X-Microsoft-Exchange-Diagnostics: 1; CY1PR03MB2268; 3:d1za1Jh+bfpfxAW5nYX32mVGLmTsHBafJ5r8OeU02ppV7rDA1AekGnOCf6+hv2LIvSD19J2sqY5o14HVKZ0tBi1LTT5mMngK5Z8YIsFJ0KEciSDZdcsgJnu79SMkeFWDC7rio53x5ROhuLTHwmghOFUqjxyu3Ao2tufGCnSuJf78OAy69mZaK6c2pi53WaSjNCezJhinsJ5iLtObdtVAEGgpqimV0h3bZgvUhLehweVAuMSoMSEvYRQVoKkRYYk6rGcyDsxyGj1HCvQ6em2ZO/JLk6QqFLJAL4s6NcT/jGSFXb5ggtQG2fV4c6ynbitexxZNhmFev/AEibcsYfwdUpzKZcBcKlV0LstQhS3AGTzY5o6xAJT4oraq+3ILup+A; 25:tZ5V2V0scF+e/PuKhvzxrLeVPsrSUMk/E9vDnHaVh9T53DSgcyPF1pbYJAEsrU83oTkT9hYL87V0GBB9HbQk+1bxrcuRc4i0ZXAPNZBfiyhf8abIfhOG63U1klqotwRMpbaYrLx78xOD8flnGYkDfPIohp1mRazeBohsByHkf4SvRGLElX0PoXkmh+6GXyVIgciQsa6acYB+9Z9FkxtnFJIOigc4p+ZEHjr56ZV4rMqN7fZhhJupqMyUMym773QH6GWZRI93/WZgWaXMhocHQ+ucHSkg85yGXpMkHGOtNP4zdk6mpmMZN6m0I58mpdB915Ca1L3rwxFZ/0AVr4wbnyZNyqluDrKmMqQYFrUwn38H+cax2y7yXLV5j+Naa8U8BTGFJcHNEA/L0FEsn0AyQmYsEFrH1wL2JM+0N8wox3AGKFeBRYAYHkf7E52M2n8Bd0eN77IT9D9vbtwibNAXXw== X-Microsoft-Exchange-Diagnostics: 1; CY1PR03MB2268; 31:7EqJr09B3QVUS7LrtNLHgUa979GGqXVyiLi/VmnrGDqJBp+F8xhlLYLoZPQZGD58MkF8aNKTubjMpFTztlxQRFNnEwm8p4AIKOUWnT3KLFq5lowQWWfKsf5ga+rlEBACu+JuWa/Nemz/e96fgd49QlIZZuojw4hWkmKGfq25c5BY27Jce2I86/ZHI0yD0wYjubwqlO2fGHT5JEHU9JBK6mYSPQXeiM4LVSRvyxeBga4hPM8S8muu2ZIeTNmpZHip X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6095060)(601004)(2401047)(13024025)(13015025)(13023025)(8121501046)(5005006)(13018025)(13017025)(3002001)(10201501046)(6055026)(6096035)(20161123556025)(20161123559025)(20161123563025)(20161123561025)(20161123565025); SRVR:CY1PR03MB2268; BCL:0; PCL:0; RULEID:(400006); SRVR:CY1PR03MB2268; X-Microsoft-Exchange-Diagnostics: 1; CY1PR03MB2268; 4:+wgEzfRZ7k10jIvgZct6Lcg8Bb5z8PMYUG+hd8/iAFHul/FT7ekxyw+L5UKA4ZJ4sqYXCXNG8d8Dy2aK8To30gn/kuCkZS02QeB0czr/z/3rqEj/+m+a2CXRknLjkHyYhmcpQOWPQcH2DVzSELnDKgYqNvGMwlIR9FaIdjHWOmesqD5mcA6jhmBLgnO+kvGBwkDM9wq6+QGGB4sQ73mWOJMzzQNZl5v4EbjGLYFPMRixwygZsFB+xOxhnGQG7pcQvwZjvsT7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H1zNCMG5DY9E8UQRUPWM0OYCVzUiDQyMixRqQYXS18qTorMcL/3dqz2D?= =?us-ascii?Q?8AMu19AjyN1Cuw74+ssuJw16KclZF20Vh/PMXp+zHkwU+iElxYDAXUdXsPI4?= =?us-ascii?Q?LglTXitttdN4COcR39451mTrzsaSWakMNuEsLdQE9qxhKB3nCC1+jamthR/+?= =?us-ascii?Q?th/Y4ZmWPBCiWn5QYPD7HQMWyI/OPjRb2n9eek8BhQK4DUI7a/YA7tchu9rx?= =?us-ascii?Q?XinfEcBbBqvIi6h8BcwCQxBR0IvkG189xhDhayziYjGP31kBAoqBdBDscoEN?= =?us-ascii?Q?0JGLkSdlVi/VXtPutMVFeeOfTYVXxZcoEygw378u7bot9NQvg0VQ0ttLoYAy?= =?us-ascii?Q?zzYaTC+4Ekn9p0c3PUfUoUQDuU5FWdMYP5//Zle8kX7wJFLG9lh3xlZk1kjm?= =?us-ascii?Q?rjV95cnAkF/DVK3e5r4GLEj0IR+OaUr54osuBJ2Nyfr4neB1WJnL08KQQ4Yz?= =?us-ascii?Q?oPUvsYfEhumLTATwBJ5Jp8QVa2vTxxbceLHOV5FPs1rKNWn7euz6BcWSOlqX?= =?us-ascii?Q?bRZqiseP4ZE/DkxgLJfs7c1rMl69pu3pDqE+Gugz5N5exatfb5xiXoU+DfDq?= =?us-ascii?Q?V5hpUYXMoeMu89cjAUE7AQj4Sn/8hF0qGNpQK7WrBAHdKcYUfzh04otSo6lx?= =?us-ascii?Q?Hu29OCr5gNlyxVRtzAhZYPJLErcOpjmVUatr70fiTI29eEag7leDfAzvJdp8?= =?us-ascii?Q?UuP3B6da2wMSV1+OsyJCk+LJn4EVdic8DxhO6CAb9ogu1MJ6/8nT2LZPO61K?= =?us-ascii?Q?fZ2SxMPTxAY1kTHqdqtgy70AEmRkbiZPdhk?= X-Microsoft-Exchange-Diagnostics: 1; CY1PR03MB2268; 6:elUrbnmKYb8YZO4i0ZJzEafck4NRFqfVNznTFheulYRzagjbEdqrWbOi1q5yppwBGdTLKrtPeEVGM6EquhnInWqAyjizy7lBERocyvGG5gX3YY54VGzKD+vz0gsV/5H4gphucPwjb+y70sK7MUqi3lqUa3FkMev45YXlKHwZNJrJmE/sEskur7+EHXFDLR1asYd+50LETiUJGrCc+JerzWpYnRx9CJ7gP1Ple//MbgN98mo6nFf4h5yqYwyjVRT0TRRzTpHw9k9NQf3vg6x/5yeZARw02i1f3daLT4SyZ5/ysY3IqjO9TZHyq81S+lJqfN3Z8pbcNk0tnqY/kH355X4YvBeBZ/AFzi6SC+Gm04Vd5nvPbO2/0a7yPPTagjiKEimAAOoWnjWa4qGbZhebjb7SB8jhQHD9DUOLm1ske8c=; 5:yn/BpzdrltzZD6To4VdmP2B9PEHnBd/3FTixoHgMbsTL8G50bi34fU8NTFGKdWTh1Ut1i1q804bdZghCPfcZgLY5vpcaGu0Pk4LnVfrIcGNqCR0crkZfpoqo8sVA75zSnbeDb7eDOlC9AsYDqIB6vsmc3foW4BWkOqHMO0IE6lsjbH99SYvCXSewdMtMKXvT; 24:4dllYNqHaXU/KGQRnO27VWz8LDtL9AECdVZ9yWRM1fxgk7XXbKt3BN7NPHsp6ep8Uc17vDYZPrAxfLFvRanjienIzWi4n0dYmvshM+jPY54= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; CY1PR03MB2268; 7:ko51VW7KIo5nTiodX7OmPxT4DH7fdngcP2fczYBfu4t/QHvSpuU8FmSXPfNzoan93JYXYa4+0t2QlJipRwoCzctkStizxDT8ht+n0M43B4VajVy89aoeHiyCzJw/xla0YW1escJhFvuLc+Ek+cibpr4zkTyqi8achE1LaBh4XDeq8ugu3Shs8usUA6WKaKNOuNNZYJyXMuEW/CCZMrYD2CM+VA24TYwMMx62OtGgp/Hw9+bfj6fP3fyYsoteDTXuZiB5JpqRBAHEh9RUN+cc6ZtpYkhnK12Zi7tTWatAKqzfE73f4ob1sAmb04mc/EgMoMkQp0kr2lYAh/KtXmg4aQ== X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Mar 2017 13:36:35.1170 (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: CY1PR03MB2268 Subject: [dpdk-dev] [PATCH v10 16/22] 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: Fri, 24 Mar 2017 13:36:37 -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 8bf1579..34e435f 100644 --- a/drivers/net/dpaa2/dpaa2_ethdev.c +++ b/drivers/net/dpaa2/dpaa2_ethdev.c @@ -588,6 +588,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, @@ -645,6 +729,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