From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM03-BY2-obe.outbound.protection.outlook.com (mail-by2nam03on0077.outbound.protection.outlook.com [104.47.42.77]) by dpdk.org (Postfix) with ESMTP id 7E2066A6E for ; Fri, 17 Mar 2017 14:09:45 +0100 (CET) Received: from BN6PR03CA0080.namprd03.prod.outlook.com (10.164.122.146) by BLUPR03MB181.namprd03.prod.outlook.com (10.255.212.146) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.977.11; Fri, 17 Mar 2017 13:09:43 +0000 Received: from BN1BFFO11FD044.protection.gbl (2a01:111:f400:7c10::1:115) by BN6PR03CA0080.outlook.office365.com (2603:10b6:405:6f::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.961.14 via Frontend Transport; Fri, 17 Mar 2017 13:09:43 +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 BN1BFFO11FD044.mail.protection.outlook.com (10.58.144.107) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.977.7 via Frontend Transport; Fri, 17 Mar 2017 13:09:43 +0000 Received: from bf-netperf1.idc ([10.232.134.28]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id v2HD8pec021077; Fri, 17 Mar 2017 06:09:39 -0700 From: Hemant Agrawal To: CC: , , , , , Date: Fri, 17 Mar 2017 18:38:38 +0530 Message-ID: <1489756124-10805-17-git-send-email-hemant.agrawal@nxp.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1489756124-10805-1-git-send-email-hemant.agrawal@nxp.com> References: <1488545223-25739-1-git-send-email-hemant.agrawal@nxp.com> <1489756124-10805-1-git-send-email-hemant.agrawal@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131342297832610178; (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)(2980300002)(1110001)(1109001)(339900001)(189002)(199003)(9170700003)(5003940100001)(38730400002)(4326008)(110136004)(36756003)(8936002)(8676002)(50986999)(50226002)(81166006)(33646002)(2351001)(76176999)(105606002)(106466001)(356003)(305945005)(5660300001)(77096006)(53936002)(81156014)(8656002)(54906002)(2906002)(47776003)(2950100002)(50466002)(86362001)(48376002)(6916009)(104016004)(85426001)(189998001); DIR:OUT; SFP:1101; SCL:1; SRVR:BLUPR03MB181; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; MLV:ovrnspm; MX:1; A:1; PTR:InfoDomainNonexistent; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN1BFFO11FD044; 1:Zpx8GOC1l+60zPI58iIibrytq3xylUw7Ulw11/crtHP6U7ODYebrqAKTIo7YnftR2xRMU5aoEEQwPuI2wpjheTWDxuD8Vt/bcA230eIiPyDYSNuW+s2NtDQI6T7BJ/zqntiP17rn2lBvLgmnTHd4NQU9lRvS+uTzf7/Q6e3FT4zdDLcQdHLbQ1PbxOFKWDGj0NyxGJ1OaLQTddnNKRqvOFr+/9Ha4gsWpdt0C1E+Q317lZdfOcgg2acY7kKbbN/4jpeIll1YCmWDkeDLvTP+VFL/vu5vw4yRjPYeX7hMx+h9OUHvKl0u95UKYsJG+PXDq288gkAoFcPhwORhXSlG7CF2rwhBrN6mQRgsYG6BHoh/mnt3h1W41nunDXQT+AQRm//xULqbvT02EsafKA/t6qabrU10lOR7E50Q9LLCqbbBznNOxUfbv+dcvtuJK1vK77c7hIjlfag8EuGvJEBQTddPS59zo67KXfY+KUljitLzUtCfwIG9zlDLAfhdvEPWgTwdwoMRbhA5PdF8jaQq6KXoAhuLibwPssdiDdSPGq6m6PVFW0/Pnk7q2nhz9pc+u2EEP8D0dG6hKAlQHNKhkfoJo1d9A20iUgOLyempl+rb85/qSWZIi6mjUEu4nPfmvow7aH2D5GyUi3vy+V2Pyg== MIME-Version: 1.0 Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: ce748f8b-dc54-43ad-7820-08d46d36e0c0 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001);SRVR:BLUPR03MB181; X-Microsoft-Exchange-Diagnostics: 1; BLUPR03MB181; 3:1hA8y0Q3QPwIWt8RHm3LynFi+yYF/xvrdKzVvZBRJ+wDs4yk1+TVw1N1ybAWSz0t6xY4x0WbaIwJFCjrTtipXcoi/Exz6uilIziRxd2Bk2Ek7oRrSz4X6c9icqkcak88ldCHwtOv+MxrIYkDk0NtCLr3yHKObwpv5pq19KAttYBSC2l0E4/RisjN1N6j/ICHpm9nBcmm6OovQR2rYynfvsyu35NFARHeLobTPJKzKOZsvtrTx1m6bN3U6NLtJINTCo3ccx7t9/V6NStlSlznuPKOMTKKblE4u/kBWYrirEBhkblc/oIdyvZUf6LsftoxrHLyJMVFPdu1zBtgizlOeaNQK9flvdh5NThZ99bNqarwOS619VEYg07dZd3BDS+C; 25:xAU/jV9qUCxmtjX1H5JP0Z++JDXAK91Vj5xFyD/90R77joDhVx43P8ns3cZWSxYmiFfpjvxbOceeccH4l/ohe0rY1+rCSmL8pNnrMWkpvkNzEhauseR5NbZnsMBeHLDZuYNdHOldyxWBTW6ZrstNdOkW0lIk4Gd3exmCfmGHQRJqa3nYfnPAyty5W5n+/O0Fi8T9Sc/una9SAv7AE+P8BMEwH0XMa2hRic7yq5ZqY1lXPCG+2UfT1A9fFeSqOpeuQBIxwFYG35oMS91YCtueFWOaSKoITfvnKBu78dAt2POlPBC/eNTslwPk+YAuA0AWleHdQcngx5FLaftKDk11j+1Tgzx+XYE8e78rD2b7BQrxtyX0Sp5FXUQBIT70BMjlvaNjTwQFTznr8k0pxXQMlK6c92qgcVepLWR/ocRipnqphc4zXrT9a1aoUt06rxtxPkt6vWJvt0L2ObMGOZWfSw== X-Microsoft-Exchange-Diagnostics: 1; BLUPR03MB181; 31:D89nDbF1KanqrHgqDUkFVTnIV03KKYI7P8/m8ahXgi0JWm7gfPq34Rn5db5hc/THnrWbdtqdy4Mk1Kmu0fGfaOsmEum+udCXmmCjyN3+lS+I9Qi/rOh7904rsElF2Rl+UNp56shC/646fOMyf498TVHdE5DEtR+DXEw0eD+wj+WrVtmlosTvnHraYejjpnNTrDAtc+HcF9DRdMEzGo6w9mBkGvfJsTN6uXUez3V0WICUbIFCGrxBXrbV91H2ax8ZM4FIud3r++Dhd+YiglJhjA== 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)(8121501046)(13018025)(13023025)(13017025)(13015025)(5005006)(3002001)(10201501046)(6055026)(6096035)(20161123563025)(20161123556025)(20161123561025)(20161123565025)(20161123559025); SRVR:BLUPR03MB181; BCL:0; PCL:0; RULEID:(400006); SRVR:BLUPR03MB181; X-Microsoft-Exchange-Diagnostics: 1; BLUPR03MB181; 4:/+2AS/gT+xfvIiZpwrxTEIL74HeEAyCpia+566qq1nq7+bpnp2mHtIFNOF+Qx53VTFYyVfKufLh2jUFFdaPHCRvXvAXPuxKOcu26772OUJrqgdZAByK6p2QaVKh7aTWP6IkMFphXtBW0t3dz/dXZ3Tl1tjmdaGmZ0JIbKlJY4R7/mfcTvCwya4si+dp+6FLSCR0N4cBUC64lDE77qbcov5P2kWNQ13goLRu+jApFpZ1Gm83SAZoJSbyRIAmmqxEnPQTLRFC1suyLku4Z8K/hxUW8B/lwwPdGbASC8KYS/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+twKlJPROeLGzV84mSHt3WjC9o+ZlHmP64qJd5vJwV5TIARQYh1ijfHdktSkbil3wCNRYEJog2OYixb8GUbNfqxSZNeohBwvX7OLjdQn9DeNXw+KnyWrA/T8BKUF/VK2SdblVtXMoLQ+oNh6cGYo=; 5:WyUiBlDSKAwvUCRQjEL6IX7u5hegcZ3wVRhwNGdKcC48ALwktPs1tp4+qUvRCt8HGyOcAM2j2aa8XSyco5hC3c0wrJh9bFP2kgDUyhwnY2JCgL+trFtivzXTa7XkRmHTBiVYOvuQlpGQhKCeEMEp2EqMqlly0mmTPqu/XVwbh9VN7h9maKQS1srpG+ZvWRwf; 24:uhYa0ycPguglM0d8A48aeTpHzpRLnXl7kfk6owv6gmBT8/atjFJFTK/Y7uhYfnza2DKTCXHrfFHwr0yX34BV6Gne7M9mSKBfmiwAYJ2wTvU= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BLUPR03MB181; 7:PMKj+FQk1bkKkQH5Ovi7zFCaNedUwqtC1aJnyk8E6pmhAk8s9x9IY91jPi4gsEOqvjRT/96ZXASwgYv0PWQ85BjfyiEeh9aFhDcjTxaqHRcLraappFEJdqVz+Q83ZdLvRq4YgK+wqviuB8yMmi71M5FyaQwTye9OK2q2KlgOXw4w/uO17UyS3+KEKkxK807mZRCNNiAR9TBHzV3H/Z0tSCFEXHeVbqCp2+cYX8Msrms9FLwsTaQk1ZzFtHbJnD1g3ZzrfO8gpMuaN5t29lWbFCaRBXErALSTZFYmDsxLL2bvsUQIW3+oav08nYdBHJaDanjIdyoHmHMkecSCMOUqcg== X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Mar 2017 13:09:43.0582 (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: BLUPR03MB181 Subject: [dpdk-dev] [PATCH v9 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, 17 Mar 2017 13:09:46 -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 db4691c..9a60777 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