From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from na01-by2-obe.outbound.protection.outlook.com (mail-by2on0086.outbound.protection.outlook.com [207.46.100.86]) by dpdk.org (Postfix) with ESMTP id 8F7CE9ACC for ; Tue, 14 Jun 2016 21:07:37 +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=XZfzDW54Vy+7NGJgzT0aJIy51YVVTy7D7u9i9R6ymd1JLTrREh2KyInWKGaWZpGPRntqGuyTICXhS6HSt3Ad56XMg2xrdQOiNdIYPXqL1SReQxyibKakT5t5a2uSTwjMssihvBWyYxF9aMAcnRoKyX01yJq3KdT9deRuyDnGSvU= 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:07:33 +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:22 +0530 Message-ID: <1465931200-23912-8-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: 99d324cc-1609-423a-7275-08d394872546 X-Microsoft-Exchange-Diagnostics: 1; BY1PR0701MB1723; 2:g6+3RAxH1zheRg/90f/4ByXWIrNugwKSBBL3ydYLnPmtIUW9TrXqzsjm9ZEI6vB5jE+My0oXHzqq8q7WRiKc9EgLiKAx7DCsV05Iq/QOHhiKWzdH6Od/rEMRoP0Cbp++kMBo11jqm9cjpjajzz/erxGqZcvX0dkjgD016TK8POEsC32j3pwNXuhhAUpbmaXm; 3:1Ci0OFFbbOT8CgXel5KpMV1LjpOOqPve/TJYUMtEZovT1obVwQJRZZqjML8/lpJaglFhR1A28vfRLM2aUsuKgVLkzTzCPh0czyEkyjEgHqFsiJ3DbptyfHbub40IQkaY X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BY1PR0701MB1723; X-Microsoft-Exchange-Diagnostics: 1; BY1PR0701MB1723; 25:ToET7hveszfbW5zB/4+HQ+xmWSPeX6747VHV5DO0XkqyLc6uh7LgPOTThndi40ZmE1YrTrF9r62xmyQayrVJXuuc0rUwLwb5oWGkZpuTNuxCN93JEM4ZhKOx7l3+e2SRK0zCgfBxCi7/AVa1SGvljQgg/BXTxj4qakVZ4dW8wpF7YbjpYPVwucQagrh9EXkciw+AK22vNefStwV96sMRWHDwYXWHEZCjKQ23hc8AAByvHP94pyN8jpq2hSg77ceVv+FtrDV9GS0ZAWOaEINJaM3XnjIXW7BWvgpxD5OiP+lh+aiLkwiRZW2gDkf4dg3YPx18MIELwtH00fdnWaiY+NgO3nNIjKwkpWsW2kflu+2w//jzkBUVmY0CO2OnPCCUfvYf+N+7+xzxd9WTB38l23ceqzKssDXGFBlFiMZLPRjJhVxmrgijZrCVaMu8rPc80ARVOGaJcyLWbjKFJc71CaoP9HAmpA6z0cE79i2l7XbsjOvGGhwzEn79UI7kDcI2SCsKdAEameToxPSetHluwUteXkE0JHUWFFjLqvKhY7xUbJa93Ci3i3akV1yLRkcrQqtMaUbpOmCf6uTILp3AWelyPUgPS5bTduZGOH+SEo+0RI4GFEjQCsbBr+qPkhOsNyyfvC0xYNTdqxZbo5bYosRQtEFbADAos7m7XTbEWz52j3V42/4/cK4UY6azpkZXL4Y7lbpgDFxXAe18fUtn/Jzljrk/tumILwKBrlnn6tgJ5B315OGRJUDAHjF14VRh X-Microsoft-Exchange-Diagnostics: 1; BY1PR0701MB1723; 20:zsrIX/xSuIgJoty8DgC48OCA63uMdJpKWIzk3kmnoIlCXZTzMJUWIOwARoT+T3tSnFECZlZqWTWUAn+dmLUM7Q6xvVAFdmyQfr2zD3bVzhKMSCP44oaydYn9GRzpYHmlOIlBv5AaAhbFGv+CN5orgGPKWKtMvc3dZX2f4Sb0ssucrpjzK6ACVntDiq4F0aDjmhdh9mK06Db9iI/CL1tTqNIKKkjxu9LtxxGHXgmMdAE2IMqtc0MWix57VFnfP7Inl1Ffub1Ts8FQn+mRDgpokAn3b+O5NKIHasZmuiXQNRpLhzLnfR5RJYXeTM/tx0wk1OKZrBlF/414Cp4C5kW4QJjWzzGaPq0jCaBu0iFBJoFUp0n8yM6DiO+mayPPr8iCdxE/2xvGDoCht/FmytvAnPlVRFOHiuV7OM1N5K4LanjU4h70JqSCcrq1FiU0K+dI9KoLeNOxC0rdUEh5qimbId5zd9xfp9saCSeW4GAnV3vyWk9PQz+dP0FCZnEU2QfJmck1LHalEr6+qI+pDyS/hhgHa8FDCwy0qbswYdPAmKzeLoKt+W4IcwwEtlWhbMvswG0XHr7ifXJ9mjqmUkMAJg2p/XAjYYGJW4A8hEsjQhk= 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:BY1PR0701MB1723; BCL:0; PCL:0; RULEID:; SRVR:BY1PR0701MB1723; X-Microsoft-Exchange-Diagnostics: 1; BY1PR0701MB1723; 4:i7R1eL4P5d4mG7rL+/oSbAk2opZYvOJAcIan24X37YCT7ZuvhQC9HoyjRXJgBzAu9tPw2zol/2elJTHv0Bu8Cq1j/YQ6OaFcXw8s7K+yiAUk/xQfAOl1SmNX9wYrVDfZ+Oh0jwkCd8tIMSOfwrCZ4e9+xjuGO2nkEwhcRXkr2HRju6/QBjcKy2IrRQ1z9Eg42B1/hPfVa67gMWeaeQpLXWA3VmjaFI0hecu3Ju5YwF9Q8GC462c5oRGUCcDaqnIieg1bUu8Ng5V7KF8wQsf78X1SlGyhitZZIgl+jdGUt6M+2xIMXcP1DnhuxXui6PrmKp8HJNixX8A5eh5v/HYzlI/In8Do53DxNUgrAfzOe+pnDz77MxHv72B68k2ExGf2 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:kIk8ueMq2hCG94aD4L6pxFy1e7glM0SZPQnfeXZ?= =?us-ascii?Q?dja5iO5xwmn2cbHhIAkJqCIiLTGJT8ZetT0+i0hwr5HD4uXYJ8s1a2qVIwu7?= =?us-ascii?Q?StKv2VuQUidniPiJ3tbNMgqDnaAyr5lQZWdoOmd7vaYO4JUUQ1zqyjSlGoVp?= =?us-asc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8EDM4HtPXYvCj6hM6wAmVm5N0DhlyrKrU5PVfuflicNr?= =?us-ascii?Q?gJmEqvGW5B4dgV4/YDK9AQJMg8L0olF8NhXq7MuhyuNR4TydrzN7Q2cZbFL0?= =?us-ascii?Q?nppTPMXPy4BlTPEc1mqPqMKHcsoxSaHFMdOyckb9Kwt5sDBZxcTF18M5LnGp?= =?us-ascii?Q?lvfZeyHZcyofXLIK3wXVEKHHmPqME10eEj0nn?= X-Microsoft-Exchange-Diagnostics: 1; BY1PR0701MB1723; 5:3FsttJhNDjYzmuyCMNQBt4YNLa/IhhrSfhu0qHg/7FV4Rl7h3avLRpKLXxDLT1X2mUJLkAXJorc0awe1nGb1NBCqK/bE6GgHQTofqpM33fn2myWHF7MZtAfb8/kAwZYbF+GxFeX8BCQbfYWl3PXvhg==; 24:Uw/6YIpN/9LRsIldwy46FzTxJtlb+vVwisAODcdUSbf8eDJphsfhMJfUjB9NC+cG6Gpmxn8HslD5uNhp60klMlZHsOWNQn3X4ZTWl+snkbU=; 7:9WbVtyqoKBsCFdKks0K5rqDMUtcB/cLHwQRaS+lzrRRL6ARwe6r5mHLDfZwuyp4M2/avYM6nfPKrIxgRQFG3mFZNofh4EKjebabWvfZBP1atBb9NKwFWAQzCVshUE6I9iuOe7XS1VX2nafbi4idAp+BpdVPKkeiLZ+KReLgjWfW+Y1tac+8E496gG7wb3Ncdm8BMKsVXvuTRJldPUMbMSg== SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Jun 2016 19:07:33.0146 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY1PR0701MB1723 Subject: [dpdk-dev] [PATCH v5 07/25] 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: Tue, 14 Jun 2016 19:07:38 -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