DPDK  22.07.0
Data Structures | Enumerations | Functions
rte_flow_classify.h File Reference
#include <rte_compat.h>
#include <rte_common.h>
#include <rte_flow.h>

Go to the source code of this file.

Data Structures

struct  rte_flow_classifier_params
 
struct  rte_flow_classify_table_params
 
struct  rte_flow_classify_ipv4_5tuple
 
struct  rte_flow_classify_stats
 

Enumerations

enum  rte_flow_classify_rule_type { RTE_FLOW_CLASSIFY_RULE_TYPE_NONE, RTE_FLOW_CLASSIFY_RULE_TYPE_IPV4_5TUPLE }
 
enum  rte_flow_classify_table_type { RTE_FLOW_CLASSIFY_TABLE_TYPE_NONE = 1 << 0, RTE_FLOW_CLASSIFY_TABLE_ACL_IP4_5TUPLE = 1 << 1, RTE_FLOW_CLASSIFY_TABLE_ACL_VLAN_IP4_5TUPLE = 1 << 2, RTE_FLOW_CLASSIFY_TABLE_ACL_QINQ_IP4_5TUPLE = 1 << 3 }
 

Functions

__rte_experimental struct rte_flow_classifier * rte_flow_classifier_create (struct rte_flow_classifier_params *params)
 
__rte_experimental int rte_flow_classifier_free (struct rte_flow_classifier *cls)
 
__rte_experimental int rte_flow_classify_table_create (struct rte_flow_classifier *cls, struct rte_flow_classify_table_params *params)
 
__rte_experimental int rte_flow_classify_validate (struct rte_flow_classifier *cls, const struct rte_flow_attr *attr, const struct rte_flow_item pattern[], const struct rte_flow_action actions[], struct rte_flow_error *error)
 
__rte_experimental struct rte_flow_classify_rule * rte_flow_classify_table_entry_add (struct rte_flow_classifier *cls, const struct rte_flow_attr *attr, const struct rte_flow_item pattern[], const struct rte_flow_action actions[], int *key_found, struct rte_flow_error *error)
 
__rte_experimental int rte_flow_classify_table_entry_delete (struct rte_flow_classifier *cls, struct rte_flow_classify_rule *rule)
 
__rte_experimental int rte_flow_classifier_query (struct rte_flow_classifier *cls, struct rte_mbuf **pkts, const uint16_t nb_pkts, struct rte_flow_classify_rule *rule, struct rte_flow_classify_stats *stats)
 

Detailed Description

RTE Flow Classify Library.

Warning
EXPERIMENTAL: All functions in this file may be changed or removed without prior notice.

This library provides flow record information with some measured properties.

Application should define the flow and measurement criteria (action) for it.

The Library doesn't maintain any flow records itself, instead flow information is returned to upper layer only for given packets.

It is application's responsibility to call rte_flow_classifier_query() for a burst of packets, just after receiving them or before transmitting them. Application should provide the flow type interested in, measurement to apply to that flow in rte_flow_classify_table_entry_add() API, and should provide the rte_flow_classifier object and storage to put results in for the rte_flow_classifier_query() API.

Usage:

Definition in file rte_flow_classify.h.

Enumeration Type Documentation

◆ rte_flow_classify_rule_type

Flow classify rule type

Enumerator
RTE_FLOW_CLASSIFY_RULE_TYPE_NONE 

no type

RTE_FLOW_CLASSIFY_RULE_TYPE_IPV4_5TUPLE 

IPv4 5tuple type

Definition at line 74 of file rte_flow_classify.h.

◆ rte_flow_classify_table_type

Flow classify table type

Enumerator
RTE_FLOW_CLASSIFY_TABLE_TYPE_NONE 

No type

RTE_FLOW_CLASSIFY_TABLE_ACL_IP4_5TUPLE 

ACL IP4 5TUPLE

RTE_FLOW_CLASSIFY_TABLE_ACL_VLAN_IP4_5TUPLE 

ACL VLAN IP4 5TUPLE

