dpaa2_node_add() and dpaa2_node_delete() had the "port is already started" check stubbed out as "if (0)", one of them with an "XXX: update it" comment. The error message and the RTE_TM_ERROR_TYPE_UNSPECIFIED argument were already in place, so only the condition was missing.
Use dev->data->dev_started, which is what other drivers test in their traffic manager callbacks. The hierarchy is pushed to the hardware by dpaa2_hierarchy_commit(), so building or removing nodes while the port is running was never going to take effect. Also removes the last two "if (0)" blocks outside base code, which clang reports as unreachable code with -Wunreachable-code-aggressive. Signed-off-by: Stephen Hemminger <[email protected]> --- drivers/net/dpaa2/dpaa2_tm.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/net/dpaa2/dpaa2_tm.c b/drivers/net/dpaa2/dpaa2_tm.c index 3057f4d031..70c5ee66f0 100644 --- a/drivers/net/dpaa2/dpaa2_tm.c +++ b/drivers/net/dpaa2/dpaa2_tm.c @@ -445,7 +445,7 @@ dpaa2_node_add(struct rte_eth_dev *dev, uint32_t node_id, struct dpaa2_tm_node *node, *parent = NULL; int ret; - if (0/* If device is started*/) + if (dev->data->dev_started) return -rte_tm_error_set(error, EPERM, RTE_TM_ERROR_TYPE_UNSPECIFIED, NULL, "Port is already started\n"); @@ -537,12 +537,10 @@ dpaa2_node_delete(struct rte_eth_dev *dev, uint32_t node_id, struct dpaa2_dev_priv *priv = dev->data->dev_private; struct dpaa2_tm_node *node; - /* XXX: update it */ - if (0) { + if (dev->data->dev_started) return -rte_tm_error_set(error, EPERM, RTE_TM_ERROR_TYPE_UNSPECIFIED, NULL, "Port is already started\n"); - } node = dpaa2_node_from_id(priv, node_id); if (!node) -- 2.53.0

