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

Function nfp_mtr_profile_insert

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

Source from the content-addressed store, hash-verified

186}
187
188static int
189nfp_mtr_profile_insert(struct nfp_app_fw_flower *app_fw_flower,
190 struct rte_mtr_meter_profile *profile,
191 uint32_t mtr_profile_id,
192 struct rte_mtr_error *error)
193{
194 int ret;
195 struct nfp_mtr_priv *priv;
196 struct nfp_mtr_profile *mtr_profile;
197
198 priv = app_fw_flower->mtr_priv;
199
200 /* Meter profile memory allocation. */
201 mtr_profile = rte_zmalloc(NULL, sizeof(struct nfp_mtr_profile), 0);
202 if (mtr_profile == NULL) {
203 return -rte_mtr_error_set(error, ENOMEM,
204 RTE_MTR_ERROR_TYPE_UNSPECIFIED,
205 NULL, "Meter profile alloc failed");
206 }
207
208 ret = nfp_mtr_profile_conf_insert(mtr_profile_id,
209 profile, mtr_profile);
210 if (ret != 0) {
211 rte_mtr_error_set(error, EINVAL,
212 RTE_MTR_ERROR_TYPE_UNSPECIFIED,
213 NULL, "Insert profile config failed");
214 goto free_profile;
215 }
216
217 ret = nfp_flower_cmsg_qos_add(app_fw_flower, &mtr_profile->conf);
218 if (ret != 0) {
219 rte_mtr_error_set(error, EINVAL,
220 RTE_MTR_ERROR_TYPE_UNSPECIFIED,
221 NULL, "Add meter to firmware failed");
222 goto free_profile;
223 }
224
225 /* Insert profile into profile list */
226 LIST_INSERT_HEAD(&priv->profiles, mtr_profile, next);
227
228 return 0;
229
230free_profile:
231 rte_free(mtr_profile);
232
233 return ret;
234}
235
236static int
237nfp_mtr_profile_mod(struct nfp_app_fw_flower *app_fw_flower,

Callers 1

nfp_mtr_profile_addFunction · 0.85

Calls 5

rte_zmallocFunction · 0.85
rte_mtr_error_setFunction · 0.85
nfp_flower_cmsg_qos_addFunction · 0.85
rte_freeFunction · 0.85

Tested by

no test coverage detected