Skip to contentSkip to conversation

flow_parser: add shared parser library

PATCH Applied Lukas Sismis 3 participants 20 messages Feb 2 – Feb 17 1 message not in the archive Arm/Amlogic Meson SoC support

v10 of 12 Applied Latest is v12 →

lore
Share & tools
lore
#0 lore raw

v10 cover flow_parser: add shared parser library

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 the following APIs:
- 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 library, ensuring a single maintained parser implementation.

Testing and Demo
-------
- Functional tests in dpdk-test
- Example application: examples/flow_parsing

Changes
-------
v10:
- rebased to avoid Github Actions CI build failure
- merge conflict solved in rel_notes/release_26_03.rst
- release notes shortened

v9:
- removed extra new line from the flow parser docs file

v8:
- rte_port/queue_id_t typedefs removal to be included in a separate patch series
- move of accidental changes of rte_flow parser library from the testpmd commit
- DynaNIC copyright name update

v7:
- Fixed implicit integer comparison (while (left) -> while (left != 0))
- NULL checks fixed
- arpa header removed for Windows compatibility
- minor comments from the last review addressed

v6:
- Inconsistent Experimental API Version adjusted
- Fixes Tag added to MSVC build commit
- Non-Standard Header Guards updated
- Implicit Pointer Comparison and Return Type issues addressed in many places
- commit message in patch 6 updated

v5:
- removed/replaced (f)printf code from the library
- reverted back to exporting the internal/private API as it is needed by testpmd and cannot be easily split further.
- adjusted length of certain lines
- marking port/queue id typedef as experimental
- updated release rel_notes
- copyeright adjustments

v4:
- ethdev changes in separate commit
- library's public API only exposes attribute, pattern and action parsing, while the full command parsing is kept internal for testpmd usage only.
- Addressed Stephen's comments from V3
- dpdk-test now have tests focused on public and internal library functions

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 (6):
cmdline: include stddef.h for MSVC compatibility
ethdev: add RSS type helper APIs
flow_parser: add shared parser library app/testpmd: use shared flow parser library examples/flow_parsing: add flow parser demo
test: add flow parser library functional tests

 MAINTAINERS                                   |     6 +-
 app/test-pmd/cmd_flex_item.c                  |    41 +-
 app/test-pmd/cmdline.c                        |   267 +-
 app/test-pmd/config.c                         |   112 +-
 app/test-pmd/flow_parser.c                    |   409 +
 app/test-pmd/flow_parser_cli.c                |   153 +
 app/test-pmd/meson.build                      |     5 +-
 app/test-pmd/testpmd.c                        |     4 +
 app/test-pmd/testpmd.h                        |   122 +-
 app/test/meson.build                          |     1 +
 app/test/test_ethdev_api.c                    |    51 +
 app/test/test_flow_parser.c                   |   923 ++
 doc/api/doxy-api-index.md                     |     1 +
 doc/api/doxy-api.conf.in                      |     1 +
 doc/guides/prog_guide/flow_parser_lib.rst     |   110 +
 doc/guides/prog_guide/index.rst               |     1 +
 doc/guides/rel_notes/release_26_03.rst        |     9 +
 examples/flow_parsing/main.c                  |   292 +
 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                       |    55 +
 lib/flow_parser/meson.build                   |     7 +
 .../flow_parser/rte_flow_parser.c             | 11420 ++++++++--------
 lib/flow_parser/rte_flow_parser.h             |   134 +
 lib/flow_parser/rte_flow_parser_private.h     |  1247 ++
 lib/meson.build                               |     2 +
 28 files changed, 9671 insertions(+), 5823 deletions(-)
 create mode 100644 app/test-pmd/flow_parser.c
 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
 create mode 100644 lib/flow_parser/rte_flow_parser_private.h
Signature · 1 line
2.43.7
#1 lore raw

PATCH v10 1/6 cmdline: include stddef.h for MSVC compatibility

Include <stddef.h> at the top of cmdline_parse.h before the fallback offsetof macro definition. This improves MSVC build compatibility by ensuring the standard offsetof is available before the fallback definition, avoiding macro redefinition warnings when building with /WX (warnings as errors).

The standard header provides offsetof on all platforms, and including it first ensures the fallback is only used when truly needed.

---
 lib/cmdline/cmdline_parse.h | 2 ++
 1 file changed, 2 insertions(+)
lib/cmdline/cmdline_parse.h +2 -0
index d9a7d86256..c4131e4af5 100644
@@ -7,6 +7,8 @@
 #ifndef _CMDLINE_PARSE_H_
 #define _CMDLINE_PARSE_H_
 
