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

Function acl_bld

dpdk/lib/acl/acl_bld.c:1506–1545  ·  view source on GitHub ↗

* Internal routine, performs 'build' phase of trie generation: * - setups build context. * - analyzes given set of rules. * - builds internal tree(s). */

Source from the content-addressed store, hash-verified

1504 * - builds internal tree(s).
1505 */
1506static int
1507acl_bld(struct acl_build_context *bcx, struct rte_acl_ctx *ctx,
1508 const struct rte_acl_config *cfg, uint32_t node_max)
1509{
1510 int32_t rc;
1511
1512 /* setup build context. */
1513 memset(bcx, 0, sizeof(*bcx));
1514 bcx->acx = ctx;
1515 bcx->pool.alignment = ACL_POOL_ALIGN;
1516 bcx->pool.min_alloc = ACL_POOL_ALLOC_MIN;
1517 bcx->cfg = *cfg;
1518 bcx->category_mask = RTE_LEN2MASK(bcx->cfg.num_categories,
1519 typeof(bcx->category_mask));
1520 bcx->node_max = node_max;
1521
1522 rc = sigsetjmp(bcx->pool.fail, 0);
1523
1524 /* build phase runs out of memory. */
1525 if (rc != 0) {
1526 RTE_LOG(ERR, ACL,
1527 "ACL context: %s, %s() failed with error code: %d\n",
1528 bcx->acx->name, __func__, rc);
1529 return rc;
1530 }
1531
1532 /* Create a build rules copy. */
1533 rc = acl_build_rules(bcx);
1534 if (rc != 0)
1535 return rc;
1536
1537 /* No rules to build for that context+config */
1538 if (bcx->build_rules == NULL) {
1539 rc = -EINVAL;
1540 } else {
1541 /* build internal trie representation. */
1542 rc = acl_build_tries(bcx, bcx->build_rules);
1543 }
1544 return rc;
1545}
1546
1547/*
1548 * Check that parameters for acl_build() are valid.

Callers 1

rte_acl_buildFunction · 0.85

Calls 3

memsetFunction · 0.85
acl_build_rulesFunction · 0.85
acl_build_triesFunction · 0.85

Tested by

no test coverage detected