From patchwork Fri Aug 25 10:49:40 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hemant Agrawal X-Patchwork-Id: 111007 Delivered-To: patch@linaro.org Received: by 10.140.95.78 with SMTP id h72csp814567qge; Fri, 25 Aug 2017 03:55:35 -0700 (PDT) X-Received: by 10.223.161.133 with SMTP id u5mr6327427wru.125.1503658535745; Fri, 25 Aug 2017 03:55:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1503658535; cv=none; d=google.com; s=arc-20160816; b=ofSp1mobEThPINxC7SKPN5Zj2L8pHD0ekb/Sh0ew8NfAgiP1IvG2aaoAbDK2cYkIST rrvo1TsbtVSZKzCTbWtJEImrdxRHskw2xvXaHUD9UZ4FVXBESXKo1CJbfqAReMO+uxiI LgRRMVNFUcT0w0I4Af2rRzVPrHbi8ywpi3mSS/rMpUdTD6iptF3turhih/wgyHvlk+jJ iCSETs+SxBXJuOoM73D3uAnD+JuMk5PswPe7pfy6r3Kt3qXqT/NpHoR5nNj7oE68/zPI w307iVdPltYqkGRyyiLcvac05CFbE7KnNePhNGJEwSJegrEgg14NeYVN1L8yPxX1XktO 4HXw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:spamdiagnosticmetadata :spamdiagnosticoutput:mime-version:references:in-reply-to:message-id :date:cc:to:from:arc-authentication-results; bh=7bv0STqnebhmwsXud+kqehAxyy6FOrizFgyHp1l2Eao=; b=elD2tEx0d7g/Slx/Ox0iuMT8iN00Ub+rwIjsgSFYT7+g5xHlPrEN54U8BiEA8E2vLu orkrJ1w7L4snvrpELuvF5ruH0I/5jXuAYQH239lmc7US4dWh3MsMjNzCpIHT1PJN7hSH 2hulOlxBJDMu4MwiQThSSPiivBCBbC9DC3ngpyz97gASWDkm+l8AZ4EEhGfxUjse3gzS yxyxj0e8F/pfw7ulgZgfLaW8wLyz5wEFhnnQd4Yh6ihDCl/BzcJiIxDSFA55NKeekVL1 rtyhqw5p/A6l20FHrV2RmQbNqClRsPsh4C8u+egJWF/D6mapwVFP3alJtkcU0IU1q4Au imgg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of dev-bounces@dpdk.org designates 2001:4b98:dc0:41:216:3eff:fe72:dd13 as permitted sender) smtp.mailfrom=dev-bounces@dpdk.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Return-Path: Received: from dpdk.org ([2001:4b98:dc0:41:216:3eff:fe72:dd13]) by mx.google.com with ESMTP id c30si5151063wrb.552.2017.08.25.03.55.35; Fri, 25 Aug 2017 03:55:35 -0700 (PDT) Received-SPF: pass (google.com: domain of dev-bounces@dpdk.org designates 2001:4b98:dc0:41:216:3eff:fe72:dd13 as permitted sender) client-ip=2001:4b98:dc0:41:216:3eff:fe72:dd13; Authentication-Results: mx.google.com; spf=pass (google.com: domain of dev-bounces@dpdk.org designates 2001:4b98:dc0:41:216:3eff:fe72:dd13 as permitted sender) smtp.mailfrom=dev-bounces@dpdk.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: from [92.243.14.124] (localhost [IPv6:::1]) by dpdk.org (Postfix) with ESMTP id 5920899D0; Fri, 25 Aug 2017 12:50:53 +0200 (CEST) Received: from NAM03-DM3-obe.outbound.protection.outlook.com (mail-dm3nam03on0076.outbound.protection.outlook.com [104.47.41.76]) by dpdk.org (Postfix) with ESMTP id 6F29499CD for ; Fri, 25 Aug 2017 12:50:48 +0200 (CEST) Received: from MWHPR03CA0042.namprd03.prod.outlook.com (10.174.173.159) by CO2PR03MB2262.namprd03.prod.outlook.com (10.166.92.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.1.1385.9; Fri, 25 Aug 2017 10:50:47 +0000 Received: from BL2FFO11FD024.protection.gbl (2a01:111:f400:7c09::110) by MWHPR03CA0042.outlook.office365.com (2603:10b6:301:3b::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.1.1385.9 via Frontend Transport; Fri, 25 Aug 2017 10:50:46 +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; 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 BL2FFO11FD024.mail.protection.outlook.com (10.173.161.103) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1341.15 via Frontend Transport; Fri, 25 Aug 2017 10:50:45 +0000 Received: from bf-netperf1.ap.freescale.net (bf-netperf1.ap.freescale.net [10.232.134.28]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id v7PAnw6S032070; Fri, 25 Aug 2017 03:50:44 -0700 From: Hemant Agrawal To: CC: , Date: Fri, 25 Aug 2017 16:19:40 +0530 Message-ID: <1503658183-4078-25-git-send-email-hemant.agrawal@nxp.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1503658183-4078-1-git-send-email-hemant.agrawal@nxp.com> References: <1503658183-4078-1-git-send-email-hemant.agrawal@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131481318460927743; (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)(39380400002)(39860400002)(2980300002)(1110001)(1109001)(339900001)(199003)(189002)(86362001)(110136004)(8656003)(8936002)(50986999)(50226002)(76176999)(104016004)(68736007)(81156014)(8676002)(2906002)(81166006)(36756003)(53936002)(6916009)(47776003)(2950100002)(97736004)(77096006)(305945005)(85426001)(4326008)(50466002)(48376002)(626005)(6666003)(356003)(498600001)(5660300001)(106466001)(54906002)(2351001)(105606002)(33646002)(189998001)(5003940100001); DIR:OUT; SFP:1101; SCL:1; SRVR:CO2PR03MB2262; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BL2FFO11FD024; 1:HX9Aq2KHdCvpoPbuqR/r5zVD7yjKqO0Nj67M8LQPVpiKzyRSEMxUAWdH8blcSvZD8cIXtU9NcwrzjVAXUnmJiAuM8VsYXwpE6+5yGxqJWYHDCCKnFxFt2CsnehlETZT2 MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 1233e53b-a805-4136-aeff-08d4eba723ed X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(22001)(300000502095)(300135100095)(300000503095)(300135400095)(2017052603199)(201703131430075)(201703131517081)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095); SRVR:CO2PR03MB2262; X-Microsoft-Exchange-Diagnostics: 1; CO2PR03MB2262; 3:Y0b8xp9zNw5axidDUzD5Fh3dXnSWM57oMJi9y59y1x9mNKgvsgsKU/7FhRbg6d5Av0C8k202oTsU4fCNhh5D9qAhEgUk2PSpDveVfYFoG0STj0A4sa/FNKUeoy/0EBRVbEk4XZcrdLpsg6Yb9sL9qjvCWzrNYE3ZDPWG70wZG9j3b2y1IjozTgkpES1aM7LavBKk9iB4gZgI35iI4A5vCur3S8oLnHSZKizIAb9lf8zrb9W4vXYx4QlTkoAzx4Tl/zCGAa3aZGdLmEFQ2nQ4p/iukpsrGhfqWSNygWfJ3b59GkERWJdkVziaG2mzigZnOdLJKMQqxfst5+jTqZPIpZj9xUn9LVhhWVuEu4JcX1w=; 25:ll/nLjtx3bCeGWzc682DLN/eTSMYz4+ednMU99UY8kTtMIcjs+wLEet+a7v4QWU2NAZTJ57zANRmEs9KDCovb20jOzF3zTwHPfzbaTQenvJlv49fAvgAWwaBHkc3wD5F+LSGHYiQBcITMqeoIvYic6zurgAFv79lBbHEIAOD9eb5Wnr3SrnLdIXTc+X7tMfipRGXDrDkfd8ctbS4uTi5AtLlI4ceNbnoJnr5VhyOgripymNVuExAMy8BMhXTp3HlGoTY+/gJS9tyafo/3ZQIts7kmRVvzccE4XactQ9/LbQvRQS7chxfE4DI7JqkeRVaYNZt8p9TCgaV0OL0elS3fw== X-MS-TrafficTypeDiagnostic: CO2PR03MB2262: X-Microsoft-Exchange-Diagnostics: 1; CO2PR03MB2262; 31:5Nw+hj9DT/aCbzpaY/URDLUyO4Y4fjUVJN80PBzEtXkyTg70jviODDwNkO5hUvpJjdTqXyjQ5qyC9BMs1mV8ab5iAHhHkgKKoQ+jkIWn9GAOhe/qsTMrAvOkk8UajA4n3AoeHbjPkN978a6qS6fWxwb/mZ89mtbrs8K64q2gtncqyN3FYf2MRL7jl1FAfdJH+OB6wpO8SI3BQrouE3W8hCMrqRX94E3vDKedivu98kM=; 4:el1U7YWv2W8nP1fQCz7SjUcNFF1V4sALR/BlqDoPKx67MNS0MUsUxt7VnN7cekOhgMoAorS7tjFgN6upZmJTFyGPAAuxxOC/GDyL3rOUvui4INY2zzGlN0YOFCYG9gRxhVUSmgU6/q2FsaOV6r9m3o550pK2u2hBcKIvcNrXLJEUX+oTg2pBu6+4OSYHmMGFY3tG/AjH9n16KmNx47W6wMJA+FIg2yWNhx5Jbc3+/SC11mEURs6cN9asvaImmsgcob1YMGhZXcg2F90ehW4zc6L2oOmMQR8Usx5NzR1jMkc= X-Exchange-Antispam-Report-Test: UriScan:(185117386973197); X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6095135)(601004)(2401047)(5005006)(13018025)(13016025)(8121501046)(100000703101)(100105400095)(3002001)(93006095)(93001095)(10201501046)(6055026)(6096035)(20161123559100)(201703131430075)(201703131441075)(201703131448075)(201703131433075)(201703161259150)(20161123556025)(20161123561025)(20161123565025)(20161123563025)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:CO2PR03MB2262; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(400006)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:CO2PR03MB2262; X-Forefront-PRVS: 041032FF37 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; CO2PR03MB2262; 23:yd5BLJ6cyKnOzcbRKJcdmfvH4SA52CgUczxl9yLfy?= q3vtHVVPDdZk+7IqDvzGJdGZ3ckI0mtZbFA342y5fQMJf4UL8b8b2j+rbRbf/zwDL0hOobX+BY/wFC5KVcYzBJ/byc2lXwNqBVYJFa9tkR2K2FJsyehJy1ePlpgUnhJGkIS4Lwff7T9f7uas9DUOvFp63Yj+TvKagFHnZPurfBcCLiFDSXyxb7V7FBHxzIKKTdYym0WDy/347x+y2fiLKgBx9Hw5N0Xu7K9Wz0Yh2tEp5x2GiOGGxBVnOpYHpFDVNv82Hq7EYNcSGZxbLJUuAO3hSBix6+fFAQWptmoExkTanXmOioCinlO5LDcBJs2ktSQOSJ90CtzghAu7ZsLcbJcIefjB3s5WlqmLiixwHsAvnPqBgXykPp6xvZ4WX67qlW4FRaG6kiGGbpltMgogX70tHgOlSmTKyZjHZoL/H19AYn84nNx24J4n1LHWxp777Mg6X+zK3SihlPbQM7GQBdLtihNoS8NVJObAM/vERqEVPf+rNRxB96b4FMZYXq9t9pIQ6Gd8rWVX07/HMW0JKonciSdVMDzg4n+f1AjXogdiV27ngR5NxfItXAaA04wSmwiRrEx7lR1RiU2PBX4WDkEvSfmQZf+KMTpnHcUYWgpWj67NLOQY7MqL3mtQZLTT1pZb2KGrIPB85hbpcwK8IIr+eE98S6WxoljhCuh1biGp+P+iF1P10ZtABFVbmrxShUmyYtKfHpAbblI9rgKc5DaQaWeQVWbn/Tm+Hq5M6Qs5+/Q8wBCM6xhx0/Rse3giOJ5WTrfh9EqzV0XCwPvvAJvSWq8X8SWScM28uGeHwDsJXXi1Nyeu/gIagJpfTPPxlNJkz/Ju78en3WW4fyy0Fvs2nXvcQnhs43XsBlYmFDif5PdQCKINT9nm7W8tgvVNIwcUL+eLjAzQ1Yf5X4JOT7qg8svH7m6VpFUJNTVHz4NTltxNax92Hx4mUx40n8KjBx8Ot/FBgksEQsmAibBonMCb9UlnHXB+J0r+bjFb8ts3iBEXJmusJclVOJXeS4jC68tHmHB2FA6ChFOU/vx6mdO67mM9CuOX1LRBSKvjm0ga9gwYCPOHrQCc/uUNVqawPiItaDU2RnGOuojryJdA5ND X-Microsoft-Exchange-Diagnostics: 1; CO2PR03MB2262; 6:fTrKf1RWuI+m3g8N/yXD04fsVAw/uh2B2WUCpPw1JkakFAeGcmFcyWpibYGgZRRH9wVfkOXwWqpWzAlssQTgC7MBknc1BEhrGUktgVTCYinvjLxn3LPpu5dF8JaMjGprUu38g9JCH5HJ5CGhdHtWfFYkAe3yzJiTPLSqmjfWdxPtCmHHVGo5rz+3aANQNLbE0QWuwCD7hrJwWOjowkAP43YeOnvw6FbYnlYY+q6UdZMDbnG/H6b5xviZK/t6sijzF4ie2a0oKE8IcDMQAZjxu+oDiUGDq0nqcdWSCBACJh6MDFeRl2Yde577CJN5eyu458sSdoicugyn/T9FfXnMTw==; 5:QyLWTerWBFjiYy5X15K8g67il/VrhCIoy/gQO0Iild0Pwirb8jSGHWlyzu87Wu7q0IQJaRtrK2L+6YNpjh3uNguA24OfMM69fICr8Tnny9DM9y0L9en5tIoXlQsejL8UFxRjo58TuE5VOF3bSCA4SQ==; 24:rhFoVi5EJ/OaAnicNhd92lAjjIRrLoRu2KtIDgk/87mbpl5Fgc34Kw/BuukjyIHoYvwDmSbylexeZLvp4AVBRMVPOn+pQasYYumEAjaWvxs=; 7:OgmMFMM5UJ1QWvy78q9D2IgiPj5bf7qJ/3cp0Zxxg2nQ0zWK5z1mR5KUJT9VFlDmevDqoPJzhUwkZTsLbTGGDJePX6EfivQFtNPUGWuuXhHdLHnFJ5qQXYgm1jW+6xzURuCvymJptsrQClato6dYTZPi4A+ErNCIvJylW+JD9WSt4JB2vvCJHsFaKCyEUKN5tEShh93hlIJsXADFOkpEUIQr1wfVmp+hjrr2ZaJ5Ygw= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Aug 2017 10:50:45.9367 (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: CO2PR03MB2262 Subject: [dpdk-dev] [PATCH 24/27] net/dpaa2: add support for extra stats 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Signed-off-by: Hemant Agrawal --- doc/guides/nics/features/dpaa2.ini | 1 + drivers/net/dpaa2/dpaa2_ethdev.c | 178 ++++++++++++++++++++++++++++++++++++- 2 files changed, 177 insertions(+), 2 deletions(-) -- 2.7.4 diff --git a/doc/guides/nics/features/dpaa2.ini b/doc/guides/nics/features/dpaa2.ini index ba4321c..6ebbab4 100644 --- a/doc/guides/nics/features/dpaa2.ini +++ b/doc/guides/nics/features/dpaa2.ini @@ -21,6 +21,7 @@ L3 checksum offload = Y L4 checksum offload = Y Packet type parsing = Y Basic stats = Y +Extended stats = Y FW version = Y Linux VFIO = Y ARMv8 = Y diff --git a/drivers/net/dpaa2/dpaa2_ethdev.c b/drivers/net/dpaa2/dpaa2_ethdev.c index 4eeddb8..b71c51d 100644 --- a/drivers/net/dpaa2/dpaa2_ethdev.c +++ b/drivers/net/dpaa2/dpaa2_ethdev.c @@ -52,6 +52,28 @@ #include #include "dpaa2_ethdev.h" +struct rte_dpaa2_xstats_name_off { + char name[RTE_ETH_XSTATS_NAME_SIZE]; + uint8_t page_id; /* dpni statistics page id */ + uint8_t stats_id; /* stats id in the given page */ +}; + +static const struct rte_dpaa2_xstats_name_off dpaa2_xstats_strings[] = { + {"ingress_multicast_frames", 0, 2}, + {"ingress_multicast_bytes", 0, 3}, + {"ingress_broadcast_frames", 0, 4}, + {"ingress_broadcast_bytes", 0, 5}, + {"egress_multicast_frames", 1, 2}, + {"egress_multicast_bytes", 1, 3}, + {"egress_broadcast_frames", 1, 4}, + {"egress_broadcast_bytes", 1, 5}, + {"ingress_filtered_frames", 2, 0}, + {"ingress_discarded_frames", 2, 1}, + {"ingress_nobuffer_discards", 2, 2}, + {"egress_discarded_frames", 2, 3}, + {"egress_confirmed_frames", 2, 4}, +}; + static struct rte_dpaa2_driver rte_dpaa2_pmd; static int dpaa2_dev_uninit(struct rte_eth_dev *eth_dev); static int dpaa2_dev_link_update(struct rte_eth_dev *dev, @@ -1090,8 +1112,155 @@ void dpaa2_dev_stats_get(struct rte_eth_dev *dev, return; }; -static -void dpaa2_dev_stats_reset(struct rte_eth_dev *dev) +static int +dpaa2_dev_xstats_get(struct rte_eth_dev *dev, struct rte_eth_xstat *xstats, + unsigned int n) +{ + struct dpaa2_dev_priv *priv = dev->data->dev_private; + struct fsl_mc_io *dpni = (struct fsl_mc_io *)priv->hw; + int32_t retcode; + union dpni_statistics value[3] = {}; + unsigned int i = 0, num = RTE_DIM(dpaa2_xstats_strings); + + if (xstats == NULL) + return 0; + + if (n < num) + return num; + + /* Get Counters from page_0*/ + retcode = dpni_get_statistics(dpni, CMD_PRI_LOW, priv->token, + 0, 0, &value[0]); + if (retcode) + goto err; + + /* Get Counters from page_1*/ + retcode = dpni_get_statistics(dpni, CMD_PRI_LOW, priv->token, + 1, 0, &value[1]); + if (retcode) + goto err; + + /* Get Counters from page_2*/ + retcode = dpni_get_statistics(dpni, CMD_PRI_LOW, priv->token, + 2, 0, &value[2]); + if (retcode) + goto err; + + for (i = 0; i < num; i++) { + xstats[i].id = i; + xstats[i].value = value[dpaa2_xstats_strings[i].page_id]. + raw.counter[dpaa2_xstats_strings[i].stats_id]; + } + return i; +err: + RTE_LOG(ERR, PMD, "Error in obtaining extended stats (%d)\n", retcode); + return retcode; +} + +static int +dpaa2_xstats_get_names(__rte_unused struct rte_eth_dev *dev, + struct rte_eth_xstat_name *xstats_names, + __rte_unused unsigned int limit) +{ + unsigned int i, stat_cnt = RTE_DIM(dpaa2_xstats_strings); + + if (xstats_names != NULL) + for (i = 0; i < stat_cnt; i++) + snprintf(xstats_names[i].name, + sizeof(xstats_names[i].name), + "%s", + dpaa2_xstats_strings[i].name); + + return stat_cnt; +} + +static int +dpaa2_xstats_get_by_id(struct rte_eth_dev *dev, const uint64_t *ids, + uint64_t *values, unsigned int n) +{ + unsigned int i, stat_cnt = RTE_DIM(dpaa2_xstats_strings); + + if (!ids) { + struct dpaa2_dev_priv *priv = dev->data->dev_private; + struct fsl_mc_io *dpni = (struct fsl_mc_io *)priv->hw; + int32_t retcode; + union dpni_statistics value[3] = {}; + + if (n < stat_cnt) + return stat_cnt; + + if (!values) + return 0; + + /* Get Counters from page_0*/ + retcode = dpni_get_statistics(dpni, CMD_PRI_LOW, priv->token, + 0, 0, &value[0]); + if (retcode) + return 0; + + /* Get Counters from page_1*/ + retcode = dpni_get_statistics(dpni, CMD_PRI_LOW, priv->token, + 1, 0, &value[1]); + if (retcode) + return 0; + + /* Get Counters from page_2*/ + retcode = dpni_get_statistics(dpni, CMD_PRI_LOW, priv->token, + 2, 0, &value[2]); + if (retcode) + return 0; + + for (i = 0; i < stat_cnt; i++) { + values[i] = value[dpaa2_xstats_strings[i].page_id]. + raw.counter[dpaa2_xstats_strings[i].stats_id]; + } + return stat_cnt; + } else { + uint64_t values_copy[stat_cnt]; + + dpaa2_xstats_get_by_id(dev, NULL, values_copy, stat_cnt); + + for (i = 0; i < n; i++) { + if (ids[i] >= stat_cnt) { + PMD_INIT_LOG(ERR, "id value isn't valid"); + return -1; + } + values[i] = values_copy[ids[i]]; + } + return n; + } +} + +static int +dpaa2_xstats_get_names_by_id( + struct rte_eth_dev *dev, + struct rte_eth_xstat_name *xstats_names, + const uint64_t *ids, + unsigned int limit) +{ + unsigned int i, stat_cnt = RTE_DIM(dpaa2_xstats_strings); + + if (!ids) { + return dpaa2_xstats_get_names(dev, xstats_names, limit); + } else { + struct rte_eth_xstat_name xstats_names_copy[stat_cnt]; + + dpaa2_xstats_get_names(dev, xstats_names_copy, limit); + + for (i = 0; i < limit; i++) { + if (ids[i] >= stat_cnt) { + PMD_INIT_LOG(ERR, "id value isn't valid"); + return -1; + } + strcpy(xstats_names[i].name, + xstats_names_copy[ids[i]].name); + } + return limit; + } +} + +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; @@ -1475,7 +1644,12 @@ static struct eth_dev_ops dpaa2_ethdev_ops = { .dev_set_link_down = dpaa2_dev_set_link_down, .link_update = dpaa2_dev_link_update, .stats_get = dpaa2_dev_stats_get, + .xstats_get = dpaa2_dev_xstats_get, + .xstats_get_by_id = dpaa2_xstats_get_by_id, + .xstats_get_names_by_id = dpaa2_xstats_get_names_by_id, + .xstats_get_names = dpaa2_xstats_get_names, .stats_reset = dpaa2_dev_stats_reset, + .xstats_reset = dpaa2_dev_stats_reset, .fw_version_get = dpaa2_fw_version_get, .dev_infos_get = dpaa2_dev_info_get, .dev_supported_ptypes_get = dpaa2_supported_ptypes_get,