[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <e4e5e98801d077cf4a6a1cca7bd34d50b5d434cf.1532166615.git.rahul.lakkireddy@chelsio.com>
Date: Tue, 24 Jul 2018 20:17:10 +0530
From: Rahul Lakkireddy <rahul.lakkireddy@...lsio.com>
To: netdev@...r.kernel.org
Cc: davem@...emloft.net, ganeshgr@...lsio.com, nirranjan@...lsio.com,
indranil@...lsio.com,
Rahul Lakkireddy <rahul.lakkireddy@...lsio.com>
Subject: [PATCH net-next 2/2] cxgb4: move Tx/Rx free pages collection to common code
This information needs to be collected in vmcore device dump as well.
So, move to common code.
Fixes: fa145d5dfd61 ("cxgb4: display number of rx and tx pages free")
Signed-off-by: Rahul Lakkireddy <rahul.lakkireddy@...lsio.com>
Signed-off-by: Ganesh Goudar <ganeshgr@...lsio.com>
---
drivers/net/ethernet/chelsio/cxgb4/cudbg_entity.h | 2 ++
drivers/net/ethernet/chelsio/cxgb4/cudbg_lib.c | 10 ++++++++++
drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c | 11 ++---------
3 files changed, 14 insertions(+), 9 deletions(-)
diff --git a/drivers/net/ethernet/chelsio/cxgb4/cudbg_entity.h b/drivers/net/ethernet/chelsio/cxgb4/cudbg_entity.h
index 84e0e71d9ad5..36d25883d123 100644
--- a/drivers/net/ethernet/chelsio/cxgb4/cudbg_entity.h
+++ b/drivers/net/ethernet/chelsio/cxgb4/cudbg_entity.h
@@ -140,6 +140,8 @@ struct cudbg_meminfo {
u32 loopback_used[NCHAN];
u32 loopback_alloc[NCHAN];
u32 p_structs_free_cnt;
+ u32 free_rx_cnt;
+ u32 free_tx_cnt;
};
struct cudbg_cim_pif_la {
diff --git a/drivers/net/ethernet/chelsio/cxgb4/cudbg_lib.c b/drivers/net/ethernet/chelsio/cxgb4/cudbg_lib.c
index e3ad733f690a..d97e0d7e541a 100644
--- a/drivers/net/ethernet/chelsio/cxgb4/cudbg_lib.c
+++ b/drivers/net/ethernet/chelsio/cxgb4/cudbg_lib.c
@@ -349,6 +349,11 @@ int cudbg_fill_meminfo(struct adapter *padap,
meminfo_buff->up_extmem2_hi = hi;
lo = t4_read_reg(padap, TP_PMM_RX_MAX_PAGE_A);
+ for (i = 0, meminfo_buff->free_rx_cnt = 0; i < 2; i++)
+ meminfo_buff->free_rx_cnt +=
+ FREERXPAGECOUNT_G(t4_read_reg(padap,
+ TP_FLM_FREE_RX_CNT_A));
+
meminfo_buff->rx_pages_data[0] = PMRXMAXPAGE_G(lo);
meminfo_buff->rx_pages_data[1] =
t4_read_reg(padap, TP_PMM_RX_PAGE_SIZE_A) >> 10;
@@ -356,6 +361,11 @@ int cudbg_fill_meminfo(struct adapter *padap,
lo = t4_read_reg(padap, TP_PMM_TX_MAX_PAGE_A);
hi = t4_read_reg(padap, TP_PMM_TX_PAGE_SIZE_A);
+ for (i = 0, meminfo_buff->free_tx_cnt = 0; i < 4; i++)
+ meminfo_buff->free_tx_cnt +=
+ FREETXPAGECOUNT_G(t4_read_reg(padap,
+ TP_FLM_FREE_TX_CNT_A));
+
meminfo_buff->tx_pages_data[0] = PMTXMAXPAGE_G(lo);
meminfo_buff->tx_pages_data[1] =
hi >= (1 << 20) ? (hi >> 20) : (hi >> 10);
diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c
index 218ee8e14249..2320f7829a6b 100644
--- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c
+++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c
@@ -2858,7 +2858,6 @@ static int meminfo_show(struct seq_file *seq, void *v)
{
static const char * const memory[] = { "EDC0:", "EDC1:", "MC:",
"MC0:", "MC1:", "HMA:"};
- unsigned int free_rx_cnt, free_tx_cnt;
struct adapter *adap = seq->private;
struct cudbg_meminfo meminfo;
int i, rc;
@@ -2890,18 +2889,12 @@ static int meminfo_show(struct seq_file *seq, void *v)
mem_region_show(seq, "uP Extmem2:", meminfo.up_extmem2_lo,
meminfo.up_extmem2_hi);
- for (i = 0, free_rx_cnt = 0; i < 2; i++)
- free_rx_cnt += FREERXPAGECOUNT_G
- (t4_read_reg(adap, TP_FLM_FREE_RX_CNT_A));
seq_printf(seq, "\n%u Rx pages (%u free) of size %uKiB for %u channels\n",
- meminfo.rx_pages_data[0], free_rx_cnt,
+ meminfo.rx_pages_data[0], meminfo.free_rx_cnt,
meminfo.rx_pages_data[1], meminfo.rx_pages_data[2]);
- for (i = 0, free_tx_cnt = 0; i < 4; i++)
- free_tx_cnt += FREETXPAGECOUNT_G
- (t4_read_reg(adap, TP_FLM_FREE_TX_CNT_A));
seq_printf(seq, "%u Tx pages (%u free) of size %u%ciB for %u channels\n",
- meminfo.tx_pages_data[0], free_tx_cnt,
+ meminfo.tx_pages_data[0], meminfo.free_tx_cnt,
meminfo.tx_pages_data[1], meminfo.tx_pages_data[2],
meminfo.tx_pages_data[3]);
--
2.14.1
Powered by blists - more mailing lists