The branch main has been updated by np:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=bbab9ab5796028e6ef9d765bfd307936bde14e89

commit bbab9ab5796028e6ef9d765bfd307936bde14e89
Author:     Navdeep Parhar <[email protected]>
AuthorDate: 2022-01-03 21:31:46 +0000
Commit:     Navdeep Parhar <[email protected]>
CommitDate: 2022-01-03 23:24:34 +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
    MFC after:      1 week
    Sponsored by:   Chelsio Communications
---
 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 f30e8c14ecb4..fe0be9ab9ff0 100644
--- a/sys/dev/cxgbe/t4_main.c
+++ b/sys/dev/cxgbe/t4_main.c
@@ -7072,7 +7072,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;

Reply via email to