The branch main has been updated by np:

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

commit 7f10048f983a31c09587b436e7fb073f7cbb76e4
Author:     Navdeep Parhar <[email protected]>
AuthorDate: 2024-04-30 23:32:55 +0000
Commit:     Navdeep Parhar <[email protected]>
CommitDate: 2024-04-30 23:32:55 +0000

    cxgbe(4): Query TPCHMAP once and not once per port.
    
    MFC after:      1 week
    Sponsored by:   Chelsio Communications
---
 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 f91d4ebf7334..894e0444b710 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 50aa5dec30d8..3d22673d34c1 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 f474d1a58ef9..185cc1140486 100644
--- a/sys/dev/cxgbe/t4_main.c
+++ b/sys/dev/cxgbe/t4_main.c
@@ -5333,6 +5333,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.
         */

Reply via email to