git: 92383a2c844b - stable/14 - cxgbe(4): Do not read hardware registers to determine the number of ports.
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 17 Jul 2024 14:21:44 UTC
The branch stable/14 has been updated by np: URL: https://cgit.FreeBSD.org/src/commit/?id=92383a2c844b102f6d65efbc2755ae21c656163b commit 92383a2c844b102f6d65efbc2755ae21c656163b Author: Navdeep Parhar <np@FreeBSD.org> AuthorDate: 2024-04-30 19:42:14 +0000 Commit: Navdeep Parhar <np@FreeBSD.org> CommitDate: 2024-07-17 06:37:39 +0000 cxgbe(4): Do not read hardware registers to determine the number of ports. PORTVEC obtained from the firmware is the authoritative source of this information, and nports (calculated from PORTVEC) is available by the time t4_port_init runs. Sponsored by: Chelsio Communications (cherry picked from commit 4d1362cdc7375984a48f5f0048b1fe909524d21d) --- sys/dev/cxgbe/common/t4_hw.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/sys/dev/cxgbe/common/t4_hw.c b/sys/dev/cxgbe/common/t4_hw.c index 8a225849930d..8d109b389f0d 100644 --- a/sys/dev/cxgbe/common/t4_hw.c +++ b/sys/dev/cxgbe/common/t4_hw.c @@ -6745,10 +6745,11 @@ static unsigned int t4_get_mps_bg_map(struct adapter *adap, int idx) if (adap->params.mps_bg_map) return ((adap->params.mps_bg_map >> (idx << 3)) & 0xff); - n = G_NUMPORTS(t4_read_reg(adap, A_MPS_CMN_CTL)); - if (n == 0) + n = adap->params.nports; + MPASS(n > 0 && n <= MAX_NPORTS); + if (n == 1) return idx == 0 ? 0xf : 0; - if (n == 1 && chip_id(adap) <= CHELSIO_T5) + if (n == 2 && chip_id(adap) <= CHELSIO_T5) return idx < 2 ? (3 << (2 * idx)) : 0; return 1 << idx; } @@ -6758,12 +6759,12 @@ static unsigned int t4_get_mps_bg_map(struct adapter *adap, int idx) */ static unsigned int t4_get_rx_e_chan_map(struct adapter *adap, int idx) { - u32 n = G_NUMPORTS(t4_read_reg(adap, A_MPS_CMN_CTL)); + const u32 n = adap->params.nports; const u32 all_chan = (1 << adap->chip_params->nchan) - 1; - if (n == 0) + if (n == 1) return idx == 0 ? all_chan : 0; - if (n == 1 && chip_id(adap) <= CHELSIO_T5) + if (n == 2 && chip_id(adap) <= CHELSIO_T5) return idx < 2 ? (3 << (2 * idx)) : 0; return 1 << idx; }