src/dpdk/drivers/net/mvpp2/mrvl_mtr.c
static int
mrvl_meter_disable(struct rte_eth_dev *dev, uint32_t mtr_id,
		       struct rte_mtr_error *error)
{
	struct mrvl_priv *priv = dev->data->dev_private;
	struct mrvl_mtr *mtr = mrvl_mtr_from_id(priv, mtr_id);
	struct rte_flow *flow;
	int ret;

	if (!mtr)
		return -rte_mtr_error_set(error, ENODEV,
					  RTE_MTR_ERROR_TYPE_MTR_ID, NULL,
					  "Meter id does not exist\n");

	LIST_FOREACH(flow, &priv->flows, next) {
		if (flow->mtr != mtr)
			continue;

		flow->action.plcr = NULL;

		ret = pp2_cls_tbl_modify_rule(priv->cls_tbl, &flow->rule,
					      &flow->action);
		if (ret)
			return -rte_mtr_error_set(error, -ret,
					RTE_MTR_ERROR_TYPE_UNSPECIFIED,
					NULL, "Failed to disable meter\n");
	}

	mtr->enabled = 0;

	return 0;
}
/**
 * Disable meter object.
 *
 * @param dev Pointer to the device.
 * @param mtr Id of the meter.
 * @param error Pointer to the error.
 * @returns 0 on success, negative value otherwise.
 */
Disable meter object.
@param dev Pointer to the device.
@param mtr Id of the meter.
@param error Pointer to the error.
@returns 0 on success, negative value otherwise.
Disable meter object . @param dev Pointer to the device . @param mtr Id of the meter . @param error Pointer to the error . @returns 0 on success negative value otherwise .
static int
mrvl_meter_disable(struct rte_eth_dev *dev, uint32_t mtr_id,
		       struct rte_mtr_error *error)
{
	struct mrvl_priv *priv = dev->data->dev_private;
	struct mrvl_mtr *mtr = mrvl_mtr_from_id(priv, mtr_id);
	struct rte_flow *flow;
	int ret;
	if (!mtr)
		return -rte_mtr_error_set(error, ENODEV,
					  RTE_MTR_ERROR_TYPE_MTR_ID, NULL,
					  "Meter id does not exist\n");
	LIST_FOREACH(flow, &priv->flows, next) {
		if (flow->mtr != mtr)
			continue;
		flow->action.plcr = NULL;
		ret = pp2_cls_tbl_modify_rule(priv->cls_tbl, &flow->rule,
					      &flow->action);
		if (ret)
			return -rte_mtr_error_set(error, -ret,
					RTE_MTR_ERROR_TYPE_UNSPECIFIED,
					NULL, "Failed to disable meter\n");
	}
	mtr->enabled = 0;
	return 0;
}
static int mrvl_meter_disable ( struct rte_eth_dev * dev , uint32_t mtr_id , struct rte_mtr_error * error ) { struct mrvl_priv * priv = dev -> data -> dev_private ; struct mrvl_mtr * mtr = mrvl_mtr_from_id ( priv , mtr_id ) ; struct rte_flow * flow ; int ret ; if ( ! mtr ) return - rte_mtr_error_set ( error , ENODEV , RTE_MTR_ERROR_TYPE_MTR_ID , NULL , " \n " ) ; LIST_FOREACH ( flow , & priv -> flows , next ) { if ( flow -> mtr != mtr ) continue ; flow -> action . plcr = NULL ; ret = pp2_cls_tbl_modify_rule ( priv -> cls_tbl , & flow -> rule , & flow -> action ) ; if ( ret ) return - rte_mtr_error_set ( error , - ret , RTE_MTR_ERROR_TYPE_UNSPECIFIED , NULL , " \n " ) ; } mtr -> enabled = 0 ; return 0 ; }
Disable meter object.
Disable meter object .