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")
Cc: sta...@dpdk.org

Signed-off-by: Junfeng Guo <junfe...@nvidia.com>
Acked-by: Dariusz Sosnowski <dsosnow...@nvidia.com>
---
 drivers/net/mlx5/mlx5_flow_hw.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/mlx5/mlx5_flow_hw.c b/drivers/net/mlx5/mlx5_flow_hw.c
index e26093522f..af2e7a84a5 100644
--- a/drivers/net/mlx5/mlx5_flow_hw.c
+++ b/drivers/net/mlx5/mlx5_flow_hw.c
@@ -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
-- 
2.34.1

Reply via email to