git: cfe1193f5f9d - stable/13 - cxgbe(4): Fix stats collection for ports with port_id != tx_chan
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 28 Feb 2022 06:55:45 UTC
The branch stable/13 has been updated by np: URL: https://cgit.FreeBSD.org/src/commit/?id=cfe1193f5f9d53c3f98c4d8f44df35ff58972dfe commit cfe1193f5f9d53c3f98c4d8f44df35ff58972dfe Author: Navdeep Parhar <np@FreeBSD.org> AuthorDate: 2022-01-03 21:31:46 +0000 Commit: Navdeep Parhar <np@FreeBSD.org> CommitDate: 2022-02-28 06:47:42 +0000 cxgbe(4): Fix stats collection for ports with port_id != tx_chan This fixes a driver panic during stats collection when a port's id does not match its tx channel. The bug affected only the T580 card running with a non-default VPD. Reported by: Suhas Lokesha @ Chelsio Sponsored by: Chelsio Communications (cherry picked from commit bbab9ab5796028e6ef9d765bfd307936bde14e89) --- sys/dev/cxgbe/common/t4_hw.c | 4 ++-- sys/dev/cxgbe/t4_main.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/sys/dev/cxgbe/common/t4_hw.c b/sys/dev/cxgbe/common/t4_hw.c index 26ffddaa98f4..d65d69075e88 100644 --- a/sys/dev/cxgbe/common/t4_hw.c +++ b/sys/dev/cxgbe/common/t4_hw.c @@ -6927,8 +6927,8 @@ void t4_get_port_stats(struct adapter *adap, int idx, struct port_stats *p) #define GET_STAT(name) \ t4_read_reg64(adap, \ - (is_t4(adap) ? PORT_REG(idx, A_MPS_PORT_STAT_##name##_L) : \ - T5_PORT_REG(idx, A_MPS_PORT_STAT_##name##_L))) + (is_t4(adap) ? PORT_REG(pi->tx_chan, A_MPS_PORT_STAT_##name##_L) : \ + T5_PORT_REG(pi->tx_chan, A_MPS_PORT_STAT_##name##_L))) #define GET_STAT_COM(name) t4_read_reg64(adap, A_MPS_STAT_##name##_L) p->tx_pause = GET_STAT(TX_PORT_PAUSE); diff --git a/sys/dev/cxgbe/t4_main.c b/sys/dev/cxgbe/t4_main.c index 2a026d3c90c9..b45f910afe88 100644 --- a/sys/dev/cxgbe/t4_main.c +++ b/sys/dev/cxgbe/t4_main.c @@ -7131,7 +7131,7 @@ cxgbe_refresh_stats(struct vi_info *vi) pi = vi->pi; sc = vi->adapter; tnl_cong_drops = 0; - t4_get_port_stats(sc, pi->tx_chan, &pi->stats); + t4_get_port_stats(sc, pi->port_id, &pi->stats); chan_map = pi->rx_e_chan_map; while (chan_map) { i = ffs(chan_map) - 1;