---
name: "rte_regexdev.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_regexdev.h"
---

# rte\_regexdev.h(3)

## NAME

rte\_regexdev.h

## SYNOPSIS

`#include <rte_compat.h>`\
 `#include <rte_common.h>`\
 `#include <rte_dev.h>`\
 `#include <rte_mbuf.h>`\
 `#include 'rte_regexdev_core.h'`\

### Data Structures

struct **rte\_regexdev\_info**\
 struct **rte\_regexdev\_config**\
 struct **rte\_regexdev\_qp\_conf**\
 struct **rte\_regexdev\_rule**\
 struct **rte\_regexdev\_xstats\_map**\
 struct **rte\_regexdev\_match**\
 struct **rte\_regex\_ops**\

### Macros

\#define **RTE\_REGEXDEV\_CAPA\_RUNTIME\_COMPILATION\_F**   (1ULL \<\< 0)\
 \#define **RTE\_REGEXDEV\_CAPA\_SUPP\_PCRE\_START\_ANCHOR\_F**   (1ULL \<\< 1)\
 \#define **RTE\_REGEXDEV\_CAPA\_SUPP\_PCRE\_ATOMIC\_GROUPING\_F**   (1ULL \<\< 2)\
 \#define **RTE\_REGEXDEV\_SUPP\_PCRE\_BACKTRACKING\_CTRL\_F**   (1ULL \<\< 3)\
 \#define **RTE\_REGEXDEV\_SUPP\_PCRE\_CALLOUTS\_F**   (1ULL \<\< 4)\
 \#define **RTE\_REGEXDEV\_SUPP\_PCRE\_BACKREFERENCE\_F**   (1ULL \<\< 5)\
 \#define **RTE\_REGEXDEV\_SUPP\_PCRE\_GREEDY\_F**   (1ULL \<\< 6)\
 \#define **RTE\_REGEXDEV\_SUPP\_PCRE\_MATCH\_ALL\_F**   (1ULL \<\< 7)\
 \#define **RTE\_REGEXDEV\_SUPP\_PCRE\_LOOKAROUND\_ASRT\_F**   (1ULL \<\< 8)\
 \#define **RTE\_REGEXDEV\_SUPP\_PCRE\_MATCH\_POINT\_RST\_F**   (1ULL \<\< 9)\
 \#define **RTE\_REGEXDEV\_SUPP\_NEWLINE\_CONVENTIONS\_F**   (1ULL \<\< 10)\
 \#define **RTE\_REGEXDEV\_SUPP\_PCRE\_NEWLINE\_SEQ\_F**   (1ULL \<\< 11)\
 \#define **RTE\_REGEXDEV\_SUPP\_PCRE\_POSSESSIVE\_QUALIFIERS\_F**   (1ULL \<\< 12)\
 \#define **RTE\_REGEXDEV\_SUPP\_PCRE\_SUBROUTINE\_REFERENCES\_F**   (1ULL \<\< 13)\
 \#define **RTE\_REGEXDEV\_SUPP\_PCRE\_UTF\_8\_F**   (1ULL \<\< 14)\
 \#define **RTE\_REGEXDEV\_SUPP\_PCRE\_UTF\_16\_F**   (1ULL \<\< 15)\
 \#define **RTE\_REGEXDEV\_SUPP\_PCRE\_UTF\_32\_F**   (1ULL \<\< 16)\
 \#define **RTE\_REGEXDEV\_SUPP\_PCRE\_WORD\_BOUNDARY\_F**   (1ULL \<\< 17)\
 \#define **RTE\_REGEXDEV\_SUPP\_PCRE\_FORWARD\_REFERENCES\_F**   (1ULL \<\< 18)\
 \#define **RTE\_REGEXDEV\_SUPP\_MATCH\_AS\_END\_F**   (1ULL \<\< 19)\
 \#define **RTE\_REGEXDEV\_SUPP\_CROSS\_BUFFER\_F**   (1ULL \<\< 20)\
 \#define **RTE\_REGEXDEV\_SUPP\_MATCH\_ALL\_F**   (1ULL \<\< 21)\
 \#define **RTE\_REGEXDEV\_CAPA\_QUEUE\_PAIR\_OOS\_F**   (1ULL \<\< 22)\
 \#define **RTE\_REGEX\_PCRE\_RULE\_ALLOW\_EMPTY\_F**   (1ULL \<\< 0)\
 \#define **RTE\_REGEX\_PCRE\_RULE\_ANCHORED\_F**   (1ULL \<\< 1)\
 \#define **RTE\_REGEX\_PCRE\_RULE\_CASELESS\_F**   (1ULL \<\< 2)\
 \#define **RTE\_REGEX\_PCRE\_RULE\_DOTALL\_F**   (1ULL \<\< 3)\
 \#define **RTE\_REGEX\_PCRE\_RULE\_DUPNAMES\_F**   (1ULL \<\< 4)\
 \#define **RTE\_REGEX\_PCRE\_RULE\_EXTENDED\_F**   (1ULL \<\< 5)\
 \#define **RTE\_REGEX\_PCRE\_RULE\_MATCH\_UNSET\_BACKREF\_F**   (1ULL \<\< 6)\
 \#define **RTE\_REGEX\_PCRE\_RULE\_MULTILINE\_F**   (1ULL \<\< 7)\
 \#define **RTE\_REGEX\_PCRE\_RULE\_NO\_AUTO\_CAPTURE\_F**   (1ULL \<\< 8)\
 \#define **RTE\_REGEX\_PCRE\_RULE\_UCP\_F**   (1ULL \<\< 9)\
 \#define **RTE\_REGEX\_PCRE\_RULE\_UNGREEDY\_F**   (1ULL \<\< 10)\
 \#define **RTE\_REGEX\_PCRE\_RULE\_UTF\_F**   (1ULL \<\< 11)\
 \#define **RTE\_REGEX\_PCRE\_RULE\_NEVER\_BACKSLASH\_C\_F**   (1ULL \<\< 12)\
 \#define **RTE\_REGEXDEV\_CFG\_CROSS\_BUFFER\_SCAN\_F**   (1ULL \<\< 0)\
 \#define **RTE\_REGEXDEV\_CFG\_MATCH\_AS\_END\_F**   (1ULL \<\< 1)\
 \#define **RTE\_REGEXDEV\_CFG\_MATCH\_ALL\_F**   (1ULL \<\< 2)\
 \#define **RTE\_REGEX\_QUEUE\_PAIR\_CFG\_OOS\_F**   (1ULL \<\< 0)\
 \#define **RTE\_REGEXDEV\_XSTATS\_NAME\_SIZE**   64\
 \#define **RTE\_REGEX\_OPS\_REQ\_GROUP\_ID0\_VALID\_F**   (1 \<\< 0)\
 \#define **RTE\_REGEX\_OPS\_REQ\_GROUP\_ID1\_VALID\_F**   (1 \<\< 1)\
 \#define **RTE\_REGEX\_OPS\_REQ\_GROUP\_ID2\_VALID\_F**   (1 \<\< 2)\
 \#define **RTE\_REGEX\_OPS\_REQ\_GROUP\_ID3\_VALID\_F**   (1 \<\< 3)\
 \#define **RTE\_REGEX\_OPS\_REQ\_STOP\_ON\_MATCH\_F**   (1 \<\< 4)\
 \#define **RTE\_REGEX\_OPS\_REQ\_MATCH\_HIGH\_PRIORITY\_F**   (1 \<\< 5)\
 \#define **RTE\_REGEX\_OPS\_RSP\_PMI\_SOJ\_F**   (1 \<\< 0)\
 \#define **RTE\_REGEX\_OPS\_RSP\_PMI\_EOJ\_F**   (1 \<\< 1)\
 \#define **RTE\_REGEX\_OPS\_RSP\_MAX\_SCAN\_TIMEOUT\_F**   (1 \<\< 2)\
 \#define **RTE\_REGEX\_OPS\_RSP\_MAX\_MATCH\_F**   (1 \<\< 3)\
 \#define **RTE\_REGEX\_OPS\_RSP\_MAX\_PREFIX\_F**   (1 \<\< 4)\
 \#define **RTE\_REGEX\_OPS\_RSP\_RESOURCE\_LIMIT\_REACHED\_F**   (1 \<\< 4)\

