Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 17 Jul 2024 14:24:43 GMT
From:      Navdeep Parhar <np@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: ab374f82d9f1 - stable/13 - cxgbe(4): Query TPCHMAP once and not once per port.
Message-ID:  <202407171424.46HEOhGe033393@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by np:

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

commit ab374f82d9f1060154938117946a2953ac8926c9
Author:     Navdeep Parhar <np@FreeBSD.org>
AuthorDate: 2024-04-30 23:32:55 +0000
Commit:     Navdeep Parhar <np@FreeBSD.org>
CommitDate: 2024-07-17 07:16:20 +0000

    cxgbe(4): Query TPCHMAP once and not once per port.
    
    Sponsored by:   Chelsio Communications
    
    (cherry picked from commit 7f10048f983a31c09587b436e7fb073f7cbb76e4)
---
 sys/dev/cxgbe/common/common.h |  4 +++-
 sys/dev/cxgbe/common/t4_hw.c  | 11 ++---------
 sys/dev/cxgbe/t4_main.c       |  8 ++++++++
 3 files changed, 13 insertions(+), 10 deletions(-)

diff --git a/sys/dev/cxgbe/common/common.h b/sys/dev/cxgbe/common/common.h
index f43ffc83dff1..67bbf5e43b79 100644
--- a/sys/dev/cxgbe/common/common.h
+++ b/sys/dev/cxgbe/common/common.h
@@ -402,7 +402,9 @@ struct adapter_params {
 	unsigned int max_ordird_qp;
 	unsigned int max_ird_adapter;
 
-	uint32_t mps_bg_map;	/* rx buffer group map for all ports (upto 4) */
+	/* These values are for all ports (8b/port, upto 4 ports) */
+	uint32_t mps_bg_map;	/* MPS rx buffer group map */
+	uint32_t tp_ch_map;	/* TPCHMAP from firmware */
 
 	bool ulptx_memwrite_dsgl;	/* use of T5 DSGL allowed */
 	bool fr_nsmr_tpte_wr_support;	/* FW support for FR_NSMR_TPTE_WR */
diff --git a/sys/dev/cxgbe/common/t4_hw.c b/sys/dev/cxgbe/common/t4_hw.c
index 3e04995eec3b..07940a44f66e 100644
--- a/sys/dev/cxgbe/common/t4_hw.c
+++ b/sys/dev/cxgbe/common/t4_hw.c
@@ -6774,15 +6774,8 @@ static unsigned int t4_get_rx_e_chan_map(struct adapter *adap, int idx)
  */
 static unsigned int t4_get_rx_c_chan(struct adapter *adap, int idx)
 {
-	u32 param, val;
-	int ret;
-
-	param = (V_FW_PARAMS_MNEM(FW_PARAMS_MNEM_DEV) |
-	    V_FW_PARAMS_PARAM_X(FW_PARAMS_PARAM_DEV_TPCHMAP));
-	ret = t4_query_params(adap, adap->mbox, adap->pf, 0, 1, &param, &val);
-	if (!ret)
-		return (val >> (8 * idx)) & 0xff;
-
+	if (adap->params.tp_ch_map != UINT32_MAX)
+		return (adap->params.tp_ch_map >> (8 * idx)) & 0xff;
         return 0;
 }
 
diff --git a/sys/dev/cxgbe/t4_main.c b/sys/dev/cxgbe/t4_main.c
index ae6e25e47a15..842eb87e9126 100644
--- a/sys/dev/cxgbe/t4_main.c
+++ b/sys/dev/cxgbe/t4_main.c
@@ -5412,6 +5412,14 @@ get_params__post_init(struct adapter *sc)
 	else
 		sc->params.mps_bg_map = UINT32_MAX;	/* Not a legal value. */
 
+	param[0] = FW_PARAM_DEV(TPCHMAP);
+	val[0] = 0;
+	rc = -t4_query_params(sc, sc->mbox, sc->pf, 0, 1, param, val);
+	if (rc == 0)
+		sc->params.tp_ch_map = val[0];
+	else
+		sc->params.tp_ch_map = UINT32_MAX;	/* Not a legal value. */
+
 	/*
 	 * Determine whether the firmware supports the filter2 work request.
 	 */



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202407171424.46HEOhGe033393>