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

Function acl_table_create

dpdk/lib/table/rte_swx_table_wm.c:274–337  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

272}
273
274static struct rte_acl_ctx *
275acl_table_create(struct rte_swx_table_params *params,
276 struct rte_swx_table_entry_list *entries,
277 uint32_t n_entries,
278 int numa_node)
279{
280 struct rte_acl_param acl_params = {0};
281 struct rte_acl_config acl_cfg = {0};
282 struct rte_acl_ctx *acl_ctx = NULL;
283 struct rte_acl_rule *acl_rules = NULL;
284 char *name = NULL;
285 int status = 0;
286
287 /* ACL config data structures. */
288 name = get_unique_name();
289 if (!name) {
290 status = -1;
291 goto free_resources;
292 }
293
294 status = acl_table_cfg_get(&acl_cfg, params);
295 if (status)
296 goto free_resources;
297
298 acl_rules = n_entries ?
299 acl_table_rules_get(&acl_cfg, params, entries, n_entries) :
300 acl_table_rules_default_get(&acl_cfg);
301 if (!acl_rules) {
302 status = -1;
303 goto free_resources;
304 }
305
306 n_entries = n_entries ? n_entries : 1;
307
308 /* ACL create. */
309 acl_params.name = name;
310 acl_params.socket_id = numa_node;
311 acl_params.rule_size = RTE_ACL_RULE_SZ(acl_cfg.num_fields);
312 acl_params.max_rule_num = n_entries;
313
314 acl_ctx = rte_acl_create(&acl_params);
315 if (!acl_ctx) {
316 status = -1;
317 goto free_resources;
318 }
319
320 /* ACL add rules. */
321 status = rte_acl_add_rules(acl_ctx, acl_rules, n_entries);
322 if (status)
323 goto free_resources;
324
325 /* ACL build. */
326 status = rte_acl_build(acl_ctx, &acl_cfg);
327
328free_resources:
329 if (status && acl_ctx)
330 rte_acl_free(acl_ctx);
331

Callers 1

table_createFunction · 0.85

Calls 9

get_unique_nameFunction · 0.85
acl_table_cfg_getFunction · 0.85
acl_table_rules_getFunction · 0.85
rte_acl_createFunction · 0.85
rte_acl_add_rulesFunction · 0.85
rte_acl_buildFunction · 0.85
rte_acl_freeFunction · 0.85
freeFunction · 0.50

Tested by

no test coverage detected