### Typedefs

**typedef** void(\* **regexdev\_stop\_flush\_t**) (uint8\_t dev\_id, uint16\_t qp\_id, struct **rte\_regex\_ops** \*op)\

### Enumerations

enum **rte\_regexdev\_attr\_id** { **RTE\_REGEXDEV\_ATTR\_SOCKET\_ID**, **RTE\_REGEXDEV\_ATTR\_MAX\_MATCHES**, **RTE\_REGEXDEV\_ATTR\_MAX\_SCAN\_TIMEOUT**, **RTE\_REGEXDEV\_ATTR\_MAX\_PREFIX** }\
 enum **rte\_regexdev\_rule\_op** { **RTE\_REGEX\_RULE\_OP\_ADD**, **RTE\_REGEX\_RULE\_OP\_REMOVE** }\

### Functions

\_\_rte\_experimental int **rte\_regexdev\_is\_valid\_dev** (uint16\_t dev\_id)\
 \_\_rte\_experimental uint8\_t **rte\_regexdev\_count** (void)\
 \_\_rte\_experimental int **rte\_regexdev\_get\_dev\_id** (const char \*name)\
 \_\_rte\_experimental int **rte\_regexdev\_info\_get** (uint8\_t dev\_id, struct **rte\_regexdev\_info** \*dev\_info)\
 \_\_rte\_experimental int **rte\_regexdev\_configure** (uint8\_t dev\_id, const struct **rte\_regexdev\_config** \*cfg)\
 \_\_rte\_experimental int **rte\_regexdev\_queue\_pair\_setup** (uint8\_t dev\_id, uint16\_t queue\_pair\_id, const struct **rte\_regexdev\_qp\_conf** \*qp\_conf)\
 \_\_rte\_experimental int **rte\_regexdev\_start** (uint8\_t dev\_id)\
 \_\_rte\_experimental int **rte\_regexdev\_stop** (uint8\_t dev\_id)\
 \_\_rte\_experimental int **rte\_regexdev\_close** (uint8\_t dev\_id)\
 \_\_rte\_experimental int **rte\_regexdev\_attr\_get** (uint8\_t dev\_id, enum **rte\_regexdev\_attr\_id** attr\_id, void \*attr\_value)\
 \_\_rte\_experimental int **rte\_regexdev\_attr\_set** (uint8\_t dev\_id, enum **rte\_regexdev\_attr\_id** attr\_id, const void \*attr\_value)\
 \_\_rte\_experimental int **rte\_regexdev\_rule\_db\_update** (uint8\_t dev\_id, const struct **rte\_regexdev\_rule** \*rules, uint32\_t nb\_rules)\
 \_\_rte\_experimental int **rte\_regexdev\_rule\_db\_compile\_activate** (uint8\_t dev\_id)\
 \_\_rte\_experimental int **rte\_regexdev\_rule\_db\_import** (uint8\_t dev\_id, const char \*rule\_db, uint32\_t rule\_db\_len)\
 \_\_rte\_experimental int **rte\_regexdev\_rule\_db\_export** (uint8\_t dev\_id, char \*rule\_db)\
 \_\_rte\_experimental int **rte\_regexdev\_xstats\_names\_get** (uint8\_t dev\_id, struct **rte\_regexdev\_xstats\_map** \*xstats\_map)\
 \_\_rte\_experimental int **rte\_regexdev\_xstats\_get** (uint8\_t dev\_id, const uint16\_t \*ids, uint64\_t \*values, uint16\_t nb\_values)\
 \_\_rte\_experimental int **rte\_regexdev\_xstats\_by\_name\_get** (uint8\_t dev\_id, const char \*name, uint16\_t \*id, uint64\_t \*value)\
 \_\_rte\_experimental int **rte\_regexdev\_xstats\_reset** (uint8\_t dev\_id, const uint16\_t \*ids, uint16\_t nb\_ids)\
 \_\_rte\_experimental int **rte\_regexdev\_selftest** (uint8\_t dev\_id)\
 \_\_rte\_experimental int **rte\_regexdev\_dump** (uint8\_t dev\_id, FILE \*f)\
 static \_\_rte\_experimental uint16\_t **rte\_regexdev\_enqueue\_burst** (uint8\_t dev\_id, uint16\_t qp\_id, struct **rte\_regex\_ops** \*\*ops, uint16\_t nb\_ops)\
 static \_\_rte\_experimental uint16\_t **rte\_regexdev\_dequeue\_burst** (uint8\_t dev\_id, uint16\_t qp\_id, struct **rte\_regex\_ops** \*\*ops, uint16\_t nb\_ops)\

## Detailed Description

RTE RegEx Device API

Defines RTE RegEx Device APIs for RegEx operations and its provisioning.

The RegEx Device API is composed of two parts:

- •

  The application-oriented RegEx API that includes functions to setup a RegEx device (configure it, setup its queue pairs and start it), update the rule database and so on.

- •

  The driver-oriented RegEx API that exports a function allowing a RegEx poll Mode Driver (PMD) to simultaneously register itself as a RegEx device driver.

RegEx device components and definitions:

```
+-----------------+
|                 |
|                 o---------+    rte_regexdev_[en|de]queue_burst()
|   PCRE based    o------+  |               |
|  RegEx pattern  |      |  |  +--------+   |
| matching engine o------+--+--o        |   |    +------+
|                 |      |  |  | queue  |<==o===>|Core 0|
|                 o----+ |  |  | pair 0 |        |      |
|                 |    | |  |  +--------+        +------+
+-----------------+    | |  |
       ^               | |  |  +--------+
       |               | |  |  |        |        +------+
       |               | +--+--o queue  |<======>|Core 1|
   Rule|Database       |    |  | pair 1 |        |      |
+------+----------+    |    |  +--------+        +------+
|     Group 0     |    |    |
| +-------------+ |    |    |  +--------+        +------+
| | Rules 0..n  | |    |    |  |        |        |Core 2|
| +-------------+ |    |    +--o queue  |<======>|      |
|     Group 1     |    |       | pair 2 |        +------+
| +-------------+ |    |       +--------+
| | Rules 0..n  | |    |
| +-------------+ |    |       +--------+
|     Group 2     |    |       |        |        +------+
| +-------------+ |    |       | queue  |<======>|Core n|
| | Rules 0..n  | |    +-------o pair n |        |      |
| +-------------+ |            +--------+        +------+
|     Group n     |
| +-------------+ |<-------rte_regexdev_rule_db_update()
| |             | |<-------rte_regexdev_rule_db_compile_activate()
| | Rules 0..n  | |<-------rte_regexdev_rule_db_import()
| +-------------+ |------->rte_regexdev_rule_db_export()
+-----------------+
```

 RegEx: A regular expression is a concise and flexible means for matching strings of text, such as particular characters, words, or patterns of characters. A common abbreviation for this is “RegEx”.

RegEx device: A hardware or software-based implementation of RegEx device API for PCRE based pattern matching syntax and semantics.

PCRE RegEx syntax and semantics specification: http://regexkit.sourceforge.net/Documentation/pcre/pcrepattern.html

RegEx queue pair: Each RegEx device should have one or more queue pair to transmit a burst of pattern matching request and receive a burst of receive the pattern matching response. The pattern matching request/response embedded in **rte\_regex\_ops structure.**

**Rule: A pattern matching rule expressed in PCRE RegEx syntax along with Match ID and Group ID to identify the rule upon the match.**

**Rule database: The RegEx device accepts regular expressions and converts them into a compiled rule database that can then be used to scan data. Compilation allows the device to analyze the given pattern(s) and pre-determine how to scan for these patterns in an optimized fashion that would be far too expensive to compute at run-time. A rule database contains a set of rules that compiled in device specific binary form.**

**Match ID or Rule ID: A unique identifier provided at the time of rule creation for the application to identify the rule upon match.**

**Group ID: Group of rules can be grouped under one group ID to enable rule isolation and effective pattern matching. A unique group identifier provided at the time of rule creation for the application to identify the rule upon match.**

