Date: Tue, 30 Apr 2024 20:04:50 GMT From: Navdeep Parhar <np@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: git: 4d1362cdc737 - main - cxgbe(4): Do not read hardware registers to determine the number of ports. Message-ID: <202404302004.43UK4oUb076671@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch main has been updated by np: URL: https://cgit.FreeBSD.org/src/commit/?id=4d1362cdc7375984a48f5f0048b1fe909524d21d commit 4d1362cdc7375984a48f5f0048b1fe909524d21d Author: Navdeep Parhar <np@FreeBSD.org> AuthorDate: 2024-04-30 19:42:14 +0000 Commit: Navdeep Parhar <np@FreeBSD.org> CommitDate: 2024-04-30 20:02:44 +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. MFC after: 1 week Sponsored by: Chelsio Communications --- 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 360d44847004..400c0d7882c0 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; }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202404302004.43UK4oUb076671>