From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from na01-bn1-obe.outbound.protection.outlook.com (mail-bn1bon0087.outbound.protection.outlook.com [157.56.111.87]) by dpdk.org (Postfix) with ESMTP id 3283DC532 for ; Fri, 17 Jun 2016 15:31:09 +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=4YIN47sEQaBKluWpf5Wa8wDIFWu0TURPQ+4SdJ33hj8=; b=kT0ESOX/ASelq39SFUVnQbkgCvKBWYf2oMtmFR8o8EhstPCtfuORPAkTWkACELlOJBaE3LNYupuByAe/eDzkomOI3WjzyaoabfL8a99Hu4eiEFSs51AtmXWjTLX0B7DdigRuGPiEObU+KWscRPw0HWzHfgxBRW4fDMJBpbrHdfY= 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:31:04 +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:34 +0530 Message-ID: <1466170194-28393-8-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: 80131f2a-95ee-4614-0086-08d396b3a3c9 X-Microsoft-Exchange-Diagnostics: 1; BN3PR0701MB1718; 2:LxTnDBkOR4iO9IfrelDTXHzqXhhv6RI9NJyG740E9jzQf7SXrosOAMXzphtLmlDqMNhcrw1W0jvat0+4IHArmoDqzBmCQa6ZpsP9THLoLEiSt/dzRrO2AsXLv0hDuDg5d4SJokLXFllchyqlCZ1WJzRR6Rqmh4P+xpctNNG7KO7AaHG/w9f9QcCcLhrgytHn; 3:6jasxA6dIJy8Dt/UIA3js3SgkSe3SlvvolGrSfQ+wj0K9A/edcSokkH84j5F8XV0oYA5a5cYkOQ6vrrWCaPusjzCFjPw2yFKTHnUU+ief8tqKtRl+sTjSvr/jHXVuva4 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BN3PR0701MB1718; X-Microsoft-Exchange-Diagnostics: 1; BN3PR0701MB1718; 25:ZzXUC2fJ0T5sLAs52+gWSyMdLJyoEn9bhVHy2d6ye48qxLlmWB3sXVvpX6WPXYde2O6zwyzkyFwStyGmUsB7MHEMwa/yy/Y0sexgMEt9JxQvdO6IG5phUk7Ou9pz55tf5W9K5KbO9Da4MfqWjq0hfEPDcvUYqujiAY4lgIQyv3ULH3aClyKfP+ghjn9kMNRtd6mYdy1yn1cvScFNwYE5QX1nDK8egLzqhyLK4UXkJ8c4C1TqLXf4LIP7QI7/zoI4Aoa82rli4WJbd1VALGSM87j9BuYcakgyamn1e3J1k2pfm++S1d/gPmVWZc2l2DmDQfcnrBNtQ9KFr5yI4UT9xKliPVDlPe/R1Tm86Sc3M56/+5qWS0VmKJWe1olqo/VvnovHTScTHvpQq6DtuuIlNQeo/+7OQZIY1qP/UI4Qj1aTyacETkBmy09GZHgTnKRDkJgRURxhcrukrUUQ/5blby2eYsBpjSyQGozyq4xpCNQJ66mrAHqcC0ga9Up39FIyo64HkWTPg/3Oyz2KmslEwJiRxkkWwj+PjPdV8SIE8cyyiXyHeTLe85WuUvgv9EQ2aDLTIIJefe+csFwXGoMzGoyxjhKCVh8UYX3J7JWNTkvlEKrOnvIlQm213ml9+bVsJjYd2DRkOdr+zz1uLkoT5bYUvpWidZtoaoFgzg4+Kf1NlWYR8onSOQ6qzcZKSn9GfTAICBZXSrvoCiJ5eb/QpxIZsqhpLcDBDBDOY8GCxkydeYuxWL5DKuqwob8+mdyR X-Microsoft-Exchange-Diagnostics: 1; BN3PR0701MB1718; 20:Hbpa8qSzsfg3QyJiz+IXy6wGyzyED1oXmyW79CeyMq8N1d4lWuw4cYzpk5HyrPyuVZ9FqSVxmxnYvksFpTTutcZiqbHoK1z+XhL3Eq4MeWdWl6WKDdIyByq9KikzPTB0WPuZpY8VfAF+nwsU1oMkqLFLZ6qULurSFh8U/QACp6nv4Ilul4jaATlhAtYLLKY0grxQ/4RCiXzhbjgdG70i+1AOI0Sj/FJcre6tZ3tgSuyO84ZY00Eu1zf2w0wvH1LTPTwwpsOC6CVw5ftQfMkpmtPqEz5w/KlvmkNuROE0YMlrMc62iJDnhaToRcaVz4rDIHAIMhkC7jR+1S1fiZ5zzqCgs+3rGB2eDBdLzvccW8wr2PmwlshZZqbp+gSu+ScnTtURqJZZGLTGcSCMau8uAco8ng7FOgvGYidri2MhuktexreMYDT3DCj8qRoRCTtj4MAmZzrIfUXiavrVbRXfaHWi6euQ8tSpCBG94Z46SlKuyWf85SykIFh69+IGp4/AOOT7+Q1SeL8zo4TtTl/BzuoZZkiBiB9IHzoOItq3Ek5JQzVJshgsx5WOwg0aDB8jAlgKRdqBsnyNGIhtYxckBQ+Q6OtrfOennKguc82ZR9s= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; 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:Br7//IBt+EqcJfxtrusxxV0jp8TpXa5wi2Xo81So5s4cTHh9JSZUhsDbhfqHuCDybucmVGl/p5KozSEGvoHpX3/HMDg5ygWiSjGzZW6p9wLhj8Xb8FQ/DTv5vorSvyiMa7YoTlObS3mIwyYNbRssf2GxPSMoEmuWtCQ6APrbuPMjvQn9ahZw/7LYoXzn7fKzFahDGIMNhbRzGhI8Q3qauD1iI8uclmRRzfKJEZdWYEiILRDkmfmIo2760Fllt5CK0Y7yYRQdwwR85LYza8A69lgKZUcO/hlBHxe4NCOrNafHttHt4V2m+7VZBOnG73VO1R/aRbbsSFnppG2v9YTAEN1QqyI8B7vAGEg7D+6lZnKiDnWwjCh08c8C1QC59kwq 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:Z+Skt6teILzPF+jP/AfsrcidWyfA/dXQrdjIZuA?= =?us-ascii?Q?DWGT70kqRiVCEAe7kon1JtktE/md1uOQ8JVNqOrs8TDt5bqNCR6U74UTHwdJ?= =?us-ascii?Q?sH5beQCK+zR82yfqxl/cVAS0ISPCvOGrJkdk3xyXPAlch2b8DgiisFjTeTTh?= =?us-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Rd/AZcGX+YUz4yL5GGepd1dd5S?= =?us-ascii?Q?YFfN9HSqpkfP4FcUNdLTubDDlAo5cA4bayhtVkb7Rk6ofkFAK/w=3D=3D?= X-Microsoft-Exchange-Diagnostics: 1; BN3PR0701MB1718; 6:4EdwIle9m9GQwGRLJ7g+x6rA1SDc85jMDLpHl0JtSy7tdrFRUDVsX+D1BeUmhdhMol+Uc9j03ugSgSB09GT8bVB/7wyQNAiuiRaGbjGOwaW6loVa8w/yg/0Jp03H1gNGIK44pslnKYZSMgwyqavWp+NVdNyZolbLtEl7XBKO2+NxHjxrxEdn+6Vm3xa95bBPhIhDZMUdV4p4Qf09HzeSKmFn4VKBbVTAQJIDHVLGDwHQZ0hHjcV2Fw0DyGP4r1v0mSEi83Mb+p5BROirdzo8IyIEfI2nGAIprDEGXhpLWaU=; 5:fqnvtyiaayxhIcxbxRD2nZtLDRRZK/PjiD33HAvVQRwsNlUGc6POqLtL8u/vAr1RURmtfienBggcNtKSfbrlJ7B0Ofg7XmYwkeu+3U5j8xa8EeyqK8VmRoW5xUHhze0YZq43D/xc2Jlabhmfz8C2Rw==; 24:vxVt91sGSFLvd+l8iWEh2W8xfKuPGRX6x5KMcBCdI863G8rF77aYLe86xG9NspbYT+t8+RSCQMp6HHnXMvrTl519aaXcP/KTffj/V6r6dnI=; 7:4IcclVlsvlHb0/UIc1U8+nHu33GQOYgcDvamO9ys3z4GULQ2P8yI3AZ1diWXPyl+nDO4a95VyPgU6dx059KccGx2FAENNMiRriiVbStQLjIg7snEHrnvctvBBAbxniAf7loTDCxJXEQnPa351L3zaccqIJ2E5Myw88Yc0UZ2CZjaMQ2XDM2AWmvhATfSSSQFMpi7J3DbRL1YMxPzQD5p7Q== SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jun 2016 13:31:04.1323 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN3PR0701MB1718 Subject: [dpdk-dev] [PATCH v6 07/27] net/thunderx/base: add statistics get HW APIs 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:31:09 -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 --- drivers/net/thunderx/base/nicvf_hw.c | 45 ++++++++++++++++++++++++++++++++++++ drivers/net/thunderx/base/nicvf_hw.h | 44 +++++++++++++++++++++++++++++++++++ 2 files changed, 89 insertions(+) diff --git a/drivers/net/thunderx/base/nicvf_hw.c b/drivers/net/thunderx/base/nicvf_hw.c index 3366aa5..001b0ed 100644 --- a/drivers/net/thunderx/base/nicvf_hw.c +++ b/drivers/net/thunderx/base/nicvf_hw.c @@ -858,3 +858,48 @@ nicvf_loopback_config(struct nicvf *nic, bool enable) return nicvf_mbox_loopback_config(nic, enable); } + +void +nicvf_hw_get_stats(struct nicvf *nic, struct nicvf_hw_stats *stats) +{ + stats->rx_bytes = NICVF_GET_RX_STATS(RX_OCTS); + stats->rx_ucast_frames = NICVF_GET_RX_STATS(RX_UCAST); + stats->rx_bcast_frames = NICVF_GET_RX_STATS(RX_BCAST); + stats->rx_mcast_frames = NICVF_GET_RX_STATS(RX_MCAST); + stats->rx_fcs_errors = NICVF_GET_RX_STATS(RX_FCS); + stats->rx_l2_errors = NICVF_GET_RX_STATS(RX_L2ERR); + stats->rx_drop_red = NICVF_GET_RX_STATS(RX_RED); + stats->rx_drop_red_bytes = NICVF_GET_RX_STATS(RX_RED_OCTS); + stats->rx_drop_overrun = NICVF_GET_RX_STATS(RX_ORUN); + stats->rx_drop_overrun_bytes = NICVF_GET_RX_STATS(RX_ORUN_OCTS); + stats->rx_drop_bcast = NICVF_GET_RX_STATS(RX_DRP_BCAST); + stats->rx_drop_mcast = NICVF_GET_RX_STATS(RX_DRP_MCAST); + stats->rx_drop_l3_bcast = NICVF_GET_RX_STATS(RX_DRP_L3BCAST); + stats->rx_drop_l3_mcast = NICVF_GET_RX_STATS(RX_DRP_L3MCAST); + + stats->tx_bytes_ok = NICVF_GET_TX_STATS(TX_OCTS); + stats->tx_ucast_frames_ok = NICVF_GET_TX_STATS(TX_UCAST); + stats->tx_bcast_frames_ok = NICVF_GET_TX_STATS(TX_BCAST); + stats->tx_mcast_frames_ok = NICVF_GET_TX_STATS(TX_MCAST); + stats->tx_drops = NICVF_GET_TX_STATS(TX_DROP); +} + +void +nicvf_hw_get_rx_qstats(struct nicvf *nic, struct nicvf_hw_rx_qstats *qstats, + uint16_t qidx) +{ + qstats->q_rx_bytes = + nicvf_queue_reg_read(nic, NIC_QSET_RQ_0_7_STATUS0, qidx); + qstats->q_rx_packets = + nicvf_queue_reg_read(nic, NIC_QSET_RQ_0_7_STATUS1, qidx); +} + +void +nicvf_hw_get_tx_qstats(struct nicvf *nic, struct nicvf_hw_tx_qstats *qstats, + uint16_t qidx) +{ + qstats->q_tx_bytes = + nicvf_queue_reg_read(nic, NIC_QSET_SQ_0_7_STATUS0, qidx); + qstats->q_tx_packets = + nicvf_queue_reg_read(nic, NIC_QSET_SQ_0_7_STATUS1, qidx); +} diff --git a/drivers/net/thunderx/base/nicvf_hw.h b/drivers/net/thunderx/base/nicvf_hw.h index a7ae531..9db1d30 100644 --- a/drivers/net/thunderx/base/nicvf_hw.h +++ b/drivers/net/thunderx/base/nicvf_hw.h @@ -45,6 +45,11 @@ #define NICVF_ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0])) +#define NICVF_GET_RX_STATS(reg) \ + nicvf_reg_read(nic, NIC_VNIC_RX_STAT_0_13 | (reg << 3)) +#define NICVF_GET_TX_STATS(reg) \ + nicvf_reg_read(nic, NIC_VNIC_TX_STAT_0_4 | (reg << 3)) + #define NICVF_PASS1 (PCI_SUB_DEVICE_ID_THUNDERX_PASS1_NICVF) #define NICVF_PASS2 (PCI_SUB_DEVICE_ID_THUNDERX_PASS2_NICVF) @@ -82,6 +87,39 @@ enum nicvf_err_e { typedef nicvf_phys_addr_t (*rbdr_pool_get_handler)(void *opaque); +struct nicvf_hw_rx_qstats { + uint64_t q_rx_bytes; + uint64_t q_rx_packets; +}; + +struct nicvf_hw_tx_qstats { + uint64_t q_tx_bytes; + uint64_t q_tx_packets; +}; + +struct nicvf_hw_stats { + uint64_t rx_bytes; + uint64_t rx_ucast_frames; + uint64_t rx_bcast_frames; + uint64_t rx_mcast_frames; + uint64_t rx_fcs_errors; + uint64_t rx_l2_errors; + uint64_t rx_drop_red; + uint64_t rx_drop_red_bytes; + uint64_t rx_drop_overrun; + uint64_t rx_drop_overrun_bytes; + uint64_t rx_drop_bcast; + uint64_t rx_drop_mcast; + uint64_t rx_drop_l3_bcast; + uint64_t rx_drop_l3_mcast; + + uint64_t tx_bytes_ok; + uint64_t tx_ucast_frames_ok; + uint64_t tx_bcast_frames_ok; + uint64_t tx_mcast_frames_ok; + uint64_t tx_drops; +}; + struct nicvf_rss_reta_info { uint8_t hash_bits; uint16_t rss_size; @@ -193,4 +231,10 @@ uint64_t nicvf_rss_get_cfg(struct nicvf *nic); int nicvf_loopback_config(struct nicvf *nic, bool enable); +void nicvf_hw_get_stats(struct nicvf *nic, struct nicvf_hw_stats *stats); +void nicvf_hw_get_rx_qstats(struct nicvf *nic, + struct nicvf_hw_rx_qstats *qstats, uint16_t qidx); +void nicvf_hw_get_tx_qstats(struct nicvf *nic, + struct nicvf_hw_tx_qstats *qstats, uint16_t qidx); + #endif /* _THUNDERX_NICVF_HW_H */ -- 2.5.5