From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM03-DM3-obe.outbound.protection.outlook.com (mail-dm3nam03on0054.outbound.protection.outlook.com [104.47.41.54]) by dpdk.org (Postfix) with ESMTP id E26B7F94A for ; Thu, 29 Dec 2016 06:15:49 +0100 (CET) Received: from BN6PR03CA0002.namprd03.prod.outlook.com (10.168.230.140) by CY4PR03MB2469.namprd03.prod.outlook.com (10.168.163.147) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.803.11; Thu, 29 Dec 2016 05:15:48 +0000 Received: from BY2FFO11OLC013.protection.gbl (2a01:111:f400:7c0c::120) by BN6PR03CA0002.outlook.office365.com (2603:10b6:404:23::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.817.10 via Frontend Transport; Thu, 29 Dec 2016 05:15:48 +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 BY2FFO11OLC013.mail.protection.outlook.com (10.1.15.25) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.789.10 via Frontend Transport; Thu, 29 Dec 2016 05:15:47 +0000 Received: from Tophie.ap.freescale.net ([10.232.14.87]) by az84smr01.freescale.net (8.14.3/8.14.0) with ESMTP id uBT5DOIA010218; Wed, 28 Dec 2016 22:15:44 -0700 From: Shreyansh Jain To: CC: , , , , , Hemant Agrawal Date: Thu, 29 Dec 2016 10:46:47 +0530 Message-ID: <1482988612-6638-29-git-send-email-shreyansh.jain@nxp.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1482988612-6638-1-git-send-email-shreyansh.jain@nxp.com> References: <1482180853-18823-1-git-send-email-hemant.agrawal@nxp.com> <1482988612-6638-1-git-send-email-shreyansh.jain@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131274621484598701; (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)(336005)(7916002)(39410400002)(39400400002)(39450400003)(39840400002)(39850400002)(39380400002)(39860400002)(2980300002)(1109001)(1110001)(339900001)(189002)(199003)(5660300001)(69596002)(104016004)(4326007)(189998001)(2906002)(97736004)(68736007)(85426001)(33646002)(77096006)(626004)(50466002)(48376002)(81156014)(356003)(8676002)(5003940100001)(305945005)(106466001)(36756003)(92566002)(50226002)(38730400001)(105606002)(81166006)(8936002)(50986999)(86362001)(8656002)(575784001)(76176999)(2351001)(110136003)(2950100002)(6916009)(47776003)(7059030); DIR:OUT; SFP:1101; SCL:1; SRVR:CY4PR03MB2469; H:az84smr01.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BY2FFO11OLC013; 1:yKo6zcRFT6c90TORg3znz7DyfbVkhgoHzl8KyN4+27U1PQY/dTNQF6fcW1FLjWv4ME1EVfblwnqVBsSSglXNjtxYDjd4lr0VuoKRYxzD086M7/tpGZeWjOgNaPweoV1NgeEa37mu1ionIvSTbmLzyM43C5JRjinJuGd6csuX79BzThO/RTmflNJQosR+tWaBi4uQKrwmwrlOWpPZKUS2IgLmUXAOFmUuTKjJDtbgm1lOfOq7gz559sbnqx5phTiN+x0nw0NWSIbONK7sYOoiSK/YdqBYdV2NKidDpterNEeyxhUzCc6jyy2jiKT7vgBbBdfxv5eHC7iLmKauW34+jHZQyc8EOt+c7YcGW5Pqad3GkY2frkn7rSeKpAAvUzyh/RUkRDf3FMwhixyUFeWh+mm8R9vRMT4MoHzJ/PGRSzUgKMcO0q4AsgyhbD0p+XkhqBkUw4GxyeSXcZjtVeQ+U4tc3JPgpmvr78NQxZioia1ilavLQkwbb4JTPEH+zJ2h9Jn1ozmUuWkRAYpqBcxm8IwgUHGUobH9nS1m8woC8JkqDRVGJy1/TFpW2orT3aAAcydyFYZDjz95K18ib47Chohd/ewglcVa1eR/0swUXSiTIMMm89lyCCBQ/yOLQPDRW8zhdmu1YAHkj+kHeO9B8ZVB21g7xXEeK46zBWdmQ0TbHsXLPTDr8054aR38yjjZZY8NJvnExqhV7dLgiNBk+r8Wxd5EWwtY2YhDkTO80iVb2OrVfOvAQ3h+mvcRjXPf9RznU0dcNA+K+esldyLDGA== MIME-Version: 1.0 Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: e5888425-443a-49fa-fac5-08d42fa9c000 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001);SRVR:CY4PR03MB2469; X-Microsoft-Exchange-Diagnostics: 1; CY4PR03MB2469; 3:PBdTpBd3RTl3Qf13X2pMj9TCUWtI9+v85ZC6A2rhflnUUOpZHN1EjZAvkbQ8+/WrndRiN6cCLYi5V38xR7Qb9i6lCkBTm550s8Og7loJQoOwH+JDreEVrq397Fb7ZHdjz9VPShwAvXIjCYlnIzK0KgSQbbLi3ovjGMGl/yKTJ9nBsXVj8goMumROp9EPnfsI+yIrfI+oRjlPPh54Cz1rSaDVSRssa44Likerhwi05C6q37jyq+7f1oU6xSCvaVTydfigq1iBB8nn1uGxRYMeVUgM7kLPw7FSKLDLKxxo2N04DBclt4m4JHuDk1BHlhRToqAv/sQ3sjj4UShsjB+T+EoonJbTPYWBx5w3ya6NQgA=; 25:8nwDFV2rfMvbNfDw18eBw8Vzq1m7NXlHnDrKyEJ32PX+8PELKJ0qsklvZF6uphIr3zPSlSpwTpYWSlTXNC3QFwUCerGrNQAkipWHnO3vcRoP15rxE+LdZYwDIJIiGM6tCjp6ChaDXlJOsahMyNfJGFJuujy45n0gySmojfrgJkDSDHRGvju46Hz7ZMs15MiVI8BvnV4xVi/BT6Dr1vrBhychDbvqqTkVNDi0T0RtqiH2JEkV7/qc1c8ZXCf8Ed039WS9qoKWvE1i7l3YTynYovkvWuZIhFpUqGjizk5eHVKOXDNfM0wfOHaLNSR/wcZ6nvLrCNsb2UEDm0arrvHkEvx8esQbGQkiuKw84Uoy7PZpSBiM0f+HFjKPmcpb4vI8ibpYGmz+SIixNxZyce3ZA0KUAB43y4RAi6bEJVaO3SqjL97vcSvB1ZdvPRnMTYPGMi01GqeB9r3uaStrEbh9pw== X-Microsoft-Exchange-Diagnostics: 1; CY4PR03MB2469; 31:i9CP/roD0hfGtjTJaiALjpKufQ2SYnd3OBn+0n8Fx8X3rUEWKEe6hqrsBZytjRnCPNeOVf0K20VxhSOhGSQgnvemc5lxkmhGGfGqbkqDaywqrLmJgEy9PAVi6YvEuXZx/1ikyCMYGEakrOLIe5UHK17rJCpuXi7lr3T5xmwS2ITotCQn8ArsVGvNSB524+lC/byk5iJfDEzL6mLu05vyBKkqAItCcg5EJu5xavpI8+TrLvMDq6GGVSnmwIsdD7II4ajJw7BwDsnd/AQpEKQ1AQ== 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)(13015025)(13017025)(13018025)(13023025)(8121501046)(13024025)(5005006)(3002001)(10201501046)(6055026)(6096035)(20161123559025)(20161123556025)(20161123563025)(20161123561025)(20161123565025); SRVR:CY4PR03MB2469; BCL:0; PCL:0; RULEID:(400006); SRVR:CY4PR03MB2469; X-Microsoft-Exchange-Diagnostics: 1; CY4PR03MB2469; 4:fxOqia/K8IMe52UZ9UL2EDEgD0Re19B+AlECReZ8+3++6mixbkVgC9MpySBsfd8CbXQHq5GAI3Q5BUi5R9HQdp5bpHuuxAaxib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v4zZy8MsjoOGQEcaXTgOI7+8uwgJheMApb?= =?us-ascii?Q?i61NleMJHMPSQFKBcUQT51U4ummHOCFnjjoPKWhP2TjbRjP7+0Dre4SIrJZL?= =?us-ascii?Q?FriFGLWnxg1P7CAclRQpXLr539BqCc1ffmgZS7jL3ibFBS69PS04U9iv7uJt?= =?us-ascii?Q?TMVbv6flXXnpwIbWeyqyaU=3D?= X-Microsoft-Exchange-Diagnostics: 1; CY4PR03MB2469; 6:2VafWedLKf9qxp5FQS2qmQXIlHeiFkHrs+xDvajhI4oIbp8dwAxy3HL62wL/BsrJmoREROl1H5Ky+bpnU0RBHNGoMpBV0O5uwMEG3w76svq4hZhB2fDQCKgITAczmE7kTy9S7+rIjJSe/o9HKZXS0wkVxhUlMzXHtTjMB5pZTnNMVCZ8M9ToXizerF6nokSFe8fcBtUQXl22e1huuVUaxaiikwPhS8jaOeme6Pl5ecHBgp40f1CrWGsAioQc+EtO4Sf3delToiaeTNSHTKmOSAkK6fmZosullj+XnNI7MQwqoz04yDzAtmA68okYzlFZpG0SzJ+X33vTgtawNsfr2FMunrelaVd2xUpL9ZSEnfMSdtrxLGD4ff2xSGwWIl+FgnLDKPm1YS2Br9asQlCwqowy/UV02wqVZ1shNV+u2wTaz03vmASDgju7as4G3tr1; 5:KWv/kKHUC9dfvoL58mZlfahmYm5Af/YGDD3W9zS5wULC2CsOQALa1igq3yus28k+jIHKNL/DmrMla6W8l+Nhc4YgiqTzM9ti24vJn7XcNIWBK3KksISkbI5hX2IU1yvmvDp9/0YI9LFr1Bjoai/4HAzE+Fce0RaPVvqN5t97uCmyhUHfBEmG7jgeqjDuwUwp; 24:JgKRWGbBI/G7kaFNPi0XrLIyvCmCIc0nXMwFQhq4dz+DPrpYO+U1NVjsozJ8U4aJ7ZNtqQDrV3Lql18jAgpQLQY+IEvU9JeC3wMdlne8mAk= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; CY4PR03MB2469; 7:qU7gbALE4b5jrEoUXZlxXLa2pzVjCljQHKQs1K+a+XPXG5ea7BWhFhYgosFPj1JgB6HCGeOEuWKPUukDsT9oXgA4SQgr7HSDnU5e/XtmjharH3wUetE1mUpGBoZ3bmuSYWLTmRtBhQk/DJdspAcH3VginXrZWy0iDat8ZYoYrxRir2beAorpwAVBPMMGyIVJBfiUgl31A9I3qC5b5C8jUu5l4Wb7f67VqBKf82ciPpHkR5SrOCk5pWmrqBpsILwxIB1bHV7+6ZtUTSQcuuuxsTONdr2SyovRXzGj1DN2fz/rnZxEXGWs1wXWE+XOwaZbtRAE8VypX/c66xvqC2ckbuEaHbmTuhA7ldVeKvNPQ3NPv0hB6FNL7ld/hY3SIx0JlXJQAF1f2jRvm0KlYDEuUlJP5J8cmP71CkRHRisqL5+uRgjEKWXfuw4R7Y4a2ZcUXYHAYqGiyQAfzhV5kSAdzQ== X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Dec 2016 05:15:47.7890 (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: CY4PR03MB2469 Subject: [dpdk-dev] [PATCH v3 28/33] 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: Thu, 29 Dec 2016 05:15:50 -0000 From: Hemant Agrawal 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 @@ 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, @@ -646,6 +730,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.7.4