**Scan: A pattern matching request through** *enqueue* **API.**

**It may possible that a given RegEx device may not support all the features of PCRE. The application may probe unsupported features through struct rte\_regexdev\_info::pcre\_unsup\_flags**

**By default, all the functions of the RegEx Device API exported by a PMD are lock-free functions which assume to not be invoked in parallel on different logical cores to work on the same target object. For instance, the dequeue function of a PMD cannot be invoked in parallel on two logical cores to operates on same RegEx queue pair. Of course, this function can be invoked in parallel by different logical core on different queue pair. It is the responsibility of the upper level application to enforce this rule.**

**In all functions of the RegEx API, the RegEx device is designated by an integer \>= 0 named the device identifier** *dev\_id*

**At the RegEx driver level, RegEx devices are represented by a generic data structure of type** *rte\_regexdev***.**

**RegEx devices are dynamically registered during the PCI/SoC device probing phase performed at EAL initialization time. When a RegEx device is being probed, a** *rte\_regexdev* **structure and a new device identifier are allocated for that device. Then, the regexdev\_init() function supplied by the RegEx driver matching the probed device is invoked to properly initialize the device.**

**The role of the device init function consists of resetting the hardware or software RegEx driver implementations.**

**If the device init operation is successful, the correspondence between the device identifier assigned to the new device and its associated** *rte\_regexdev* **structure is effectively registered. Otherwise, both the** *rte\_regexdev* **structure and the device identifier are freed.**

**The functions exported by the application RegEx API to setup a device designated by its device identifier must be invoked in the following order:**

- •

  **rte\_regexdev\_configure()**

- •

  **rte\_regexdev\_queue\_pair\_setup()**

- •

  **rte\_regexdev\_start()**

**Then, the application can invoke, in any order, the functions exported by the RegEx API to enqueue pattern matching job, dequeue pattern matching response, get the stats, update the rule database, get/set device attributes and so on**

**If the application wants to change the configuration (i.e. call rte\_regexdev\_configure() or rte\_regexdev\_queue\_pair\_setup()), it must call rte\_regexdev\_stop() first to stop the device and then do the reconfiguration before calling rte\_regexdev\_start() again. The enqueue and dequeue functions should not be invoked when the device is stopped.**

**Finally, an application can close a RegEx device by invoking the rte\_regexdev\_close() function.**

**Each function of the application RegEx API invokes a specific function of the PMD that controls the target device designated by its device identifier.**

**For this purpose, all device-specific functions of a RegEx driver are supplied through a set of pointers contained in a generic structure of type** *regexdev\_ops***. The address of the** *regexdev\_ops* **structure is stored in the** *rte\_regexdev* **structure by the device init function of the RegEx driver, which is invoked during the PCI/SoC device probing phase, as explained earlier.**

**In other words, each function of the RegEx API simply retrieves the** *rte\_regexdev* **structure associated with the device identifier and performs an indirect invocation of the corresponding driver function supplied in the** *regexdev\_ops* **structure of the** *rte\_regexdev* **structure.**

**For performance reasons, the address of the fast-path functions of the RegEx driver is not contained in the** *regexdev\_ops* **structure. Instead, they are directly stored at the beginning of the** *rte\_regexdev* **structure to avoid an extra indirect memory access during their invocation.**

**RTE RegEx device drivers do not use interrupts for enqueue or dequeue operation. Instead, RegEx drivers export Poll-Mode enqueue and dequeue functions to applications.**

**The** *enqueue* **operation submits a burst of RegEx pattern matching request to the RegEx device and the** *dequeue* **operation gets a burst of pattern matching response for the ones submitted through** *enqueue* **operation.**

**Typical application utilisation of the RegEx device API will follow the following programming flow.**

- •

  **rte\_regexdev\_configure()**

- •

  **rte\_regexdev\_queue\_pair\_setup()**

- •

  **rte\_regexdev\_rule\_db\_update() Needs to invoke if precompiled rule database not provided in rte\_regexdev\_config::rule\_db for rte\_regexdev\_configure() and/or application needs to update rule database.**

- •

  **rte\_regexdev\_rule\_db\_compile\_activate() Needs to invoke if rte\_regexdev\_rule\_db\_update function was used.**

- •

  **Create or reuse exiting mempool for rte\_regex\_ops objects.**

- •

  **rte\_regexdev\_start()**

- •

  **rte\_regexdev\_enqueue\_burst()**

- •

  **rte\_regexdev\_dequeue\_burst()**

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

## Macro Definition Documentation

### #define RTE\_REGEXDEV\_CAPA\_RUNTIME\_COMPILATION\_F (1ULL \<\< 0)

**RegEx device does support compiling the rules at runtime unlike loading only the pre-built rule database using struct rte\_regexdev\_config::rule\_db in rte\_regexdev\_configure()**

**See also**

**struct rte\_regexdev\_config::rule\_db, rte\_regexdev\_configure()**

**struct rte\_regexdev\_info::regexdev\_capa**

**Definition at line 280 of file rte\_regexdev.h.**

### #define RTE\_REGEXDEV\_CAPA\_SUPP\_PCRE\_START\_ANCHOR\_F (1ULL \<\< 1)

**RegEx device support PCRE Anchor to start of match flag. Example RegEx is** `/\Gfoo\d/`**. Here** `\G` **asserts position at the end of the previous match or the start of the string for the first match. This position will change each time the RegEx is applied to the subject string. If the RegEx is applied to** `foo1foo2Zfoo3` **the first two matches will be successful for** `foo1foo2` **and fail for** `Zfoo3`**.**

**See also**

**struct rte\_regexdev\_info::regexdev\_capa**

**Definition at line 291 of file rte\_regexdev.h.**

### #define RTE\_REGEXDEV\_CAPA\_SUPP\_PCRE\_ATOMIC\_GROUPING\_F (1ULL \<\< 2)

**RegEx device support PCRE Atomic grouping. Atomic groups are represented by** `(?>)`**. An atomic group is a group that, when the RegEx engine exits from it, automatically throws away all backtracking positions remembered by any tokens inside the group. Example RegEx is** `a(?>bc|b)c` **if the given patterns are** `abc` **and** `abcc` **then** `a(bc|b)c` **matches both where as** `a(?>bc|b)c` **matches only abcc because atomic groups don't allow backtracking back to** `b`**.**

**See also**

**struct rte\_regexdev\_info::regexdev\_capa**

**Definition at line 303 of file rte\_regexdev.h.**

### #define RTE\_REGEXDEV\_SUPP\_PCRE\_BACKTRACKING\_CTRL\_F (1ULL \<\< 3)

**RegEx device support PCRE backtracking control verbs. Some examples of backtracking verbs are (\*COMMIT), (\*ACCEPT), (\*FAIL), (\*SKIP), (\*PRUNE).**

**See also**

**struct rte\_regexdev\_info::regexdev\_capa**

**Definition at line 311 of file rte\_regexdev.h.**

### #define RTE\_REGEXDEV\_SUPP\_PCRE\_CALLOUTS\_F (1ULL \<\< 4)

**RegEx device support PCRE callouts. PCRE supports calling external function in between matches by using** `(?C)`**. Example RegEx** `ABC(?C)D` **if a given patter is** `ABCD` **then the RegEx engine will parse ABC perform a userdefined callout and return a successful match at D.**

**See also**

**struct rte\_regexdev\_info::regexdev\_capa**

**Definition at line 321 of file rte\_regexdev.h.**

### #define RTE\_REGEXDEV\_SUPP\_PCRE\_BACKREFERENCE\_F (1ULL \<\< 5)

**RegEx device support PCRE backreference. Example RegEx is** `(\2ABC|(GHI))+` `\2` **matches the same text as most recently matched by the 2nd capturing group i.e.** `GHI`**.**

**See also**

**struct rte\_regexdev\_info::regexdev\_capa**

**Definition at line 329 of file rte\_regexdev.h.**

### #define RTE\_REGEXDEV\_SUPP\_PCRE\_GREEDY\_F (1ULL \<\< 6)

