Skip to contentSkip to conversation

net/mlx5: fix flag non-template rule cleanup

PATCH In review Junfeng Guo 2 participants 2 messages Jun 5, 2025 – Jun 10, 2025 Network drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net/mlx5: fix flag non-template rule cleanup

Set the flag nt_rule to be FALSE whenever the flow rule is created through template API. This would ensure that this flow is always treated as template API flow after mlx5_ipool_malloc without being zeroing via memset.

Otherwise, some tables or template actions may be still in use for port init stage when attaching a port for template or non-template rule, in scenarios where the uninitialized memory nt_rule happens to contain a TRUE value.

Fixes 2fda185a8c1c ("net/mlx5: reuse flow fields")
Fixes 63296851fadb ("net/mlx5: support flow rule update")
---
 drivers/net/mlx5/mlx5_flow_hw.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/mlx5/mlx5_flow_hw.c +2 -1
index e26093522f..af2e7a84a5 100644
@@ -3935,6 +3935,7 @@ flow_hw_async_flow_create_generic(struct rte_eth_dev *dev,
 		rte_errno = ENOMEM;
 		goto error;
 	}
+	flow->nt_rule = false;
 	rule_acts = flow_hw_get_dr_action_buffer(priv, table, action_template_index, queue);
 	/*
 	 * Set the table here in order to know the destination table
@@ -4141,7 +4142,7 @@ flow_hw_async_flow_update(struct rte_eth_dev *dev,
 	}
 	aux = mlx5_flow_hw_aux(dev->data->port_id, of);
 	nf = &aux->upd_flow;
-	memset(nf, 0, sizeof(struct rte_flow_hw));
+	nf->nt_rule = false;
 	rule_acts = flow_hw_get_dr_action_buffer(priv, table, action_template_index, queue);
 	/*
 	 * Set the table here in order to know the destination table
Signature · 1 line
2.34.1
#1 lore raw

Hi,

Quoted 10 lines · Junfeng Guo

Set the flag nt_rule to be FALSE whenever the flow rule is created through template API. This would ensure that this flow is always treated as template API flow after mlx5_ipool_malloc without being zeroing via memset.

Otherwise, some tables or template actions may be still in use for port init stage when attaching a port for template or non-template rule, in scenarios where the uninitialized memory nt_rule happens to contain a TRUE value.

Quoted 6 lines
Fixes 2fda185a8c1c ("net/mlx5: reuse flow fields")
Fixes 63296851fadb ("net/mlx5: support flow rule update")

Patch applied to next-net-mlx,

Kindest regards
Raslan Darawsheh