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

Function nfp_mtr_profile_delete

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

* Callback to delete MTR profile. * * @param[in] dev * Pointer to Ethernet device. * @param[in] mtr_profile_id * Meter profile 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

335 * 0 on success, a negative value otherwise and rte_errno is set.
336 */
337static int
338nfp_mtr_profile_delete(struct rte_eth_dev *dev,
339 uint32_t mtr_profile_id,
340 struct rte_mtr_error *error)
341{
342 int ret;
343 struct nfp_mtr_priv *priv;
344 struct nfp_mtr_profile *mtr_profile;
345 struct nfp_app_fw_flower *app_fw_flower;
346 struct nfp_flower_representor *representor;
347
348 representor = dev->data->dev_private;
349 app_fw_flower = representor->app_fw_flower;
350 priv = app_fw_flower->mtr_priv;
351
352 /* Check if mtr profile id exist */
353 mtr_profile = nfp_mtr_profile_search(priv, mtr_profile_id);
354 if (mtr_profile == NULL) {
355 return -rte_mtr_error_set(error, EINVAL,
356 RTE_MTR_ERROR_TYPE_METER_PROFILE_ID,
357 NULL, "Request meter profile not exist");
358 }
359
360 if (mtr_profile->in_use) {
361 return -rte_mtr_error_set(error, EINVAL,
362 RTE_MTR_ERROR_TYPE_METER_PROFILE,
363 NULL, "Request meter profile is been used");
364 }
365
366 ret = nfp_flower_cmsg_qos_delete(app_fw_flower, &mtr_profile->conf);
367 if (ret != 0) {
368 return -rte_mtr_error_set(error, EINVAL,
369 RTE_MTR_ERROR_TYPE_UNSPECIFIED,
370 NULL, "Delete meter from firmware failed");
371 }
372
373 /* Remove profile from profile list */
374 LIST_REMOVE(mtr_profile, next);
375 rte_free(mtr_profile);
376
377 return 0;
378}
379
380static struct nfp_mtr_policy *
381nfp_mtr_policy_search(struct nfp_mtr_priv *priv, uint32_t mtr_policy_id)

Callers

nothing calls this directly

Calls 4

nfp_mtr_profile_searchFunction · 0.85
rte_mtr_error_setFunction · 0.85
rte_freeFunction · 0.85

Tested by

no test coverage detected