From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM01-SN1-obe.outbound.protection.outlook.com (mail-sn1nam01on0082.outbound.protection.outlook.com [104.47.32.82]) by dpdk.org (Postfix) with ESMTP id 874194C57 for ; Sun, 9 Apr 2017 10:10:08 +0200 (CEST) Received: from BN3PR03CA0105.namprd03.prod.outlook.com (10.174.66.23) by DM2PR03MB398.namprd03.prod.outlook.com (10.141.84.140) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1005.10; Sun, 9 Apr 2017 08:10:07 +0000 Received: from BN1BFFO11FD044.protection.gbl (2a01:111:f400:7c10::1:179) by BN3PR03CA0105.outlook.office365.com (2603:10b6:400:4::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1019.17 via Frontend Transport; Sun, 9 Apr 2017 08:10:06 +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.1019.14 via Frontend Transport; Sun, 9 Apr 2017 08:10:06 +0000 Received: from DTS-02.ap.freescale.net (DTS-02.ap.freescale.net [10.232.132.223]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id v3989Aot015502; Sun, 9 Apr 2017 01:10:03 -0700 From: Hemant Agrawal To: CC: , , , , , Date: Sun, 9 Apr 2017 13:41:17 +0530 Message-ID: <1491725483-6619-17-git-send-email-hemant.agrawal@nxp.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1491725483-6619-1-git-send-email-hemant.agrawal@nxp.com> References: <1490362538-20854-1-git-send-email-hemant.agrawal@nxp.com> <1491725483-6619-1-git-send-email-hemant.agrawal@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131361990065487408; (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)(39410400002)(39850400002)(39860400002)(39840400002)(39450400003)(39400400002)(2980300002)(1109001)(1110001)(339900001)(189002)(199003)(9170700003)(5003940100001)(53936002)(8656002)(189998001)(356003)(2950100002)(5660300001)(8676002)(81166006)(50226002)(106466001)(105606002)(77096006)(305945005)(8936002)(36756003)(50986999)(76176999)(33646002)(6916009)(6666003)(86362001)(4326008)(54906002)(2351001)(85426001)(47776003)(110136004)(38730400002)(2906002)(48376002)(50466002)(104016004); DIR:OUT; SFP:1101; SCL:1; SRVR:DM2PR03MB398; 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:SaELXrtC3WHOAFdLH8sll28cOK16JGkUC+pE0lyNsq9IvBjgLJdaBCVvMJ2+KEq4DfQLf1RGk/6Xe1TmOhd5kT13GAXggADVxikufTxkXvxDqUeOm12ir9+lkhlAOdgV9p0pbgLYUF15sN3rg/5Bc7RqUffwjHUVyUjN8RnGXZnHIjWTQNYRydsubdG2g8HJFiy3dFiTPwEKZCRbCoUG6oNO9RsqaJqpE++pblGRkp4Pfg8UzMb8bYnd7S4u+SkrbdppGnjFUsN9riTPEPxcvqoQ4xz1t9ShKH08vQhV5D9cipIC+t88+cwlid4bylLHNX2Pd/EDeyUI8O9gaancxy/5G/cI+9KO/TaScxirP2o2Z66tHG35ZEoCvbUtYvJteRbRSQOAw+el75JpUIYuPM7LHrhFaWD5cnA0z/pDUwNW+o/6Q1dlbNSwP5OA1IMFtifI2CRB4bco9tbL+YIrgC8fpCIu59lrUXnwLmMSR8z6T+9IAPhIhUtTCHY31PpNyi3KYy2pHOUT1TF6J9w/vzVo+xGWBhqVTTUa9twg5ecLSCFCcRbye6LO7twYUOYLhyNDdRSWiXPGjAniKiwEABR/bpaKjP04Yk2bjFFRLL+IM3ZZ2EBPgrjw/q08MbnZOtp91bU6Gh6z3rvoNYl1XobdXClVYZfrRZBKLMA+RbA= MIME-Version: 1.0 Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: 57936501-2afb-48d7-1ccf-08d47f1fd54c X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(201703131430075)(201703131517081); SRVR:DM2PR03MB398; X-Microsoft-Exchange-Diagnostics: 1; DM2PR03MB398; 3:FEgdUXYgFnma88nF66J+01nU2GovbsoMAdSJrhSDDp0XN97PRFuc9/F3L18G6suEitc26hHD4LwnW8eOSttySaEMakips3hk1wEfbjjED7iVlKaApcYRSk4hPqQiVIZKPO5hyKCJ7Bw4ZnXHMQRJ+avIwmVbFx2dfj1ebjSk+4K4D5MQJaaS3SMyDCewkF5qa2Xfpxfav+dOqtjFsmO2r9Ne7LME+awIQYwzZT6/2QeOjuouqOtxR2AALIBI8o/VvZvNf628zlfImaSxLR95vAydCe/oBqfePBVmBA8oNsEiziVqmwtkyUHJVWzW2Yy06eClZ1XGZM250usdmMhyINIdXQ+RpJljYRFbOWEFXB7xRv9V9fGzOT8R/Ztak1a3syKxSq2F/dVSKz4h359B9J49/vAbW4XjwdL7tESi3l0VZ3/3BLnr43SX+x4HKs25; 25:Dt58J8ClLMREloIKvxctEUlcx+M4cD52sxbV+veCpIELjNhB+nU8S64FRUYEFXSgS5QA3teYU4x0Hev/Qn8udKXAMui/1GTzZH4FA934vWk3zvzqGZFonDDkf+tQwaZVdU/vszczG0kxFd9bW5QWzNhGfIoqCkdMltxWhz85vo9wTcswgJBMVpnLkR+/xkRw5+cHRQYW6fSkaW4xJ3pjBawTLhDbA2Ef9NhaNUN4ZJpr965bROAMmjL1mbpS1Jk6DoSyij1kfpYsRp5J7PQr4Hwzj8FNPy/mO/sWhohEG4axcwTITkcg5Ig+T59VjhvXuM6rDVwk/PEgLxJgzKDfUQIIwKBN2GziEI/sK8jwMYyy+caMIu8YmWkzfazbwP1zZOxvKRpfKXNmpmsjx12opIzTfemq4HC2wjpyW21YC10lz/zJ5or1xF4QiY6KoRY9OQKet3so0/WxU8pyKCxaUA== X-Microsoft-Exchange-Diagnostics: 1; DM2PR03MB398; 31:LYt4CGP6DVTsKL0FpR6Cgkdl9v9+bFyFFaSDYWlW/nFelZcEVRHEOjrR4s2KewI/OWJicmq9n5kF0PpFPtVCgX0GoD2vhf9njquwqNuhasOgH0Lj0RNy4q7NwcaIlNVFoP4vlkZVD4pFfgwny9SJDQKNhsaexZ1HEWAJhbtJQERTPCqNXWk4jvCYy2811ovhh4YZ42Zjfz3XjZSRcEHLjFv7iSh3xHZasCkWWmIKz0UaydL6lzJ9IIeZmV1qDsFHnlzotnqmjDjX8HRnVbIS5w== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6095135)(601004)(2401047)(13018025)(13024025)(13023025)(13017025)(13015025)(8121501046)(5005006)(10201501046)(93006095)(93001095)(3002001)(6055026)(6096035)(20161123563025)(201703131430075)(201703131448075)(201703131433075)(201703161259075)(20161123556025)(20161123565025)(20161123561025); SRVR:DM2PR03MB398; BCL:0; PCL:0; RULEID:(400006); SRVR:DM2PR03MB398; X-Microsoft-Exchange-Diagnostics: 1; DM2PR03MB398; 4:2Lf1c3cuOWzntZgjtu0uXuBINen7W31poj8lsYTh/EbznYX9Euodi0wdhKZPwHXuwuqcuVhMP2u38Cx12VA+YafFOOL0y5co9zBqHcQw4wU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mM8NuFfyrBru6?= =?us-ascii?Q?WGvpVvlfBMcjyfhlsm6X/0SJm+1CKUr9wYmNWszzB8IlYKCkvfCL/qITtiIE?= =?us-ascii?Q?c/IHwSCRyudrMr23rD09uLFfBXYFVJonGDt/JsNwJK+Xw+b4YLJ6hsed+SkU?= =?us-ascii?Q?H4ZnWJFQd7J28=3D?= X-Microsoft-Exchange-Diagnostics: 1; DM2PR03MB398; 6:gB2nZWqjAXCDKnGCYTyYVtbDJn2Sbc8gdQKefQNR/bvoRXihDYKwCZEar4WKzAok7mJ6eQ5wZwnaGZqqlNOfUSSiVRHx/OyblxhNy/kjcPD34C2iVCbfUUfyDvBz2PE+d073apt475GVzO1JGQD0yhVGQMjMluKGSOmi1+kuCAm9p4d1qHSqECC50UaYaYnSVjKm7z79Z5EjEcjXjxFMSCtxDyr2pvbIL36nZo3LmJAgT996jHUleZZH4bS2v9TOp+neYKPcx8zaML0ks1c299D5ThYtHYFJw1Ukhp4z4Q2BIrGb0XkD8gzHpGUKHQpCElz4RCztYU10ulYIk9uJRO0VeNvGZyZAdL5w0qZ+9suNpcXNary25h2VEp/cyD9O9bAji6Bt3/CQe0ia+COr1D1Z6Z3CvXD7sIcq7bwJmoI3PwF/xVEroiedRp+MQyK1x2AjeS2nkItaR6fWOZC0vw==; 5:xYVIu07bxpP+jzGpfQItccCYygEQb3NflhkZu4CXlkYl9KIXHLnBExGAy29oAD/Pel8J4eKUuIx5f9cd6wknjvfCS2kwHlRJXikQomYCNw5llVBhKNAWgIPQDDZLhUfypeijDgT3iB6WG2GLp3tEhVsqPqfxftv9XXhdwU2bR215gC6JsU3NEvARI6yahbSv; 24:uZx+S99utVKkRkMMHRZwu7f9oKI7X7ITJtsZEoGQr78CnqIqdssaMyL5Rd7cBgb6xsYF1034OW+6DNBZzXYZrj2RgJW1DS7i5CBPlTnHqyU= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; DM2PR03MB398; 7:WeON89bH69GVRSFdZlDG9Om1QsgGYfAtiV4yoq0XAJCsiX8rreg4PkVzzgPfNi1Am3Fay5WDrd0awsathMGXxMg13oM9mzGUzP/DuVlikxhVVzzg/uOEizElreWj0ATLbz7awGh5cCyO6j2fpneqDJIvsFPTAlFfttekYZWyDL+4+i9Lgjeo8JDw5MMk/bSMgpL7s0LalZ9hg+d/jFYU7eIzmd6NtOHjcukenygOqCnZF7qG3su18JiMRpzcfxTvyoUzGWFGOkfAUFCYMUYyGOm1tez+ro+DlL7/C4X9fYJr6IxnO/AUcvQxDWFg/xKwA5l/gC3UraBqGzjTaQojGg== X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Apr 2017 08:10:06.3459 (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: DM2PR03MB398 Subject: [dpdk-dev] [PATCH v11 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: Sun, 09 Apr 2017 08:10:10 -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 8bf1579..34e435f 100644 --- a/drivers/net/dpaa2/dpaa2_ethdev.c +++ b/drivers/net/dpaa2/dpaa2_ethdev.c @@ -588,6 +588,90 @@ dpaa2_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu) 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 @@ static struct eth_dev_ops dpaa2_ethdev_ops = { .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, -- 2.1.4