From: Satha Rao Date: Wed, 7 Jul 2021 16:49:16 +0000 (-0400) Subject: net/octeontx2: fix TM node statistics query X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=d9dda782ac08a47ca092a0c499b21635b23e6644;p=dpdk.git 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: 1e25d57fae38 ("net/octeontx2: add TM stats and shaper profile") Cc: stable@dpdk.org Signed-off-by: Satha Rao Acked-by: Jerin Jacob --- diff --git a/drivers/net/octeontx2/otx2_tm.c b/drivers/net/octeontx2/otx2_tm.c index fdd56697f1..6aff1f9587 100644 --- a/drivers/net/octeontx2/otx2_tm.c +++ b/drivers/net/octeontx2/otx2_tm.c @@ -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);