From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from na01-bn1-obe.outbound.protection.outlook.com (mail-bn1bon0076.outbound.protection.outlook.com [157.56.111.76]) by dpdk.org (Postfix) with ESMTP id A1F72D009 for ; Fri, 17 Jun 2016 15:32: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=mmJ0EgotwjmCdv/14kssCeQe6Hf/aQogAC265hRog4Y=; b=mNaNQVbDY0iPwIE7lp56XDfKQ02+I5atwufHtKAlfxPXwZBAHlbexBk42ycfKborfp3g684qYM2Q8bw2tN6aP1LKLgkiruhbIgT3/bW5X7/cZcUS5qzp69IO25b2lMsMA07LlG3x4053XxABDLmpqonTAf6ioyMS2ksVOI3yT0Q= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Jerin.Jacob@cavium.com; Received: from localhost.localdomain.localdomain (171.48.17.70) by BN3PR0701MB1718.namprd07.prod.outlook.com (10.163.39.17) with Microsoft SMTP Server (TLS) id 15.1.517.8; Fri, 17 Jun 2016 13:32:10 +0000 From: Jerin Jacob To: CC: , , , Jerin Jacob , Maciej Czekaj , Kamil Rytarowski , Zyta Szpak , Slawomir Rosek , Radoslaw Biernacki Date: Fri, 17 Jun 2016 18:59:45 +0530 Message-ID: <1466170194-28393-19-git-send-email-jerin.jacob@caviumnetworks.com> X-Mailer: git-send-email 2.5.5 In-Reply-To: <1466170194-28393-1-git-send-email-jerin.jacob@caviumnetworks.com> References: <1465931200-23912-1-git-send-email-jerin.jacob@caviumnetworks.com> <1466170194-28393-1-git-send-email-jerin.jacob@caviumnetworks.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [171.48.17.70] X-ClientProxiedBy: BM1PR01CA0028.INDPRD01.PROD.OUTLOOK.COM (10.163.198.163) To BN3PR0701MB1718.namprd07.prod.outlook.com (10.163.39.17) X-MS-Office365-Filtering-Correlation-Id: 89eea6a5-f05c-4351-e44a-08d396b3cb81 X-Microsoft-Exchange-Diagnostics: 1; BN3PR0701MB1718; 2:Mpngd+HeuPV/dgPj8fCZaWwbiUTPpn2fl/xz5x+0++yIbDn8Z+/9oRjA2gyTwwi6zYz6krcAczZIyH6uHNftrxiUS9RcwFwYXFue4xLsqlGrVWJLv8wvkHGPiNrFUSTYH8Y313BHgs7d/SClqy+d0Xb+AUc0X0meYStlXNiZTQ4eUttRqlaCjidzRdbdrdtr; 3:CyR+vB1TwiHri39gZ98ezalU0I2ShpOD0L/LG9XeNO6UEvRjr1I50jOJ4sBdh9JwiWLAs/B7hrmphG63rlAf3lLC3q3mlxhdzpyfYUxyZeI/ywVn8T5yYVgzjrVJoxcm; 25:GEDDgA9chOBbfinEXo/hvTyqD54eaAA6DDE7NOVircUR9LfZ3xwspBAnUr4DDbidxVw0opnV6zbA+2MmqsTz7HRi9rDt3nkp/yCk18fLBcEV6Z1ORN9ijWZb5V7GfAIQfT2stk+G/0LDB3W0HJQOBmOjkaBf/MX4jvc6BYqOy8p5ZeLvFmZ50CbpZ7pa1BstzNGFKvt/NYlX/zo3Ih9yN6WLRxXjFhqOa13SGDYDL0WbLPVVZzB8W8zL3urtJzsXO7TquQszjeA2rPRhPkn9SbFii4yX5mZa1DlIjYcDW7jHFShYgxB6hkMRFXrR2tEZUXPzYqf+2VfkQ9nPDntZfqmrwb/mTGMifK+sEtUv3+ZZcaEm5BWy8M8y5qzND7MogkhgRN31K2q0+V37uU//TUZKdD4kMErXSyDsXuiwJQQ= X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BN3PR0701MB1718; X-Microsoft-Exchange-Diagnostics: 1; BN3PR0701MB1718; 20:4nk0fnw/UfALF2yiVGSGqv/R2xmmOmJFGsmBcaGGrNNQkFZDibVQ1QrE93k2KFM7JE01PBr3MVMhhbCl0ELbUP7rRsfCX8CgdHateM9olRKFf/PFkO4Zd+g6aanDtv50dlez6Nr+ZlPEUAz4epOY54PC0J3SB1ieIWhxfR/HvbilKzPQ5VqxrMhDDw8g2V/dwJVnBw8Lpy2X0BIZniJYbuAF4NhrlSB+4/kzwCuJGgPPQwaPloj3eg3WprMcVJ3OB8q5lvmKsDazzcX+LvTE2F6Usx5MHDfeHcW8jp+c/UuMquVodiWwk/15v1eRdVbRqBsBggKn4AoXlK5KoR8wB9BZFhkyKJj3bfd5Spaq7Z3PBXZVQUCTRVG78ozB7tbWuuxjAu3mzc4veATRCiGhyihit8q28Yj5Ojl2dqbIbjwjFasYtT5BACFQ5P/yMcfhHqkNb5hfKu7lrdZc9BYfT+pZn2h4jtQ1e1yIpSlszr5P2koi2TodDzQCz1kKop8E6ZIOR6IheAC+xCLhYmsQY59vD0YHg56OTF/cUBeRa4m2fZ+WlePIkj6SX2jLPL4KVXZPHduLBpyjy2/18EN7pDj5TSdtAe9AoDEMH1QUbJA= 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:BN3PR0701MB1718; BCL:0; PCL:0; RULEID:; SRVR:BN3PR0701MB1718; X-Microsoft-Exchange-Diagnostics: 1; BN3PR0701MB1718; 4:1eSqE08RbFZEcU3IkjO3wirVR2fEpU8ffa4M0jlTS0gye/9eggIqc3sxGwxpDCsU90pUQ2AzAhxqL8Jm5oxI1WLslW85+tIeIRguuXMxx+jBJZvg+zbeE3E2YOO3S+DmOUt0rg6LXi7xqtt0lHwa8J3ALN7tOuDRzfq8+tKQuNsD92vT1MmnRUYYfj0Jh5FyBlB0cnWyNgjUAdJ72JklzINX60dIsGC71nkj4MAWRkr+RqP88BmfziPAMjRw6VUzw4pXQ/0+avSOig1dj1x3MLv7l2J4vWpDPcWZ9jW1jC+zT4bkhuQLXsokq0mW7Zcmx1OrFLKzTEqoZMrKh3Od3Cs1xaF984ICtNIaeqwARykj24FzdHOuArXZbvYakZYps7E1M23hsr9cImiZTdQ57a0MBHE7e1QoXrdUZNZgbvY= X-Forefront-PRVS: 09760A0505 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6069001)(6009001)(7916002)(199003)(189002)(48376002)(19580395003)(68736007)(2351001)(47776003)(229853001)(97736004)(19580405001)(586003)(50986999)(110136002)(36756003)(3846002)(66066001)(92566002)(105586002)(189998001)(76176999)(33646002)(42186005)(81156014)(575784001)(5004730100002)(101416001)(50466002)(2950100001)(5003940100001)(4326007)(5008740100001)(50226002)(2906002)(6116002)(77096005)(81166006)(8676002)(106356001); DIR:OUT; SFP:1101; SCL:1; SRVR:BN3PR0701MB1718; H:localhost.localdomain.localdomain; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX: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; BN3PR0701MB1718; 23:4lC6C2R8Kg4kzGQkKomupc4zW0KTO5ZPUatlEr6?= =?us-ascii?Q?8YL0PX1hissAros6d+yyYMsc/aobpLM5uj55TQVkcbe5QUhoUr5U73quZHAV?= =?us-ascii?Q?JaIo72zuGTZTxo5a2VeW/hxlKIxtTu4GeuGvqv1m+mNPljkHRt2QRMBcBuIB?= =?us-ascii?Q?mJLomeA8PGIXZ2uk66M2r7WcxOec1oSWOLfMT+aooTjLKeAZb9ijSTfxOcVE?= =?us-ascii?Q?719vgWfmDzh/wgn70TJUYEUwGdXMzWQP5W1miEuBD2FeTJYXYkxBms2jXuWX?= =?us-ascii?Q?VOePY30GzrCR3e0++aaW07mmoPmb0kmkJCylVp6p9rmQTbwCLEKaEN+2m0C9?= =?us-ascii?Q?guCZGn5YSE0fH7PuX0D2aaCCxcu6EKeSl1z4oQJqnLg8QolLYxgxPumlI8NF?= =?us-ascii?Q?u07Vj49hVwgspZVEYia2OYPj+JdHIEkzsUS2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Oqe+d5TGwUyukwFS/B26twe9lw+pMRJrdl/4YCW2GDHaUIJbVW02woz34ViJzek9s6owqqbm/rJiLGGF5kgsucz2Lhf6h5/WmwBy4ThdY=; 5:T9EXNiLTBj7Wf7TXCgf55mv4Xobkzgy9m2NHDDg3BggftUhTpxJzNWnuG+vHj/nojD/mf0EkgEM5gGi4TWz9ZvatD63K4llXt1PSwQXCCXylAYWTSUw9w7agFY9FXSvCVML0BTu1IIOJd3s2VwiWZg==; 24:4CrIvTooq4+IrmwgE1vXLWtjJjgxQsgQGZGQJqHVDLBXlPnPBwoLScg001G+fJIFdFBGSfkxjP45IKbiZt6mcOWn2y30RjJUm+T/G2TLsFU=; 7:yGvCU9lb3nVYfb4e9p+Eqnn8VyJP0gBMltk2LGqdxyBVihvaz0bJb6aqujDfW5bAA+0xPJRL7YSmCDwYkKg4kZcYoNj5o00vjKPkGHhKsyq5OgHb3z2+6q7a+aBHuqhdLaBHNz6xTH+7FwRVk9ockfW7hAcH4+9II1z57J1KxMgKdNECaRWp+cv2b7X1VURj6tGduZsazL7bl/T45U6WAw== SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jun 2016 13:32:10.7751 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN3PR0701MB1718 Subject: [dpdk-dev] [PATCH v6 18/27] 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: Fri, 17 Jun 2016 13:32:18 -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 9c95ce8..e20f0d9 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