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

Function nfp_mask_table_add

dpdk/drivers/net/nfp/nfp_flow.c:210–253  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

208}
209
210static int
211nfp_mask_table_add(struct nfp_flow_priv *priv,
212 char *mask_data,
213 uint32_t mask_len,
214 uint8_t *id)
215{
216 int ret;
217 uint8_t mask_id;
218 uint32_t hash_key;
219 struct nfp_mask_id_entry *mask_entry;
220
221 mask_entry = rte_zmalloc("mask_entry", sizeof(struct nfp_mask_id_entry), 0);
222 if (mask_entry == NULL) {
223 ret = -ENOMEM;
224 goto exit;
225 }
226
227 ret = nfp_mask_id_alloc(priv, &mask_id);
228 if (ret != 0)
229 goto mask_entry_free;
230
231 hash_key = rte_jhash(mask_data, mask_len, priv->hash_seed);
232 mask_entry->mask_id = mask_id;
233 mask_entry->hash_key = hash_key;
234 mask_entry->ref_cnt = 1;
235 PMD_DRV_LOG(DEBUG, "hash_key=%#x id=%u ref=%u", hash_key,
236 mask_id, mask_entry->ref_cnt);
237
238 ret = rte_hash_add_key_data(priv->mask_table, &hash_key, mask_entry);
239 if (ret != 0) {
240 PMD_DRV_LOG(ERR, "Add to mask table failed.");
241 goto mask_id_free;
242 }
243
244 *id = mask_id;
245 return 0;
246
247mask_id_free:
248 nfp_mask_id_free(priv, mask_id);
249mask_entry_free:
250 rte_free(mask_entry);
251exit:
252 return ret;
253}
254
255static int
256nfp_mask_table_del(struct nfp_flow_priv *priv,

Callers 1

nfp_check_mask_addFunction · 0.85

Calls 6

rte_zmallocFunction · 0.85
nfp_mask_id_allocFunction · 0.85
rte_hash_add_key_dataFunction · 0.85
nfp_mask_id_freeFunction · 0.85
rte_freeFunction · 0.85
rte_jhashFunction · 0.50

Tested by

no test coverage detected