net/octeontx2: fix TM node statistics query

Until hierarchy committed TM hardware resources are not allocated
for node.
This patch check for status of HW resources before reading statistics.

Fixes: 1e25d57fae ("net/octeontx2: add TM stats and shaper profile")
Cc: stable@dpdk.org

Signed-off-by: Satha Rao <skoteshwar@marvell.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
This commit is contained in:
Satha Rao 2021-07-07 12:49:16 -04:00 committed by Jerin Jacob
parent 12e491a6b6
commit d9dda782ac

View File

@ -2769,6 +2769,12 @@ otx2_nix_tm_node_stats_read(struct rte_eth_dev *eth_dev, uint32_t node_id,
return -EINVAL;
}
if (!(tm_node->flags & NIX_TM_NODE_HWRES)) {
error->type = RTE_TM_ERROR_TYPE_NODE_ID;
error->message = "HW resources not allocated";
return -EINVAL;
}
/* Stats support only for leaf node or TL1 root */
if (nix_tm_is_leaf(dev, tm_node->lvl)) {
reg = (((uint64_t)tm_node->id) << 32);