[2/3] net/octeontx2: get tm node stats after resource allocated
Checks
Commit Message
From: Satha Rao <skoteshwar@marvell.com>
We are getting kernel crash while reading tm node stats when tm
hierarchy is not committed. Until hierarchy committed hardware
resources are not allocated for node, this causes mbox timeout.
This patch check for status of HW resources before reading statistics.
Signed-off-by: Satha Rao <skoteshwar@marvell.com>
---
drivers/net/octeontx2/otx2_tm.c | 6 ++++++
1 file changed, 6 insertions(+)
@@ -2769,6 +2769,12 @@ int otx2_nix_sq_enable(void *_txq)
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);