From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from na01-by2-obe.outbound.protection.outlook.com (mail-by2on0094.outbound.protection.outlook.com [207.46.100.94]) by dpdk.org (Postfix) with ESMTP id 43FE85955 for ; Mon, 13 Jun 2016 15:57:29 +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=Xc+bId524n/OhnecmqBE8M9MTh+O4TZDzBclZ1KpfZCLfeqZ2LLrH/t3zbZ+/wZ2k2832eEZZZmRl9O9m1nMSbrh/k5QHyvjpMm/zGvzJuAfOeMo/BFwu53g+taeBnKerE7BtJrXfB27UZ8BmRhFf3LEYv8a6s3nkbtpFfQ0sRk= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Jerin.Jacob@cavium.com; Received: from localhost.localdomain.localdomain (171.48.21.3) by BN3PR0701MB1717.namprd07.prod.outlook.com (10.163.39.16) with Microsoft SMTP Server (TLS) id 15.1.517.8; Mon, 13 Jun 2016 13:57:22 +0000 From: Jerin Jacob To: CC: , , , Jerin Jacob , Maciej Czekaj , Kamil Rytarowski , Zyta Szpak , Slawomir Rosek , Radoslaw Biernacki Date: Mon, 13 Jun 2016 19:25:35 +0530 Message-ID: <1465826143-22159-12-git-send-email-jerin.jacob@caviumnetworks.com> X-Mailer: git-send-email 2.5.5 In-Reply-To: <1465826143-22159-1-git-send-email-jerin.jacob@caviumnetworks.com> References: <1465317632-11471-2-git-send-email-jerin.jacob@caviumnetworks.com> <1465826143-22159-1-git-send-email-jerin.jacob@caviumnetworks.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [171.48.21.3] X-ClientProxiedBy: BM1PR01CA0031.INDPRD01.PROD.OUTLOOK.COM (10.163.198.166) To BN3PR0701MB1717.namprd07.prod.outlook.com (10.163.39.16) X-MS-Office365-Filtering-Correlation-Id: 6e916e76-d9f5-439b-65d3-08d39392a6ee X-Microsoft-Exchange-Diagnostics: 1; BN3PR0701MB1717; 2:H7KaozvzW1r805R2cMLdIXngwzOdxqiSxrsEKe5ZQfP2w0TOzBvWtuTH13q63eiRbCs2U9vJ8nyNH1cGUtYrT6S/t8C2E2wJCb9sEpE0MVflWpEgVJbR1PzIYUI+kUtivNen413lw4+FmOpAvdZMWnASzxO/emx0/ghfGEeTda+lnVwN7OYZXbw40NCLuL8B; 3:QgSofYJur7PtMxt8WeLAVMbAggIx5IV/KnANaYCuZEHebnrSt+lgCAzADzvuLKB3F2PDNx4UlcCcu8Do1V8KBMYHtAhuEEX6RseOrsKPEqXpj1YUO6fIqw9MDkePha3c X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BN3PR0701MB1717; X-Microsoft-Exchange-Diagnostics: 1; BN3PR0701MB1717; 25:JwdwYfI4lNtwBuAFe6RibRKTDdu5ZC65sPlaMrED8lzOIRUCiEjHMYON8CUW3PCLHNTxuMCut9Z8FBUVu35O/dWYO5LOrIZ3poadEKfZPT2KU/4sxv5EAnLaSJk1kEa4cTp5DKGcGPIlaso9MWF58QTy8Ku6kZZ4LHOYpFQxX+EJlcx4dF2v491ANRebfML0TeB8YvWGiPhmhbrRZA/rXP1qWTx7+yNjvSppdnrAwtt7AGrXkWjZRzbgl2pViKcKvay3x3YklAoKJZf/0Oj83viYCtT7lHza2V2Xzoj+SvGsn+4asbOskXYhzOJYGoAdXbeXmg1XqNU+vADZ6t2V+x0PO7J4Lt6kFAO71DNEYpca8N4YNANKraNcf5UaGyd+/GQbVRSkNmmMBDvKr6JtIqVA8n04+ADL3zjDzrkQVO66A7I17N05HBRyz8TSIdoNQnRB29PnSFqeFqzttrN2BOyFRpYVgHRIp/XClIsTCrBeAXSIF/zPk4W5yWJYPVvLOtzMXzlTMXcnur6/SbJSaTUV45G+3CifTEOYmG/41hUkz/gNewcO44f8f7fX0BapoQ/uL/7M82tpDC6wOZ0DLBC/hIzYmeoOBRrzGxbpjTJeLy2r5meHiiQPB9QCn+v5bgxRiLBJkPoDEf/QjczmfmKNuugGS4Su+gYv/w0vbpSFrDCpCKPpGBeX5Cr1lW4qyJ3N7AxJBbE5leGhSK7Q2kx8fsow2/0I9A/VV6fginzI6hqVvYuGFra5Iz3fstFx X-Microsoft-Exchange-Diagnostics: 1; BN3PR0701MB1717; 20:RZkZ5eD0kVTmBt/n65P5WMAuS0C2kYfRt/JV+2kpCCPVQhJ1fWcBdJHU0p702Fo+SfwcxbgOsfGwonxlNleK9ftncLGoi2pYZCZcVpIBzmRQeaFpSa8ruxSOvMkD6yUqf+H1Tbplp0nPjSSFBDm8XktGWTlLShjvMu36Jb+LK8801kdSjHCQfVLYtAd/sGhg7nGFAPb62WUCrWxk+ZDsBWAYbdIdUaoq503kAE4tzEdaf0QUyjia+Z1FMCB3RF13HV4MdG9R04iDGtEwFsUWOuUwsGejnndUzSv1mcAvUOCJHHDVOFqhGq8NujS1Q0Nuvck/tevy+wk/y7flmBTHJ6VJV2ydAUUY2b/F+0PErJeXLUSAXKITKI/ZsZV2ROSQF4qnLiEc7R/B72HT863aaWeiYHFF4wz1VYIqmkIgGvZggneDGpMLChYGClcYJX158rKBFc1zJxhIAl6tuRxyx+28483wdQpqVs53RQ1V3C4qzgzY+f/s8aF/fUdZZRn91D7coC/J1/i/qhMmGZnLKXdHduGFrEdMyL8/ExmczZN41xNwMWlBXTiCd9lB3/nnfpoOaU/kUelNVTB2SuS+qgyasTtQ43V9NUYBUOlVeVY= 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:BN3PR0701MB1717; BCL:0; PCL:0; RULEID:; SRVR:BN3PR0701MB1717; X-Microsoft-Exchange-Diagnostics: 1; BN3PR0701MB1717; 4:Cm2PXrjszGBxn4eOmlw1ElkfDVnTr/2En95/eSKUDk+flMhaQ8mcEB0Uur6e49DEVnXQsyArWO3mhvqeytsYXluCO1ZX2zee65TYlQOw3EDBu1KwoSnUpilGnDNny3TB+/o2hjy2WxLpz7BrOj/ATu/hhrg8ujtoSS8HfgcD7UXdQHTO7CdIft+kCyKRH0EPothq3Xjq9KfAsg2zswoon+AAIFd59hyqSDUcN/o5DE8m2Nq4JupVodpvELKSouk+sdP3xCIUv7Fi2RfVZSwsBlHNmjaeNCt2+mZiHn9W8v5wPlVWh30TGDGTzXms6w+P+kGkw2GG3tUNIre472s8TtMEuqcdS9xVAB5FWNEpPm2ke4zP6paCHXWG710HecCiBjgli0tsw4icoLeBI1b7iuyeFhReXq9kFl2uiki3Mb8= X-Forefront-PRVS: 0972DEC1D9 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6009001)(6069001)(7916002)(189002)(199003)(50466002)(48376002)(101416001)(42186005)(50986999)(92566002)(76176999)(105586002)(106356001)(33646002)(2351001)(5004730100002)(47776003)(66066001)(36756003)(586003)(3846002)(6116002)(19580405001)(19580395003)(575784001)(77096005)(8676002)(2906002)(81156014)(81166006)(4326007)(189998001)(97736004)(2950100001)(110136002)(5008740100001)(229853001)(5003940100001)(50226002)(68736007); DIR:OUT; SFP:1101; SCL:1; SRVR:BN3PR0701MB1717; H:localhost.localdomain.localdomain; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; CAT:NONE; LANG:en; CAT:NONE; Received-SPF: None (protection.outlook.com: cavium.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BN3PR0701MB1717; 23:guDMmpShe8DcUsq7WVy2RH4hjRIy8GZiHcLBodc?= =?us-ascii?Q?vvYSwbOAlW/Hobtz7q6gcwx7ENLxK/howNuQe9sctuCDtktAP8rsXTmrrCtu?= =?us-ascii?Q?ykMjvd3qTrI/3EznLO3o2QcyxXnQDWfdlCsiB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ossTenant-OriginalArrivalTime: 13 Jun 2016 13:57:22.6460 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN3PR0701MB1717 Subject: [dpdk-dev] [PATCH v4 11/19] 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: Mon, 13 Jun 2016 13:57:30 -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