net/ice: fix support for 3 scheduler levels

Message ID 20250506103414.892849-1-bruce.richardson@intel.com (mailing list archive)
State New
Delegated to: Bruce Richardson
Headers
Series net/ice: fix support for 3 scheduler levels |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/loongarch-compilation success Compilation OK
ci/loongarch-unit-testing success Unit Testing PASS
ci/Intel-compilation success Compilation OK
ci/iol-marvell-Functional success Functional Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/github-robot: build success github build: passed
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-unit-arm64-testing success Testing PASS
ci/iol-abi-testing success Testing PASS
ci/iol-compile-amd64-testing success Testing PASS
ci/iol-compile-arm64-testing success Testing PASS
ci/iol-unit-amd64-testing success Testing PASS
ci/aws-unit-testing success Unit Testing PASS
ci/iol-sample-apps-testing success Testing PASS
ci/intel-Testing success Testing PASS
ci/intel-Functional success Functional PASS

Commit Message

Bruce Richardson May 6, 2025, 10:34 a.m. UTC
When using only 3 scheduler levels, the VSI node needs to be a node
further down the scheduler hierarchy, rather than one up it as with all
other possible level settings (5-9). Take account of this possibility in
the code.

Fixes: 4ace7701eb44 ("net/ice: provide parameter to limit scheduler layers")
Cc: stable@dpdk.org

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
 drivers/net/intel/ice/ice_tm.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)
  

Patch

diff --git a/drivers/net/intel/ice/ice_tm.c b/drivers/net/intel/ice/ice_tm.c
index ff3a6cd77f..f2d8e12181 100644
--- a/drivers/net/intel/ice/ice_tm.c
+++ b/drivers/net/intel/ice/ice_tm.c
@@ -818,6 +818,18 @@  commit_new_hierarchy(struct rte_eth_dev *dev)
 	uint8_t qg_lvl = q_lvl - 1;
 
 	struct ice_sched_node *new_vsi_root = hw->vsi_ctx[pf->main_vsi->idx]->sched.vsi_node[0];
+	/* handle case where VSI node needs to move DOWN the hierarchy */
+	while (new_vsi_root->tx_sched_layer < new_root_level) {
+		if (new_vsi_root->num_children == 0)
+			return -1;
+		/* remove all child nodes but the first */
+		while (new_vsi_root->num_children > 1)
+			free_sched_node_recursive(pi, new_vsi_root,
+					new_vsi_root->children[1],
+					new_vsi_root->vsi_handle);
+		new_vsi_root = new_vsi_root->children[0];
+	}
+	/* handle case where VSI node needs to move UP the hierarchy */
 	while (new_vsi_root->tx_sched_layer > new_root_level)
 		new_vsi_root = new_vsi_root->parent;