**RegEx device support PCRE Greedy mode. For example if the RegEx is** `AB\d*?` **then** `*?` **represents zero or unlimited matches. In greedy mode the pattern** `AB12345` **will be matched completely where as the ungreedy mode** `AB` **will be returned as the match.**

**See also**

**struct rte\_regexdev\_info::regexdev\_capa**

**Definition at line 338 of file rte\_regexdev.h.**

### #define RTE\_REGEXDEV\_SUPP\_PCRE\_MATCH\_ALL\_F (1ULL \<\< 7)

**RegEx device support match all mode. For example if the RegEx is** `AB\d*?` **then** `*?` **represents zero or unlimited matches. In match all mode the pattern** `AB12345` **will return 6 matches. AB, AB1, AB12, AB123, AB1234, AB12345.**

**See also**

**struct rte\_regexdev\_info::regexdev\_capa**

**Definition at line 347 of file rte\_regexdev.h.**

### #define RTE\_REGEXDEV\_SUPP\_PCRE\_LOOKAROUND\_ASRT\_F (1ULL \<\< 8)

**RegEx device support PCRE Lookaround assertions (Zero-width assertions). Example RegEx is** `[a-z]+\d+(?=!{3,})` **if the given pattern is** `dwad1234!` **the RegEx engine doesn't report any matches because the assert** `(?=!{3,})` **fails. The pattern** `dwad123!!!` **would return a successful match.**

**See also**

**struct rte\_regexdev\_info::regexdev\_capa**

**Definition at line 357 of file rte\_regexdev.h.**

### #define RTE\_REGEXDEV\_SUPP\_PCRE\_MATCH\_POINT\_RST\_F (1ULL \<\< 9)

**RegEx device doesn't support PCRE match point reset directive. Example RegEx is** `[a-z]+\K\d+` **if the pattern is** `dwad123` **then even though the entire pattern matches only** `123` **is reported as a match.**

**See also**

**struct rte\_regexdev\_info::regexdev\_capa**

**Definition at line 366 of file rte\_regexdev.h.**

### #define RTE\_REGEXDEV\_SUPP\_NEWLINE\_CONVENTIONS\_F (1ULL \<\< 10)

**RegEx support PCRE newline convention. Newline conventions are represented as follows: (\*CR) carriage return (\*LF) linefeed (\*CRLF) carriage return, followed by linefeed (\*ANYCRLF) any of the three above (\*ANY) all Unicode newline sequences**

**See also**

**struct rte\_regexdev\_info::regexdev\_capa**

**Definition at line 378 of file rte\_regexdev.h.**

### #define RTE\_REGEXDEV\_SUPP\_PCRE\_NEWLINE\_SEQ\_F (1ULL \<\< 11)

**RegEx device support PCRE newline sequence. The escape sequence** `\R` **will match any newline sequence. It is equivalent to:** `(?>\r\n|\n|\x0b|\f|\r|\x85)`**.**

**See also**

**struct rte\_regexdev\_info::regexdev\_capa**

**Definition at line 386 of file rte\_regexdev.h.**

### #define RTE\_REGEXDEV\_SUPP\_PCRE\_POSSESSIVE\_QUALIFIERS\_F (1ULL \<\< 12)

**RegEx device support PCRE possessive qualifiers. Example RegEx possessive qualifiers** `*+`**,** `++`**,** `?+`**,** `{m,n}+`**. Possessive quantifier repeats the token as many times as possible and it does not give up matches as the engine backtracks. With a possessive quantifier, the deal is all or nothing.**

**See also**

**struct rte\_regexdev\_info::regexdev\_capa**

**Definition at line 396 of file rte\_regexdev.h.**

### #define RTE\_REGEXDEV\_SUPP\_PCRE\_SUBROUTINE\_REFERENCES\_F (1ULL \<\< 13)

**RegEx device support PCRE Subroutine references. PCRE Subroutine references allow for sub patterns to be assessed as part of the RegEx. Example RegEx is** `(foo|fuzz)\g<1>+bar` **matches the pattern** `foofoofuzzfoofuzzbar`**.**

**See also**

**struct rte\_regexdev\_info::regexdev\_capa**

**Definition at line 405 of file rte\_regexdev.h.**

### #define RTE\_REGEXDEV\_SUPP\_PCRE\_UTF\_8\_F (1ULL \<\< 14)

**RegEx device support UTF-8 character encoding.**

**See also**

**struct rte\_regexdev\_info::pcre\_unsup\_flags**

**Definition at line 411 of file rte\_regexdev.h.**

### #define RTE\_REGEXDEV\_SUPP\_PCRE\_UTF\_16\_F (1ULL \<\< 15)

**RegEx device support UTF-16 character encoding.**

**See also**

**struct rte\_regexdev\_info::regexdev\_capa**

**Definition at line 417 of file rte\_regexdev.h.**

### #define RTE\_REGEXDEV\_SUPP\_PCRE\_UTF\_32\_F (1ULL \<\< 16)

**RegEx device support UTF-32 character encoding.**

**See also**

**struct rte\_regexdev\_info::regexdev\_capa**

**Definition at line 423 of file rte\_regexdev.h.**

### #define RTE\_REGEXDEV\_SUPP\_PCRE\_WORD\_BOUNDARY\_F (1ULL \<\< 17)

**RegEx device support word boundaries. The meta character** `\b` **represents word boundary anchor.**

**See also**

**struct rte\_regexdev\_info::regexdev\_capa**

**Definition at line 430 of file rte\_regexdev.h.**

### #define RTE\_REGEXDEV\_SUPP\_PCRE\_FORWARD\_REFERENCES\_F (1ULL \<\< 18)

**RegEx device support Forward references. Forward references allow you to use a back reference to a group that appears later in the RegEx. Example RegEx is** `(\3ABC|(DEF|(GHI)))+` **matches the following string** `GHIGHIABCDEF`**.**

**See also**

**struct rte\_regexdev\_info::regexdev\_capa**

**Definition at line 439 of file rte\_regexdev.h.**

### #define RTE\_REGEXDEV\_SUPP\_MATCH\_AS\_END\_F (1ULL \<\< 19)

**RegEx device support match as end. Match as end means that the match result holds the end offset of the detected match. No len value is set. If the device doesn't support this feature it means the match result holds the starting position of match and the length of the match.**

**See also**

**struct rte\_regexdev\_info::regexdev\_capa**

**Definition at line 449 of file rte\_regexdev.h.**

### #define RTE\_REGEXDEV\_SUPP\_CROSS\_BUFFER\_F (1ULL \<\< 20)

**RegEx device support cross buffer match. Cross buffer matching means that the match can be detected even if the string was started in previous buffer. In case the device is configured as RTE\_REGEXDEV\_CFG\_MATCH\_AS\_END the end offset will be relative for the first packet. For example RegEx is ABC the first buffer is xxxx second buffer yyyA and the last buffer BCzz. In case the match as end is configured the end offset will be 10.**

**See also**

**RTE\_REGEXDEV\_CFG\_MATCH\_AS\_END\_F**

**RTE\_REGEXDEV\_CFG\_CROSS\_BUFFER\_SCAN\_F**

**RTE\_REGEX\_OPS\_RSP\_PMI\_SOJ\_F**

**RTE\_REGEX\_OPS\_RSP\_PMI\_EOJ\_F**

**Definition at line 465 of file rte\_regexdev.h.**

### #define RTE\_REGEXDEV\_SUPP\_MATCH\_ALL\_F (1ULL \<\< 21)

**RegEx device support match all. Match all means that the RegEx engine will return all possible matches. For example, assume the RegEx is** `A+b`**, given the input AAAb the returned matches will be: Ab, AAb and AAAb.**

**See also**

**RTE\_REGEXDEV\_CFG\_MATCH\_ALL\_F**

**Definition at line 474 of file rte\_regexdev.h.**

### #define RTE\_REGEXDEV\_CAPA\_QUEUE\_PAIR\_OOS\_F (1ULL \<\< 22)

**RegEx device supports out of order scan. Out of order scan means the response of a specific job can be returned as soon as it is ready even if previous jobs on the same queue didn't complete.**

**See also**