RTE_FLOW_CLASSIFY_TABLE_ACL_QINQ_IP4_5TUPLE 

ACL QinQ IP4 5TUPLE

Definition at line 82 of file rte_flow_classify.h.

Function Documentation

◆ rte_flow_classifier_create()

__rte_experimental struct rte_flow_classifier* rte_flow_classifier_create ( struct rte_flow_classifier_params params)

Flow classifier create

Parameters
paramsParameters for flow classifier creation
Returns
Handle to flow classifier instance on success or NULL otherwise
Examples:
examples/flow_classify/flow_classify.c.

◆ rte_flow_classifier_free()

__rte_experimental int rte_flow_classifier_free ( struct rte_flow_classifier *  cls)

Flow classifier free

Parameters
clsHandle to flow classifier instance
Returns
0 on success, error code otherwise
Examples:
examples/flow_classify/flow_classify.c.

◆ rte_flow_classify_table_create()

__rte_experimental int rte_flow_classify_table_create ( struct rte_flow_classifier *  cls,
struct rte_flow_classify_table_params params 
)

Flow classify table create

Parameters
clsHandle to flow classifier instance
paramsParameters for flow_classify table creation
Returns
0 on success, error code otherwise
Examples:
examples/flow_classify/flow_classify.c.

◆ rte_flow_classify_validate()

__rte_experimental int rte_flow_classify_validate ( struct rte_flow_classifier *  cls,
const struct rte_flow_attr attr,
const struct rte_flow_item  pattern[],
const struct rte_flow_action  actions[],
struct rte_flow_error error 
)

Flow classify validate

Parameters
clsHandle to flow classifier instance
[in]attrFlow rule attributes
[in]patternPattern specification (list terminated by the END pattern item).
[in]actionsAssociated actions (list terminated by the END pattern item).
[out]errorPerform verbose error reporting if not NULL. Structure initialised in case of error only.
Returns
0 on success, error code otherwise
Examples:
examples/flow_classify/flow_classify.c.

◆ rte_flow_classify_table_entry_add()

__rte_experimental struct rte_flow_classify_rule* rte_flow_classify_table_entry_add ( struct rte_flow_classifier *  cls,
const struct rte_flow_attr attr,
const struct rte_flow_item  pattern[],
const struct rte_flow_action  actions[],
int *  key_found,
struct rte_flow_error error 
)

Add a flow classify rule to the flow_classifier table.

Parameters
[in]clsFlow classifier handle
[in]attrFlow rule attributes
[in]patternPattern specification (list terminated by the END pattern item).
[in]actionsAssociated actions (list terminated by the END pattern item).
[out]key_foundreturns 1 if rule present already, 0 otherwise.
[out]errorPerform verbose error reporting if not NULL. Structure initialised in case of error only.
Returns
A valid handle in case of success, NULL otherwise.
Examples:
examples/flow_classify/flow_classify.c.

◆ rte_flow_classify_table_entry_delete()

__rte_experimental int rte_flow_classify_table_entry_delete ( struct rte_flow_classifier *  cls,
struct rte_flow_classify_rule *  rule 
)

Delete a flow classify rule from the flow_classifier table.

Parameters
[in]clsFlow classifier handle
[in]ruleFlow classify rule
Returns
0 on success, error code otherwise.
Examples:
examples/flow_classify/flow_classify.c.

◆ rte_flow_classifier_query()

__rte_experimental int rte_flow_classifier_query ( struct rte_flow_classifier *  cls,
struct rte_mbuf **  pkts,
const uint16_t  nb_pkts,
struct rte_flow_classify_rule *  rule,
struct rte_flow_classify_stats stats 
)

Query flow classifier for given rule.

Parameters
[in]clsFlow classifier handle
[in]pktsPointer to packets to process
[in]nb_pktsNumber of packets to process
[in]ruleFlow classify rule
[in]statsFlow classify stats
Returns
0 on success, error code otherwise.
Examples:
examples/flow_classify/flow_classify.c.