structrte_acl_ctx*rte_acl_create(conststructrte_acl_param*param)
Create a new ACL context.
Parametersparam Parameters used to create and initialise the ACL context.
Returns
Pointer to ACL context structure that is used in future ACL operations, or NULL on error, with error
code set in rte_errno. Possible rte_errno errors include:
• EINVAL - invalid parameter passed to function
structrte_acl_ctx*rte_acl_find_existing(constchar*name)
Find an existing ACL context object and return a pointer to it.
Parametersname Name of the ACL context as passed to rte_acl_create()Returns
Pointer to ACL context or NULL if object not found with rte_errno set appropriately. Possible
rte_errno values include:
• ENOENT - value not available for return
voidrte_acl_free(structrte_acl_ctx*ctx)
De-allocate all memory used by ACL context.
Parametersctx ACL context to free If ctx is NULL, no operation is performed.
intrte_acl_add_rules(structrte_acl_ctx*ctx,conststructrte_acl_rule*rules,uint32_tnum)
Add rules to an existing ACL context. This function is not multi-thread safe.
Parametersctx ACL context to add patterns to.
rules Array of rules to add to the ACL context. Note that all fields in rte_acl_rule structures are
expected to be in host byte order. Each rule expected to be in the same format and not exceed size
specified at ACL context creation time.
num Number of elements in the input array of rules.
Returns
• -ENOMEM if there is no space in the ACL context for these rules.
• -EINVAL if the parameters are invalid.
• Zero if operation completed successfully.
voidrte_acl_reset_rules(structrte_acl_ctx*ctx)
Delete all rules from the ACL context. This function is not multi-thread safe. Note that internal run-
time structures are not affected.
Parametersctx ACL context to delete rules from.
intrte_acl_build(structrte_acl_ctx*ctx,conststructrte_acl_config*cfg)
Analyze set of rules and build required internal run-time structures. This function is not multi-thread
safe.
Parametersctx ACL context to build.
cfg Pointer to struct rte_acl_config - defines build parameters.
Returns
• -ENOMEM if couldn't allocate enough memory.
• -EINVAL if the parameters are invalid.
• Negative error code if operation failed.
• Zero if operation completed successfully.
voidrte_acl_reset(structrte_acl_ctx*ctx)
Delete all rules from the ACL context and destroy all internal run-time structures. This function is not
multi-thread safe.
Parametersctx ACL context to reset.
intrte_acl_classify(conststructrte_acl_ctx*ctx,constuint8_t**data,uint32_t*results,uint32_tnum,uint32_tcategories)[extern]
Perform search for a matching ACL rule for each input data buffer. Each input data buffer can have up to
categories matches. That implies that results array should be big enough to hold (categories * num)
elements. Also categories parameter should be either one or multiple of RTE_ACL_RESULTS_MULTIPLIER and
can't be bigger than RTE_ACL_MAX_CATEGORIES. If more than one rule is applicable for given input buffer
and given category, then rule with highest priority will be returned as a match. Note, that it is a
caller's responsibility to ensure that input parameters are valid and point to correct memory locations.
Parametersctx ACL context to search with.
data Array of pointers to input data buffers to perform search. Note that all fields in input data
buffers supposed to be in network byte order (MSB).
results Array of search results, categories results per each input data buffer.
num Number of elements in the input data buffers array.
categories Number of maximum possible matches for each input buffer, one possible match per category.
Returns
zero on successful completion. -EINVAL for incorrect arguments.
intrte_acl_classify_alg(conststructrte_acl_ctx*ctx,constuint8_t**data,uint32_t*results,uint32_tnum,uint32_tcategories,enumrte_acl_classify_algalg)[extern]
Perform search using specified algorithm for a matching ACL rule for each input data buffer. Each input
data buffer can have up to categories matches. That implies that results array should be big enough to
hold (categories * num) elements. Also categories parameter should be either one or multiple of
RTE_ACL_RESULTS_MULTIPLIER and can't be bigger than RTE_ACL_MAX_CATEGORIES. If more than one rule is
applicable for given input buffer and given category, then rule with highest priority will be returned as
a match. Note, that it is a caller's responsibility to ensure that input parameters are valid and point
to correct memory locations.
Parametersctx ACL context to search with.
data Array of pointers to input data buffers to perform search. Note that all fields in input data
buffers supposed to be in network byte order (MSB).
results Array of search results, categories results per each input data buffer.
num Number of elements in the input data buffers array.
categories Number of maximum possible matches for each input buffer, one possible match per category.
alg Algorithm to be used for the search. It is the caller responsibility to ensure that the value
refers to the existing algorithm, and that it could be run on the given CPU.
Returns
zero on successful completion. -EINVAL for incorrect arguments.
voidrte_acl_dump(conststructrte_acl_ctx*ctx)
Dump an ACL context structure to the console.
Parametersctx ACL context to dump.
voidrte_acl_list_dump(void)
Dump all ACL context structures to the console.