**RTE\_REGEX\_QUEUE\_PAIR\_CFG\_OOS\_F**

**struct rte\_regexdev\_info::regexdev\_capa**

**Definition at line 483 of file rte\_regexdev.h.**

### #define RTE\_REGEX\_PCRE\_RULE\_ALLOW\_EMPTY\_F (1ULL \<\< 0)

**When this flag is set, the pattern that can match against an empty string, such as** `.*` **are allowed.**

**See also**

**struct rte\_regexdev\_info::rule\_flags**

**struct rte\_regexdev\_rule::rule\_flags**

**Definition at line 492 of file rte\_regexdev.h.**

### #define RTE\_REGEX\_PCRE\_RULE\_ANCHORED\_F (1ULL \<\< 1)

**When this flag is set, the pattern is forced to be 'anchored', that is, it is constrained to match only at the first matching point in the string that is being searched. Similar to** `^` **and represented by** `\A`**.**

**See also**

**struct rte\_regexdev\_info::rule\_flags**

**struct rte\_regexdev\_rule::rule\_flags**

**Definition at line 501 of file rte\_regexdev.h.**

### #define RTE\_REGEX\_PCRE\_RULE\_CASELESS\_F (1ULL \<\< 2)

**When this flag is set, letters in the pattern match both upper and lower case letters in the subject.**

**See also**

**struct rte\_regexdev\_info::rule\_flags**

**struct rte\_regexdev\_rule::rule\_flags**

**Definition at line 509 of file rte\_regexdev.h.**

### #define RTE\_REGEX\_PCRE\_RULE\_DOTALL\_F (1ULL \<\< 3)

**When this flag is set, a dot metacharacter in the pattern matches any character, including one that indicates a newline.**

**See also**

**struct rte\_regexdev\_info::rule\_flags**

**struct rte\_regexdev\_rule::rule\_flags**

**Definition at line 517 of file rte\_regexdev.h.**

### #define RTE\_REGEX\_PCRE\_RULE\_DUPNAMES\_F (1ULL \<\< 4)

**When this flag is set, names used to identify capture groups need not be unique.**

**See also**

**struct rte\_regexdev\_info::rule\_flags**

**struct rte\_regexdev\_rule::rule\_flags**

**Definition at line 525 of file rte\_regexdev.h.**

### #define RTE\_REGEX\_PCRE\_RULE\_EXTENDED\_F (1ULL \<\< 5)

**When this flag is set, most white space characters in the pattern are totally ignored except when escaped or inside a character class.**

**See also**

**struct rte\_regexdev\_info::rule\_flags**

**struct rte\_regexdev\_rule::rule\_flags**

**Definition at line 533 of file rte\_regexdev.h.**

### #define RTE\_REGEX\_PCRE\_RULE\_MATCH\_UNSET\_BACKREF\_F (1ULL \<\< 6)

**When this flag is set, a backreference to an unset capture group matches an empty string.**

**See also**

**struct rte\_regexdev\_info::rule\_flags**

**struct rte\_regexdev\_rule::rule\_flags**

**Definition at line 541 of file rte\_regexdev.h.**

### #define RTE\_REGEX\_PCRE\_RULE\_MULTILINE\_F (1ULL \<\< 7)

**When this flag is set, the** `^` **and** `$` **constructs match immediately following or immediately before internal newlines in the subject string, respectively, as well as at the very start and end.**

**See also**

**struct rte\_regexdev\_info::rule\_flags**

**struct rte\_regexdev\_rule::rule\_flags**

**Definition at line 550 of file rte\_regexdev.h.**

### #define RTE\_REGEX\_PCRE\_RULE\_NO\_AUTO\_CAPTURE\_F (1ULL \<\< 8)

**When this Flag is set, it disables the use of numbered capturing parentheses in the pattern. References to capture groups (backreferences or recursion/subroutine calls) may only refer to named groups, though the reference can be by name or by number.**

**See also**

**struct rte\_regexdev\_info::rule\_flags**

**struct rte\_regexdev\_rule::rule\_flags**

**Definition at line 560 of file rte\_regexdev.h.**

### #define RTE\_REGEX\_PCRE\_RULE\_UCP\_F (1ULL \<\< 9)

**By default, only ASCII characters are recognized, When this flag is set, Unicode properties are used instead to classify characters.**

**See also**

**struct rte\_regexdev\_info::rule\_flags**

**struct rte\_regexdev\_rule::rule\_flags**

**Definition at line 568 of file rte\_regexdev.h.**

### #define RTE\_REGEX\_PCRE\_RULE\_UNGREEDY\_F (1ULL \<\< 10)

**When this flag is set, the 'greediness' of the quantifiers is inverted so that they are not greedy by default, but become greedy if followed by** `?`**.**

**See also**

**struct rte\_regexdev\_info::rule\_flags**

**struct rte\_regexdev\_rule::rule\_flags**

**Definition at line 577 of file rte\_regexdev.h.**

### #define RTE\_REGEX\_PCRE\_RULE\_UTF\_F (1ULL \<\< 11)

**When this flag is set, RegEx engine has to regard both the pattern and the subject strings that are subsequently processed as strings of UTF characters instead of single-code-unit strings.**

**See also**

**struct rte\_regexdev\_info::rule\_flags**

**struct rte\_regexdev\_rule::rule\_flags**

**Definition at line 586 of file rte\_regexdev.h.**

### #define RTE\_REGEX\_PCRE\_RULE\_NEVER\_BACKSLASH\_C\_F (1ULL \<\< 12)

**This flag locks out the use of** `\C` **in the pattern that is being compiled. This escape matches one data unit, even in UTF mode which can cause unpredictable behavior in UTF-8 or UTF-16 modes, because it may leave the current matching point in the mi:set hlsearchddle of a multi-code-unit character.**

**See also**

**struct rte\_regexdev\_info::rule\_flags**

**struct rte\_regexdev\_rule::rule\_flags**

**Definition at line 597 of file rte\_regexdev.h.**

### #define RTE\_REGEXDEV\_CFG\_CROSS\_BUFFER\_SCAN\_F (1ULL \<\< 0)

**Cross buffer scan refers to the ability to be able to detect matches that occur across buffer boundaries, where the buffers are related to each other in some way. Enable this flag when to scan payload size greater than struct rte\_regexdev\_info::max\_payload\_size and/or matches can present across scan buffer boundaries.**

**See also**

**struct rte\_regexdev\_info::max\_payload\_size**

**struct rte\_regexdev\_config::dev\_cfg\_flags, rte\_regexdev\_configure()**

**RTE\_REGEX\_OPS\_RSP\_PMI\_SOJ\_F**

**RTE\_REGEX\_OPS\_RSP\_PMI\_EOJ\_F**

**Definition at line 660 of file rte\_regexdev.h.**

### #define RTE\_REGEXDEV\_CFG\_MATCH\_AS\_END\_F (1ULL \<\< 1)

**Match as end is the ability to return the result as ending offset. When this flag is set, the result for each match will hold the ending offset of the match in end\_offset. If this flag is not set, then the match result will hold the starting offset in start\_offset, and the length of the match in len.**

**See also**

**RTE\_REGEXDEV\_SUPP\_MATCH\_AS\_END\_F**

**Definition at line 670 of file rte\_regexdev.h.**

### #define RTE\_REGEXDEV\_CFG\_MATCH\_ALL\_F (1ULL \<\< 2)

**Match all is the ability to return all possible results.**

**See also**

**RTE\_REGEXDEV\_SUPP\_MATCH\_ALL\_F**

**Definition at line 676 of file rte\_regexdev.h.**

### #define RTE\_REGEX\_QUEUE\_PAIR\_CFG\_OOS\_F (1ULL \<\< 0)

**Out of order scan, If not set, a scan must retire after previously issued in-order scans to this queue pair. If set, this scan can be retired as soon as device returns completion. Application should not set out of order scan flag if it needs to maintain the ingress order of scan request.**

**See also**

**struct rte\_regexdev\_qp\_conf::qp\_conf\_flags**

**rte\_regexdev\_queue\_pair\_setup()**

**Definition at line 756 of file rte\_regexdev.h.**

