[PATCH v1 0/5] flow_parser: add shared parser library

Lukas Sismis
2026-01-05T21:31:02Z

This series extracts the testpmd flow CLI parser into a reusable library,
enabling external applications to parse rte_flow rules using testpmd syntax.

Motivation
----------
External applications like Suricata IDS [1] need to express hardware filtering
rules in a consistent, human-readable format. Rather than inventing custom
syntax, reusing testpmd's well-tested flow grammar provides immediate
compatibility with existing documentation and user knowledge.

Note: This library provides only one way to create rte_flow structures.
Applications can also construct rte_flow_attr, rte_flow_item[], and
rte_flow_action[] directly in C code.

Design
------
The library (librte_flow_parser) exposes:
- rte_flow_parser_parse(): Parse command strings into structured output
- rte_flow_parser_parse_attr_str(): Parse attributes only
- rte_flow_parser_parse_pattern_str(): Parse patterns only
- rte_flow_parser_parse_actions_str(): Parse actions only

Testpmd is updated to use the shared library, ensuring a single
maintained parser implementation.

Testing
-------
- Unit tests: flow_parser_autotest, flow_parser_helpers_autotest
- Example application: examples/flow_parsing
- All existing testpmd flow commands work unchanged

Note:
This initial submission is to mainly trigger QA, but feedback is highly
appreciated.

[1] https://github.com/OISF/suricata/pull/13950

Lukas Sismis (5):
flow_parser: add shared parser library
app/testpmd: integrate shared flow parser library
examples/flow_parsing: add flow parser demo
test: add flow parser unit tests
doc: add flow parser library maintainers

.mailmap | 3 +-
MAINTAINERS | 3 +
app/test-pmd/cmd_flex_item.c | 41 +-
app/test-pmd/cmdline.c | 215 +-
app/test-pmd/config.c | 109 +-
app/test-pmd/flow_parser.c | 745 ++
app/test-pmd/flow_parser.h | 8 +
app/test-pmd/flow_parser_cli.c | 149 +
app/test-pmd/meson.build | 5 +-
app/test-pmd/testpmd.c | 4 +
app/test-pmd/testpmd.h | 124 +-
app/test/meson.build | 1 +
app/test/test_flow_parser.c | 226 +
doc/guides/prog_guide/flow_parser_lib.rst | 140 +
doc/guides/prog_guide/index.rst | 1 +
doc/guides/rel_notes/release_26_03.rst | 9 +
examples/flow_parsing/main.c | 348 +
examples/flow_parsing/meson.build | 11 +
examples/meson.build | 1 +
lib/ethdev/rte_ethdev.c | 107 +
lib/ethdev/rte_ethdev.h | 60 +
lib/flow_parser/meson.build | 6 +
.../flow_parser/rte_flow_parser.c | 10727 ++++++++--------
lib/flow_parser/rte_flow_parser.h | 1296 ++
lib/meson.build | 1 +
25 files changed, 8858 insertions(+), 5482 deletions(-)
create mode 100644 app/test-pmd/flow_parser.c
create mode 100644 app/test-pmd/flow_parser.h
create mode 100644 app/test-pmd/flow_parser_cli.c
create mode 100644 app/test/test_flow_parser.c
create mode 100644 doc/guides/prog_guide/flow_parser_lib.rst
create mode 100644 examples/flow_parsing/main.c
create mode 100644 examples/flow_parsing/meson.build
create mode 100644 lib/flow_parser/meson.build
rename app/test-pmd/cmdline_flow.c => lib/flow_parser/rte_flow_parser.c (57%)
create mode 100644 lib/flow_parser/rte_flow_parser.h

--
2.43.7