net/mlx5: fix meter creation default state
PATCH 1/1 net/mlx5: fix meter creation default state
Disable means there is no packet drop in the meter. Meter is active always but programmed with another CIR/CBS value.
If the user wants to disable the meter in creation, PMD calls the disable() API manually after meter initialized.
--- drivers/net/mlx5/mlx5_flow_meter.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
drivers/net/mlx5/mlx5_flow_meter.c +8 -1
@@ -15,6 +15,10 @@#include "mlx5.h" #include "mlx5_flow.h" +static int +mlx5_flow_meter_disable (struct rte_eth_dev *dev, +uint32_t meter_id, +struct rte_mtr_error *error);/** * Create the meter action. *
@@ -1288,7 +1292,7 @@ mlx5_flow_meter_create(struct rte_eth_dev *dev, uint32_t meter_id, }/* Add to the flow meter list. */ fm->active_state =1 ;/* Config meter starts as active. */ - fm->is_enable =1 ; + fm->is_enable = params->meter_enable; fm->shared = !!shared;__atomic_add_fetch (&fm->profile->ref_cnt,1 , __ATOMIC_RELAXED);if (params->meter_policy_id == priv->sh->mtrmng->def_policy_id) {
@@ -1313,7 +1317,10 @@ mlx5_flow_meter_create(struct rte_eth_dev *dev, uint32_t meter_id, data.dword = mtr_idx;if (mlx5_l3t_set_entry (priv->mtr_idx_tbl, meter_id, &data)) goto error; + }else if (!params->meter_enable &&mlx5_flow_meter_disable (dev, meter_id, error)) { + goto error; } + fm->active_state = params->meter_enable;if (mtr_policy)__atomic_add_fetch (&mtr_policy->ref_cnt,1 , __ATOMIC_RELAXED);return 0 ;
Signature · 1 line
2.27.0
From: Rongwei Liu
Quoted 9 lines
Disable means there is no packet drop in the meter. Meter is active always but programmed with another CIR/CBS value.
If the user wants to disable the meter in creation, PMD calls the
disable()API manually after meter initialized.Fixes 444320186393 ("net/mlx5: support meter creation with policy")Signed-off-by Rongwei Liu <[email protected]>
Hi,
Quoted 14 lines
-----Original Message-----
From: Rongwei Liu <[email protected]>
Sent: Monday, March 7, 2022 10:01 AM
To: Matan Azrad <[email protected]>; Slava Ovsiienko <[email protected]>; Ori Kam <[email protected]>; NBU-Contact- Thomas Monjalon (EXTERNAL) <[email protected]>; Li Zhang <[email protected]>
Cc: [email protected]; Raslan Darawsheh <[email protected]>; [email protected]
Subject: [PATCH v1] net/mlx5: fix meter creation default stateDisable means there is no packet drop in the meter. Meter is active always but programmed with another CIR/CBS value.
Quoted 6 lines
If the user wants to disable the meter in creation, PMD calls the
disable()API manually after meter initialized.Fixes 444320186393 ("net/mlx5: support meter creation with policy")Signed-off-by Rongwei Liu <[email protected]>
Patch applied to next-net-mlx,
Kindest regards,
Raslan Darawsheh