+#include <stddef.h>
+
 #ifdef __cplusplus
 extern "C" {
 #endif
Signature · 1 line
2.43.7
#2 lore raw

PATCH v10 2/6 ethdev: add RSS type helper APIs

In reply to Lukas Sismis

Add a global RSS type string table and helper functions to convert between RSS type names and values.
Add unit tests for RSS type helper.

---
 app/test/test_ethdev_api.c             |  51 ++++++++++++
 doc/guides/rel_notes/release_26_03.rst |   4 +
 lib/ethdev/rte_ethdev.c                | 107 +++++++++++++++++++++++++
 lib/ethdev/rte_ethdev.h                |  55 +++++++++++++
 4 files changed, 217 insertions(+)
app/test/test_ethdev_api.c +51 -0
index 76afd0345c..7c0cde87a6 100644
@@ -2,6 +2,9 @@
  * Copyright (C) 2023, Advanced Micro Devices, Inc.
  */
 
+#include <stdbool.h>
+#include <string.h>
+
 #include <rte_log.h>
 #include <rte_ethdev.h>
 
@@ -162,12 +165,60 @@ ethdev_api_queue_status(void)
 	return TEST_SUCCESS;
 }
 
+static int
+ethdev_api_rss_type_helpers(void)
+{
+	const struct rte_eth_rss_type_info *tbl;
+	const char *zero_name = NULL;
+	unsigned int i;
+	bool has_zero = false;
+	const char *name;
+	uint64_t type;
+
+	tbl = rte_eth_rss_type_info_get();
+	TEST_ASSERT_NOT_NULL(tbl, "rss type table missing");
+
+	for (i = 0; tbl[i].str != NULL; i++) {
+		type = rte_eth_rss_type_from_str(tbl[i].str);
+		TEST_ASSERT_EQUAL(type, tbl[i].rss_type,
+			"rss type mismatch for %s", tbl[i].str);
+
+		if (tbl[i].rss_type == 0 && !has_zero) {
+			has_zero = true;
+			zero_name = tbl[i].str;
+		}
+
+		name = rte_eth_rss_type_to_str(tbl[i].rss_type);
+		TEST_ASSERT_NOT_NULL(name, "rss type name missing for %s",
+			tbl[i].str);
+		TEST_ASSERT_EQUAL(rte_eth_rss_type_from_str(name), tbl[i].rss_type,
+			"rss type round-trip mismatch for %s", name);
+	}
+
+	TEST_ASSERT(tbl[i].str == NULL, "rss type table not NULL terminated");
+	TEST_ASSERT_EQUAL(rte_eth_rss_type_from_str(NULL), 0,
+		"rss type from NULL should be 0");
+	TEST_ASSERT_EQUAL(rte_eth_rss_type_from_str("not-a-type"), 0,
+		"rss type unknown should be 0");
+	name = rte_eth_rss_type_to_str(0);
+	if (has_zero) {
+		TEST_ASSERT_NOT_NULL(name, "rss type 0 should be defined");
+		TEST_ASSERT(strcmp(name, zero_name) == 0,
+			"rss type 0 name mismatch");
+	} else {
+		TEST_ASSERT(name == NULL, "rss type 0 should be NULL");
+	}
+
+	return TEST_SUCCESS;
+}
+
 static struct unit_test_suite ethdev_api_testsuite = {
 	.suite_name = "ethdev API tests",
 	.setup = NULL,
 	.teardown = NULL,
 	.unit_test_cases = {
 		TEST_CASE(ethdev_api_queue_status),
+		TEST_CASE(ethdev_api_rss_type_helpers),
 		/* TODO: Add deferred_start queue status test */
 		TEST_CASES_END() /**< NULL terminate unit test array */
 	}
doc/guides/rel_notes/release_26_03.rst +4 -0
index 39a3db0f18..648af00f13 100644
@@ -59,6 +59,10 @@ New Features
 
   * Added support for V4000 Krackan2e.
 
+* **Added experimental RSS type helper APIs in ethdev.**
+
+  * Added new APIs to convert between RSS type names and values.
+  * Added new API call to obtain the global RSS string table.
 
 Removed Items
 -------------
lib/ethdev/rte_ethdev.c +107 -0

113 lines not on this page · raw message

lib/ethdev/rte_ethdev.h +55 -0

61 lines not on this page · raw message

Signature · 1 line
2.43.7
#3 lore raw

Re: [PATCH v10 2/6] ethdev: add RSS type helper APIs

Quoted 6 lines · On Mon, 2 Feb 2026 12:36:54 +0100 Lukas Sismis <[email protected]> wrote:

Add a global RSS type string table and helper functions to convert between RSS type names and values.
Add unit tests for RSS type helper.

---

Since the only usage of this in flow parser, marking this as deferred. When flow parser is reworked, this can be reconsidered. Thomas had point that ideally table of strings could be auto generated so that new flow types could be added in one place.

#4 lore raw

PATCH v10 4/6 app/testpmd: use shared flow parser library

In reply to Lukas Sismis

Switch testpmd to use the shared librte_flow_parser library instead of the embedded cmdline_flow.c implementation.

Changes:
- Remove app/test-pmd/cmdline_flow.c (moved to library)
- Add flow_parser.c: Implements flow operation callbacks that bridge the parser library to testpmd's port/flow management functions
- Add flow_parser_cli.c: Hosts cmdline integration for 'flow' and 'set raw_encap/decap' commands
- Update cmdline.c to register flow commands with the parser
- Update meson.build to link against flow_parser library

The testpmd flow command syntax remains unchanged. All existing flow commands continue to work identically.

---
 MAINTAINERS                    |     2 +-
 app/test-pmd/cmd_flex_item.c   |    41 +-
 app/test-pmd/cmdline.c         |   267 +-
 app/test-pmd/cmdline_flow.c    | 14434 -------------------------------
 app/test-pmd/config.c          |   112 +-
 app/test-pmd/flow_parser.c     |   409 +
 app/test-pmd/flow_parser_cli.c |   153 +
 app/test-pmd/meson.build       |     5 +-
 app/test-pmd/testpmd.c         |     4 +
 app/test-pmd/testpmd.h         |   122 +-
 10 files changed, 760 insertions(+), 14789 deletions(-)
 delete mode 100644 app/test-pmd/cmdline_flow.c
 create mode 100644 app/test-pmd/flow_parser.c
 create mode 100644 app/test-pmd/flow_parser_cli.c
MAINTAINERS +1 -1
index b755f00550..d668dcc8e4 100644
@@ -444,7 +444,7 @@ F: doc/guides/prog_guide/ethdev/switch_representation.rst
 Flow API
 M: Ori Kam <[email protected]>
 T: git://dpdk.org/next/dpdk-next-net
-F: app/test-pmd/cmdline_flow.c
+F: app/test-pmd/flow_parser*
 F: doc/guides/prog_guide/ethdev/flow_offload.rst
 F: doc/guides/prog_guide/flow_parser_lib.rst
 F: lib/ethdev/rte_flow*
app/test-pmd/cmd_flex_item.c +23 -18

68 lines not on this page · raw message

app/test-pmd/cmdline.c +155 -112

436 lines not on this page · raw message

app/test-pmd/cmdline_flow.c deleted +0 -14434

2,488 lines not on this page · raw message

app/test-pmd/config.c +10 -102

112 lines not on this page · raw message

app/test-pmd/flow_parser.c new file +409 -0

409 lines not on this page · raw message

app/test-pmd/flow_parser_cli.c new file +153 -0

153 lines not on this page · raw message

app/test-pmd/meson.build +3 -2
index 83163a5406..79eabc2cfd 100644

Lines of this file are not shown. View the raw message.

app/test-pmd/testpmd.c +4 -0
index 3a080f9d8c..2b41f21ac1 100644

Lines of this file are not shown. View the raw message.

app/test-pmd/testpmd.h +2 -120

122 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

Signature · 1 line
2.43.7

Part of the diff is not shown here. View the raw message.

#5 lore raw

PATCH v10 5/6 examples/flow_parsing: add flow parser demo

In reply to Lukas Sismis

Add example application demonstrating the flow parser library API.

The example shows how to use the primary external functions for parsing parts of rte_flow rules.

Configure with: meson configure -Dexamples=flow_parsing

---
 MAINTAINERS                       |   1 +
 examples/flow_parsing/main.c      | 292 ++++++++++++++++++++++++++++++
 examples/flow_parsing/meson.build |  11 ++
 examples/meson.build              |   1 +
 4 files changed, 305 insertions(+)
 create mode 100644 examples/flow_parsing/main.c
 create mode 100644 examples/flow_parsing/meson.build
MAINTAINERS +1 -0
index d668dcc8e4..899c767691 100644
@@ -449,6 +449,7 @@ F: doc/guides/prog_guide/ethdev/flow_offload.rst
 F: doc/guides/prog_guide/flow_parser_lib.rst
 F: lib/ethdev/rte_flow*
 F: lib/flow_parser/
+F: examples/flow_parsing/
 
 Traffic Management API
 M: Cristian Dumitrescu <[email protected]>
examples/flow_parsing/main.c new file +292 -0

292 lines not on this page · raw message

examples/flow_parsing/meson.build new file +11 -0
new file mode 100644
index 0000000000..a4f4c5910c
@@ -0,0 +1,11 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright(c) 2026 DynaNIC Semiconductors, Ltd.
+
+# meson file, for building this example as part of a main DPDK build.
+#
+# To build this example as a standalone application with an already-installed
+# DPDK instance, use 'make'
+
+allow_experimental_apis = true
+deps += 'flow_parser'
+sources = files('main.c')
examples/meson.build +1 -0
index 25d9c88457..22f45e8c81 100644
@@ -17,6 +17,7 @@ all_examples = [
         'eventdev_pipeline',
         'fips_validation',
         'flow_filtering',
+        'flow_parsing',
         'helloworld',
         'ip_fragmentation',
         'ip_pipeline',
Signature · 1 line
2.43.7
#6 lore raw

PATCH v10 6/6 test: add flow parser library functional tests

In reply to Lukas Sismis

Add functional tests for the flow parser library covering:
- success cases: verifying variety of flow/set rules through the main parse function and through parser helpers
- fail cases: testing invalid arguments, input, and syntax

---
 MAINTAINERS                 |   1 +
 app/test/meson.build        |   1 +
 app/test/test_flow_parser.c | 923 ++++++++++++++++++++++++++++++++++++
 3 files changed, 925 insertions(+)
 create mode 100644 app/test/test_flow_parser.c
MAINTAINERS +1 -0
index 899c767691..92c09ad3b7 100644
@@ -450,6 +450,7 @@ F: doc/guides/prog_guide/flow_parser_lib.rst
 F: lib/ethdev/rte_flow*
 F: lib/flow_parser/
 F: examples/flow_parsing/
+F: app/test/test_flow_parser.c
 
 Traffic Management API
 M: Cristian Dumitrescu <[email protected]>
app/test/meson.build +1 -0
index f4d04a6e42..d18f827b73 100644
@@ -88,6 +88,7 @@ source_file_deps = {
     'test_fib6_perf.c': ['fib'],
     'test_fib_perf.c': ['net', 'fib'],
     'test_flow_classify.c': ['net', 'acl', 'table', 'ethdev', 'flow_classify'],
+    'test_flow_parser.c': ['flow_parser', 'cmdline', 'ethdev'],
     'test_func_reentrancy.c': ['hash', 'lpm'],
     'test_graph.c': ['graph'],
     'test_graph_feature_arc.c': ['graph'],
app/test/test_flow_parser.c new file +923 -0

923 lines not on this page · raw message

Signature · 1 line
2.43.7
#7 lore raw
In reply to Lukas Sismis
Quoted 126 lines · On Mon, 2 Feb 2026 12:36:52 +0100 Lukas Sismis <[email protected]> wrote:

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 the following APIs:
- 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 library, ensuring a single maintained parser implementation.

Testing and Demo
-------
- Functional tests in dpdk-test
- Example application: examples/flow_parsing

Changes
-------
v10:
- rebased to avoid Github Actions CI build failure
- merge conflict solved in rel_notes/release_26_03.rst
- release notes shortened

v9:
- removed extra new line from the flow parser docs file

v8:
- rte_port/queue_id_t typedefs removal to be included in a separate patch series
- move of accidental changes of rte_flow parser library from the testpmd commit
- DynaNIC copyright name update

v7:
- Fixed implicit integer comparison (while (left) -> while (left != 0))
- NULL checks fixed
- arpa header removed for Windows compatibility
- minor comments from the last review addressed

v6:
- Inconsistent Experimental API Version adjusted
- Fixes Tag added to MSVC build commit
- Non-Standard Header Guards updated
- Implicit Pointer Comparison and Return Type issues addressed in many places
- commit message in patch 6 updated

v5:
- removed/replaced (f)printf code from the library
- reverted back to exporting the internal/private API as it is needed by testpmd and cannot be easily split further.
- adjusted length of certain lines
- marking port/queue id typedef as experimental
- updated release rel_notes
- copyeright adjustments

v4:
- ethdev changes in separate commit
- library's public API only exposes attribute, pattern and action parsing, while the full command parsing is kept internal for testpmd usage only.
- Addressed Stephen's comments from V3
- dpdk-test now have tests focused on public and internal library functions

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 (6):
cmdline: include stddef.h for MSVC compatibility
ethdev: add RSS type helper APIs
flow_parser: add shared parser library app/testpmd: use shared flow parser library examples/flow_parsing: add flow parser demo
test: add flow parser library functional tests

 MAINTAINERS                                   |     6 +-
 app/test-pmd/cmd_flex_item.c                  |    41 +-
 app/test-pmd/cmdline.c                        |   267 +-
 app/test-pmd/config.c                         |   112 +-
 app/test-pmd/flow_parser.c                    |   409 +
 app/test-pmd/flow_parser_cli.c                |   153 +
 app/test-pmd/meson.build                      |     5 +-
 app/test-pmd/testpmd.c                        |     4 +
 app/test-pmd/testpmd.h                        |   122 +-
 app/test/meson.build                          |     1 +
 app/test/test_ethdev_api.c                    |    51 +
 app/test/test_flow_parser.c                   |   923 ++
 doc/api/doxy-api-index.md                     |     1 +
 doc/api/doxy-api.conf.in                      |     1 +
 doc/guides/prog_guide/flow_parser_lib.rst     |   110 +
 doc/guides/prog_guide/index.rst               |     1 +
 doc/guides/rel_notes/release_26_03.rst        |     9 +
 examples/flow_parsing/main.c                  |   292 +
 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                       |    55 +
 lib/flow_parser/meson.build                   |     7 +
 .../flow_parser/rte_flow_parser.c             | 11420 ++++++++--------
 lib/flow_parser/rte_flow_parser.h             |   134 +
 lib/flow_parser/rte_flow_parser_private.h     |  1247 ++
 lib/meson.build                               |     2 +
 28 files changed, 9671 insertions(+), 5823 deletions(-)
 create mode 100644 app/test-pmd/flow_parser.c
 create mode 100644 app/test-pmd/flow_parser_cli.c
Quoted 9 lines
 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
 create mode 100644 lib/flow_parser/rte_flow_parser_private.h

Queued to next-net.

PS: you made AI very happy...
Review Complete
I've thoroughly reviewed the 6-patch flow parser v10 series against AGENTS.md guidelines.
Bottom line: This is an excellent patchset - APPROVED with no errors or warnings.
The series introduces a new librte_flow_parser library that extracts testpmd's flow command parser into a reusable component. All patches follow DPDK conventions meticulously:

✅ Proper commit message formatting and tags
✅ All new APIs marked __rte_experimental with RTE_EXPORT_* macros ✅ Comprehensive testing (unit tests + functional tests + example app) ✅ Complete documentation (prog guide + API docs + release notes) ✅ Correct SPDX licensing on all files
✅ MAINTAINERS file updated appropriately

This demonstrates exemplary DPDK development practices.

A message that is not in the archive (sent off-list or not yet received): [email protected]

#9 lore raw
Quoted 13 lines · On Mon, 2 Feb 2026 12:36:55 +0100 Lukas Sismis <[email protected]> wrote:
(quoted diff) +13 -0
+int
+rte_flow_parser_run(const char *src)
+{
+	uint8_t buf[4096];
+	struct rte_flow_parser_output *out = (struct rte_flow_parser_output *)buf;
+	int ret;
+
+	ret = rte_flow_parser_parse(src,
+				    (struct rte_flow_parser_output *)buf,
+				    sizeof(buf));
+	if (ret < 0)
+		return ret;
+	switch (out->command) {

Review

Quoted 10 lines
(quoted diff) +10 -0
+	case RTE_FLOW_PARSER_CMD_SET_SAMPLE_ACTIONS:
+	case RTE_FLOW_PARSER_CMD_SET_IPV6_EXT_PUSH:
+	case RTE_FLOW_PARSER_CMD_SET_IPV6_EXT_REMOVE:
+	case RTE_FLOW_PARSER_CMD_SET_RAW_ENCAP:
+	case RTE_FLOW_PARSER_CMD_SET_RAW_DECAP:
+		cmd_set_raw_parsed(out);
+		break;
+	default:
+		return cmd_flow_parsed(out);
+		break;

The kernel version of checkpatch complains here. The DPDK shell script seems to be set to ignore this but.

WARNING: break is not useful after a return #15008: FILE: lib/flow_parser/rte_flow_parser.c:14763:
+ return cmd_flow_parsed(out);
+ break;

#10 lore raw
Quoted 10 lines

The kernel version of checkpatch complains here. The DPDK shell script seems to be set to ignore this but.

WARNING: break is not useful after a return #15008: FILE: lib/flow_parser/rte_flow_parser.c:14763:

(quoted diff) +2 -0
+               return cmd_flow_parsed(out);
+               break;

Should I create a new patch set or just let it be at this moment?

Lukas

#11 lore raw
Quoted 11 lines · On Tue, 3 Feb 2026 09:34:26 +0100 Lukáš Šišmiš <[email protected]> wrote:
Quoted 10 lines

The kernel version of checkpatch complains here. The DPDK shell script seems to be set to ignore this but.

WARNING: break is not useful after a return #15008: FILE: lib/flow_parser/rte_flow_parser.c:14763:

(quoted diff) +2 -0
+               return cmd_flow_parsed(out);
+               break;

Should I create a new patch set or just let it be at this moment?

Lukas

I am ok with it as is.

#12 lore raw

04/02/2026 15:53, Stephen Hemminger:

Quoted 12 lines
Quoted 9 lines · On Tue, 3 Feb 2026 09:34:26 +0100 Lukáš Šišmiš <[email protected]> wrote:
Quoted 9 lines

The kernel version of checkpatch complains here. The DPDK shell script seems to be set to ignore this but.

WARNING: break is not useful after a return #15008: FILE: lib/flow_parser/rte_flow_parser.c:14763:

(quoted diff) +2 -0
+               return cmd_flow_parsed(out);
+               break;
Quoted 5 lines
Quoted 2 lines
Quoted 1 line

Should I create a new patch set or just let it be at this moment?

Lukas

I am ok with it as is.

Better to update.

There are other warnings:

WARNING:STRNCPY: Prefer strscpy, strscpy_pad, or __nonstring over strncpy - see: https://github.com/KSPP/linux/issues/90
#13052: FILE: lib/flow_parser/rte_flow_parser.c:12825:
+ strncpy(buf, str, len);

and a lot of WARNING:LONG_LINE

And on a more general note, I would have expected to ask the opinion of rte_flow maintainers, but they are not Cc'ed in these patches.

I'm a bit skeptical about adding this outside of ethdev library which defines the flow API.

#13 lore raw

pá 6. 2. 2026 v 15:02 odesílatel Thomas Monjalon <[email protected]> napsal:

Quoted 30 lines

04/02/2026 15:53, Stephen Hemminger:

Quoted 5 lines
Quoted 2 lines · On Tue, 3 Feb 2026 09:34:26 +0100 Lukáš Šišmiš <[email protected]> wrote:
Quoted 2 lines

The kernel version of checkpatch complains here. The DPDK shell

script

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

seems to be set to ignore this but.

WARNING: break is not useful after a return #15008: FILE: lib/flow_parser/rte_flow_parser.c:14763:

(quoted diff) +2 -0
+               return cmd_flow_parsed(out);
+               break;
Quoted 5 lines
Quoted 2 lines
Quoted 1 line

Should I create a new patch set or just let it be at this moment?

Lukas

I am ok with it as is.

Better to update.

There are other warnings:

WARNING:STRNCPY: Prefer strscpy, strscpy_pad, or __nonstring over strncpy
- see: https://github.com/KSPP/linux/issues/90
#13052 <https://github.com/KSPP/linux/issues/90#13052>: FILE:
lib/flow_parser/rte_flow_parser.c:12825:
+ strncpy(buf, str, len);

Quoted 8 lines

and a lot of WARNING:LONG_LINE

I can have a look after the decision.

And on a more general note, I would have expected to ask the opinion of rte_flow maintainers, but they are not Cc'ed in these patches.

I communicated primarily with Stephen, and will CC Ori too. Anyone else?

Quoted 3 lines

I'm a bit skeptical about adding this outside of ethdev library which defines the flow API.

CCing Ori to make a decision. I don't mind putting it directly into ethdev as well, I just thought the parser could be its own separate lib as it is just consuming strings and producing rte_flow structures. I can see the heavy ties to the flow library, though. Thomas, Stephen, what are your opinions?

#14 lore raw
Quoted 48 lines · On Fri, 6 Feb 2026 16:40:39 +0100 Lukáš Šišmiš <[email protected]> wrote:

pá 6. 2. 2026 v 15:02 odesílatel Thomas Monjalon <[email protected]> napsal:

Quoted 30 lines

04/02/2026 15:53, Stephen Hemminger:

Quoted 5 lines
Quoted 2 lines · On Tue, 3 Feb 2026 09:34:26 +0100 Lukáš Šišmiš <[email protected]> wrote:
Quoted 2 lines

The kernel version of checkpatch complains here. The DPDK shell

script

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

seems to be set to ignore this but.

WARNING: break is not useful after a return #15008: FILE: lib/flow_parser/rte_flow_parser.c:14763:

(quoted diff) +2 -0
+               return cmd_flow_parsed(out);
+               break;
Quoted 5 lines
Quoted 2 lines
Quoted 1 line

Should I create a new patch set or just let it be at this moment?

Lukas

I am ok with it as is.

Better to update.

There are other warnings:

WARNING:STRNCPY: Prefer strscpy, strscpy_pad, or __nonstring over strncpy
- see: https://github.com/KSPP/linux/issues/90
#13052 <https://github.com/KSPP/linux/issues/90#13052>: FILE:
lib/flow_parser/rte_flow_parser.c:12825:
+ strncpy(buf, str, len);

Quoted 8 lines

and a lot of WARNING:LONG_LINE

I can have a look after the decision.

And on a more general note, I would have expected to ask the opinion of rte_flow maintainers, but they are not Cc'ed in these patches.

I communicated primarily with Stephen, and will CC Ori too. Anyone else?

Quoted 3 lines

I'm a bit skeptical about adding this outside of ethdev library which defines the flow API.

Quoted 5 lines

CCing Ori to make a decision. I don't mind putting it directly into ethdev as well, I just thought the parser could be its own separate lib as it is just consuming strings and producing rte_flow structures. I can see the heavy ties to the flow library, though. Thomas, Stephen, what are your opinions?

I am beginning to agree with Thomas, this belongs in the ethdev directory next to rte_flow.

Also, not sure what the purpose of parser_ops is. It says to pass NULL, but test-pmd is doing something else. It would be better to have an initializer (i.e RTE_INIT) instead? Maybe

#15 lore raw

pá 13. 2. 2026 v 1:43 odesílatel Stephen Hemminger < [email protected]> napsal:

Quoted 60 lines
Quoted 18 lines · On Fri, 6 Feb 2026 16:40:39 +0100 Lukáš Šišmiš <[email protected]> wrote:

pá 6. 2. 2026 v 15:02 odesílatel Thomas Monjalon <[email protected]> napsal:

Quoted 15 lines

04/02/2026 15:53, Stephen Hemminger:

Quoted 5 lines
Quoted 2 lines · On Tue, 3 Feb 2026 09:34:26 +0100 Lukáš Šišmiš <[email protected]> wrote:
Quoted 2 lines

The kernel version of checkpatch complains here. The DPDK shell

script

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

seems to be set to ignore this but.

WARNING: break is not useful after a return #15008: FILE: lib/flow_parser/rte_flow_parser.c:14763:

(quoted diff) +2 -0
+               return cmd_flow_parsed(out);
+               break;

Should I create a new patch set or just let it be at this

moment?

Quoted 10 lines
Quoted 10 lines
Quoted 4 lines
Quoted 1 line

Lukas

I am ok with it as is.

Better to update.

There are other warnings:

WARNING:STRNCPY: Prefer strscpy, strscpy_pad, or __nonstring over

strncpy

Quoted 13 lines
Quoted 5 lines

- see: https://github.com/KSPP/linux/issues/90
#13052 <https://github.com/KSPP/linux/issues/90#13052>: FILE:
lib/flow_parser/rte_flow_parser.c:12825:
+ strncpy(buf, str, len);

Quoted 8 lines

and a lot of WARNING:LONG_LINE

I can have a look after the decision.

And on a more general note, I would have expected to ask the opinion of rte_flow maintainers, but they are not Cc'ed in these patches.

Quoted 8 lines

I communicated primarily with Stephen, and will CC Ori too. Anyone else?

Quoted 3 lines

I'm a bit skeptical about adding this outside of ethdev library which defines the flow API.

CCing Ori to make a decision. I don't mind putting it directly into

ethdev

Quoted 4 lines

as well, I just thought the parser could be its own separate lib as it is just consuming strings and producing rte_flow structures. I can see the heavy ties to the flow library, though. Thomas, Stephen, what are your opinions?

Quoted 7 lines

I am beginning to agree with Thomas, this belongs in the ethdev directory next to rte_flow.

Also, not sure what the purpose of parser_ops is. It says to pass NULL, but test-pmd is doing something else. It would be better to have an initializer (i.e RTE_INIT) instead? Maybe

Ok, I can move it there then. Should I proceed with Patch v11 - that would include moving the ethdev directory and addressing the kernel's checkpatch issues?

The initializer doesn't seem like a bad idea. I didn't know about that one. The parser_ops are not needed for purely parsing, but to remain compatible with the testpmd's code, which is using, e.g., the hints on the commandline I added parser_ops.
The simple public library API is for converting strings to rte_flow structures,
the parser_ops is for hooking up the testpmd.

#16 lore raw
Quoted 11 lines · On Fri, 13 Feb 2026 08:46:04 +0100 Lukáš Šišmiš <[email protected]> wrote:

Ok, I can move it there then. Should I proceed with Patch v11 - that would include moving the ethdev directory and addressing the kernel's checkpatch issues?

The initializer doesn't seem like a bad idea. I didn't know about that one. The parser_ops are not needed for purely parsing, but to remain compatible with the testpmd's code, which is using, e.g., the hints on the commandline I added parser_ops.
The simple public library API is for converting strings to rte_flow structures,
the parser_ops is for hooking up the testpmd.

Testpmd can change as needed.
In general testpmd shouldn't be using "special" API's; that would indicate a architecture issue.

#17 lore raw
In reply to Lukáš Šišmiš
Quoted 81 lines · On Fri, 13 Feb 2026 08:46:04 +0100 Lukáš Šišmiš <[email protected]> wrote:

pá 13. 2. 2026 v 1:43 odesílatel Stephen Hemminger < [email protected]> napsal:

Quoted 65 lines
Quoted 20 lines · On Fri, 6 Feb 2026 16:40:39 +0100 Lukáš Šišmiš <[email protected]> wrote:

pá 6. 2. 2026 v 15:02 odesílatel Thomas Monjalon
<[email protected]> napsal:

Quoted 17 lines

04/02/2026 15:53, Stephen Hemminger:

Quoted 6 lines
Quoted 3 lines · On Tue, 3 Feb 2026 09:34:26 +0100 Lukáš Šišmiš <[email protected]> wrote:
Quoted 3 lines

The kernel version of checkpatch complains here. The DPDK shell

script

Quoted 9 lines
Quoted 9 lines
Quoted 9 lines

seems to be set to ignore this but.

WARNING: break is not useful after a return #15008: FILE: lib/flow_parser/rte_flow_parser.c:14763:

(quoted diff) +2 -0
+               return cmd_flow_parsed(out);
+               break;

Should I create a new patch set or just let it be at this

moment?

Quoted 11 lines
Quoted 11 lines
Quoted 4 lines
Quoted 1 line

Lukas

I am ok with it as is.

Better to update.

There are other warnings:

WARNING:STRNCPY: Prefer strscpy, strscpy_pad, or __nonstring over

strncpy

Quoted 17 lines
Quoted 5 lines

- see: https://github.com/KSPP/linux/issues/90
#13052 <https://github.com/KSPP/linux/issues/90#13052>: FILE:
lib/flow_parser/rte_flow_parser.c:12825:
+ strncpy(buf, str, len);

Quoted 8 lines

and a lot of WARNING:LONG_LINE

I can have a look after the decision.

And on a more general note, I would have expected to ask the opinion of rte_flow maintainers, but they are not Cc'ed in these patches.

I communicated primarily with Stephen, and will CC Ori too. Anyone else?

Quoted 6 lines
Quoted 3 lines

I'm a bit skeptical about adding this outside of ethdev library which defines the flow API.

CCing Ori to make a decision. I don't mind putting it directly into

ethdev

Quoted 4 lines

as well, I just thought the parser could be its own separate lib as it is just consuming strings and producing rte_flow structures. I can see the heavy ties to the flow library, though. Thomas, Stephen, what are your opinions?

Quoted 7 lines

I am beginning to agree with Thomas, this belongs in the ethdev directory next to rte_flow.

Also, not sure what the purpose of parser_ops is. It says to pass NULL, but test-pmd is doing something else. It would be better to have an initializer (i.e RTE_INIT) instead? Maybe

Ok, I can move it there then. Should I proceed with Patch v11 - that would include moving the ethdev directory and addressing the kernel's checkpatch issues?

Quoted 7 lines

The initializer doesn't seem like a bad idea. I didn't know about that one. The parser_ops are not needed for purely parsing, but to remain compatible with the testpmd's code, which is using, e.g., the hints on the commandline I added parser_ops.
The simple public library API is for converting strings to rte_flow structures,
the parser_ops is for hooking up the testpmd.

My response was more immediate (gut feel). But wanted more detailed feedback.
I think you need to have a really simple API like the PCAP does for compiling string into BPF. See pcap_compile.

The testpmd/cmdline method is creating too much baggage!

This is what the result of back-and-forth with Claude AI came to:

rte_flow_parser_ops — Summary of Issues

64 callbacks, zero documentation. No Doxygen on any member. The only way to understand the contract is to read testpmd's implementation — making testpmd the de facto spec.

Inconsistent return types. 36 callbacks return int, 10 return void. Similar operations use different conventions (e.g. flow_create returns int, flow_tunnel_create returns void). No error reporting possible from the void ones.

Testpmd internals leaked into the API. verbose_level_get is a UI concern, not a parser concern. The void/int split mirrors whatever testpmd's internal functions happened to use, not a designed interface.

No guidance on minimal implementation. "Unused callbacks may be NULL" but which ones does the parser actually call during a basic flow create? A new consumer can't tell without tracing the code.

ABI-fragile but installed as a header. Adding any new rte_flow command means extending these structs. No versioning mechanism, yet it's in indirect_headers so external code can (and will) use it.

681-entry command enum couples consumers to parser internals. Anyone interpreting rte_flow_parser_output.command must understand the full token namespace.

Bottom line: This is a testpmd function dispatch table promoted to a library header without the design work to make it an external API. Either don't install the private header, or invest in documenting/versioning it properly.

#18 lore raw
In reply to a message not in the archive
Quoted 13 lines · On Mon, 2 Feb 2026 12:36:55 +0100 Lukas Sismis <[email protected]> wrote:

Introduce librte_flow_parser as an experimental library exposing the testpmd flow CLI parser as an optional reusable component.

The library provides:
- rte_flow_parser_init(): Initialize parser with operation callbacks
- rte_flow_parser_parse(): Parse flow command strings into output
- rte_flow_parser_run(): Parse and execute via registered callbacks
- Lightweight functions for parsing pattern/action/attribute strings

The parser uses a single global instance design for simplicity. All parsing state is internal to the library. Callbacks are invoked for flow create, destroy, validate, query and other flow operations.

Quoted 7 lines

This enables applications to reuse testpmd's well-tested flow syntax without duplicating the parser implementation.

Other applications should primarily leverage the functions for separately parsing rte_flow rule attributes/patterns/actions.

I fixed a couple of checkpatch warnings during merge to next-net. The break, use strlcpy, and spelling.

#19 lore raw
In reply to Lukas Sismis
Quoted 21 lines · On Mon, 2 Feb 2026 12:36:52 +0100 Lukas Sismis <[email protected]> wrote:

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 the following APIs:
- 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

Quoted 7 lines

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

Testing and Demo
-------
- Functional tests in dpdk-test
- Example application: examples/flow_parsing

I am working on being able to use null PMD to exercise rte_flow. Will add another automated test to exercise flow parser in automated test.

#20 lore raw

út 10. 2. 2026 v 15:45 odesílatel Stephen Hemminger < [email protected]> napsal:

Quoted 30 lines
Quoted 2 lines · On Mon, 2 Feb 2026 12:36:52 +0100 Lukas Sismis <[email protected]> wrote:

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

syntax.

Quoted 4 lines

Motivation
----------
External applications like Suricata IDS [1] need to express hardware

filtering

Quoted 1 line

rules in a consistent, human-readable format. Rather than inventing

custom

Quoted 17 lines

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 the following APIs:
- 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 library, ensuring a single maintained parser implementation.

Quoted 8 lines
Quoted 4 lines

Testing and Demo
-------
- Functional tests in dpdk-test
- Example application: examples/flow_parsing

I am working on being able to use null PMD to exercise rte_flow. Will add another automated test to exercise flow parser in automated test.

Great, thank you (also for the little fixes).
I tried to implement it in Suricata directly, and it suits me, so hopefully, it will work for you!