* 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. */
| 515 | * 0 on success, a negative value otherwise and rte_errno is set. |
| 516 | */ |
| 517 | static int |
| 518 | nfp_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 | |
| 550 | struct nfp_mtr * |
| 551 | nfp_mtr_find_by_mtr_id(struct nfp_mtr_priv *priv, uint32_t mtr_id) |
nothing calls this directly
no test coverage detected