From: Lukas Sismis <sismis@dyna-nic.com>
To: dev@dpdk.org
Cc: Lukas Sismis <sismis@dyna-nic.com>
Subject: [PATCH v3 0/7] flow_parser: add shared parser library
Date: Fri, 16 Jan 2026 00:01:06 +0100 [thread overview]
Message-ID: <cover.1768518003.git.sismis@dyna-nic.com> (raw)
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, among others, the following APIs:
- 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 and Demo
-------
- Functional tests in dpdk-test
- Example application: examples/flow_parsing
Changes
-------
v3:
- Add more functional tests
- More concise MAINTAINERS updates
- Updated license headers
- A thing to note: When playing with flow commands, I figured, some may use
non-flow commands, such as raw decap/encap, policy meter and others.
Flow parser library itself now supports `set` command to set e.g. the decap/
encap parameters, as the flow syntax only supports defining the index of the
encap/decap configs. The library, however, does not support e.g. `create`
command to create policy meters, as that is just an ID and it can be created
separately using rte_meter APIs.
[1] https://github.com/OISF/suricata/pull/13950
Lukas Sismis (7):
cmdline: include stddef.h for offsetof
flow_parser: add shared parser library
app/testpmd: use shared flow parser library
examples/flow_parsing: add flow parser demo
dpdk-test: add flow parser library functional tests
mailmap: update a new contributor email
dts: fix invalid f-string syntax in testpmd API
.mailmap | 2 +-
MAINTAINERS | 6 +-
app/test-pmd/cmd_flex_item.c | 41 +-
app/test-pmd/cmdline.c | 254 +-
app/test-pmd/config.c | 112 +-
app/test-pmd/flow_parser.c | 406 +
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 | 126 +-
app/test/meson.build | 1 +
app/test/test_flow_parser.c | 698 +
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 +
dts/api/testpmd/__init__.py | 8 +-
examples/flow_parsing/main.c | 288 +
examples/flow_parsing/meson.build | 11 +
examples/meson.build | 1 +
lib/cmdline/cmdline_parse.h | 2 +
lib/ethdev/rte_ethdev.c | 107 +
lib/ethdev/rte_ethdev.h | 60 +
lib/flow_parser/meson.build | 6 +
.../flow_parser/rte_flow_parser.c | 11320 ++++++++--------
lib/flow_parser/rte_flow_parser.h | 1306 ++
lib/meson.build | 2 +
27 files changed, 9300 insertions(+), 5773 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 (55%)
create mode 100644 lib/flow_parser/rte_flow_parser.h
--
2.43.7
next reply other threads:[~2026-01-15 23:01 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-15 23:01 Lukas Sismis [this message]
2026-01-15 23:01 ` [PATCH v3 1/7] cmdline: include stddef.h for offsetof Lukas Sismis
2026-01-15 23:01 ` [PATCH v3 3/7] app/testpmd: use shared flow parser library Lukas Sismis
2026-01-16 17:21 ` Stephen Hemminger
2026-01-15 23:01 ` [PATCH v3 4/7] examples/flow_parsing: add flow parser demo Lukas Sismis
2026-01-16 17:22 ` Stephen Hemminger
2026-01-15 23:01 ` [PATCH v3 5/7] dpdk-test: add flow parser library functional tests Lukas Sismis
2026-01-15 23:01 ` [PATCH v3 6/7] mailmap: update a new contributor email Lukas Sismis
2026-01-15 23:01 ` [PATCH v3 7/7] dts: fix invalid f-string syntax in testpmd API Lukas Sismis
2026-01-20 16:44 ` Dean Marx
2026-01-20 16:53 ` Patrick Robb
2026-01-20 17:29 ` Dean Marx
2026-01-16 6:01 ` [PATCH v3 0/7] flow_parser: add shared parser library Stephen Hemminger
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=cover.1768518003.git.sismis@dyna-nic.com \
--to=sismis@dyna-nic.com \
--cc=dev@dpdk.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox