DPDK-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 1/2] net/ice: properly handle TM hierarchy deletion
@ 2026-05-07 12:59 Ciara Loftus
  2026-05-07 12:59 ` [PATCH v2 2/2] net/ice: fix shaper profile reference count tracking Ciara Loftus
  2026-05-07 13:11 ` [PATCH v2 1/2] net/ice: properly handle TM hierarchy deletion Bruce Richardson
  0 siblings, 2 replies; 4+ messages in thread
From: Ciara Loftus @ 2026-05-07 12:59 UTC (permalink / raw)
  To: dev; +Cc: Mukul Katiyar, stable, Ciara Loftus

From: Mukul Katiyar <mukul@versa-networks.com>

When a TM hierarchy is fully deleted and then committed, the hardware
scheduler nodes may be left with any bandwidth limits that were
programmed by the previous hierarchy commit. These stale limits may
remain in effect the next time the device starts, permanently throttling
traffic even though the TM hierarchy was removed.

Fix this by resetting all descendant hardware scheduler nodes to their
default state when committing an empty hierarchy. Also restore the port
queue count to its hardware default and clear the committed flag so the
port starts cleanly without any TM configuration applied.

Fixes: 715d449a965b ("net/ice: enhance Tx scheduler hierarchy support")
Cc: stable@dpdk.org

Signed-off-by: Mukul Katiyar <mukul@versa-networks.com>
Signed-off-by: Ciara Loftus <ciara.loftus@intel.com>
---
v2:
* Ensure restore is only performed if a hierarchy has already been
committed
---
 .mailmap                       |  1 +
 drivers/net/intel/ice/ice_tm.c | 24 ++++++++++++++++++++++--
 2 files changed, 23 insertions(+), 2 deletions(-)

diff --git a/.mailmap b/.mailmap
index 22476860ed..2f96e80f16 100644
--- a/.mailmap
+++ b/.mailmap
@@ -1132,6 +1132,7 @@ Moti Haimovsky <motih@mellanox.com>
 Muhammad Ahmad <muhammad.ahmad@emumba.com>
 Muhammad Bilal <m.bilal@emumba.com>
 Mukesh Dua <mukesh.dua81@gmail.com>
+Mukul Katiyar <mukul@versa-networks.com>
 Murphy Yang <murphyx.yang@intel.com>
 Murthy NSSR <nidadavolu.murthy@caviumnetworks.com>
 Muthurajan Jayakumar <muthurajan.jayakumar@intel.com>
diff --git a/drivers/net/intel/ice/ice_tm.c b/drivers/net/intel/ice/ice_tm.c
index ff53f2acfd..2bb684bb02 100644
--- a/drivers/net/intel/ice/ice_tm.c
+++ b/drivers/net/intel/ice/ice_tm.c
@@ -805,6 +805,19 @@ create_sched_node_recursive(struct ice_pf *pf, struct ice_port_info *pi,
 	return 0;
 }
 
+static void
+reset_hw_node_recursive(struct ice_hw *hw, struct ice_sched_node *node)
+{
+	uint16_t i;
+
+	for (i = 0; i < node->num_children; i++) {
+		reset_hw_node_recursive(hw, node->children[i]);
+		if (ice_cfg_hw_node(hw, NULL, node->children[i]))
+			PMD_DRV_LOG(WARNING, "Failed to reset node %u to default configuration",
+					node->children[i]->info.node_teid);
+	}
+}
+
 static int
 commit_new_hierarchy(struct rte_eth_dev *dev)
 {
@@ -820,8 +833,15 @@ commit_new_hierarchy(struct rte_eth_dev *dev)
 	struct ice_sched_node *new_vsi_root = hw->vsi_ctx[pf->main_vsi->idx]->sched.vsi_node[0];
 
 	if (sw_root == NULL) {
-		PMD_DRV_LOG(ERR, "No root node defined in TM hierarchy");
-		return -1;
+		if (!pf->tm_conf.committed) {
+			PMD_DRV_LOG(ERR, "No root node defined in TM hierarchy");
+			return -EINVAL;
+		}
+		/* TM hierarchy deleted. Restore default scheduler state. */
+		reset_hw_node_recursive(hw, hw->vsi_ctx[pf->main_vsi->idx]->sched.vsi_node[0]);
+		pf->main_vsi->nb_qps = pf->lan_nb_qps;
+		pf->tm_conf.committed = false;
+		return ice_alloc_lan_q_ctx(hw, 0, 0, pf->main_vsi->nb_qps);
 	}
 
 	/* handle case where VSI node needs to move DOWN the hierarchy */
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH v2 2/2] net/ice: fix shaper profile reference count tracking
  2026-05-07 12:59 [PATCH v2 1/2] net/ice: properly handle TM hierarchy deletion Ciara Loftus
