DPDK patches and discussions
 help / color / mirror / Atom feed
From: Rongwei Liu <rongweil@nvidia.com>
To: <matan@nvidia.com>, <viacheslavo@nvidia.com>, <orika@nvidia.com>,
	<thomas@monjalon.net>, Bing Zhao <bingz@nvidia.com>
Cc: <dev@dpdk.org>, <rasland@nvidia.com>
Subject: [dpdk-dev] [PATCH v1] net/mlx5: fix meter policy validation
Date: Tue, 2 Nov 2021 09:22:40 +0200	[thread overview]
Message-ID: <20211102072240.1073955-1-rongweil@nvidia.com> (raw)

When a user specifies meter policy like "g_actions queue / end
y_actions queue / r_action drop / end", validation logic missed
to set meter policy mode and it took a random value from the stack.

Define ALL policy modes for the mentioned cases.

Fixes: 4b7bf3ffb473 ("net/mlx5: support yellow in meter policy validation")
Cc: bingz@nvidia.com
Signed-off-by: Rongwei Liu <rongweil@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
---
 drivers/net/mlx5/mlx5.h         | 2 ++
 drivers/net/mlx5/mlx5_flow_dv.c | 2 ++
 2 files changed, 4 insertions(+)

diff --git a/drivers/net/mlx5/mlx5.h b/drivers/net/mlx5/mlx5.h
index 39c001aa1b..591ae2764a 100644
--- a/drivers/net/mlx5/mlx5.h
+++ b/drivers/net/mlx5/mlx5.h
@@ -622,6 +622,8 @@ struct mlx5_dev_shared_port {
 #define MLX5_MTR_TABLE_ID_DROP 2
 /* Priority of the meter policy matcher. */
 #define MLX5_MTR_POLICY_MATCHER_PRIO 0
+/* Green & yellow color valid for now. */
+#define MLX5_MTR_POLICY_MODE_ALL 0
 /* Default policy. */
 #define MLX5_MTR_POLICY_MODE_DEF 1
 /* Only green color valid. */
diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c
index 8962d26c75..e516c11d9a 100644
--- a/drivers/net/mlx5/mlx5_flow_dv.c
+++ b/drivers/net/mlx5/mlx5_flow_dv.c
@@ -17617,6 +17617,8 @@ flow_dv_validate_mtr_policy_acts(struct rte_eth_dev *dev,
 		*policy_mode = MLX5_MTR_POLICY_MODE_OG;
 	} else if (def_green && !def_yellow) {
 		*policy_mode = MLX5_MTR_POLICY_MODE_OY;
+	} else {
+		*policy_mode = MLX5_MTR_POLICY_MODE_ALL;
 	}
 	/* Set to empty string in case of NULL pointer access by user. */
 	flow_err.message = "";
-- 
2.27.0


             reply	other threads:[~2021-11-02  7:22 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-02  7:22 Rongwei Liu [this message]
2021-11-02  8:20 ` Bing Zhao
2021-11-02  8:24   ` Rongwei Liu
2021-11-02  8:25     ` Bing Zhao
2021-11-09 13:38 ` 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=20211102072240.1073955-1-rongweil@nvidia.com \
    --to=rongweil@nvidia.com \
    --cc=bingz@nvidia.com \
    --cc=dev@dpdk.org \
    --cc=matan@nvidia.com \
    --cc=orika@nvidia.com \
    --cc=rasland@nvidia.com \
    --cc=thomas@monjalon.net \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).