MCPcopy Create free account
hub / github.com/F-Stack/f-stack / nfp_mtr_policy_delete

Function nfp_mtr_policy_delete

dpdk/drivers/net/nfp/nfp_mtr.c:517–548  ·  view source on GitHub ↗

* Callback to delete MTR policy. * * @param[in] dev * Pointer to Ethernet device. * @param[in] mtr_policy_id * Meter policy id. * @param[out] error * Pointer to the error structure. * * @return * 0 on success, a negative value otherwise and rte_errno is set. */

Source from the content-addressed store, hash-verified

515 * 0 on success, a negative value otherwise and rte_errno is set.
516 */
517static int
518nfp_mtr_policy_delete(struct rte_eth_dev *dev,
519 uint32_t mtr_policy_id,
520 struct rte_mtr_error *error)
521{
522 struct nfp_mtr_priv *priv;
523 struct nfp_mtr_policy *mtr_policy;
524 struct nfp_flower_representor *representor;
525
526 representor = dev->data->dev_private;
527 priv = representor->app_fw_flower->mtr_priv;
528
529 /* Check if mtr policy id exist */
530 mtr_policy = nfp_mtr_policy_search(priv, mtr_policy_id);
531 if (mtr_policy == NULL) {
532 return -rte_mtr_error_set(error, EINVAL,
533 RTE_MTR_ERROR_TYPE_METER_POLICY_ID,
534 NULL, "Request meter policy not exist");
535 }
536
537 if (mtr_policy->ref_cnt > 0) {
538 return -rte_mtr_error_set(error, EBUSY,
539 RTE_MTR_ERROR_TYPE_METER_POLICY,
540 NULL, "Request mtr policy is been used");
541 }
542
543 /* Remove profile from profile list */
544 LIST_REMOVE(mtr_policy, next);
545 rte_free(mtr_policy);
546
547 return 0;
548}
549
550struct nfp_mtr *
551nfp_mtr_find_by_mtr_id(struct nfp_mtr_priv *priv, uint32_t mtr_id)

Callers

nothing calls this directly

Calls 3

nfp_mtr_policy_searchFunction · 0.85
rte_mtr_error_setFunction · 0.85
rte_freeFunction · 0.85

Tested by

no test coverage detected