@ 2026-05-07 12:59 ` Ciara Loftus
  2026-05-07 13:11 ` [PATCH v2 1/2] net/ice: properly handle TM hierarchy deletion Bruce Richardson
  1 sibling, 0 replies; 4+ messages in thread
From: Ciara Loftus @ 2026-05-07 12:59 UTC (permalink / raw)
  To: dev; +Cc: Ciara Loftus, stable, Bruce Richardson

Currently, when a TM node is added with a shaper profile assigned,
the profile's reference count is not incremented. Equally, when a node
is deleted, the count is not decremented. As a result, the guard that
blocks deletion of an in-use profile never triggers, allowing the profile
to be freed while nodes still hold a pointer to it.

Fix by maintaining the reference count correctly when nodes take or
release a shaper profile, so that deletion of an in-use profile is
properly rejected.

Fixes: 8c481c3bb65b ("net/ice: support queue and queue group bandwidth limit")
Cc: stable@dpdk.org

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

diff --git a/drivers/net/intel/ice/ice_tm.c b/drivers/net/intel/ice/ice_tm.c
index 2bb684bb02..015a827d7a 100644
--- a/drivers/net/intel/ice/ice_tm.c
+++ b/drivers/net/intel/ice/ice_tm.c
@@ -456,6 +456,8 @@ ice_tm_node_add(struct rte_eth_dev *dev, uint32_t node_id,
 		tm_node->parent = NULL;
 		tm_node->reference_count = 0;
 		tm_node->shaper_profile = shaper_profile;
+		if (shaper_profile != NULL)
+			shaper_profile->reference_count++;
 		tm_node->children = RTE_PTR_ADD(tm_node, sizeof(struct ice_tm_node));
 		tm_node->params = *params;
 		pf->tm_conf.root = tm_node;
@@ -518,6 +520,8 @@ ice_tm_node_add(struct rte_eth_dev *dev, uint32_t node_id,
 	tm_node->parent = parent_node;
 	tm_node->level = level_id;
 	tm_node->shaper_profile = shaper_profile;
+	if (shaper_profile != NULL)
+		shaper_profile->reference_count++;
 	tm_node->children = RTE_PTR_ADD(tm_node, sizeof(struct ice_tm_node));
 	tm_node->parent->children[tm_node->parent->reference_count++] = tm_node;
 	tm_node->params = *params;
@@ -568,6 +572,8 @@ ice_tm_node_delete(struct rte_eth_dev *dev, uint32_t node_id,
 
 	/* root node */
 	if (tm_node->level == 0) {
+		if (tm_node->shaper_profile != NULL)
+			tm_node->shaper_profile->reference_count--;
 		rte_free(tm_node);
 		pf->tm_conf.root = NULL;
 		return 0;
@@ -582,6 +588,8 @@ ice_tm_node_delete(struct rte_eth_dev *dev, uint32_t node_id,
 		tm_node->parent->children[j] = tm_node->parent->children[j + 1];
 
 	tm_node->parent->reference_count--;
+	if (tm_node->shaper_profile != NULL)
+		tm_node->shaper_profile->reference_count--;
 	rte_free(tm_node);
 
 	return 0;
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v2 1/2] net/ice: properly handle TM hierarchy deletion
  2026-05-07 12:59 [PATCH v2 1/2] net/ice: properly handle TM hierarchy deletion Ciara Loftus
  2026-05-07 12:59 ` [PATCH v2 2/2] net/ice: fix shaper profile reference count tracking Ciara Loftus
@ 2026-05-07 13:11 ` Bruce Richardson
  2026-05-07 13:39   ` Bruce Richardson
  1 sibling, 1 reply; 4+ messages in thread
From: Bruce Richardson @ 2026-05-07 13:11 UTC (permalink / raw)
  To: Ciara Loftus; +Cc: dev, Mukul Katiyar, stable

On Thu, May 07, 2026 at 12:59:29PM +0000, Ciara Loftus wrote:
> From: Mukul Katiyar <mukul@versa-networks.com>
> 
> When a TM hierarchy is fully deleted and then committed, the hardware
> scheduler nodes may be left with any bandwidth limits that were
> programmed by the previous hierarchy commit. These stale limits may
> remain in effect the next time the device starts, permanently throttling
> traffic even though the TM hierarchy was removed.
> 
> Fix this by resetting all descendant hardware scheduler nodes to their
> default state when committing an empty hierarchy. Also restore the port
> queue count to its hardware default and clear the committed flag so the
> port starts cleanly without any TM configuration applied.
> 
> Fixes: 715d449a965b ("net/ice: enhance Tx scheduler hierarchy support")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Mukul Katiyar <mukul@versa-networks.com>
> Signed-off-by: Ciara Loftus <ciara.loftus@intel.com>
> ---
> v2:
> * Ensure restore is only performed if a hierarchy has already been
> committed
> ---
>  .mailmap                       |  1 +
>  drivers/net/intel/ice/ice_tm.c | 24 ++++++++++++++++++++++--
>  2 files changed, 23 insertions(+), 2 deletions(-)
Acked-by: Bruce Richardson <bruce.richardson@intel.com>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2 1/2] net/ice: properly handle TM hierarchy deletion
  2026-05-07 13:11 ` [PATCH v2 1/2] net/ice: properly handle TM hierarchy deletion Bruce Richardson
@ 2026-05-07 13:39   ` Bruce Richardson
  0 siblings, 0 replies; 4+ messages in thread
From: Bruce Richardson @ 2026-05-07 13:39 UTC (permalink / raw)
  To: Ciara Loftus; +Cc: dev, Mukul Katiyar, stable

On Thu, May 07, 2026 at 02:11:16PM +0100, Bruce Richardson wrote:
> On Thu, May 07, 2026 at 12:59:29PM +0000, Ciara Loftus wrote:
> > From: Mukul Katiyar <mukul@versa-networks.com>
> > 
> > When a TM hierarchy is fully deleted and then committed, the hardware
> > scheduler nodes may be left with any bandwidth limits that were
> > programmed by the previous hierarchy commit. These stale limits may
> > remain in effect the next time the device starts, permanently throttling
> > traffic even though the TM hierarchy was removed.
> > 
> > Fix this by resetting all descendant hardware scheduler nodes to their
> > default state when committing an empty hierarchy. Also restore the port
> > queue count to its hardware default and clear the committed flag so the
> > port starts cleanly without any TM configuration applied.
> > 
> > Fixes: 715d449a965b ("net/ice: enhance Tx scheduler hierarchy support")
> > Cc: stable@dpdk.org
> > 
> > Signed-off-by: Mukul Katiyar <mukul@versa-networks.com>
> > Signed-off-by: Ciara Loftus <ciara.loftus@intel.com>
> > ---
> > v2:
> > * Ensure restore is only performed if a hierarchy has already been
> > committed
> > ---
> >  .mailmap                       |  1 +
> >  drivers/net/intel/ice/ice_tm.c | 24 ++++++++++++++++++++++--
> >  2 files changed, 23 insertions(+), 2 deletions(-)
> Acked-by: Bruce Richardson <bruce.richardson@intel.com>

Series applied to dpdk-next-net-intel.
Thanks,
/Bruce

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-05-07 13:39 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-07 12:59 [PATCH v2 1/2] net/ice: properly handle TM hierarchy deletion Ciara Loftus
2026-05-07 12:59 ` [PATCH v2 2/2] net/ice: fix shaper profile reference count tracking Ciara Loftus
2026-05-07 13:11 ` [PATCH v2 1/2] net/ice: properly handle TM hierarchy deletion Bruce Richardson
2026-05-07 13:39   ` Bruce Richardson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox