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

Function acl_build_rules

dpdk/lib/acl/acl_bld.c:1442–1480  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1440}
1441
1442static int
1443acl_build_rules(struct acl_build_context *bcx)
1444{
1445 struct rte_acl_build_rule *br, *head;
1446 const struct rte_acl_rule *rule;
1447 uint32_t *wp;
1448 uint32_t fn, i, n, num;
1449 size_t ofs, sz;
1450
1451 fn = bcx->cfg.num_fields;
1452 n = bcx->acx->num_rules;
1453 ofs = n * sizeof(*br);
1454 sz = ofs + n * fn * sizeof(*wp);
1455
1456 br = tb_alloc(&bcx->pool, sz);
1457
1458 wp = (uint32_t *)((uintptr_t)br + ofs);
1459 num = 0;
1460 head = NULL;
1461
1462 for (i = 0; i != n; i++) {
1463 rule = (const struct rte_acl_rule *)
1464 ((uintptr_t)bcx->acx->rules + bcx->acx->rule_sz * i);
1465 if ((rule->data.category_mask & bcx->category_mask) != 0) {
1466 br[num].next = head;
1467 br[num].config = &bcx->cfg;
1468 br[num].f = rule;
1469 br[num].wildness = wp;
1470 wp += fn;
1471 head = br + num;
1472 num++;
1473 }
1474 }
1475
1476 bcx->num_rules = num;
1477 bcx->build_rules = head;
1478
1479 return 0;
1480}
1481
1482/*
1483 * Copy data_indexes for each trie into RT location.

Callers 1

acl_bldFunction · 0.85

Calls 1

tb_allocFunction · 0.85

Tested by

no test coverage detected