src/dpdk/drivers/net/mvpp2/mrvl_mtr.c
static int
mrvl_destroy(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;

	if (!priv->ppio)
		return -rte_mtr_error_set(error, EPERM,
					  RTE_MTR_ERROR_TYPE_UNSPECIFIED,
					  NULL, "Port is uninitialized\n");

	mtr = mrvl_mtr_from_id(priv, mtr_id);
	if (!mtr)
		return -rte_mtr_error_set(error, EEXIST,
					  RTE_MTR_ERROR_TYPE_MTR_ID, NULL,
					  "Meter id does not exist\n");

	if (mtr->refcnt)
		return -rte_mtr_error_set(error, EPERM,
					  RTE_MTR_ERROR_TYPE_MTR_ID, NULL,
					  "Meter is used\n");

	LIST_REMOVE(mtr, next);
	mtr->profile->refcnt--;

	if (mtr->plcr_bit != MRVL_PLCR_BIT_INVALID)
		priv->used_plcrs &= ~BIT(mtr->plcr_bit);

	if (mtr->plcr)
		pp2_cls_plcr_deinit(mtr->plcr);

	rte_free(mtr);

	return 0;
}
/**
 * Destroy meter object.
 *
 * @param dev Pointer to the device.
 * @param mtr_id Id of the meter object.
 * @param error Pointer to the error.
 * @returns 0 on success, negative value otherwise.
 */
Destroy meter object.
@param dev Pointer to the device.
@param mtr_id Id of the meter object.
@param error Pointer to the error.
@returns 0 on success, negative value otherwise.
Destroy meter object . @param dev Pointer to the device . @param mtr_id Id of the meter object . @param error Pointer to the error . @returns 0 on success negative value otherwise .
static int
mrvl_destroy(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;
	if (!priv->ppio)
		return -rte_mtr_error_set(error, EPERM,
					  RTE_MTR_ERROR_TYPE_UNSPECIFIED,
					  NULL, "Port is uninitialized\n");
	mtr = mrvl_mtr_from_id(priv, mtr_id);
	if (!mtr)
		return -rte_mtr_error_set(error, EEXIST,
					  RTE_MTR_ERROR_TYPE_MTR_ID, NULL,
					  "Meter id does not exist\n");
	if (mtr->refcnt)
		return -rte_mtr_error_set(error, EPERM,
					  RTE_MTR_ERROR_TYPE_MTR_ID, NULL,
					  "Meter is used\n");
	LIST_REMOVE(mtr, next);
	mtr->profile->refcnt--;
	if (mtr->plcr_bit != MRVL_PLCR_BIT_INVALID)
		priv->used_plcrs &= ~BIT(mtr->plcr_bit);
	if (mtr->plcr)
		pp2_cls_plcr_deinit(mtr->plcr);
	rte_free(mtr);
	return 0;
}
static int mrvl_destroy ( 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 ; if ( ! priv -> ppio ) return - rte_mtr_error_set ( error , EPERM , RTE_MTR_ERROR_TYPE_UNSPECIFIED , NULL , " \n " ) ; mtr = mrvl_mtr_from_id ( priv , mtr_id ) ; if ( ! mtr ) return - rte_mtr_error_set ( error , EEXIST , RTE_MTR_ERROR_TYPE_MTR_ID , NULL , " \n " ) ; if ( mtr -> refcnt ) return - rte_mtr_error_set ( error , EPERM , RTE_MTR_ERROR_TYPE_MTR_ID , NULL , " \n " ) ; LIST_REMOVE ( mtr , next ) ; mtr -> profile -> refcnt -- ; if ( mtr -> plcr_bit != MRVL_PLCR_BIT_INVALID ) priv -> used_plcrs &= ~ BIT ( mtr -> plcr_bit ) ; if ( mtr -> plcr ) pp2_cls_plcr_deinit ( mtr -> plcr ) ; rte_free ( mtr ) ; return 0 ; }
Destroy meter object.
Destroy meter object .