From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1nam02on0089.outbound.protection.outlook.com [104.47.36.89]) by dpdk.org (Postfix) with ESMTP id 2C051FA87 for ; Fri, 3 Mar 2017 08:14:58 +0100 (CET) Received: from BN3PR03CA0108.namprd03.prod.outlook.com (10.174.66.26) by MWHPR03MB2959.namprd03.prod.outlook.com (10.175.136.140) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.947.12; Fri, 3 Mar 2017 07:14:57 +0000 Received: from BL2FFO11OLC015.protection.gbl (2a01:111:f400:7c09::112) by BN3PR03CA0108.outlook.office365.com (2603:10b6:400:4::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.933.12 via Frontend Transport; Fri, 3 Mar 2017 07:14:57 +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 BL2FFO11OLC015.mail.protection.outlook.com (10.173.160.81) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.933.11 via Frontend Transport; Fri, 3 Mar 2017 07:14:56 +0000 Received: from bf-netperf1.idc ([10.232.134.28]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id v237D50d005035; Fri, 3 Mar 2017 00:14:53 -0700 From: Hemant Agrawal To: CC: , , , , , Date: Fri, 3 Mar 2017 18:16:53 +0530 Message-ID: <1488545223-25739-37-git-send-email-hemant.agrawal@nxp.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1488545223-25739-1-git-send-email-hemant.agrawal@nxp.com> References: <1487205586-6785-1-git-send-email-hemant.agrawal@nxp.com> <1488545223-25739-1-git-send-email-hemant.agrawal@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131329988968102171; (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)(7916002)(39410400002)(39860400002)(39850400002)(39400400002)(39450400003)(39840400002)(39380400002)(2980300002)(1109001)(1110001)(339900001)(189002)(199003)(9170700003)(626004)(76176999)(50986999)(8676002)(81166006)(8936002)(5660300001)(36756003)(77096006)(33646002)(305945005)(50466002)(48376002)(189998001)(2351001)(356003)(8656002)(6916009)(2950100002)(50226002)(110136004)(38730400002)(2906002)(106466001)(85426001)(104016004)(54906002)(47776003)(105606002)(4326008)(53936002)(5003940100001)(92566002)(86362001); DIR:OUT; SFP:1101; SCL:1; SRVR:MWHPR03MB2959; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; MLV:ovrnspm; MX:1; A:1; PTR:InfoDomainNonexistent; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BL2FFO11OLC015; 1:g1m8fsNGYGC9jmlwl3rcFecD0VOV5pnNeDVp4ek+gNtEhb6Fn3FlAzSLp0lJLrOAzn5DpbCFqJHoE/LGl8HRjJNzzQrEaNkH8z3QZVE3fTg/0OQGQcSVx4WKsdE56lg7NwlZOgaTIdG1/FBVqhBTtVANOklpoXaEy7KoMy8oNVoz+IZ7UY+KdWSXGimNbLSn4/vzBH+nDfuGs5LBJajgNA93w73dNuFcAYAnG2BtS61UwSaV4eFHXHfPzMQal2PsEc20FliDE1X1TJOffteuz8YPS7Gm88kdeDjkwvoULwyWxEk5sDmA0bdkRwRaBzsP4IsXHSDs5/5Lw8Xl8exdHW+QtNszeygNC6VCSdw+DzJrCmWju4wqhsVV6U4sWI9YgPm8gN/6wdsrc445V17WpdNV3IaucFjcFMyZL2rBrciKOw+6iuSGusJgueS0G4to9j+q0xrVfeF/aN+qaxZc34F4+lDqyjZynachbVRXZS4hjvaC7B8mOwtoANsUzN3Eudvme51jfpGwDfAUEo+ikGcfc/vino9ZwPbSpmS0nVSE/clG4JXsU39NAx525ANBYGsmQg27gxdrwCSX1B7XUvUH+gsPbbHc/UNc845VtJZORG9foIxNn9cL6I1yOuhHbyL8ppShxOEGpSwHD96i6g== MIME-Version: 1.0 Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: ba6069ca-181a-4449-b91b-08d46204ff43 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001);SRVR:MWHPR03MB2959; X-Microsoft-Exchange-Diagnostics: 1; MWHPR03MB2959; 3:iePbjzw+JtO1JZsnosqlqbmkOTN540WhFrA0QeZ7Mtrk9x0Z5yX33Ezc8awLA1TmD6PnFLX/0wV3iPjljadsBz6v688N0ixmkz3UZ28L3KKejBtC1AuQIzDt76rGDYbITOlrFpnfTKGnctIyl4WAPtpfjbVDH3CwvdZLPpRXiimrTaOwAZsmwVi3G2WllUeimOctotrf36sLuf9GYtK/pVM3+iN/ZQTuSjO5nqX3aVPtmS87r5K9loOw+m7xkLIcmrjfw5jYiREpGQFD+ZUcFrUDVcb6EMesTyJ9Qlsiuss1ODk+r7er8RAUI6/8h1qD1Q/KO/oINnTxPHjhfY73Sdb76duzDs3CpjQ+3+VWvc1YWLz70c8BwSIQioaXFGRM; 25:C3B5XbhBt6mOoIPkiGIjgR802UyF0pZZHoo3+Bpu8ZcaqJDB6wQidhcGf760B+2cXVh5z43Afq7nN/BlnRE2uOkqUYomZw2SDW9rC/Fq7fMJY2XER3Ei4Nce1PfCypyMku6jbp0SUOMzONNINybhztrNn20AI01IDDvd95cOWDtBQifglqgMgTzWbpNNkw8l2ohSW149GM32jNT4LgUsuJsLfM+yKSt+Of3HVctbCcXehDKsbse5/WlLAi5yaGeqKolJccvOKrhm1v8icyYEafkOHX47D+TRyvZPpHTtSeFhHzuupkeG8dnEn5qUQr6yYBEZJfeE+tojbJsd6x7tYpp8bOlpSDqbnc+fHfMzobuexFdo5vTy3Ubot7QEYVhilIeCyYQE+Z6OW2zfOhf/kOtL3fCSuz2bDDwCvC/D4fpWeMLjzgKKfUkSBQb21sbUveKeBq9ZRTmxS/AlHSM98w== X-Microsoft-Exchange-Diagnostics: 1; MWHPR03MB2959; 31:Mi+OO1WWBN67k6Dv9fRtiDbwehNaP2F2ybc/Z1XsZs8nDQjtTdc7RGc075WS/zwWfy1otUDdAQ/AWC5b5V+aiQGsmn/DrrvTRsXSVIXaYMf8gILhcOSdx8OpVYA/hffL4YwWqQSlVbob7WJmlfHo4BrY90ay/7j7Pf6OefAimBLwKlDG4dtssbwHSTIvMW833e1myGeztc7QvoHPbNWEkyZesMIllPxfWfPkRcPmKHcrmfmmbjqdZwvDZrs3PzDy7kEtOOkRex/M1mX5QoVIHQ== 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)(13023025)(13024025)(13018025)(13017025)(13015025)(5005006)(8121501046)(10201501046)(3002001)(6055026)(6096035)(20161123565025)(20161123561025)(20161123556025)(20161123559025)(20161123563025); SRVR:MWHPR03MB2959; BCL:0; PCL:0; RULEID:(400006); SRVR:MWHPR03MB2959; X-Microsoft-Exchange-Diagnostics: 1; MWHPR03MB2959; 4:Yia1sULTkWCGk78+lh1X4oSHSCqfy0nFzDvthkYNkYc3/wJNeYxbQFuYmbxNViNPaoTcf57xiZLLayqqE14Ny6+gk1iPF9C2slYxhA31PuYx8a1ojfbE0jZf2orsj9MCm2YlKSlJv3FXErgA4IIIPzvwMlZ7CzznROAjMunmq5DhumTbmYZB9l6WqGxfmDm3zIN6wEzFiL/LUb6e19JloPElcSknrdCf6j+Tx8EF/C4QX+xPlbzO6xP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ascii?Q?zijvPW3IBp4hgvsAE/COZnlRaw3xjlJ7MMLOQ2UZY/8jKUSx+tjGO3C+AwVR?= =?us-ascii?Q?8sxj7XdboX1lK/91Z9HuEiDbkPTnPylO8yk0BdTo7fphRQ+UMiCxL427mjD4?= =?us-ascii?Q?UoaTgwB6cRBDBDKC4bP/3Emly2ARfpj08r/4r61k5M5RjQJ3/CJNncans0nM?= =?us-ascii?Q?oTjj9v51AiV2FE3oPLKUx8LvQuNHtwQ7M84PnEVzUZYa2ji9zM3FaaPt2XnD?= =?us-ascii?Q?k1vt4zphuvFD0xwx99MghSJBgqEqHdy4L7TScAoe/gNs6lQbd/nOpR4dRdFa?= =?us-ascii?Q?2yC+rQdz1MQ2ioHsTCma101msmYgF7B9E1Liauj9GEcX4doVqdTu2PqYdu1d?= =?us-ascii?Q?sL6LEOqEmtDoLevd2R6+C1aaQ1nKH2LLXeWP2h29QhqLuYPSk3dIBo28SFlZ?= =?us-ascii?Q?CfjfmRcbm6M0/Caq3B0P79SPZajNmcHbI1mdQSz2H4fcPzPoB5NMX1qay41y?= =?us-ascii?Q?ML5X0uGtNNbuJlDtMgqfAHmBHNlrThtlg66LcI/c0oa1xfpLabX67ZP96r/O?= =?us-ascii?Q?/SW7R7j1okxpV8bhlN0cqPzFZD3+e/1rkW93CIyP1tE1ijargmkJ+9q2m940?= =?us-ascii?Q?+nBAkBS074QL6DeyM+RRxZfqnGTPaJaeun4VbXO2lP80JxJt3IeKio3y7098?= =?us-ascii?Q?StuFt1fBsGR6gRqB96w4I2LizRt//FQJReYuIPms58WkmEemZdms4U7aGWTf?= =?us-ascii?Q?Nl+brGoGXGgSt7Uk7fi4UfwR/s+mKDzz+uJRw4IMutI2yWPgyf3dbkzLcpoT?= =?us-ascii?Q?LFcXjW5awyylAKlWGzCthUv651G5aQnFgIGzpqI/VL4OxLsvesBORnOwzQyQ?= =?us-ascii?Q?mloB8vaq+9jib/XTjg=3D?= X-Microsoft-Exchange-Diagnostics: 1; MWHPR03M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SYkwjnMCpxj3a4IHjRKnly61UsZ3E8Qo7K/yp3MAwScxomZ+Fc0oJkWtlFzRSpJX9fk536OFLfXmO8pPH2JmSa9abQ7+w== X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Mar 2017 07:14:56.6230 (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: MWHPR03MB2959 Subject: [dpdk-dev] [PATCHv8 36/46] 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, 03 Mar 2017 07:14:58 -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 14b9654..1d6ae36 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