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

Function nfp_mtr_profile_mod

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

Source from the content-addressed store, hash-verified

234}
235
236static int
237nfp_mtr_profile_mod(struct nfp_app_fw_flower *app_fw_flower,
238 struct rte_mtr_meter_profile *profile,
239 struct nfp_mtr_profile *mtr_profile,
240 struct rte_mtr_error *error)
241{
242 int ret;
243 struct nfp_profile_conf old_conf;
244
245 /* Get the old profile config */
246 rte_memcpy(&old_conf, &mtr_profile->conf, sizeof(old_conf));
247
248 memset(&mtr_profile->conf, 0, sizeof(struct nfp_profile_conf));
249
250 ret = nfp_mtr_profile_conf_mod(mtr_profile->profile_id,
251 profile, &mtr_profile->conf);
252 if (ret != 0) {
253 rte_mtr_error_set(error, EINVAL,
254 RTE_MTR_ERROR_TYPE_UNSPECIFIED,
255 NULL, "Mod profile config failed");
256 goto rollback;
257 }
258
259 ret = nfp_flower_cmsg_qos_add(app_fw_flower, &mtr_profile->conf);
260 if (ret != 0) {
261 rte_mtr_error_set(error, EINVAL,
262 RTE_MTR_ERROR_TYPE_UNSPECIFIED,
263 NULL, "Mod meter to firmware failed");
264 goto rollback;
265 }
266
267 return 0;
268
269rollback:
270 rte_memcpy(&mtr_profile->conf, &old_conf, sizeof(old_conf));
271
272 return ret;
273}
274
275/**
276 * Callback to add MTR profile.

Callers 1

nfp_mtr_profile_addFunction · 0.85

Calls 5

memsetFunction · 0.85
nfp_mtr_profile_conf_modFunction · 0.85
rte_mtr_error_setFunction · 0.85
nfp_flower_cmsg_qos_addFunction · 0.85
rte_memcpyFunction · 0.50

Tested by

no test coverage detected