### #define RTE\_REGEXDEV\_XSTATS\_NAME\_SIZE 64

**Maximum name length for extended statistics counters**

**Definition at line 1086 of file rte\_regexdev.h.**

### #define RTE\_REGEX\_OPS\_REQ\_GROUP\_ID0\_VALID\_F (1 \<\< 0)

**Set when struct rte\_regexdev\_rule::group\_id0 is valid.**

**Definition at line 1274 of file rte\_regexdev.h.**

### #define RTE\_REGEX\_OPS\_REQ\_GROUP\_ID1\_VALID\_F (1 \<\< 1)

**Set when struct rte\_regexdev\_rule::group\_id1 is valid.**

**Definition at line 1277 of file rte\_regexdev.h.**

### #define RTE\_REGEX\_OPS\_REQ\_GROUP\_ID2\_VALID\_F (1 \<\< 2)

**Set when struct rte\_regexdev\_rule::group\_id2 is valid.**

**Definition at line 1280 of file rte\_regexdev.h.**

### #define RTE\_REGEX\_OPS\_REQ\_GROUP\_ID3\_VALID\_F (1 \<\< 3)

**Set when struct rte\_regexdev\_rule::group\_id3 is valid.**

**Definition at line 1283 of file rte\_regexdev.h.**

### #define RTE\_REGEX\_OPS\_REQ\_STOP\_ON\_MATCH\_F (1 \<\< 4)

**The RegEx engine will stop scanning and return the first match.**

**Definition at line 1286 of file rte\_regexdev.h.**

### #define RTE\_REGEX\_OPS\_REQ\_MATCH\_HIGH\_PRIORITY\_F (1 \<\< 5)

**In High Priority mode a maximum of one match will be returned per scan to reduce the post-processing required by the application. The match with the lowest Rule id, lowest start pointer and lowest match length will be returned.**

**See also**

**struct rte\_regex\_ops::nb\_actual\_matches**

**struct rte\_regex\_ops::nb\_matches**

**Definition at line 1296 of file rte\_regexdev.h.**

### #define RTE\_REGEX\_OPS\_RSP\_PMI\_SOJ\_F (1 \<\< 0)

**Indicates that the RegEx device has encountered a partial match at the start of scan in the given buffer.**

**See also**

**RTE\_REGEXDEV\_CFG\_CROSS\_BUFFER\_SCAN\_F**

**Definition at line 1305 of file rte\_regexdev.h.**

### #define RTE\_REGEX\_OPS\_RSP\_PMI\_EOJ\_F (1 \<\< 1)

**Indicates that the RegEx device has encountered a partial match at the end of scan in the given buffer.**

**See also**

**RTE\_REGEXDEV\_CFG\_CROSS\_BUFFER\_SCAN\_F**

**Definition at line 1312 of file rte\_regexdev.h.**

### #define RTE\_REGEX\_OPS\_RSP\_MAX\_SCAN\_TIMEOUT\_F (1 \<\< 2)

**Indicates that the RegEx device has exceeded the max timeout while scanning the given buffer.**

**See also**

**RTE\_REGEXDEV\_ATTR\_MAX\_SCAN\_TIMEOUT**

**Definition at line 1319 of file rte\_regexdev.h.**

### #define RTE\_REGEX\_OPS\_RSP\_MAX\_MATCH\_F (1 \<\< 3)

**Indicates that the RegEx device has exceeded the max matches while scanning the given buffer.**

**See also**

**RTE\_REGEXDEV\_ATTR\_MAX\_MATCHES**

**Definition at line 1326 of file rte\_regexdev.h.**

### #define RTE\_REGEX\_OPS\_RSP\_MAX\_PREFIX\_F (1 \<\< 4)

**Indicates that the RegEx device has reached the max allowed prefix length while scanning the given buffer.**

**See also**

**RTE\_REGEXDEV\_ATTR\_MAX\_PREFIX**

**Definition at line 1333 of file rte\_regexdev.h.**

### #define RTE\_REGEX\_OPS\_RSP\_RESOURCE\_LIMIT\_REACHED\_F (1 \<\< 4)

**Indicates that the RegEx device has reached the max allowed resource allowed while scanning the given buffer.**

**Definition at line 1338 of file rte\_regexdev.h.**

## Typedef Documentation

### typedef void(\* regexdev\_stop\_flush\_t) (uint8\_t dev\_id, uint16\_t qp\_id, struct rte\_regex\_ops \*op)

**Callback function called during rte\_regexdev\_stop(), invoked once per flushed RegEx op.**

**Definition at line 759 of file rte\_regexdev.h.**

## Enumeration Type Documentation

### enum rte\_regexdev\_attr\_id

**Enumerates RegEx device attribute identifier**

**Enumerator**

- *RTE\_REGEXDEV\_ATTR\_SOCKET\_ID*

  *The NUMA socket id to which the device is connected or a default of zero if the socket could not be determined. datatype: int operation: get*

- *RTE\_REGEXDEV\_ATTR\_MAX\_MATCHES*

  *Maximum number of matches per scan. datatype: uint8\_t operation: get and set*

**See also**

**RTE\_REGEX\_OPS\_RSP\_MAX\_MATCH\_F**

- *RTE\_REGEXDEV\_ATTR\_MAX\_SCAN\_TIMEOUT*

  *Upper bound scan time in ns. datatype: uint16\_t operation: get and set*

**See also**

**RTE\_REGEX\_OPS\_RSP\_MAX\_SCAN\_TIMEOUT\_F**

- *RTE\_REGEXDEV\_ATTR\_MAX\_PREFIX*

  *Maximum number of prefix detected per scan. This would be useful for denial of service detection. datatype: uint16\_t operation: get and set*

**See also**

**RTE\_REGEX\_OPS\_RSP\_MAX\_PREFIX\_F**

*Definition at line* **868** *of file* **rte\_regexdev.h***.*

### enum rte\_regexdev\_rule\_op

*Enumerates RegEx rule operation.*

**Enumerator**

- *RTE\_REGEX\_RULE\_OP\_ADD*

  *Add RegEx rule to rule database.*

- *RTE\_REGEX\_RULE\_OP\_REMOVE*

  *Remove RegEx rule from rule database.*

*Definition at line* **946** *of file* **rte\_regexdev.h***.*

## Function Documentation

### \_\_rte\_experimental int rte\_regexdev\_is\_valid\_dev (uint16\_t dev\_id)

**Warning**

**EXPERIMENTAL:** *this API may change without prior notice.*

*Check if dev\_id is ready.*

**Parameters**

*dev\_id The dev identifier of the RegEx device.*

**Returns**

- •

  *0 if device state is not in ready state.*

- •

  *1 if device state is ready state.*

### \_\_rte\_experimental uint8\_t rte\_regexdev\_count (void)

**Warning**

**EXPERIMENTAL:** *this API may change without prior notice.*

*Get the total number of RegEx devices that have been successfully initialised.*

**Returns**

*The total number of usable RegEx devices.*

### \_\_rte\_experimental int rte\_regexdev\_get\_dev\_id (const char \* name)

**Warning**

**EXPERIMENTAL:** *this API may change without prior notice.*

*Get the device identifier for the named RegEx device.*

**Parameters**

*name RegEx device name to select the RegEx device identifier.*

**Returns**

*Returns RegEx device identifier on success.*

- •

  *\<0: Failure to find named RegEx device.*

### \_\_rte\_experimental int rte\_regexdev\_info\_get (uint8\_t dev\_id, struct rte\_regexdev\_info \* dev\_info)

**Warning**

**EXPERIMENTAL:** *this API may change without prior notice.*

*Retrieve the contextual information of a RegEx device.*

**Parameters**

*dev\_id The identifier of the device.*\
 *dev\_info A pointer to a structure of type* **rte\_regexdev\_info to be filled with the contextual information of the device.**

**Returns**

- •

  **0: Success, driver updates the contextual information of the RegEx device**

- •

  **\<0: Error code returned by the driver info get function.**

### \_\_rte\_experimental int rte\_regexdev\_configure (uint8\_t dev\_id, const struct rte\_regexdev\_config \* cfg)

