From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM01-SN1-obe.outbound.protection.outlook.com (mail-sn1nam01on0072.outbound.protection.outlook.com [104.47.32.72]) by dpdk.org (Postfix) with ESMTP id 0EDCCFA50 for ; Mon, 19 Dec 2016 16:22:13 +0100 (CET) Received: from BLUPR0301CA0040.namprd03.prod.outlook.com (10.162.113.178) by BN6PR03MB2466.namprd03.prod.outlook.com (10.168.223.20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.789.14; Mon, 19 Dec 2016 15:22:13 +0000 Received: from BL2FFO11FD005.protection.gbl (2a01:111:f400:7c09::192) by BLUPR0301CA0040.outlook.office365.com (2a01:111:e400:5259::50) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.789.14 via Frontend Transport; Mon, 19 Dec 2016 15:22:12 +0000 Authentication-Results: spf=fail (sender IP is 192.88.158.2) 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.158.2 as permitted sender) receiver=protection.outlook.com; client-ip=192.88.158.2; helo=az84smr01.freescale.net; Received: from az84smr01.freescale.net (192.88.158.2) by BL2FFO11FD005.mail.protection.outlook.com (10.173.161.1) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.789.10 via Frontend Transport; Mon, 19 Dec 2016 15:22:12 +0000 Received: from bf-netperf1.idc ([10.232.134.28]) by az84smr01.freescale.net (8.14.3/8.14.0) with ESMTP id uBJFKMhs029110; Mon, 19 Dec 2016 08:22:09 -0700 From: Hemant Agrawal To: CC: , , , , , , Hemant Agrawal Date: Tue, 20 Dec 2016 02:24:08 +0530 Message-ID: <1482180853-18823-30-git-send-email-hemant.agrawal@nxp.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1482180853-18823-1-git-send-email-hemant.agrawal@nxp.com> References: <1480875447-23680-1-git-send-email-hemant.agrawal@nxp.com> <1482180853-18823-1-git-send-email-hemant.agrawal@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131266345328086083; (91ab9b29-cfa4-454e-5278-08d120cd25b8); () X-Forefront-Antispam-Report: CIP:192.88.158.2; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(7916002)(336005)(39450400003)(39400400002)(39860400002)(39840400002)(39850400002)(39380400002)(39410400002)(2980300002)(1110001)(1109001)(339900001)(199003)(189002)(2351001)(575784001)(86362001)(4326007)(104016004)(92566002)(8666005)(8936002)(2906002)(626004)(97736004)(85426001)(105606002)(356003)(189998001)(305945005)(106466001)(68736007)(69596002)(47776003)(50466002)(50986999)(77096006)(110136003)(2950100002)(48376002)(38730400001)(36756003)(5003940100001)(50226002)(76176999)(8676002)(33646002)(81156014)(6916009)(81166006)(5660300001)(7059030); DIR:OUT; SFP:1101; SCL:1; SRVR:BN6PR03MB2466; H:az84smr01.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BL2FFO11FD005; 1:xIfZ1dRBft/5IxxTLA9u7hq7hd7uztjqTd0qiJlpJC1gQaXXTFbMgGgYBipEvSVHuokJC/kKI55Yaqs70Pq66kUuGMLBu0oRN88Bo9kxJkC90WGUlvfJZzps7olIw2AgQZ83cU88QNEm6Z45ZAAcwgJbRzNqlvUlxc47dEffav90uzFVi0Q4D384yy6JVMPB4WhgNhj5CLOtRqbNArL8erZHtvwr6C2Kj7Ac1jKdMtD6bE6gau0PvMZ7S/SDM589wjFatga2oX0vpHSs17b0C1J1R/+3WWfB4XlgK5U1XeYZgyVl+aKadeCS3zSZrx88Q2Qt0Di3yipJ5FPzn654oDjEheLGa5KrsnUQVk6E9Ub4YTivbYHoC0gGBo60IDv2JkcMPJJkT/1OJLwjKO5xdWuOl0gmX23WPJSqf4OyRWclMq31W2VFBlPCP01BcCsK71kNkfHJppSTXtLXNQkS3as0MyRX+DLKDasVJLRBt0WL2pPMuz9fY7yuPivmOSj9xiPvmrxwLvHv3L1yJgKvh8gsb8MK3oyf5xHYWFW7H3ZQ3NyVO9766mLBfZ5kOmXBBQvKLNY/eX2+9UgMzbd6HjNWL9LfkHgL1sd0GDOluhJA6pX7PmMdtz7lZStc9u1MbLzyFvb+OSOtoqYA3ec/y5vXOWUieXQAQpme1H4pRWuXuLqS1qN92iK3BCtgcV/iubU64qQX28SkCwuJ0y6pt2ov8uL267y8wYjAQ75NYdJBkztQ56/abry7sGfMLEemkxeTzqyaz8kAyaERt9wvgw== MIME-Version: 1.0 Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: 8174f664-5559-4496-1fda-08d42822cea0 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001);SRVR:BN6PR03MB2466; X-Microsoft-Exchange-Diagnostics: 1; BN6PR03MB2466; 3:xMAOl/HUro3vBtwvldBBmCuvsEw6GuZsPGo/h4OZk27pqioAHutKMHoutNqns6CHZ9+J7j/yi/xXfWBlsOwEa1s3GUPdlSWEP4wv3kbZB7eqBm1S1io27Oq6tHkCUHvfkhz+uuaEemjvs13TuQ0dCh+8JVSCnfHgWMMG7HJD3YjXllfB3dMPpoNVpvwyxNG/xXZwuugQL7XAj2ej+nad52JitfNLsnp4z79kek1mSBBxDc3ZqWXtfr3xi30xOvlBH8fgdRPM9uRsxn43GRkWme0n/kdiD50vZ0TQbWtN6R9PUMdymLxE9pZRiLxCmX6Hx+mznxDdYlWz2AtX4wOLd9yvR1I5fX+HK0zsVHlaeU5Z+zZsLBLHx7DL1PoxjHZM X-Microsoft-Exchange-Diagnostics: 1; BN6PR03MB2466; 25:FqL/joOzLZJd9PoF7+qV04TZA1grJKvfu10dUd93bi2f6MBCJ4iw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PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6095060)(601004)(2401047)(8121501046)(13018025)(13015025)(13024025)(5005006)(13023025)(13017025)(3002001)(10201501046)(6055026)(6096035)(20161123563025)(20161123561025)(20161123565025)(20161123556025)(20161123559025); SRVR:BN6PR03MB2466; BCL:0; PCL:0; RULEID:(400006); SRVR:BN6PR03MB2466; X-Microsoft-Exchange-Diagnostics: 1; BN6PR03MB2466; 4:UJ50reX8nGiTd35ePz/2u/yUjaeYZ0xSN0H78NRBx4pMVu9m2OT5UiZ8QzaG/YXrJj64QIfagi0b/VENyatppIk5nrS8EfU7DgmGvsjQxx3P/vxBMhaCww0k5Ytt6Sj2YUTCLB5q4RwwtY5KalW7IYfDPHm1Bb1g0g+yaB2uM+wJJwRpqNRQ3GxN4M8/MCgvrlnOXCath1hf65diK6ikSsjQpYDGXAZ0cPJNskQs06Ba8wZzfqT6JuRA5ry4cZV1LBs0rwfdxcScu/+OEsfNkT5TzuHOb2VpqszUyiwes8OgOCivBAeGUDxySPS8GfYd8MOnPbaEFQbV49bt+qC6T0COVGupZm5nUNA4C11seibW5zF1f3EyAQMtL5V/ZtzmC+fgYUlB8aKCXkpM31DOO8UfXydWxhAR4BFBobHcF9TJN9dkq18JuVeKNdyINVcGr+a024Ew9qRwSDEhFQQHxz0+ax3NF3znPeQqY4X0MEfP7qYjhFSOerCTm9lzeBK71G8vR80LpiYhcYVxM16Qh8rcDZ9OBDGLdax/NNxKmPF5ZLfPTyxf9bWVga7jkIBt+PKWG0hxg8OGkVBtKaPSXLLbNy5Z8YVYOyaxKnOUTlwQV6aRELWM9CECFH34hAmRpTk805ce7rjqWG2+ZsCglM1uwacxaRaHvxO/XBG5Byz5P/8gT4iqzxFd4vEbbqtXAN834ycP1t3/FXMO9k+pfSwX7E2qOn4gNdnPopnmIpWxwu+F/shVdU1oPUvKHBfB X-Forefront-PRVS: 01613DFDC8 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BN6PR03MB2466; 23:m7dHHI3ZQsR+NAyvWztMKq+2SyL5pEqLPxU2smXQj?= =?us-ascii?Q?OR6M/OcvO1sdwvK9mW3A5IFd93pYvz9LxdUorMO0SL3M3YvotRA6CHUkiLCV?= =?us-ascii?Q?+ED5OF5LHUL8kBzHqeasEPTrRwNk4OIQ5AXxbccC+ogCLqfF/Mihhhwxf1tZ?= =?us-ascii?Q?c38dErYaIqqGwPdh3U2dVdZlYmR29Wwe+zayN1ExjMvbBeGe2CyJtrp5frpH?= =?us-ascii?Q?gBKmWDhjTBQ/A9OKm/IiF04xuNP5Y2iRIMh5IfT/qU0w+Bsay9f/pF5/3ze9?= =?us-ascii?Q?B+PWorSgtsrrqmKeEtyNFYoLnLZ4ocQc08GtY+n7panw5sVqYQ/vvIN1skhU?= =?us-ascii?Q?G/VM8g0gi1YRXAUMLLQkBLsMpzA49ReIy1wT0tJ5McGr0H1/l9p3FYo/3mfi?= =?us-ascii?Q?ZbHS06RtZotgeh5xRclHDYTWjehagv6dm82sNI2wTyGthNoYbla3I5CIssNk?= =?us-ascii?Q?cTb5Foj672adZJEgMxC1HnNzEUxgwpp/wDbGafxer4VVJlix8Ug3zGsjGDVJ?= =?us-ascii?Q?1VslXscmaY5UHPYAVSFrSPfzCulUcFFG70G7IpmAHiL7OXk35IVNf0zXUBvk?= =?us-ascii?Q?FbDE4jENkbkPTxv0jQlkLiHIDFbf6g2jLmk461XIpI5PhU68PgbGXIXeW/mT?= =?us-ascii?Q?La7pvXkGyrcl/CjvSZiCwG/97eJ4RbZskbhU0VqDOKPfUL7rOIglpv1c/2nK?= =?us-ascii?Q?1+LI8cWer6a9ppwNNXXCCUuAZLj7wro14JVbQoPBrutNBcZmZvCnOuGEZfVP?= =?us-ascii?Q?z+MRB25b5Lytx6Rss3wkwZwsM/xKwaAwBl3kN9mXlDmdj3AmpU6gnH/9y0m4?= =?us-ascii?Q?6Hw8BTfgefWJDnqv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hYnHS6; 5:P/+6XKHPH+JVyZ8fym15qEK5TN6b2JgzWMCzaCqmRJK1dDaIXAryRfel9nSEBfL22EZosAWfLfX21ThCYCfIduubsxF75RZPxzbY7lkwHD8C0l9G6iZxkRx6KlyZxRRWNfylM1Eguvz9J4eZ/Wb4KT6UlUBc0MwJDFRwuZt9bC8r2MA23wxj/1amLtdnbyUA; 24:nQrPVMwj+wk1fOXLavEvMROUhTMFRVGyIbxsFFX1s68MDN+4g1wSKUksyn7mx2TxnvFQcJcPq/GFDi+HO0KVUU+QfITel3zzVdRE+7tvxf0= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BN6PR03MB2466; 7:xJ/PoJfanDThWeHW1TFqiXcSPlbm365W1iK0Xa9D88kAzWR4MxzF8jS4DB+tF6jW3g4p1RJZc0yX9PJRUpIl7Qq/u+lZvXPzBK0nn91bEHbhaSft+MZnazuKrAZqhckOXj8oC0J9+n2WTVSg3RbtDXeK2H4JMIDzpeflOT2YMqR5GzirUzWEh2SBW+xaeZLSp7LIp5sNcSZ/ZM1anqRlRi3pkwEHfHPRVwWB5NK0+OL299ug30K/oS3eQsTnb6usHgGiTkM+u9OCKBzi2jZEZgRk6uWodE8eqe/LNETJWXVINnJcuuPLdUJYCG7q5pD5Jxw3Mg9VumIyJS3HIX+ll+NDbF4qNLusTTz3qxc8CWtipVT7n5NBSobOn68VMKVx8Gf2Xdr+VFdTFlz/hh6yntcljCo54GgoYxQgJX6bpXgNZxVMaer//sYAdpSXZRJyucbriz5zE5ActWghAnktdw== X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Dec 2016 15:22:12.4498 (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.158.2]; Helo=[az84smr01.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR03MB2466 Subject: [dpdk-dev] [PATCHv2 29/34] 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: Mon, 19 Dec 2016 15:22:14 -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 0d53003..d0cdc80 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