All of lore.kernel.org
 help / color / mirror / Atom feed
From: Junfeng Guo <junfengg@nvidia.com>
To: <dev@dpdk.org>
Cc: <stable@dpdk.org>, <dsosnowski@nvidia.com>,
	<viacheslavo@nvidia.com>, <bingz@nvidia.com>, <orika@nvidia.com>,
	<suanmingm@nvidia.com>, <matan@nvidia.com>, <junfengg@nvidia.com>
Subject: [PATCH] net/mlx5: fix flag non-template rule cleanup
Date: Thu, 5 Jun 2025 13:07:34 +0300	[thread overview]
Message-ID: <20250605100734.35936-1-junfengg@nvidia.com> (raw)

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: stable@dpdk.org

Signed-off-by: Junfeng Guo <junfengg@nvidia.com>
Acked-by: Dariusz Sosnowski <dsosnowski@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	other threads:[~2025-06-05 10:08 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-05 10:07 Junfeng Guo [this message]
2025-06-10 13:19 ` [PATCH] net/mlx5: fix flag non-template rule cleanup Raslan Darawsheh

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250605100734.35936-1-junfengg@nvidia.com \
    --to=junfengg@nvidia.com \
    --cc=bingz@nvidia.com \
    --cc=dev@dpdk.org \
    --cc=dsosnowski@nvidia.com \
    --cc=matan@nvidia.com \
    --cc=orika@nvidia.com \
    --cc=stable@dpdk.org \
    --cc=suanmingm@nvidia.com \
    --cc=viacheslavo@nvidia.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.