diff mbox series

net/mlx5: fix the meter hierarchy validation with yellow

Message ID 20210729160405.161982-4-bingz@nvidia.com (mailing list archive)
State Accepted, archived
Delegated to: Raslan Darawsheh
Headers show
Series net/mlx5: fix the meter hierarchy validation with yellow | expand

Checks

Context Check Description
ci/iol-mellanox-Functional fail Functional Testing issues
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-testing success Testing PASS
ci/iol-abi-testing success Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/intel-Testing success Testing PASS
ci/Intel-compilation success Compilation OK
ci/github-robot success github build: passed
ci/checkpatch success coding style OK

Commit Message

Bing Zhao July 29, 2021, 4:04 p.m. UTC
In mlx5 PMD, the meter hierarchy only supports the green color. It
means that a meter action can only be in the green action list. In
the meanwhile, the yellow action list should be empty now. Any
action for the yellow color policy will be considered invalid if
the green color policy is a hierarchy.

Also, the error message printing of meter hierarchy validation is
fixed by removing an incorrect checking.

Fixes: 4b7bf3ffb473 ("net/mlx5: support yellow in meter policy validation")
Fixes: a3b7af90baba ("net/mlx5: validate meter action in policy")
Cc: shunh@nvidia.com

Signed-off-by: Bing Zhao <bingz@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
---
 drivers/net/mlx5/mlx5_flow_dv.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

Comments

Raslan Darawsheh July 29, 2021, 8:07 p.m. UTC | #1
Hi,

> -----Original Message-----
> From: Bing Zhao <bingz@nvidia.com>
> Sent: Thursday, July 29, 2021 7:04 PM
> To: Slava Ovsiienko <viacheslavo@nvidia.com>; Matan Azrad
> <matan@nvidia.com>
> Cc: dev@dpdk.org; Ori Kam <orika@nvidia.com>; Raslan Darawsheh
> <rasland@nvidia.com>; NBU-Contact-Thomas Monjalon
> <thomas@monjalon.net>; Shun Hao <shunh@nvidia.com>
> Subject: [PATCH] net/mlx5: fix the meter hierarchy validation with yellow
> 
> In mlx5 PMD, the meter hierarchy only supports the green color. It means
> that a meter action can only be in the green action list. In the meanwhile, the
> yellow action list should be empty now. Any action for the yellow color policy
> will be considered invalid if the green color policy is a hierarchy.
> 
> Also, the error message printing of meter hierarchy validation is fixed by
> removing an incorrect checking.
> 
> Fixes: 4b7bf3ffb473 ("net/mlx5: support yellow in meter policy validation")
> Fixes: a3b7af90baba ("net/mlx5: validate meter action in policy")
> Cc: shunh@nvidia.com
> 
> Signed-off-by: Bing Zhao <bingz@nvidia.com>
> Acked-by: Matan Azrad <matan@nvidia.com>
> ---
>  drivers/net/mlx5/mlx5_flow_dv.c | 11 ++++++++---
>  1 file changed, 8 insertions(+), 3 deletions(-)
> 

Patch applied to next-net-mlx,

Kindest regards,
Raslan Darawsheh
diff mbox series

Patch

diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c
index 837450722a..d5669e209d 100644
--- a/drivers/net/mlx5/mlx5_flow_dv.c
+++ b/drivers/net/mlx5/mlx5_flow_dv.c
@@ -17691,9 +17691,14 @@  flow_dv_validate_mtr_policy_acts(struct rte_eth_dev *dev,
 					return -rte_mtr_error_set(error,
 						ENOTSUP,
 						RTE_MTR_ERROR_TYPE_METER_POLICY,
-						NULL, flow_err.message ?
-						flow_err.message :
-				  "Meter hierarchy only supports GREEN color.");
+						NULL,
+						"Meter hierarchy only supports GREEN color.");
+				if (*policy_mode != MLX5_MTR_POLICY_MODE_OG)
+					return -rte_mtr_error_set(error,
+						ENOTSUP,
+						RTE_MTR_ERROR_TYPE_METER_POLICY,
+						NULL,
+						"No yellow policy should be provided in meter hierarchy.");
 				mtr = act->conf;
 				ret = flow_dv_validate_policy_mtr_hierarchy(dev,
 							mtr->mtr_id,