* Callback to add MTR profile. * * @param[in] dev * Pointer to Ethernet device. * @param[in] mtr_profile_id * Meter profile id. * @param[in] profile * Pointer to meter profile detail. * @param[out] error * Pointer to the error structure. * * @return * 0 on success, a negative value otherwise and rte_errno is set. */
| 288 | * 0 on success, a negative value otherwise and rte_errno is set. |
| 289 | */ |
| 290 | static int |
| 291 | nfp_mtr_profile_add(struct rte_eth_dev *dev, |
| 292 | uint32_t mtr_profile_id, |
| 293 | struct rte_mtr_meter_profile *profile, |
| 294 | struct rte_mtr_error *error) |
| 295 | { |
| 296 | int ret; |
| 297 | struct nfp_mtr_priv *priv; |
| 298 | struct nfp_mtr_profile *mtr_profile; |
| 299 | struct nfp_app_fw_flower *app_fw_flower; |
| 300 | struct nfp_flower_representor *representor; |
| 301 | |
| 302 | representor = dev->data->dev_private; |
| 303 | app_fw_flower = representor->app_fw_flower; |
| 304 | priv = app_fw_flower->mtr_priv; |
| 305 | |
| 306 | /* Check input params */ |
| 307 | ret = nfp_mtr_profile_validate(mtr_profile_id, profile, error); |
| 308 | if (ret != 0) |
| 309 | return ret; |
| 310 | |
| 311 | /* Check if mtr profile id exist */ |
| 312 | mtr_profile = nfp_mtr_profile_search(priv, mtr_profile_id); |
| 313 | if (mtr_profile == NULL) { |
| 314 | ret = nfp_mtr_profile_insert(app_fw_flower, |
| 315 | profile, mtr_profile_id, error); |
| 316 | } else { |
| 317 | ret = nfp_mtr_profile_mod(app_fw_flower, |
| 318 | profile, mtr_profile, error); |
| 319 | } |
| 320 | |
| 321 | return ret; |
| 322 | } |
| 323 | |
| 324 | /** |
| 325 | * Callback to delete MTR profile. |
nothing calls this directly
no test coverage detected