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

Function acl_check_bld_param

dpdk/lib/acl/acl_bld.c:1550–1588  ·  view source on GitHub ↗

* Check that parameters for acl_build() are valid. */

Source from the content-addressed store, hash-verified

1548 * Check that parameters for acl_build() are valid.
1549 */
1550static int
1551acl_check_bld_param(struct rte_acl_ctx *ctx, const struct rte_acl_config *cfg)
1552{
1553 static const size_t field_sizes[] = {
1554 sizeof(uint8_t), sizeof(uint16_t),
1555 sizeof(uint32_t), sizeof(uint64_t),
1556 };
1557
1558 uint32_t i, j;
1559
1560 if (ctx == NULL || cfg == NULL || cfg->num_categories == 0 ||
1561 cfg->num_categories > RTE_ACL_MAX_CATEGORIES ||
1562 cfg->num_fields == 0 ||
1563 cfg->num_fields > RTE_ACL_MAX_FIELDS)
1564 return -EINVAL;
1565
1566 for (i = 0; i != cfg->num_fields; i++) {
1567 if (cfg->defs[i].type > RTE_ACL_FIELD_TYPE_BITMASK) {
1568 RTE_LOG(ERR, ACL,
1569 "ACL context: %s, invalid type: %hhu for %u-th field\n",
1570 ctx->name, cfg->defs[i].type, i);
1571 return -EINVAL;
1572 }
1573 for (j = 0;
1574 j != RTE_DIM(field_sizes) &&
1575 cfg->defs[i].size != field_sizes[j];
1576 j++)
1577 ;
1578
1579 if (j == RTE_DIM(field_sizes)) {
1580 RTE_LOG(ERR, ACL,
1581 "ACL context: %s, invalid size: %hhu for %u-th field\n",
1582 ctx->name, cfg->defs[i].size, i);
1583 return -EINVAL;
1584 }
1585 }
1586
1587 return 0;
1588}
1589
1590/*
1591 * With current ACL implementation first field in the rule definition

Callers 1

rte_acl_buildFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected