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")
Cc: stable@dpdk.org
Signed-off-by: Rongwei Liu <rongweil@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
#include "mlx5.h"
#include "mlx5_flow.h"
#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.
*
/**
* Create the meter action.
*
}
/* Add to the flow meter list. */
fm->active_state = 1; /* Config meter starts as active. */
}
/* Add to the flow meter list. */
fm->active_state = 1; /* Config meter starts as active. */
+ 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) {
fm->shared = !!shared;
__atomic_add_fetch(&fm->profile->ref_cnt, 1, __ATOMIC_RELAXED);
if (params->meter_policy_id == priv->sh->mtrmng->def_policy_id) {
data.dword = mtr_idx;
if (mlx5_l3t_set_entry(priv->mtr_idx_tbl, meter_id, &data))
goto error;
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;
if (mtr_policy)
__atomic_add_fetch(&mtr_policy->ref_cnt, 1, __ATOMIC_RELAXED);
return 0;