**Warning**

**EXPERIMENTAL: this API may change without prior notice.**

**Configure a RegEx device.**

**This function must be invoked first before any other function in the API. This function can also be re-invoked when a device is in the stopped state.**

**The caller may use rte\_regexdev\_info\_get() to get the capability of each resources available for this regex device.**

**Parameters**

*dev\_id* **The identifier of the device to configure.** \
 *cfg* **The RegEx device configuration structure.**

**Returns**

- •

  **0: Success, device configured. Otherwise negative errno is returned.**

### \_\_rte\_experimental int rte\_regexdev\_queue\_pair\_setup (uint8\_t dev\_id, uint16\_t queue\_pair\_id, const struct rte\_regexdev\_qp\_conf \* qp\_conf)

**Warning**

**EXPERIMENTAL: this API may change without prior notice.**

**Allocate and set up a RegEx queue pair for a RegEx device.**

**Parameters**

*dev\_id* **The identifier of the device.** \
 *queue\_pair\_id* **The index of the RegEx queue pair to setup. The value must be in the range \[0, nb\_queue\_pairs - 1\] previously supplied to rte\_regexdev\_configure().** \
 *qp\_conf* **The pointer to the configuration data to be used for the RegEx queue pair. NULL value is allowed, in which case default configuration used.**

**Returns**

**0 on success. Otherwise negative errno is returned.**

### \_\_rte\_experimental int rte\_regexdev\_start (uint8\_t dev\_id)

**Warning**

**EXPERIMENTAL: this API may change without prior notice.**

**Start a RegEx device.**

**The device start step is the last one and consists of setting the RegEx queues to start accepting the pattern matching scan requests.**

**On success, all basic functions exported by the API (RegEx enqueue, RegEx dequeue and so on) can be invoked.**

**Parameters**

*dev\_id* **RegEx device identifier.**

**Returns**

**0 on success. Otherwise negative errno is returned.**

### \_\_rte\_experimental int rte\_regexdev\_stop (uint8\_t dev\_id)

**Warning**

**EXPERIMENTAL: this API may change without prior notice.**

**Stop a RegEx device.**

**Stop a RegEx device. The device can be restarted with a call to rte\_regexdev\_start().**

**This function causes all queued response regex ops to be drained in the response queue. While draining ops out of the device, struct rte\_regexdev\_qp\_conf::cb will be invoked for each ops.**

**Parameters**

*dev\_id* **RegEx device identifier.**

**Returns**

**0 on success. Otherwise negative errno is returned.**

### \_\_rte\_experimental int rte\_regexdev\_close (uint8\_t dev\_id)

**Warning**

**EXPERIMENTAL: this API may change without prior notice.**

**Close a RegEx device. The device cannot be restarted!**

**Parameters**

*dev\_id* **RegEx device identifier**

**Returns**

**0 on success. Otherwise negative errno is returned.**

### \_\_rte\_experimental int rte\_regexdev\_attr\_get (uint8\_t dev\_id, enum rte\_regexdev\_attr\_id attr\_id, void \* attr\_value)

**Warning**

**EXPERIMENTAL: this API may change without prior notice.**

**Get an attribute from a RegEx device.**

**Parameters**

*dev\_id* **RegEx device identifier.** \
 *attr\_id* **The attribute ID to retrieve.** \
 *attr\_value* **A pointer that will be filled in with the attribute value if successful.**

**Returns**

- •

  **0: Successfully retrieved attribute value.**

- •

  **-EINVAL: Invalid device or** *attr\_id* **provided, or** *attr\_value* **is NULL.**

- •

  **-ENOTSUP: if the device doesn't support specific** *attr\_id***.**

### \_\_rte\_experimental int rte\_regexdev\_attr\_set (uint8\_t dev\_id, enum rte\_regexdev\_attr\_id attr\_id, const void \* attr\_value)

**Warning**

**EXPERIMENTAL: this API may change without prior notice.**

**Set an attribute to a RegEx device.**

**Parameters**

*dev\_id* **RegEx device identifier.** \
 *attr\_id* **The attribute ID to retrieve.** \
 *attr\_value* **Pointer that will be filled in with the attribute value by the application.**

**Returns**

- •

  **0: Successfully applied the attribute value.**

- •

  **-EINVAL: Invalid device or** *attr\_id* **provided, or** *attr\_value* **is NULL.**

- •

  **-ENOTSUP: if the device doesn't support specific** *attr\_id***.**

### \_\_rte\_experimental int rte\_regexdev\_rule\_db\_update (uint8\_t dev\_id, const struct rte\_regexdev\_rule \* rules, uint32\_t nb\_rules)

**Warning**

**EXPERIMENTAL: this API may change without prior notice.**

**Update the local rule set. This functions only modify the rule set in memory. In order for the changes to take effect, the function rte\_regexdev\_rule\_db\_compile\_active must be called.**

**Parameters**

*dev\_id* **RegEx device identifier.** \
 *rules* **Points to an array of** *nb\_rules* **objects of type rte\_regexdev\_rule structure which contain the regex rules attributes to be updated in rule database.** \
 *nb\_rules* **The number of PCRE rules to update the rule database.**

**Returns**

**The number of regex rules actually updated on the regex device's rule database. The return value can be less than the value of the** *nb\_rules* **parameter when the regex devices fails to update the rule database or if invalid parameters are specified in a rte\_regexdev\_rule. If the return value is less than** *nb\_rules***, the remaining PCRE rules at the end of** *rules* **are not consumed and the caller has to take care of them and rte\_errno is set accordingly. Possible errno values include:**

- •

  **-EINVAL: Invalid device ID or rules is NULL**

- •

  **-ENOTSUP: The last processed rule is not supported on this device.**

- •

  **-ENOSPC: No space available in rule database.**

**See also**

**rte\_regexdev\_rule\_db\_import(), rte\_regexdev\_rule\_db\_export(), rte\_regexdev\_rule\_db\_compile\_activate()**

### \_\_rte\_experimental int rte\_regexdev\_rule\_db\_compile\_activate (uint8\_t dev\_id)

**Warning**

**EXPERIMENTAL: this API may change without prior notice.**

**Compile local rule set and burn the complied result to the RegEx device.**

**Parameters**

*dev\_id* **RegEx device identifier.**

**Returns**

**0 on success, otherwise negative errno.**

**See also**

**rte\_regexdev\_rule\_db\_import(), rte\_regexdev\_rule\_db\_export(), rte\_regexdev\_rule\_db\_update()**

### \_\_rte\_experimental int rte\_regexdev\_rule\_db\_import (uint8\_t dev\_id, const char \* rule\_db, uint32\_t rule\_db\_len)

**Warning**

**EXPERIMENTAL: this API may change without prior notice.**

**Import a prebuilt rule database from a buffer to a RegEx device.**

**Parameters**

*dev\_id* **RegEx device identifier.** \
 *rule\_db* **Points to prebuilt rule database.** \
 *rule\_db\_len* **Length of the rule database.**

**Returns**

- •

  **0: Successfully updated the prebuilt rule database.**

- •

  **-EINVAL: Invalid device ID or rule\_db is NULL**

- •

  **-ENOTSUP: Rule database import is not supported on this device.**

- •

  **-ENOSPC: No space available in rule database.**

**See also**

**rte\_regexdev\_rule\_db\_update(), rte\_regexdev\_rule\_db\_export()**

### \_\_rte\_experimental int rte\_regexdev\_rule\_db\_export (uint8\_t dev\_id, char \* rule\_db)

**Warning**

**EXPERIMENTAL: this API may change without prior notice.**

**Export the prebuilt rule database from a RegEx device to the buffer.**

**Parameters**

*dev\_id* **RegEx device identifier.** \
 *rule\_db* **Block of memory to insert the rule database. Must be at least size in capacity. If set to NULL, function returns required capacity.**

**Returns**

- •

  **0: Successfully exported the prebuilt rule database.**

- •

  **size: If rule\_db set to NULL then required capacity for** *rule\_db*

- •

  **-EINVAL: Invalid device ID**

- •

  **-ENOTSUP: Rule database export is not supported on this device.**

