---
name: "rte_acl.h"
section: "3"
platform: "linux"
package: "dpdk-doc"
version: "24.11.4-0+deb13u1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/rte_acl.h"
---

# rte\_acl.h(3)

## NAME

rte\_acl.h

## SYNOPSIS

`#include <rte_acl_osdep.h>`\

### Data Structures

struct **rte\_acl\_field\_def**\
 struct **rte\_acl\_config**\
 struct **rte\_acl\_field**\
 struct **rte\_acl\_rule\_data**\
 struct **rte\_acl\_param**\

### Macros

\#define **RTE\_ACL\_RULE\_DEF**(name,  fld\_num)\
 \#define **RTE\_ACL\_NAMESIZE**   32\

### Enumerations

enum **rte\_acl\_classify\_alg** {  }\

### Functions

struct rte\_acl\_ctx \* **rte\_acl\_create** (const struct **rte\_acl\_param** \*param)\
 struct rte\_acl\_ctx \* **rte\_acl\_find\_existing** (const char \*name)\
 void **rte\_acl\_free** (struct rte\_acl\_ctx \*ctx)\
 int **rte\_acl\_add\_rules** (struct rte\_acl\_ctx \*ctx, const struct rte\_acl\_rule \*rules, uint32\_t num)\
 void **rte\_acl\_reset\_rules** (struct rte\_acl\_ctx \*ctx)\
 int **rte\_acl\_build** (struct rte\_acl\_ctx \*ctx, const struct **rte\_acl\_config** \*cfg)\
 void **rte\_acl\_reset** (struct rte\_acl\_ctx \*ctx)\
 int **rte\_acl\_classify** (const struct rte\_acl\_ctx \*ctx, const uint8\_t \*\*data, uint32\_t \*results, uint32\_t num, uint32\_t categories)\
 int **rte\_acl\_classify\_alg** (const struct rte\_acl\_ctx \*ctx, const uint8\_t \*\*data, uint32\_t \*results, uint32\_t num, uint32\_t categories, enum **rte\_acl\_classify\_alg** alg)\
 void **rte\_acl\_dump** (const struct rte\_acl\_ctx \*ctx)\
 void **rte\_acl\_list\_dump** (void)\

## Detailed Description

RTE Classifier.

Definition in file **rte\_acl.h**.

## Macro Definition Documentation

### #define RTE\_ACL\_RULE\_DEF(name, fld\_num)

**Value:**.PP

```
    struct name {\
    struct rte_acl_rule_data data;               \
    struct rte_acl_field field[fld_num];         \
}
```

Defines single ACL rule. data - miscellaneous data for the rule. field\[\] - value and mask or range for each field.

Definition at line **111** of file **rte\_acl.h**.

### #define RTE\_ACL\_NAMESIZE 32

Max number of characters in name.

Definition at line **123** of file **rte\_acl.h**.

## Enumeration Type Documentation

### enum rte\_acl\_classify\_alg

Available implementations of ACL classify.

**Enumerator**

- *RTE\_ACL\_CLASSIFY\_SCALAR*

  *generic implementation.*

- *RTE\_ACL\_CLASSIFY\_SSE*

  *requires SSE4.1 support.*

- *RTE\_ACL\_CLASSIFY\_AVX2*

  *requires AVX2 support.*

- *RTE\_ACL\_CLASSIFY\_NEON*

  *requires NEON support.*

- *RTE\_ACL\_CLASSIFY\_ALTIVEC*

  *requires ALTIVEC support.*

- *RTE\_ACL\_CLASSIFY\_AVX512X16*

  *requires AVX512 support.*

- *RTE\_ACL\_CLASSIFY\_AVX512X32*

  *requires AVX512 support.*

*Definition at line* **238** *of file* **rte\_acl.h***.*

## Function Documentation

### struct rte\_acl\_ctx \* rte\_acl\_create (const struct rte\_acl\_param \* param)

*Create a new ACL context.*

**Parameters**

*param 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*

### struct rte\_acl\_ctx \* rte\_acl\_find\_existing (const char \* name)

*Find an existing ACL context object and return a pointer to it.*

**Parameters**

*name 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*

### void rte\_acl\_free (struct rte\_acl\_ctx \* ctx)

*De-allocate all memory used by ACL context.*

**Parameters**

*ctx ACL context to free If ctx is NULL, no operation is performed.*

### int rte\_acl\_add\_rules (struct rte\_acl\_ctx \* ctx, const struct rte\_acl\_rule \* rules, uint32\_t num)

*Add rules to an existing ACL context. This function is not multi-thread safe.*

**Parameters**

*ctx 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.*

### void rte\_acl\_reset\_rules (struct rte\_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.*

**Parameters**

*ctx ACL context to delete rules from.*

### int rte\_acl\_build (struct rte\_acl\_ctx \* ctx, const struct rte\_acl\_config \* cfg)

*Analyze set of rules and build required internal run-time structures. This function is not multi-thread safe.*

**Parameters**

*ctx 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.*

### void rte\_acl\_reset (struct rte\_acl\_ctx \* ctx)

*Delete all rules from the ACL context and destroy all internal run-time structures. This function is not multi-thread safe.*

**Parameters**

*ctx ACL context to reset.*

### int rte\_acl\_classify (const struct rte\_acl\_ctx \* ctx, const uint8\_t \*\* data, uint32\_t \* results, uint32\_t num, uint32\_t categories)` [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.*

**Parameters**

*ctx 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.*

### int rte\_acl\_classify\_alg (const struct rte\_acl\_ctx \* ctx, const uint8\_t \*\* data, uint32\_t \* results, uint32\_t num, uint32\_t categories, enum rte\_acl\_classify\_alg alg)` [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.*

**Parameters**

*ctx 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.*

### void rte\_acl\_dump (const struct rte\_acl\_ctx \* ctx)

*Dump an ACL context structure to the console.*

**Parameters**

*ctx ACL context to dump.*

### void rte\_acl\_list\_dump (void)

*Dump all ACL context structures to the console.*

## Author

*Generated automatically by Doxygen for DPDK from the source code.*
