DPDK
19.08.0-rc0
|
#include <rte_common.h>
#include <rte_config.h>
#include <rte_dev.h>
#include <rte_errno.h>
#include <rte_memory.h>
Go to the source code of this file.
Data Structures | |
struct | rte_regex_dev_info |
struct | rte_regex_dev_config |
struct | rte_regex_qp_conf |
struct | rte_regex_rule |
struct | rte_regex_dev_xstats_map |
struct | rte_regex_match |
struct | rte_regex_ops |
Typedefs | |
typedef void(* | regexdev_stop_flush_t) (uint8_t dev_id, uint16_t qp_id, struct rte_regex_ops *op) |
Functions | |
uint8_t | rte_regex_dev_count (void) |
int | rte_regex_dev_get_dev_id (const char *name) |
int | rte_regex_dev_info_get (uint8_t dev_id, struct rte_regex_dev_info *dev_info) |
int | rte_regex_dev_configure (uint8_t dev_id, const struct rte_regex_dev_config *cfg) |
int | rte_regex_queue_pair_setup (uint8_t dev_id, uint8_t queue_pair_id, const struct rte_regex_qp_conf *qp_conf) |
int | rte_regex_dev_start (uint8_t dev_id) |
void | rte_regex_dev_stop (uint8_t dev_id) |
int | rte_regex_dev_close (uint8_t dev_id) |
int | rte_regex_dev_attr_get (uint8_t dev_id, enum rte_regex_dev_attr_id attr_id, void *attr_value) |
int | rte_regex_dev_attr_set (uint8_t dev_id, enum rte_regex_dev_attr_id attr_id, const void *attr_value) |
uint16_t | rte_regex_rule_db_update (uint8_t dev_id, const struct rte_regex_rule *rules, uint16_t nb_rules) |
int | rte_regex_rule_db_import (uint8_t dev_id, const char *rule_db, uint32_t rule_db_len) |
int | rte_regex_rule_db_export (uint8_t dev_id, char *rule_db) |
int | rte_regex_dev_xstats_names_get (uint8_t dev_id, struct rte_regex_dev_xstats_map *xstats_map) |
int | rte_regex_dev_xstats_get (uint8_t dev_id, const uint16_t ids[], uint64_t values[], uint16_t n) |
int | rte_regex_dev_xstats_by_name_get (uint8_t dev_id, const char *name, uint16_t *id, uint64_t *value) |
int | rte_regex_dev_xstats_reset (uint8_t dev_id, const uint16_t ids[], uint16_t nb_ids) |
int | rte_regex_dev_selftest (uint8_t dev_id) |
int | rte_regex_dev_dump (uint8_t dev_id, FILE *f) |
uint16_t | rte_regex_enqueue_burst (uint8_t dev_id, uint16_t qp_id, struct rte_regex_ops **ops, uint16_t nb_ops) |
uint16_t | rte_regex_dequeue_burst (uint8_t dev_id, uint16_t qp_id, struct rte_regex_ops **ops, uint16_t nb_ops) |
RTE RegEx Device API
Defines RTE RegEx Device APIs for RegEx operations and its provisioning.
The RegEx Device API is composed of two parts:
RegEx device components and definitions:
+-----------------+ | | | o---------+ rte_regex_[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_regex_rule_db_update() | | Rules 0..n | |<-------rte_regex_rule_db_import() | +-------------+ |------->rte_regex_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_regex_dev_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_regex_dev.
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_regex_dev structure and a new device identifier are allocated for that device. Then, the regex_dev_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_regex_dev structure is effectively registered. Otherwise, both the rte_regex_dev 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:
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_regex_dev_configure() or rte_regex_queue_pair_setup()), it must call rte_regex_dev_stop() first to stop the device and then do the reconfiguration before calling rte_regex_dev_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_regex_dev_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 regex_dev_ops. The address of the regex_dev_ops structure is stored in the rte_regex_dev 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_regex_dev structure associated with the device identifier and performs an indirect invocation of the corresponding driver function supplied in the regex_dev_ops structure of the rte_regex_dev structure.
For performance reasons, the address of the fast-path functions of the RegEx driver is not contained in the regex_dev_ops structure. Instead, they are directly stored at the beginning of the rte_regex_dev 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.
Definition in file rte_regexdev.h.
#define RTE_REGEX_DEV_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_regex_dev_config::rule_db in rte_regex_dev_configure()
Definition at line 227 of file rte_regexdev.h.
#define RTE_REGEX_DEV_PCRE_UNSUP_START_ANCHOR_F (1ULL << 0) |
RegEx device doesn't 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'.
Definition at line 237 of file rte_regexdev.h.
#define RTE_REGEX_DEV_PCRE_UNSUP_ATOMIC_GROUPING_F (1ULL << 1) |
RegEx device doesn't 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 backtracing back to 'b'.
Definition at line 247 of file rte_regexdev.h.
#define RTE_REGEX_DEV_PCRE_UNSUP_BACKTRACKING_CTRL_F (1ULL << 2) |
RegEx device doesn't support PCRE backtracking control verbs. Some examples of backtracing verbs are (*COMMIT), (*ACCEPT), (*FAIL), (*SKIP), (*PRUNE).
Definition at line 258 of file rte_regexdev.h.
#define RTE_REGEX_DEV_PCRE_UNSUP_CALLOUTS_F (1ULL << 3) |
RegEx device doesn't 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.
Definition at line 265 of file rte_regexdev.h.
#define RTE_REGEX_DEV_PCRE_UNSUP_BACKREFERENCE_F (1ULL << 4) |
RegEx device doesn't 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'.
Definition at line 274 of file rte_regexdev.h.
#define RTE_REGEX_DEV_PCRE_UNSUP_GREEDY_F (1ULL << 5) |
RegEx device doesn't 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.
Definition at line 281 of file rte_regexdev.h.
#define RTE_REGEX_DEV_PCRE_UNSUP_LOOKAROUND_ASRT_F (1ULL << 6) |
RegEx device doesn't 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.
Definition at line 289 of file rte_regexdev.h.
#define RTE_REGEX_DEV_PCRE_UNSUP_MATCH_POINT_RST_F (1ULL << 7) |
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.
Definition at line 298 of file rte_regexdev.h.
#define RTE_REGEX_DEV_PCRE_UNSUP_NEWLINE_CONVENTIONS_F (1ULL << 8) |
RegEx device doesn't 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
Definition at line 306 of file rte_regexdev.h.
#define RTE_REGEX_DEV_PCRE_UNSUP_NEWLINE_SEQ_F (1ULL << 9) |
RegEx device doesn't support PCRE newline sequence. The escape sequence '\R' will match any newline sequence. It is equivalent to: '(?>\r
|
|\x0b|\f|\r|\x85)'.
Definition at line 317 of file rte_regexdev.h.
#define RTE_REGEX_DEV_PCRE_UNSUP_POSSESSIVE_QUALIFIERS_F (1ULL << 10) |
RegEx device doesn't 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.
Definition at line 324 of file rte_regexdev.h.
#define RTE_REGEX_DEV_PCRE_UNSUP_SUBROUTINE_REFERENCES_F (1ULL << 11) |
RegEx device doesn't 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'.
Definition at line 333 of file rte_regexdev.h.
#define RTE_REGEX_DEV_PCRE_UNSUP_UTF_8_F (1ULL << 12) |
RegEx device doesn't support UTF-8 character encoding.
Definition at line 341 of file rte_regexdev.h.
#define RTE_REGEX_DEV_PCRE_UNSUP_UTF_16_F (1ULL << 13) |
RegEx device doesn't support UTF-16 character encoding.
Definition at line 346 of file rte_regexdev.h.
#define RTE_REGEX_DEV_PCRE_UNSUP_UTF_32_F (1ULL << 14) |
RegEx device doesn't support UTF-32 character encoding.
Definition at line 351 of file rte_regexdev.h.
#define RTE_REGEX_DEV_PCRE_UNSUP_WORD_BOUNDARY_F (1ULL << 15) |
RegEx device doesn't support word boundaries. The meta character '' represents word boundary anchor.
Definition at line 356 of file rte_regexdev.h.
#define RTE_REGEX_DEV_PCRE_UNSUP_FORWARD_REFERENCES_F (1ULL << 16) |
RegEx device doesn't 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'.
Definition at line 362 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.
Definition at line 371 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.
Definition at line 377 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.
Definition at line 384 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.
Definition at line 390 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.
Definition at line 396 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.
Definition at line 402 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.
Definition at line 408 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.
Definition at line 415 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.
Definition at line 422 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.
Definition at line 430 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 '?'.
Definition at line 436 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.
Definition at line 443 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 middle of a multi-code-unit character.
Definition at line 450 of file rte_regexdev.h.
#define RTE_REGEX_DEV_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 struct struct rte_regex_dev_info::max_payload_size and/or matches can present across scan buffer boundaries.
Definition at line 508 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.
Definition at line 588 of file rte_regexdev.h.
#define RTE_REGEX_DEV_XSTATS_NAME_SIZE 64 |
Maximum name length for extended statistics counters
Definition at line 858 of file rte_regexdev.h.
#define RTE_REGEX_OPS_REQ_GROUP_ID1_VALID_F (1 << 0) |
Set when struct rte_regex_rule::group_id1 valid
Definition at line 1014 of file rte_regexdev.h.
#define RTE_REGEX_OPS_REQ_GROUP_ID2_VALID_F (1 << 1) |
Set when struct rte_regex_rule::group_id2 valid
Definition at line 1017 of file rte_regexdev.h.
#define RTE_REGEX_OPS_REQ_GROUP_ID3_VALID_F (1 << 2) |
Set when struct rte_regex_rule::group_id3 valid
Definition at line 1020 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 1023 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.
Definition at line 1026 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.
Definition at line 1038 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.
Definition at line 1045 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.
Definition at line 1052 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.
Definition at line 1059 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.
Definition at line 1066 of file rte_regexdev.h.
typedef void(* regexdev_stop_flush_t) (uint8_t dev_id, uint16_t qp_id, struct rte_regex_ops *op) |
Callback function called during rte_regex_dev_stop(), invoked once per flushed RegEx op.
Definition at line 598 of file rte_regexdev.h.
Enumerates RegEx device attribute identifier
Enumerator | |
---|---|
RTE_REGEX_DEV_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_REGEX_DEV_ATTR_MAX_MATCHES | Maximum number of matches per scan. datatype: uint8_t operation: get and set
|
RTE_REGEX_DEV_ATTR_MAX_SCAN_TIMEOUT | Upper bound scan time in ns. datatype: uint16_t operation: get and set |
RTE_REGEX_DEV_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
|
Definition at line 692 of file rte_regexdev.h.
enum rte_regex_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 759 of file rte_regexdev.h.
uint8_t rte_regex_dev_count | ( | void | ) |
Get the total number of RegEx devices that have been successfully initialised.
int rte_regex_dev_get_dev_id | ( | const char * | name | ) |
Get the device identifier for the named RegEx device.
name | RegEx device name to select the RegEx device identifier. |
int rte_regex_dev_info_get | ( | uint8_t | dev_id, |
struct rte_regex_dev_info * | dev_info | ||
) |
Retrieve the contextual information of a RegEx device.
dev_id | The identifier of the device. | |
[out] | dev_info | A pointer to a structure of type rte_regex_dev_info to be filled with the contextual information of the device. |
int rte_regex_dev_configure | ( | uint8_t | dev_id, |
const struct rte_regex_dev_config * | cfg | ||
) |
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_regex_dev_info_get() to get the capability of each resources available for this regex device.
dev_id | The identifier of the device to configure. |
cfg | The RegEx device configuration structure. |
int rte_regex_queue_pair_setup | ( | uint8_t | dev_id, |
uint8_t | queue_pair_id, | ||
const struct rte_regex_qp_conf * | qp_conf | ||
) |
Allocate and set up a RegEx queue pair for a RegEx device.
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_regex_dev_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. |
int rte_regex_dev_start | ( | uint8_t | dev_id | ) |
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.
dev_id | RegEx device identifier |
void rte_regex_dev_stop | ( | uint8_t | dev_id | ) |
Stop a RegEx device.
Stop a RegEx device. The device can be restarted with a call to rte_regex_dev_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_regex_qp_conf::cb will be invoked for each ops.
dev_id | RegEx device identifier. |
int rte_regex_dev_close | ( | uint8_t | dev_id | ) |
Close a RegEx device. The device cannot be restarted!
dev_id | RegEx device identifier |
int rte_regex_dev_attr_get | ( | uint8_t | dev_id, |
enum rte_regex_dev_attr_id | attr_id, | ||
void * | attr_value | ||
) |
Get an attribute from a RegEx device.
dev_id | RegEx device identifier | |
attr_id | The attribute ID to retrieve | |
[out] | attr_value | A pointer that will be filled in with the attribute value if successful. |
int rte_regex_dev_attr_set | ( | uint8_t | dev_id, |
enum rte_regex_dev_attr_id | attr_id, | ||
const void * | attr_value | ||
) |
Set an attribute to a RegEx device.
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 by the application |
uint16_t rte_regex_rule_db_update | ( | uint8_t | dev_id, |
const struct rte_regex_rule * | rules, | ||
uint16_t | nb_rules | ||
) |
Update the rule database of a RegEx device.
dev_id | RegEx device identifier |
rules | Points to an array of nb_rules objects of type rte_regex_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. |
int rte_regex_rule_db_import | ( | uint8_t | dev_id, |
const char * | rule_db, | ||
uint32_t | rule_db_len | ||
) |
Import a prebuilt rule database from a buffer to a RegEx device.
dev_id | RegEx device identifier |
rule_db | Points to prebuilt rule database. |
rule_db_len | Length of the rule database. |
int rte_regex_rule_db_export | ( | uint8_t | dev_id, |
char * | rule_db | ||
) |
Export the prebuilt rule database from a RegEx device to the buffer.
dev_id | RegEx device identifier | |
[out] | 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. |
int rte_regex_dev_xstats_names_get | ( | uint8_t | dev_id, |
struct rte_regex_dev_xstats_map * | xstats_map | ||
) |
Retrieve names of extended statistics of a regex device.
dev_id | The identifier of the regex device. | |
[out] | 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. |
int rte_regex_dev_xstats_get | ( | uint8_t | dev_id, |
const uint16_t | ids[], | ||
uint64_t | values[], | ||
uint16_t | n | ||
) |
Retrieve extended statistics of an regex device.
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_regex_dev_xstats_names_get(), or by using rte_regex_dev_xstats_by_name_get(). | |
[out] | values | The values for each stats request by ID. |
n | The number of stats requested |
int rte_regex_dev_xstats_by_name_get | ( | uint8_t | dev_id, |
const char * | name, | ||
uint16_t * | id, | ||
uint64_t * | value | ||
) |
Retrieve the value of a single stat by requesting it by name.
dev_id | The identifier of the device | |
name | The stat name to retrieve | |
[out] | 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_regex_dev_xstats_get, which will be faster as it doesn't need to scan a list of names for the stat. |
[out] | value | Must be non-NULL, retrieved xstat value will be stored in this address. |
int rte_regex_dev_xstats_reset | ( | uint8_t | dev_id, |
const uint16_t | ids[], | ||
uint16_t | nb_ids | ||
) |
Reset the values of the xstats of the selected component in the device.
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. |
int rte_regex_dev_selftest | ( | uint8_t | dev_id | ) |
Trigger the RegEx device self test.
dev_id | The identifier of the device |
int rte_regex_dev_dump | ( | uint8_t | dev_id, |
FILE * | f | ||
) |
Dump internal information about dev_id to the FILE* provided in f.
dev_id | The identifier of the device. |
f | A pointer to a file for output |
uint16_t rte_regex_enqueue_burst | ( | uint8_t | dev_id, |
uint16_t | qp_id, | ||
struct rte_regex_ops ** | ops, | ||
uint16_t | nb_ops | ||
) |
Enqueue a burst of scan request on a RegEx device.
The rte_regex_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_regex_op structures.
The rte_regex_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.
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_regex_dev_configure(). |
ops | The address of an array of nb_ops pointers to rte_regex_op structures which contain the regex operations to be processed. |
nb_ops | The number of operations to process. |
uint16_t rte_regex_dequeue_burst | ( | uint8_t | dev_id, |
uint16_t | qp_id, | ||
struct rte_regex_ops ** | ops, | ||
uint16_t | nb_ops | ||
) |
Dequeue a burst of scan response from a queue on the RegEx device. The dequeued operation are stored in rte_regex_op structures whose pointers are supplied in the ops array.
The rte_regex_dequeue_burst() function returns the number of ops actually dequeued, which is the number of rte_regex_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_regex_dequeue_burst() function until a value less than nb_ops is returned.
The rte_regex_dequeue_burst() function does not provide any error notification to avoid the corresponding overhead.
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_regex_dev_configure(). |
ops | The address of an array of pointers to rte_regex_op structures that must be large enough to store nb_ops pointers in it. |
nb_ops | The maximum number of operations to dequeue. |