From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from na01-by2-obe.outbound.protection.outlook.com (mail-by2on0082.outbound.protection.outlook.com [207.46.100.82]) by dpdk.org (Postfix) with ESMTP id 2126D9AC1 for ; Tue, 14 Jun 2016 21:08:17 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=CAVIUMNETWORKS.onmicrosoft.com; s=selector1-cavium-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=9PdP5bTE9xorgiNw9O6lcKx6fhpr1bkQhrFwPwG8jl0=; b=mnspROOwcpMVfjsSoGiINZv2a+oZ2SrOqqgPTJtu7w4yn0iC64zsH3lZaEFmcxT7x7RbPeduJAgaslxZe5w04HjnJdzTmw2H5j4iQPHfqrsEFR4IrWgTPtcPmvPQik3+K9OT6UM8j5OjI8tTanK1/VmZe4bmm/4k/EQykQxzYiA= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Jerin.Jacob@cavium.com; Received: from localhost.caveonetworks.com (111.93.218.67) by BY1PR0701MB1723.namprd07.prod.outlook.com (10.162.111.142) with Microsoft SMTP Server (TLS) id 15.1.511.8; Tue, 14 Jun 2016 19:08:12 +0000 From: Jerin Jacob To: CC: , , , Jerin Jacob , Maciej Czekaj , Kamil Rytarowski , Zyta Szpak , Slawomir Rosek , Radoslaw Biernacki Date: Wed, 15 Jun 2016 00:36:32 +0530 Message-ID: <1465931200-23912-18-git-send-email-jerin.jacob@caviumnetworks.com> X-Mailer: git-send-email 2.5.5 In-Reply-To: <1465931200-23912-1-git-send-email-jerin.jacob@caviumnetworks.com> References: <1465826143-22159-1-git-send-email-jerin.jacob@caviumnetworks.com> <1465931200-23912-1-git-send-email-jerin.jacob@caviumnetworks.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [111.93.218.67] X-ClientProxiedBy: MA1PR01CA0040.INDPRD01.PROD.OUTLOOK.COM (10.164.116.140) To BY1PR0701MB1723.namprd07.prod.outlook.com (10.162.111.142) X-MS-Office365-Filtering-Correlation-Id: 6984e58d-4496-44d9-e877-08d394873d2e X-Microsoft-Exchange-Diagnostics: 1; BY1PR0701MB1723; 2:ntzS8YJ98ojnMXsfGw34T3KCe1e1WaNNLB7S6PgjhQXhQMjsCwQNkcBPqfIh6Dzp9Bcqj0+b1cONnEEBU2e/ngWxjc4nHa7r/56urMW6lcpd93O/Ao1+OO5s+mklKHTvJ9iLffHGbzdDosMI3t+qC5c7kQNrHSTcZVVMRFIioWRXhgigW8l2c/Q99niwFwGW; 3:RGi5Nfau+ySQS42JJYIfNIULuz8L7DrZ+2NgT4VHaK3o3eTywfNtqC+LvW4fJTFKoTPfmIUXSWx6U7TzN4+c2B0YDqf4U4QWVhyaPKyzKourkdZ2wHfpqy+WdpbK3sxp; 25:uaULJRqMeanL4Du52EXOu5rm3LcBXXFGjoUbauQ83oGlNgPBjfFNIgZZnegPdI4VVYl9INHbIwcZT773AUEOVGEKH4bcQv7xuT0uvPNz01CelY4npufPZiDuScoM3YXH6P7BXRe7Y0ZLw6gPyqOX4lI8qfbZmK7hsm+jEYFTHLnvotLhPf93WF0G5AivFOSfP5gsC5M9vjY8FPJcrkQkFciOxSSGM8DHZ+rdR204P4QD3yE603bEML7wPH5m3FoHWfwyIFdqzux1mTXLP8PXzE2nA8nk8OskL8P9YZPz1VcmlEd3fpobpIGZ6xBEynWiVFkTO7wE/tzpi4JgSx6VxDiwoJevTt9KqQPdDztfgIDF99tXAGVwDm1dogqE59YwZ3vaOYR4ZMde76UbKUbYpPgi2Sm3I5IkRgtZJh3eN0I= X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BY1PR0701MB1723; X-Microsoft-Exchange-Diagnostics: 1; BY1PR0701MB1723; 20:klD30sVFmRQwM1cr75xUnECRNwW8AEcEfEpjcYkQgjvAVognWOBLSPsCa9XJj6dcCBVrqCb4FwPsJfpXWnsXHZSLtygIRZnbtJuQJDijehedVSEke8Pmu9qyBK02p/K1OZaaESq/g4p5bmMEYO2N4berrm73cJq27dWRZcZgWqAEFX4y0FeiFmyFcUEqE1uo9FJQEbLCzGzLa3A+FUj3InEqRwmgJ69reKrvcCCfL6rcKFmMQpm9GNFH4Km9jbwRoOgrG1bGTsge+GmYR2AXEi19hFMsExgckrt22c2ciIe2vrjVxCl4jD15jy7rmxPwS3NH1PoVDmglJpdMXiHbZc8fUdv3cdOMUkxr1hVNk8W9VmbVyyh/yT1iunJL1Gf6lcWtOE8pLYV17lfSjBeF8F41lvg83IasLz241miZlHh2Vr03dGWoGK0OJcjpbT6q0uXDqa/i85d6mpmGp7I7RU+thzm8Bbg4zKF2LDKffIVkIzXjy/ugWXovF+wELn9gx8LWZtum4IoIaD10JYOjr88+m00oSdvgcepfrPQKZSNzdcgPtOue7rxXIhYoMppU8dwH2AW1d+NZjQ18sDH9MCuLZ6WnFfoUTO0kgWsaQY0= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(228905959029699); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(5005006)(8121501046)(3002001)(10201501046); SRVR:BY1PR0701MB1723; BCL:0; PCL:0; RULEID:; SRVR:BY1PR0701MB1723; X-Microsoft-Exchange-Diagnostics: 1; BY1PR0701MB1723; 4:TBw3IRVxh0vyuGfvoVQ4wrx+M1y+B0Mhka4bq4mT1ypwrrR8RjnjS22pIGI7jfjee6FYm7TIxQalEFSWBkltVIel/F+PcS8byEQZ6HtimI3xD4LXDdWBG5nmTiQQnJZxS3WF3AHZ+xjD5MPExr+Lr+d0i6bIQpAOMoR287r1/AwGFIUggt6H3qFmsH1CVOG3Do4llHkCnOwrfxIwHDOUYSDg0wSBWE8VEc1OwtuVcfgXM9TKyNbx8kyqamkOSmRY9rUbYrtOLWieKoTV3P6hiVjbo5KVvRp1VR5oDfWDyZYiDd+8VMw9SCUnpytSAlZVHTY6/rgskiBtgW5OVrpSnttkjA0VWemRlBmeiZhpLtBhrkiZAPsY0ZU8s0KKxeW6CY5PjniJfwDr+YYWk/PW5SrIfmx6dXtIM9y8OULtorI= X-Forefront-PRVS: 09730BD177 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6069001)(6009001)(7916002)(189002)(199003)(69596002)(189998001)(2950100001)(48376002)(77096005)(36756003)(19580405001)(5004730100002)(19580395003)(76176999)(5009440100003)(50986999)(97736004)(5003940100001)(68736007)(110136002)(92566002)(101416001)(5008740100001)(81166006)(8676002)(229853001)(81156014)(66066001)(4326007)(50466002)(2906002)(105586002)(106356001)(2351001)(47776003)(53416004)(76506005)(42186005)(575784001)(33646002)(586003)(3846002)(6116002)(50226002)(7099028); DIR:OUT; SFP:1101; SCL:1; SRVR:BY1PR0701MB1723; H:localhost.caveonetworks.com; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; Received-SPF: None (protection.outlook.com: cavium.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BY1PR0701MB1723; 23:4mXycR8iOVm9qJGaXosYSbROH7bMJDArSX3x1wH?= =?us-ascii?Q?MleynFd+yvbVBUpOjsfmXF4c5Q3kXp8PCXNBwTGeXPODC48I5BFuOyeu0BgJ?= =?us-ascii?Q?U9VMqUHsTiO+/i4EFbAGxqz/YzsY5q27Plb8DcLs69O8/og86LfnqagmfLIw?= =?us-ascii?Q?ueUp8LdLGt7kobXYk1bKQ9N1rQzLx/V09l76Rmv81DAOOe67LWHMjRT+KQZ9?= =?us-ascii?Q?jRrsVhl0YUWFpO3JOYiMLVsTs4gSjFD1UWP4xiRrUJNKIe/dZJcRONqqaoYr?= =?us-ascii?Q?JKsT8ibU2icdcDyA4ULbcNZI/rnk/DTNZutHrhv4W3QfUN6u/JYUxQQuxHg6?= =?us-ascii?Q?wXmTkHmvzDLztVWBp0japf5UW0M3lDGrDsO/PxW2XE5CZOLM66nbG8aaNSem?= =?us-ascii?Q?Ooa0y27q4FJMAryp2rBuz1IrGW4+WWDba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0t7KITklBGHFKWjCgITwKfEITaR/mshMDDUt7YJn3L9gTiqS2SigEmxynktQ8LGC/j+lTERQZwmlvyx4Lw==; 24:cIwQg9nwse+qR96/RmXGHVs/6SlHPo0vK5lEaFekv0erSV3rAQ1c7k3VVEAXpPYB+R75Oyp2euH3tjulzuqdsUJe/eOYKisg6j+EUetejtg=; 7:bc1wtkzlvxP+3sIjSMtL4OAC7zde4qXZg4Tj5N4r0la/p/teq4gMv/Qh5rDG7BhB+MWMDv2QcOw0MoBoTxDExaOIyBUYuEC7s59a6s2/els/K/fS+tEUWrZF/39GsP4CRRp9vrVsJjC9i+OpI4dYTKHfMNj/c+2OXZlGhJ92nRCf8qUSElOZ2vvbOWZKsQri9gc6EZOF6lLcDDl3/9JmRQ== SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Jun 2016 19:08:12.9538 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY1PR0701MB1723 Subject: [dpdk-dev] [PATCH v5 17/25] net/thunderx: add stats support X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Jun 2016 19:08:17 -0000 Signed-off-by: Jerin Jacob Signed-off-by: Maciej Czekaj Signed-off-by: Kamil Rytarowski Signed-off-by: Zyta Szpak Signed-off-by: Slawomir Rosek Signed-off-by: Radoslaw Biernacki Reviewed-by: Ferruh Yigit --- drivers/net/thunderx/nicvf_ethdev.c | 66 +++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) diff --git a/drivers/net/thunderx/nicvf_ethdev.c b/drivers/net/thunderx/nicvf_ethdev.c index f0e3371..19ad85a 100644 --- a/drivers/net/thunderx/nicvf_ethdev.c +++ b/drivers/net/thunderx/nicvf_ethdev.c @@ -211,6 +211,70 @@ nicvf_dev_get_regs(struct rte_eth_dev *dev, struct rte_dev_reg_info *regs) return -ENOTSUP; } +static void +nicvf_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats) +{ + uint16_t qidx; + struct nicvf_hw_rx_qstats rx_qstats; + struct nicvf_hw_tx_qstats tx_qstats; + struct nicvf_hw_stats port_stats; + struct nicvf *nic = nicvf_pmd_priv(dev); + + /* Reading per RX ring stats */ + for (qidx = 0; qidx < dev->data->nb_rx_queues; qidx++) { + if (qidx == RTE_ETHDEV_QUEUE_STAT_CNTRS) + break; + + nicvf_hw_get_rx_qstats(nic, &rx_qstats, qidx); + stats->q_ibytes[qidx] = rx_qstats.q_rx_bytes; + stats->q_ipackets[qidx] = rx_qstats.q_rx_packets; + } + + /* Reading per TX ring stats */ + for (qidx = 0; qidx < dev->data->nb_tx_queues; qidx++) { + if (qidx == RTE_ETHDEV_QUEUE_STAT_CNTRS) + break; + + nicvf_hw_get_tx_qstats(nic, &tx_qstats, qidx); + stats->q_obytes[qidx] = tx_qstats.q_tx_bytes; + stats->q_opackets[qidx] = tx_qstats.q_tx_packets; + } + + nicvf_hw_get_stats(nic, &port_stats); + stats->ibytes = port_stats.rx_bytes; + stats->ipackets = port_stats.rx_ucast_frames; + stats->ipackets += port_stats.rx_bcast_frames; + stats->ipackets += port_stats.rx_mcast_frames; + stats->ierrors = port_stats.rx_l2_errors; + stats->imissed = port_stats.rx_drop_red; + stats->imissed += port_stats.rx_drop_overrun; + stats->imissed += port_stats.rx_drop_bcast; + stats->imissed += port_stats.rx_drop_mcast; + stats->imissed += port_stats.rx_drop_l3_bcast; + stats->imissed += port_stats.rx_drop_l3_mcast; + + stats->obytes = port_stats.tx_bytes_ok; + stats->opackets = port_stats.tx_ucast_frames_ok; + stats->opackets += port_stats.tx_bcast_frames_ok; + stats->opackets += port_stats.tx_mcast_frames_ok; + stats->oerrors = port_stats.tx_drops; +} + +static void +nicvf_dev_stats_reset(struct rte_eth_dev *dev) +{ + int i; + uint16_t rxqs = 0, txqs = 0; + struct nicvf *nic = nicvf_pmd_priv(dev); + + for (i = 0; i < dev->data->nb_rx_queues; i++) + rxqs |= (0x3 << (i * 2)); + for (i = 0; i < dev->data->nb_tx_queues; i++) + txqs |= (0x3 << (i * 2)); + + nicvf_mbox_reset_stat_counters(nic, 0x3FFF, 0x1F, rxqs, txqs); +} + /* Promiscuous mode enabled by default in LMAC to VF 1:1 map configuration */ static void nicvf_dev_promisc_enable(struct rte_eth_dev *dev __rte_unused) @@ -817,6 +881,8 @@ nicvf_dev_configure(struct rte_eth_dev *dev) static const struct eth_dev_ops nicvf_eth_dev_ops = { .dev_configure = nicvf_dev_configure, .link_update = nicvf_dev_link_update, + .stats_get = nicvf_dev_stats_get, + .stats_reset = nicvf_dev_stats_reset, .promiscuous_enable = nicvf_dev_promisc_enable, .dev_infos_get = nicvf_dev_info_get, .mtu_set = nicvf_dev_set_mtu, -- 2.5.5