DPDK  17.11.10
Data Structures | Macros | Enumerations | Functions
rte_flow_classify.h File Reference
#include <rte_common.h>
#include <rte_ethdev.h>
#include <rte_ether.h>
#include <rte_flow.h>
#include <rte_acl.h>
#include <rte_table_acl.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
 

Macros

#define RTE_FLOW_CLASSIFY_TABLE_MAX   64
 

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, RTE_FLOW_CLASSIFY_TABLE_TYPE_ACL }
 

Functions

struct rte_flow_classifier * rte_flow_classifier_create (struct rte_flow_classifier_params *params)
 
int rte_flow_classifier_free (struct rte_flow_classifier *cls)
 
int rte_flow_classify_table_create (struct rte_flow_classifier *cls, struct rte_flow_classify_table_params *params, uint32_t *table_id)
 
struct rte_flow_classify_rule * rte_flow_classify_table_entry_add (struct rte_flow_classifier *cls, uint32_t table_id, int *key_found, const struct rte_flow_attr *attr, const struct rte_flow_item pattern[], const struct rte_flow_action actions[], struct rte_flow_error *error)
 
int rte_flow_classify_table_entry_delete (struct rte_flow_classifier *cls, uint32_t table_id, struct rte_flow_classify_rule *rule)
 
int rte_flow_classifier_query (struct rte_flow_classifier *cls, uint32_t table_id, 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

EXPERIMENTAL: this API may change 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.

Macro Definition Documentation

#define RTE_FLOW_CLASSIFY_TABLE_MAX   64

Maximum number of tables allowed for any Flow Classifier instance. The value of this parameter cannot be changed.

Examples:
examples/flow_classify/flow_classify.c.

Definition at line 119 of file rte_flow_classify.h.

Enumeration Type Documentation

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 100 of file rte_flow_classify.h.

Flow classify table type

Enumerator
RTE_FLOW_CLASSIFY_TABLE_TYPE_NONE 

no type

RTE_FLOW_CLASSIFY_TABLE_TYPE_ACL 

ACL type

Definition at line 108 of file rte_flow_classify.h.

Function Documentation

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.
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.
int rte_flow_classify_table_create ( struct rte_flow_classifier *  cls,
struct rte_flow_classify_table_params params,
uint32_t *  table_id 
)

Flow classify table create

Parameters
clsHandle to flow classifier instance
paramsParameters for flow_classify table creation
table_idTable ID. Valid only within the scope of table IDs of the current classifier. Only returned after a successful invocation.
Returns
0 on success, error code otherwise
Examples:
examples/flow_classify/flow_classify.c.
struct rte_flow_classify_rule* rte_flow_classify_table_entry_add ( struct rte_flow_classifier *  cls,
uint32_t  table_id,
int *  key_found,
const struct rte_flow_attr attr,
const struct rte_flow_item  pattern[],
const struct rte_flow_action  actions[],
struct rte_flow_error error 
)

Add a flow classify rule to the flow_classifer table.

Parameters
[in]clsFlow classifier handle
[in]table_idid of table
[out]key_foundreturns 1 if key present already, 0 otherwise.
[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
A valid handle in case of success, NULL otherwise.
Examples:
examples/flow_classify/flow_classify.c.
int rte_flow_classify_table_entry_delete ( struct rte_flow_classifier *  cls,
uint32_t  table_id,
struct rte_flow_classify_rule *  rule 
)

Delete a flow classify rule from the flow_classifer table.

Parameters
[in]clsFlow classifier handle
[in]table_idid of table
[in]ruleFlow classify rule
Returns
0 on success, error code otherwise.
Examples:
examples/flow_classify/flow_classify.c.
int rte_flow_classifier_query ( struct rte_flow_classifier *  cls,
uint32_t  table_id,
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]table_idid of table
[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.