diff options
author | Rahul Lakkireddy <rahul.lakkireddy@chelsio.com> | 2018-07-24 20:17:10 +0530 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2018-07-24 10:12:22 -0700 |
commit | ae2a922fae023164b3e0de62db3a2e6e93305c2e (patch) | |
tree | 3482050a9e948bca5433fedb2b567d73075294a6 /drivers/net/ethernet/chelsio | |
parent | 9d0f180cd509aec0172ae15bf1aed54de34d1132 (diff) |
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@chelsio.com>
Signed-off-by: Ganesh Goudar <ganeshgr@chelsio.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/chelsio')
-rw-r--r-- | drivers/net/ethernet/chelsio/cxgb4/cudbg_entity.h | 2 | ||||
-rw-r--r-- | drivers/net/ethernet/chelsio/cxgb4/cudbg_lib.c | 10 | ||||
-rw-r--r-- | 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]); |