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: fa145d5dfd
("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>
This commit is contained in:
parent
9d0f180cd5
commit
ae2a922fae
@ -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 {
|
||||
|
@ -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);
|
||||
|
@ -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]);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user