Currently, when flow usese meter hierarchy, a tag action is always applied
to set the first meter's meter id, so as to update the first meter's drop
count. But it's not considered if first meter doesn't have drop count.

This patch fixes it, that in hierarchy, if the first meter doesn't have
drop count, no need to add the meter id tag action. No change for
non-hierarchy meter.

Fixes: e8146c63 ("net/mlx5: support represented port item in flow rules")
Cc: sta...@dpdk.org

Signed-off-by: Shun Hao <sh...@nvidia.com>
Acked-by: Matan Azrad <ma...@nvidia.com>
---
 drivers/net/mlx5/mlx5_flow.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c
index 2038c4a6c0..e4744b0a67 100644
--- a/drivers/net/mlx5/mlx5_flow.c
+++ b/drivers/net/mlx5/mlx5_flow.c
@@ -6438,14 +6438,12 @@ flow_create_split_meter(struct rte_eth_dev *dev,
                }
                /*
                 * If it isn't default-policy Meter, and
-                * 1. There's no action in flow to change
+                * 1. Not meter hierarchy and there's no action in flow to 
change
                 *    packet (modify/encap/decap etc.), OR
                 * 2. No drop count needed for this meter.
-                * 3. It's not meter hierarchy.
                 * Then no need to use regC to save meter id anymore.
                 */
-               if (!fm->def_policy && !is_mtr_hierarchy &&
-                   (!has_modify || !fm->drop_cnt))
+               if (!fm->def_policy && ((!has_modify && !is_mtr_hierarchy) || 
!fm->drop_cnt))
                        set_mtr_reg = false;
                /* Prefix actions: meter, decap, encap, tag, jump, end, cnt. */
 #define METER_PREFIX_ACTION 7
-- 
2.20.0

Reply via email to