From: Satha Rao <[email protected]>

Only emit the TM link configuration register when the configured TM
link level matches the hardware level being dumped, and use nix->tx_link
for the register and label so the dump reflects the active link.

Fixes: fcdef46b6698 ("common/cnxk: support NIX TM debug and misc utils")
Cc: [email protected]

Signed-off-by: Satha Rao <[email protected]>
---
Changes in v2: No change.

 drivers/common/cnxk/roc_nix_debug.c | 31 +++++++++++++++++++----------
 1 file changed, 20 insertions(+), 11 deletions(-)

diff --git a/drivers/common/cnxk/roc_nix_debug.c 
b/drivers/common/cnxk/roc_nix_debug.c
index d4b2b86916..9c3bc8abe3 100644
--- a/drivers/common/cnxk/roc_nix_debug.c
+++ b/drivers/common/cnxk/roc_nix_debug.c
@@ -1150,7 +1150,7 @@ roc_nix_sq_dump(struct roc_nix_sq *sq, FILE *file)
 };

 static uint8_t
-nix_tm_reg_dump_prep(uint16_t hw_lvl, uint16_t schq, uint16_t link,
+nix_tm_reg_dump_prep(struct nix *nix, uint16_t hw_lvl, uint16_t schq,
                     uint64_t *reg, char regstr[][NIX_REG_NAME_SZ])
 {
        FILE *file = NULL;
@@ -1228,9 +1228,14 @@ nix_tm_reg_dump_prep(uint16_t hw_lvl, uint16_t schq, 
uint16_t link,
                snprintf(regstr[k++], NIX_REG_NAME_SZ,
                         "NIX_AF_TL3[%u]_TOPOLOGY", schq);

-               reg[k] = NIX_AF_TL3_TL2X_LINKX_CFG(schq, link);
-               snprintf(regstr[k++], NIX_REG_NAME_SZ,
-                        "NIX_AF_TL3_TL2[%u]_LINK[%u]_CFG", schq, link);
+               /* Link configuration */
+               if (!nix->sdp_link &&
+                   nix->tm_link_cfg_lvl == NIX_TXSCH_LVL_TL3) {
+                       reg[k] = NIX_AF_TL3_TL2X_LINKX_CFG(schq, nix->tx_link);
+                       snprintf(regstr[k++], NIX_REG_NAME_SZ,
+                                "NIX_AF_TL3_TL2[%u]_LINK[%u]_CFG", schq,
+                                nix->tx_link);
+               }

                reg[k] = NIX_AF_TL3X_SCHEDULE(schq);
                snprintf(regstr[k++], NIX_REG_NAME_SZ,
@@ -1261,9 +1266,14 @@ nix_tm_reg_dump_prep(uint16_t hw_lvl, uint16_t schq, 
uint16_t link,
                snprintf(regstr[k++], NIX_REG_NAME_SZ,
                         "NIX_AF_TL2[%u]_TOPOLOGY", schq);

-               reg[k] = NIX_AF_TL3_TL2X_LINKX_CFG(schq, link);
-               snprintf(regstr[k++], NIX_REG_NAME_SZ,
-                        "NIX_AF_TL3_TL2[%u]_LINK[%u]_CFG", schq, link);
+               /* Link configuration */
+               if (!nix->sdp_link &&
+                   nix->tm_link_cfg_lvl == NIX_TXSCH_LVL_TL2) {
+                       reg[k] = NIX_AF_TL3_TL2X_LINKX_CFG(schq, nix->tx_link);
+                       snprintf(regstr[k++], NIX_REG_NAME_SZ,
+                                "NIX_AF_TL3_TL2[%u]_LINK[%u]_CFG", schq,
+                                nix->tx_link);
+               }

                reg[k] = NIX_AF_TL2X_SCHEDULE(schq);
                snprintf(regstr[k++], NIX_REG_NAME_SZ,
@@ -1370,8 +1380,7 @@ nix_tm_dump_lvl(struct nix *nix, struct nix_tm_node_list 
*list, uint8_t hw_lvl)
                        root = node;

                /* Dump registers only when HWRES is present */
-               k = nix_tm_reg_dump_prep(node->hw_lvl, schq, nix->tx_link, reg,
-                                        regstr);
+               k = nix_tm_reg_dump_prep(nix, node->hw_lvl, schq, reg, regstr);
                if (!k)
                        continue;

@@ -1396,8 +1405,8 @@ nix_tm_dump_lvl(struct nix *nix, struct nix_tm_node_list 
*list, uint8_t hw_lvl)

        /* Dump TL1 node data when root level is TL2 */
        if (root && root->hw_lvl == NIX_TXSCH_LVL_TL2) {
-               k = nix_tm_reg_dump_prep(NIX_TXSCH_LVL_TL1, root->parent_hw_id,
-                                        nix->tx_link, reg, regstr);
+               k = nix_tm_reg_dump_prep(nix, NIX_TXSCH_LVL_TL1,
+                                        root->parent_hw_id, reg, regstr);
                if (!k)
                        return;

--
2.34.1

Reply via email to