Until hierarchy committed TM hardware resources are not allocated
for node.
This patch check for status of HW resources before reading statistics.
Fixes:
1e25d57fae38 ("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>
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);