[dpdk-dev] [PATCH v9 0/4] flow classification library
bernard.iremonger at intel.com
Sun Oct 22 15:32:00 CEST 2017
DPDK works with packets, but some network administration tools work with flow information.
This library is proposed to provide an API to classify received packets using flow patterns.
Basically the library consists of APIs to create the classifier object, add a table to the classifer,
add and delete flow rules to the table and to query the stats for a given rule.
The application should use the following sequence of API's:
call rte_flow_classifier_create() to create the classifier object.
call rte_flow_classify_table_create() to add a table to the classifier.
call rte_flow_classify_table_entry_add to add a flow rule to the table.
After a call to rte_eth_rx-burst() to receive a packet burst.
call rte_flow_classifier_query() to classify the packets in the against the rules in the classifier and
to return data to the application.
The flow_classify sample application in this patchset is using the ACL table for packet matching.
The flow classification library can support other tables for example EM and LPM tables.
The library header file has more comments on how library works and the provided APIs.
Packets to flow rule matching will cause a performance drop, that is why classification is done on
demand by the rte_flow_classifier_query() API provided by this library.
The initial implementation is to provide counting of IPv4 five tuple packets for UDP, TCP and SCTP,
but the library is planned to be as generic as possible.
The flow information provided by this library is missing to implement full IPFIX features,
but this is planned to be the initial step.
Flows are defined using rte_flow, also measurements (actions) are provided by rte_flow.
To support more IPFIX measurements, the implementation may require extending rte_flow in addition to
extending this library.
The library uses both flows and actions defined by rte_flow.h so this library has a dependency on
This patch set also contains a set of unit tests for the Flow Classify library, patch(4) and
a patch(3) containing additional functions added to the packet burst generator code.
For further steps, this library may be expanded to benefit from hardware filters for better performance.
It will be more beneficial to shape this library to cover more use cases,
please feel free to comment on possible other use cases and desired functionalities.
Changes in v9:
The library has been reworked following comments on the v8 patchset.
The validate API has changed to an internal function and renamed.
The run API has been merged with the query API.
The default_entry code has been removed from the library.
A key_found parameter has been added to the rte_classify_table_entry_add API.
Checks on the f_* functions has been added to library.
The rte_flow_classify_table_entry structure has been made private.
The doxygen API output has been revised.
The flow_classify sample application has been revised for the latest API's.
The flow_classify_autotest program has been revised for the latest API's
Changes in v8:
The library has been reworked so that it can be used with any of the tables supported by librte_table.
Four new API's have been added to support this, rte_flow_classifier_create, rte_flow_classifier_free
rte_flow_classify_table_create and rte_flow_classify_run.
rte_flow_classify_create has been replaced by rte_flow_classify_table_entry_add.
rte_flow_classify_destroy has been replaced by rte_flow_classify_table_entry_delete.
rte_flow_classify_query has been replaced by rte_flow_classifier_run.
Changes in v7:
Fix rte_flow_classify_version.map file.
Fix checkpatch warnings.
Changes in v6:
Dropped two librte_table patches (patches 1 and 2 in v5 patch set).
Revised librte_flow_classify patch to use librte_table API's correctly.
Changes in v5:
Added tests for TCP an STCP traffic to unit test code.
Added patch to packet_burst_generator code to add functions for TCP and SCTP protocols.
Changes in v4:
Replaced GET_CB_FIELD macro with get_cb_field function in the flow classify sample application
to fix checkpatch warning.
Fixed checkpatch warnings in test_flow_classify.c
Changes in v3:
Patch 3 from the v2 patch set has been dropped,"librte_ether: initialise IPv4 protocol mask for rte_flow".
The flow_classify sample application is now using an input file of IPv4 five tuple rules instead of
A minor fix to the rte_flow_classify_create() function.
Changes in v2:
Patch 1, librte_table: move structure to header file, has been dropped.
The code has been reworked to not access struct rte_table_acl directly.
An entry_size parameter has been added to the rte_flow_classify_create function.
The f_lookup function is now called instead of the rte_acl_classify function.
Patch 2, librte_table: fix acl lookup function, has been added.
Changes in v1, since RFC v3:
added rte_flow_classify_validate API.
librte_table ACL is used for packet matching.
a table_acl parameter has been added to all of the API's
an error parameter has been been added to all of the API's
Bernard Iremonger (3):
examples/flow_classify: flow classify sample application
test: add packet burst generator functions
test: flow classify library unit tests
Ferruh Yigit (1):
librte_flow_classify: add flow classify library
MAINTAINERS | 7 +
config/common_base | 6 +
doc/api/doxy-api-index.md | 1 +
doc/api/doxy-api.conf | 1 +
examples/flow_classify/Makefile | 57 ++
examples/flow_classify/flow_classify.c | 850 +++++++++++++++++++++
examples/flow_classify/ipv4_rules_file.txt | 14 +
lib/Makefile | 3 +
lib/librte_eal/common/include/rte_log.h | 1 +
lib/librte_flow_classify/Makefile | 51 ++
lib/librte_flow_classify/rte_flow_classify.c | 685 +++++++++++++++++
lib/librte_flow_classify/rte_flow_classify.h | 285 +++++++
lib/librte_flow_classify/rte_flow_classify_parse.c | 546 +++++++++++++
lib/librte_flow_classify/rte_flow_classify_parse.h | 74 ++
.../rte_flow_classify_version.map | 12 +
mk/rte.app.mk | 1 +
test/test/Makefile | 1 +
test/test/packet_burst_generator.c | 191 +++++
test/test/packet_burst_generator.h | 22 +-
test/test/test_flow_classify.c | 673 ++++++++++++++++
test/test/test_flow_classify.h | 234 ++++++
21 files changed, 3713 insertions(+), 2 deletions(-)
create mode 100644 examples/flow_classify/Makefile
create mode 100644 examples/flow_classify/flow_classify.c
create mode 100644 examples/flow_classify/ipv4_rules_file.txt
create mode 100644 lib/librte_flow_classify/Makefile
create mode 100644 lib/librte_flow_classify/rte_flow_classify.c
create mode 100644 lib/librte_flow_classify/rte_flow_classify.h
create mode 100644 lib/librte_flow_classify/rte_flow_classify_parse.c
create mode 100644 lib/librte_flow_classify/rte_flow_classify_parse.h
create mode 100644 lib/librte_flow_classify/rte_flow_classify_version.map
create mode 100644 test/test/test_flow_classify.c
create mode 100644 test/test/test_flow_classify.h
More information about the dev