**See also**

**rte\_regexdev\_rule\_db\_update(), rte\_regexdev\_rule\_db\_import()**

### \_\_rte\_experimental int rte\_regexdev\_xstats\_names\_get (uint8\_t dev\_id, struct rte\_regexdev\_xstats\_map \* xstats\_map)

**Warning**

**EXPERIMENTAL: this API may change without prior notice.**

**Retrieve names of extended statistics of a regex device.**

**Parameters**

*dev\_id* **The identifier of the regex device.** \
 *xstats\_map* **Block of memory to insert id and names into. Must be at least size in capacity. If set to NULL, function returns required capacity.**

**Returns**

- •

  **Positive value on success: -The return value is the number of entries filled in the stats map. -If xstats\_map set to NULL then required capacity for xstats\_map.**

- •

  **Negative value on error: -ENODEV for invalid** *dev\_id* **-ENOTSUP if the device doesn't support this function.**

### \_\_rte\_experimental int rte\_regexdev\_xstats\_get (uint8\_t dev\_id, const uint16\_t \* ids, uint64\_t \* values, uint16\_t nb\_values)

**Warning**

**EXPERIMENTAL: this API may change without prior notice.**

**Retrieve extended statistics of an regex device.**

**Parameters**

*dev\_id* **The identifier of the device.** \
 *ids* **The id numbers of the stats to get. The ids can be got from the stat position in the stat list from rte\_regexdev\_xstats\_names\_get(), or by using rte\_regexdev\_xstats\_by\_name\_get().** \
 *values* **The values for each stats request by ID.** \
 *nb\_values* **The number of stats requested.**

**Returns**

- •

  **Positive value: number of stat entries filled into the values array**

- •

  **Negative value on error: -ENODEV for invalid** *dev\_id* **-ENOTSUP if the device doesn't support this function.**

### \_\_rte\_experimental int rte\_regexdev\_xstats\_by\_name\_get (uint8\_t dev\_id, const char \* name, uint16\_t \* id, uint64\_t \* value)

**Warning**

**EXPERIMENTAL: this API may change without prior notice.**

**Retrieve the value of a single stat by requesting it by name.**

**Parameters**

*dev\_id* **The identifier of the device.** \
 *name* **The stat name to retrieve.** \
 *id* **If non-NULL, the numerical id of the stat will be returned, so that further requests for the stat can be got using rte\_regexdev\_xstats\_get, which will be faster as it doesn't need to scan a list of names for the stat.** \
 *value* **Must be non-NULL, retrieved xstat value will be stored in this address.**

**Returns**

- •

  **0: Successfully retrieved xstat value.**

- •

  **-EINVAL: invalid parameters**

- •

  **-ENOTSUP: if not supported.**

### \_\_rte\_experimental int rte\_regexdev\_xstats\_reset (uint8\_t dev\_id, const uint16\_t \* ids, uint16\_t nb\_ids)

**Warning**

**EXPERIMENTAL: this API may change without prior notice.**

**Reset the values of the xstats of the selected component in the device.**

**Parameters**

*dev\_id* **The identifier of the device.** \
 *ids* **Selects specific statistics to be reset. When NULL, all statistics will be reset. If non-NULL, must point to array of at least** *nb\_ids* **size.** \
 *nb\_ids* **The number of ids available from the** *ids* **array. Ignored when ids is NULL.**

**Returns**

- •

  **0: Successfully reset the statistics to zero.**

- •

  **-EINVAL: invalid parameters.**

- •

  **-ENOTSUP: if not supported.**

### \_\_rte\_experimental int rte\_regexdev\_selftest (uint8\_t dev\_id)

**Warning**

**EXPERIMENTAL: this API may change without prior notice.**

**Trigger the RegEx device self test.**

**Parameters**

*dev\_id* **The identifier of the device.**

**Returns**

- •

  **0: Selftest successful.**

- •

  **-ENOTSUP if the device doesn't support selftest.**

- •

  **other values \< 0 on failure.**

### \_\_rte\_experimental int rte\_regexdev\_dump (uint8\_t dev\_id, FILE \* f)

**Warning**

**EXPERIMENTAL: this API may change without prior notice.**

**Dump internal information about** *dev\_id* **to the FILE\* provided in** *f***.**

**Parameters**

*dev\_id* **The identifier of the device.** \
 *f* **A pointer to a file for output.**

**Returns**

**0 on success, negative errno on failure.**

### static \_\_rte\_experimental uint16\_t rte\_regexdev\_enqueue\_burst (uint8\_t dev\_id, uint16\_t qp\_id, struct rte\_regex\_ops \*\* ops, uint16\_t nb\_ops)` [inline]`, ` [static]`

**Warning**

**EXPERIMENTAL: this API may change without prior notice.**

**Enqueue a burst of scan request on a RegEx device.**

**The rte\_regexdev\_enqueue\_burst() function is invoked to place regex operations on the queue** *qp\_id* **of the device designated by its** *dev\_id***.**

**The** *nb\_ops* **parameter is the number of operations to process which are supplied in the** *ops* **array of** *rte\_regexdev\_op* **structures.**

**The rte\_regexdev\_enqueue\_burst() function returns the number of operations it actually enqueued for processing. A return value equal to** *nb\_ops* **means that all packets have been enqueued.**

**Parameters**

*dev\_id* **The identifier of the device.** \
 *qp\_id* **The index of the queue pair which packets are to be enqueued for processing. The value must be in the range \[0, nb\_queue\_pairs - 1\] previously supplied to rte\_regexdev\_configure().** \
 *ops* **The address of an array of** *nb\_ops* **pointers to** *rte\_regexdev\_op* **structures which contain the regex operations to be processed.** \
 *nb\_ops* **The number of operations to process.**

**Returns**

**The number of operations actually enqueued on the regex device. The return value can be less than the value of the** *nb\_ops* **parameter when the regex devices queue is full or if invalid parameters are specified in a** *rte\_regexdev\_op***. If the return value is less than** *nb\_ops***, the remaining ops at the end of** *ops* **are not consumed and the caller has to take care of them.**

**Definition at line 1470 of file rte\_regexdev.h.**

### static \_\_rte\_experimental uint16\_t rte\_regexdev\_dequeue\_burst (uint8\_t dev\_id, uint16\_t qp\_id, struct rte\_regex\_ops \*\* ops, uint16\_t nb\_ops)` [inline]`, ` [static]`

**Warning**

**EXPERIMENTAL: this API may change without prior notice.**

**Dequeue a burst of scan response from a queue on the RegEx device. The dequeued operation are stored in** *rte\_regexdev\_op* **structures whose pointers are supplied in the** *ops* **array.**

**The rte\_regexdev\_dequeue\_burst() function returns the number of ops actually dequeued, which is the number of** *rte\_regexdev\_op* **data structures effectively supplied into the** *ops* **array.**

**A return value equal to** *nb\_ops* **indicates that the queue contained at least** *nb\_ops* **operations, and this is likely to signify that other processed operations remain in the devices output queue. Applications implementing a 'retrieve as many processed operations as possible' policy can check this specific case and keep invoking the rte\_regexdev\_dequeue\_burst() function until a value less than** *nb\_ops* **is returned.**

**The rte\_regexdev\_dequeue\_burst() function does not provide any error notification to avoid the corresponding overhead.**

**Parameters**

*dev\_id* **The RegEx device identifier** \
 *qp\_id* **The index of the queue pair from which to retrieve processed packets. The value must be in the range \[0, nb\_queue\_pairs - 1\] previously supplied to rte\_regexdev\_configure().** \
 *ops* **The address of an array of pointers to** *rte\_regexdev\_op* **structures that must be large enough to store** *nb\_ops* **pointers in it.** \
 *nb\_ops* **The maximum number of operations to dequeue.**

**Returns**

**The number of operations actually dequeued, which is the number of pointers to** *rte\_regexdev\_op* **structures effectively supplied to the** *ops* **array. If the return value is less than** *nb\_ops***, the remaining ops at the end of** *ops* **are not consumed and the caller has to take care of them.**

**Definition at line 1530 of file rte\_regexdev.h.**

## Author

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