From patchwork Sat Sep 16 10:52:35 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hemant Agrawal X-Patchwork-Id: 112802 Delivered-To: patch@linaro.org Received: by 10.140.106.117 with SMTP id d108csp1617372qgf; Sat, 16 Sep 2017 03:57:51 -0700 (PDT) X-Google-Smtp-Source: ADKCNb6i4hytgGFPrdYkupKUV8Enbi7WjPMS18rwEyC/chgxdiwcpRmiE0XiZDAgwbjkqcinEV7x X-Received: by 10.223.135.102 with SMTP id 35mr23023690wrz.160.1505559471426; Sat, 16 Sep 2017 03:57:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1505559471; cv=none; d=google.com; s=arc-20160816; b=Pb10p2x3d5MmC269ehZEOOQqz6HOTTs+IXtV8dAU4193QUNwbzzeXROhy80jyrpdTj jt+MbGpBNHcJhCaO6J8pIPjvMBLbIfE3eHmPVI/CZdiap7G6lK3g3M6WIRGSUIbGBFrT 5fUKygpYhfRCy9yU2rDln6zlbR5/tCbLLycB64nnstkxIDl2iF4jJuP7eHQmQMStbnkb 5R7Je9hCqnDMS5IgYmShpDhDVF1ozIKRYRsI5hBRtKxiuptlqSLIgIeIuQOqQ6uGmcsh rGtKRb7dMfd5hJX74UiUpSk4GK0baSRRVE/gW6vFhE+Le25LbKneiLFBxfeOnmCDCGGK 8FUg== 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=S5clSY2E+1pJN31fd3ReYtPo3r99lfiB+fsq8Sw09/0=; b=x0e5KBreP7CLBFozCjmZTRjTpQpNOU8CVLtSx2+2+LDDSWiYfZACW8kjIR3tEZXnli EMWCXFyUY0j7yjJaw86vXB3+89yu0dWcYxdLorrQN5l6bNH6ckyy1y7GftM4ZQ/1H5T0 xJal5gN954JwHAsuHMosIChQUdDi2iPa/DTASwhE8GQoh3r94u858JTtiLh3qFbqunhN pMOnyAYgerZXqVpAkYcBhgcoTuOjLGr0K9XvOfnuMRyUKPvggPSnBMy65s32TW6+gjAB DsGgjIK8q84MfPlpcfJ3WyCwupUKvCUjRGMo2XFwFSwhyaf9kFFvhI3JRm7hJro/o9XY oqnA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of dev-bounces@dpdk.org designates 92.243.14.124 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 (dpdk.org. [92.243.14.124]) by mx.google.com with ESMTP id t133si2411159wmf.35.2017.09.16.03.57.51; Sat, 16 Sep 2017 03:57:51 -0700 (PDT) Received-SPF: pass (google.com: domain of dev-bounces@dpdk.org designates 92.243.14.124 as permitted sender) client-ip=92.243.14.124; Authentication-Results: mx.google.com; spf=pass (google.com: domain of dev-bounces@dpdk.org designates 92.243.14.124 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 [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id B419A1B22B; Sat, 16 Sep 2017 12:54:09 +0200 (CEST) Received: from NAM03-BY2-obe.outbound.protection.outlook.com (mail-by2nam03on0071.outbound.protection.outlook.com [104.47.42.71]) by dpdk.org (Postfix) with ESMTP id B872A1B1A9 for ; Sat, 16 Sep 2017 12:53:49 +0200 (CEST) Received: from BN3PR03CA0107.namprd03.prod.outlook.com (10.174.66.25) by DM5PR03MB2699.namprd03.prod.outlook.com (10.168.197.137) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.56.11; Sat, 16 Sep 2017 10:53:48 +0000 Received: from BN1BFFO11FD031.protection.gbl (2a01:111:f400:7c10::1:161) by BN3PR03CA0107.outlook.office365.com (2603:10b6:400:4::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.56.11 via Frontend Transport; Sat, 16 Sep 2017 10:53: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; 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 BN1BFFO11FD031.mail.protection.outlook.com (10.58.144.94) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.13.11 via Frontend Transport; Sat, 16 Sep 2017 10:53:47 +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 v8GAr6v8028328; Sat, 16 Sep 2017 03:53:45 -0700 From: Hemant Agrawal To: CC: , Date: Sat, 16 Sep 2017 16:22:35 +0530 Message-ID: <1505559161-29222-22-git-send-email-hemant.agrawal@nxp.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1505559161-29222-1-git-send-email-hemant.agrawal@nxp.com> References: <1504860327-18451-1-git-send-email-hemant.agrawal@nxp.com> <1505559161-29222-1-git-send-email-hemant.agrawal@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131500328276475389; (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)(376002)(346002)(39860400002)(39380400002)(2980300002)(1110001)(1109001)(339900001)(189002)(199003)(316002)(53936002)(189998001)(54906002)(8656003)(50986999)(76176999)(105606002)(106466001)(33646002)(356003)(104016004)(97736004)(5003940100001)(498600001)(85426001)(110136004)(4326008)(16586007)(68736007)(5660300001)(77096006)(8676002)(50466002)(81166006)(81156014)(86362001)(2906002)(6916009)(2950100002)(6666003)(50226002)(2351001)(36756003)(8936002)(47776003)(305945005)(48376002); DIR:OUT; SFP:1101; SCL:1; SRVR:DM5PR03MB2699; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN1BFFO11FD031; 1:6wHrm8eIudiQ5XRgR6lldRGE1ZacJOkZn41AKSCxC6GFMN2u+tX+x2/C1AII4q2whRJ0dLDIAZyyVH/nQL6Y3J1CGnUpzNAtrSz9o28aU2Sxg9tPXs55TzBo+enytAit MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: e16c682b-f0a7-4df0-dc9c-08d4fcf13538 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:DM5PR03MB2699; X-Microsoft-Exchange-Diagnostics: 1; DM5PR03MB2699; 3:Sbj5u5EU1nzqkiOXg8sqQdXamOLa8tuz9qvmWXeM8Z61tuaTuNMERShXQHBXlu93Qhx6+0pipvvL6HjkG4GkJDZdSomp6t6OiB/0OAFUZtoD1TKQu/IDl1TQr5LqgfIXD/48KkcMmaXtSwNqlu5Rc6w+MxONkhmTei6ezWyEDJB2uTrLlbmvUTtkU6F3ac+rJV6Ht2lcQ42/VNvrmoFlwNTtC08wBNZeXNbqEUdDN4Z6q4UERvDZixadKVwaJEikLnRt2xIkh01KhzAMfr6LDFYaBdhsWca3TqvHHV9Wbi3XNydCE4O8iW7uRPn7ndYeO7e2j5XnlhumOHkhIZU5cgSwFjmjoKPO89zed6J3j7Y=; 25:CWrEdetdYmDEw9CxjO60Eb2nF+51EArJB2nUO5to6glk/cDF/o2VvVl7l1UwMYGj1gAvvZV7yzfJGn/rk5fD2Bp1WDl6Ko5J2fY9JN20rCizweb2NhaKF+j7eoCfFBUQgflQVts9wqDA3FkRvm+uJjXcCJhpGxa6cmCfVCIlIW51PecbZpGYVvnIJiPCZX3oherrX3BSjIMfCpB99EihNI0kY2gCH5GoZW3nwmh45+QH3hgGMiCznaitt10grxAy2jv7xOt7+XlCkJLHfaFYXaWWtWRbbIs7odBZu0duAZ5Fr669RtwAKuku0llt+nclv81e1Ji5UOH3CzsgMbNf6Q== X-MS-TrafficTypeDiagnostic: DM5PR03MB2699: X-Microsoft-Exchange-Diagnostics: 1; DM5PR03MB2699; 31:LObreztN7LnR1OublxV5dcztPqvW2letUBSo1ZiQdg/gmj4KiNFx+JCEni7f1M9CQgI42iVQShbdYL78NuzQkPxWjCSeEw2e2f4Tp17zv8WyVm/XNN5sS5wyipp47EETUsxEu2PMd8VFo9DRaSZnQP/8tIml8k3+DjL4iWSJDed2YQmIcuLaNPsH/CyVm5lrj0cyLXY8JwY9peNAOEwK9enlSXSjNVZlVaUzzDtW4AE=; 4:ZZs3P1rLZNwRRnmIYgqZp60L6mgvIMRAJsRRfc/jhl2Ijw0y3Vbwrr1a3BvJqSiETCnbcmlMMcHOOVvlpn3j1xRyNkxT7P+BP7cNr8jWgxIcbqeeoaQhvxkiQnxmazbgb64ISBEJ+f89JK8HRIucHLBnwyP9iBJnqd38hGyXw+6CsYyQPbeaPMn2tBhBLmrEjamLs6B+kiuKldn9y43KVHIlZ6jTaj1PSfKDgkHK914dWf8p7+jejzL4bLbe0y7GT+WJTyYtc3IWaktmYKHIO0fK/cOojtRSrrYFdp2jLxI= 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)(2401047)(5005006)(8121501046)(10201501046)(100000703101)(100105400095)(3002001)(93006095)(93001095)(6055026)(6096035)(20161123563025)(20161123561025)(201703131430075)(201703131448075)(201703131433075)(201703161259150)(201703151042153)(20161123559100)(20161123565025)(20161123556025)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:DM5PR03MB2699; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(400006)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:DM5PR03MB2699; X-Forefront-PRVS: 0432A04947 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DM5PR03MB2699; 23:uMa7X8DOYXVQvCUxtveL/99P1yjSNSuP+lpG0DMoj?= FnZL0LhJV841x5LxRXbF7TvzqzsZQ8Nivp5NH4G4ML9z9TYg1ssIZ+LA4Fm8roEE0pHevOsRexGB49d5EEjDc4RHUkujQCLd/+agjQkiDZQzHUavlPfP3S1VCndjJhgidibUxOEUIsSa+QVJip3LlFwlNueDXmPqDHN+SQN2pRQvxXyb1kQXmyKcZIXwzK5oOba1+eyT0Sswt4reUIjpMZa+ayO380Vy4c50icbUeInyTbGnpWN0RUoVZ/Z4gN2dmQUmkqgiIdHGs/NcgydGYIvokwQMRZtQNmPzcY3a36v4rbeej18mPDxseMX4nGyiTZP7XmBlR6pWXqFAK+B8lxpcKVGhpaGpMnav0ny53Bz0lZzuLBK05KG65GJ93ZvSrpUsUyiXfVdvJjFzRfbq/KMZb2h/BbB1k5esLU7l4GMUs7PIsvsKtIX9ByX1bH4u1Dc991TWipYHs/fH+L2EERuMvw+79EWWxWekZQd/N4tYjXvbonCxMwp8+7XVFJ1b2mFTMNGEMMLkCImzbmUGuLT3OAa29f1+vyJY6m9te53LgOEfkvN2CV+rPNNOfX8uiyhn/eFcapQKsb62s8DsjUn+9V3NMfcHgdrAI6PmvpXzi9Uvdg35tLQBq3ytZmuQTMrD+onKVROJ5/uW3cjD7QGpUNGC7aNFGP08IA9wCpg6U8kPC2aiQUM0tm6XJmXA7oYll73TN44B0/w410+d5NSdQOKSZDZLSl9OjqN+7QOXzd4MvEJg3RcMY5dwKVOPCO+htczhIBMlrtNkPgq27rntygjRY+4mavR8l4zcCPgIvjYruheCY18KZDluQc8VYeZR0UOsWc7M6zzqBOE8vVU+obU7XwQFjN5Qp1OJz+Lc/CsBLiTsh38CR6KXWmT6iajSo8am4MtPxp+9I6s5K1abvJV5gpWLyDXurZDV1nhfjVKqpZ5zcjbGtlwZ/gpPeztQSw7/Y5OkpsZtfWnr/gK36R3i7NTIwTUWvxW2Wgy16FzGLiIlW8UxKzXnJ3tx87QSVZTDU98qfFDoaVMoQ5DeC2xlm66H8R4rlx9IkyJ3e3A994YD6zpFWAUJwTdLXCWHpCkmvIou0o9lZvrqYwd+t8Ni53VJ/g7Z/mMy9xJViVPO+6/sSk0fi2wJRhm8r4= X-Microsoft-Exchange-Diagnostics: 1; DM5PR03MB2699; 6:n112dWS1bEqeBJDkNGzBiYwPUfBOlWdOyxiWvoFGQ/RlsUkqX90HweOuxDI0T082K7R7A6/6QHQBYoA2x2G0q3xa131yD6rtdQ8HLLIF4otfSJoQRGawN7V3sd3e20Q135V6YBHl2bLvFhrt/7iRN8Euvt7Wo2SDZe2hTXAd7cLKiBPrTXAuDlNyFcXeqXzIuLOlJf4zvEipUKiz23kyWwv6ip/uHa0Eht0jnu1QFFpZ2oH+VB9YTcLIRTNohtif6ur++jpknWxNDXONsdPKS1Caykf/qOJ7nUNRwJFw2NFM/PErvnHcOBMZN6SgMjIV2ie0bKP/LgIMKfK3kGfCoA==; 5:9QG1xbOW7N7avwK1GM1JeZu+8tsZ2xOiHahfrpJmWRsGPctDGCrwiFG6zzB/VrpIIrpEQ5pqLJdxJWKxzuBhS5pxkmlRqG4gr+1eFwwYlVQ5jdrdejEMnyPF79gceq5QiJzKAaABiVRGOYyRGqWKCPVv6cuI2ZJ009YdF8+tD6U=; 24:rtWKgwvp14pq4ftIt3apROjPkiO7oWCsqmqluysPxAJI8AqEuB+FBd5TSRjhl3Y97Iz/upY64t0H6dRzY/+pacFjjYrL2wfbUUCJecNBEqA=; 7:yW5MXYG0HzBF5YxS6E/8ghEcQ+N6YmDWahYXj9b0LXJq7WasqclkKzIwl/R31IfQAVi0cgAgZ2h+sCqjBdvPiuYk+4pza91fntPBkmrAgfn21A5J9AfA+pPR8E6stf1BvHI+joJASu7aPJjkK2OByAOJaw6vaQXANi/+5htIVVRZWAyzd+sca8ggAemNL/KnOl+gSpaPOZwG1Ol1t0yJbgSc0M+QoUvCDbx7XCF9TEk= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Sep 2017 10:53:47.4603 (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: DM5PR03MB2699 Subject: [dpdk-dev] [PATCH v3 21/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 | 174 ++++++++++++++++++++++++++++++++++++- 2 files changed, 173 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 643d882..7b09a87 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,151 @@ 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); + uint64_t values_copy[stat_cnt]; + + 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; + } + + 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); + struct rte_eth_xstat_name xstats_names_copy[stat_cnt]; + + if (!ids) + return dpaa2_xstats_get_names(dev, xstats_names, limit); + + 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; @@ -1471,7 +1636,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,