Skip to contentSkip to conversation

flow_parser: add shared parser library

PATCH Superseded Lukas Sismis 4 participants 13 messages Jan 15 – Jan 20 Arm/Amlogic Meson SoC support

v3 of 12 Superseded Latest is v12 →

lore
Share & tools
lore
#0 lore raw

v3 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, 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
Signature · 1 line
2.43.7
#1 lore raw

PATCH v3 1/7 cmdline: include stddef.h for offsetof

Include <stddef.h> at the top of cmdline_parse.h before the fallback offsetof macro definition. This prevents macro redefinition warnings when building with MSVC which uses /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 v3 3/7 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            |   254 +-
 app/test-pmd/cmdline_flow.c       | 14434 ----------------------------
 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 +-
 lib/flow_parser/rte_flow_parser.c |   328 +-
 lib/flow_parser/rte_flow_parser.h |   126 +-
 13 files changed, 1013 insertions(+), 14982 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.h
 create mode 100644 app/test-pmd/flow_parser_cli.c
MAINTAINERS +1 -1
index 7089dfbc69..4a5c142ee8 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 +152 -102

434 lines not on this page · raw message

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

2,490 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 +406 -0

406 lines not on this page · raw message

app/test-pmd/flow_parser.h new file +8 -0
new file mode 100644
index 0000000000..2f77bc45e8

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

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

149 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 1fe41d852a..ab9c76a5c2 100644

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

app/test-pmd/testpmd.h +4 -122

126 lines not on this page · raw message

lib/flow_parser/rte_flow_parser.c +186 -142

328 lines not on this page · raw message

lib/flow_parser/rte_flow_parser.h +67 -59

126 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.

#3 lore raw

Re: [PATCH v3 3/7] app/testpmd: use shared flow parser library

app/test-pmd/cmdline.c static void cmd_set_nvgre_parsed(void *parsed_result, · line 10599

Quoted 10 lines · On Fri, 16 Jan 2026 00:01:09 +0100 Lukas Sismis <[email protected]> wrote:
app/test-pmd/cmdline.c +4 -4
-	if (nvgre_encap_conf.select_vlan)
-		nvgre_encap_conf.vlan_tci = rte_cpu_to_be_16(res->tci);
-	rte_memcpy(nvgre_encap_conf.eth_src, res->eth_src.addr_bytes,
+	if (nvgre_conf->select_vlan)
+		nvgre_conf->vlan_tci = rte_cpu_to_be_16(res->tci);
+	rte_memcpy(nvgre_conf->eth_src, res->eth_src.addr_bytes,
 		   RTE_ETHER_ADDR_LEN);
-	rte_memcpy(nvgre_encap_conf.eth_dst, res->eth_dst.addr_bytes,
+	rte_memcpy(nvgre_conf->eth_dst, res->eth_dst.addr_bytes,
 		   RTE_ETHER_ADDR_LEN);

rte_memcpy() should not be used everywhere. It should only be used in optimized data paths with variable length values. The compiler inlining is as fast or faster and static checkers do better job of checking for overrruns.

Also, where possible use rte_ether_addr_copy or structure assignment

#4 lore raw

PATCH v3 4/7 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      | 288 ++++++++++++++++++++++++++++++
 examples/flow_parsing/meson.build |  11 ++
 examples/meson.build              |   1 +
 4 files changed, 301 insertions(+)
 create mode 100644 examples/flow_parsing/main.c
 create mode 100644 examples/flow_parsing/meson.build
MAINTAINERS +1 -0
index 4a5c142ee8..ff6d3d2fa8 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 +288 -0

288 lines not on this page · raw message

examples/flow_parsing/meson.build new file +11 -0
new file mode 100644
index 0000000000..deab338bfb
@@ -0,0 +1,11 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright(c) 2024 Intel Corporation
+
+# 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
#5 lore raw

Re: [PATCH v3 4/7] examples/flow_parsing: add flow parser demo

examples/flow_parsing/main.c line 55

Quoted 7 lines · On Fri, 16 Jan 2026 00:01:10 +0100 Lukas Sismis <[email protected]> wrote:
examples/flow_parsing/main.c new file +7 -0
+/* Helper to print a MAC address */
+static void
+print_mac(const char *label, const uint8_t *mac)
+{
+	printf("    %s: %02x:%02x:%02x:%02x:%02x:%02x\n", label,
+	       mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
+}

Prefer use of rte_ether_format_addr

#6 lore raw

PATCH v3 5/7 dpdk-test: add flow parser library functional tests

In reply to Lukas Sismis

Tests cover:
- success cases - veryfing variety of flow/set rules through the main parse function and through parser helpers
- fail cases - to test invalid arguments/input/syntax

---
 MAINTAINERS                 |   1 +
 app/test/meson.build        |   1 +
 app/test/test_flow_parser.c | 698 ++++++++++++++++++++++++++++++++++++
 3 files changed, 700 insertions(+)
 create mode 100644 app/test/test_flow_parser.c
MAINTAINERS +1 -0
index ff6d3d2fa8..c6ae31cb10 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 efec42a6bf..03cf8aa70c 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 +698 -0

698 lines not on this page · raw message

Signature · 1 line
2.43.7
#7 lore raw

PATCH v3 6/7 mailmap: update a new contributor email

In reply to Lukas Sismis
---
 .mailmap | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
.mailmap +1 -1
index 2f089326ff..d838ffb4db 100644
@@ -933,7 +933,7 @@ Luca Boccassi <[email protected]> <[email protected]>
 Luca Boccassi <[email protected]> <[email protected]>
 Luca Vizzarro <[email protected]>
 Luka Jankovic <[email protected]>
-Lukas Sismis <[email protected]>
+Lukas Sismis <[email protected]> <[email protected]>
 Lukasz Bartosik <[email protected]>
 Lukasz Cieplicki <[email protected]>
 Lukasz Czapnik <[email protected]>
Signature · 1 line
2.43.7
#8 lore raw

PATCH v3 7/7 dts: fix invalid f-string syntax in testpmd API

In reply to Lukas Sismis

The f-string syntax was missing the 'f' prefix, causing string interpolation to fail.

Fixes cfd851f264 ("dts: add QinQ strip and VLAN extend to testpmd shell")
---
 dts/api/testpmd/__init__.py | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
dts/api/testpmd/__init__.py +4 -4
index a20dedc25a..703cae487e 100644
@@ -227,7 +227,7 @@ def start_tx_first(self, burst_num: int, verify: bool = True) -> None:
             InteractiveCommandExecutionError: If `verify` is :data:`True` and forwarding fails to
                 start or ports fail to come up.
         """
-        self.send_command(f"start tx_first {burst_num if burst_num is not None else ""}")
+        self.send_command(f"start tx_first {burst_num if burst_num is not None else ''}")
         if verify:
             # If forwarding was already started, sending "start" again should tell us
             start_cmd_output = self.send_command("start")
@@ -898,11 +898,11 @@ def set_qinq_strip(self, port: int, enable: bool, verify: bool = True) -> None:
             vlan_settings = self.show_port_info(port_id=port).vlan_offload
             if enable ^ (vlan_settings is not None and VLANOffloadFlag.QINQ_STRIP in vlan_settings):
                 self._logger.debug(
-                    f"Failed to {"enable" if enable else "disable"}"
+                    f"Failed to {'enable' if enable else 'disable'}"
                     f"QinQ strip on port {port}: \n{qinq_cmd_output}"
                 )
                 raise InteractiveCommandExecutionError(
-                    f"Failed to {"enable" if enable else "disable"} QinQ strip on port {port}"
+                    f"Failed to {'enable' if enable else 'disable'} QinQ strip on port {port}"
                 )
 
     def set_mac_address(self, port: int, mac_address: str, verify: bool = True) -> None:
@@ -1535,7 +1535,7 @@ def set_port_mbuf_fast_free(
             InteractiveCommandExecutionError: If mbuf_fast_free could not be set successfully.
         """
         mbuf_output = self.send_command(
-            f"port config {port_id} tx_offload mbuf_fast_free {"on" if on else "off"}"
+            f"port config {port_id} tx_offload mbuf_fast_free {'on' if on else 'off'}"
         )
 
         if verify and "Error" in mbuf_output:
Signature · 1 line
2.43.7
Reviewed-by on v3 7/7
#9 lore raw

Re: [PATCH v3 7/7] dts: fix invalid f-string syntax in testpmd API

Quoted 8 lines · Lukas Sismis

The f-string syntax was missing the 'f' prefix, causing string interpolation to fail.

Fixes cfd851f264 ("dts: add QinQ strip and VLAN extend to testpmd shell")

Seems like the commit message is a bit misleading, otherwise looks good. Thanks for the fix!

Reviewed-by on v3 7/7
#10 lore raw

Re: [PATCH v3 7/7] dts: fix invalid f-string syntax in testpmd API

In reply to Lukas Sismis

Looks good to me, thanks for finding this issue. And, since we do need the 'enable' strings to be templated in right, I am asking Dean to re-run this testsuite with your patch applied.

Thomas, I gather this series will not be applied/go through next-dts since it is not primarily a DTS series, but please let me know if it should. I am asking you since I see it is delegated to you on Patchwork.

Quoted 64 lines · Lukas Sismis

The f-string syntax was missing the 'f' prefix, causing string interpolation to fail.

Fixes cfd851f264 ("dts: add QinQ strip and VLAN extend to testpmd shell")
---
 dts/api/testpmd/__init__.py | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
dts/api/testpmd/__init__.py +0 -0
index a20dedc25a..703cae487e 100644
@@ -227,7 +227,7 @@ def start_tx_first(self, burst_num: int, verify: bool

= True) -> None:
InteractiveCommandExecutionError: If verify is :data:True
and forwarding fails to
start or ports fail to come up.
"""
- self.send_command(f"start tx_first {burst_num if burst_num is not
None else ""}")
+ self.send_command(f"start tx_first {burst_num if burst_num is not
None else ''}")
if verify:
# If forwarding was already started, sending "start" again
should tell us
start_cmd_output = self.send_command("start")

dts/api/testpmd/__init__.py +0 -0
@@ -898,11 +898,11 @@ def set_qinq_strip(self, port: int, enable: bool,

verify: bool = True) -> None:
vlan_settings = self.show_port_info(port_id=port).vlan_offload if enable ^ (vlan_settings is not None and
VLANOffloadFlag.QINQ_STRIP in vlan_settings):

                 self._logger.debug(
dts/api/testpmd/__init__.py +1 -2
-                    f"Failed to {"enable" if enable else "disable"}"
+                    f"Failed to {'enable' if enable else 'disable'}"
                     f"QinQ strip on port {port}: \n{qinq_cmd_output}"
                 )
                 raise InteractiveCommandExecutionError(
-                    f"Failed to {"enable" if enable else "disable"} QinQ

strip on port {port}"
+ f"Failed to {'enable' if enable else 'disable'} QinQ
strip on port {port}"
)

def set_mac_address(self, port: int, mac_address: str, verify: bool =
True) -> None:

dts/api/testpmd/__init__.py +0 -0
@@ -1535,7 +1535,7 @@ def set_port_mbuf_fast_free(
             InteractiveCommandExecutionError: If mbuf_fast_free could not

be set successfully.

         """
         mbuf_output = self.send_command(

- f"port config {port_id} tx_offload mbuf_fast_free {"on" if on
else "off"}"
+ f"port config {port_id} tx_offload mbuf_fast_free {'on' if on
else 'off'}"
)

if verify and "Error" in mbuf_output:
--
2.43.7

#11 lore raw

Re: [PATCH v3 7/7] dts: fix invalid f-string syntax in testpmd API

Quoted 2 lines · Patrick Robb

Looks good to me, thanks for finding this issue. And, since we do need the 'enable' strings to be templated in right, I am asking Dean to re-run this testsuite with your patch applied.

Test suite passes with the patch applied

#12 lore raw
In reply to Lukas Sismis
Quoted 86 lines · On Fri, 16 Jan 2026 00:01:06 +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, 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
Quoted 9 lines
 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

Overall looks good, some AI comments.

---

## DPDK Patch Review: flow_parser library v3 (7 patches)

### Overview
This series introduces librte_flow_parser as an experimental library exposing the testpmd flow CLI parser as a reusable component, along with supporting changes.

---

## Patch 1/7: cmdline: include stddef.h for offsetof

### Commit Message ✅

| Criteria | Status | Notes |
|----------|--------|-------|
| Subject ≤60 chars | ✅ Pass | 41 characters |
| Lowercase after colon | ✅ Pass | "include stddef.h..." |
| Correct prefix | ✅ Pass | `cmdline:` is correct for lib/cmdline |
| Imperative mood | ✅ Pass | "include" is imperative |
| No trailing period | ✅ Pass | |
| Body ≤75 chars | ✅ Pass | |
| Signed-off-by | ✅ Pass | Present with valid name/email |

### Code ✅
- Simple, correct fix
- No issues identified

**Verdict: PASS** - Ready to merge

---

## Patch 2/7: flow_parser: add shared parser library

### Commit Message

| Criteria | Status | Notes |
|----------|--------|-------|
| Subject ≤60 chars | ✅ Pass | 38 characters |
| Lowercase after colon | ✅ Pass | |
| Correct prefix | ✅ Pass | `flow_parser:` for new lib |
| Body ≤75 chars | ✅ Pass | |
| Signed-off-by | ✅ Pass | |

**⚠️ Warning (typo in body):** Line 212 has "Lightweigth" → should be "Lightweight"

### License/Copyright ✅

| File | SPDX | Copyright | Blank line |
|------|------|-----------|------------|
| rte_flow_parser.c | ✅ BSD-3-Clause | ✅ "Copyright 2026 Dyna-NIC" | ✅ |
| rte_flow_parser.h | ✅ BSD-3-Clause | ✅ "Copyright(c) 2026 Dyna-NIC" | ✅ |
| meson.build | ✅ BSD-3-Clause | N/A (scripts don't require) | ✅ |

### API Tags ✅

- All new APIs correctly marked __rte_experimental
- __rte_experimental appears alone on line preceding return type (verified in header)
- Proper RTE_EXPORT_EXPERIMENTAL_SYMBOL usage in .c file

### Code Style

| Criteria | Status | Notes |
|----------|--------|-------|
| Lines ≤100 chars | ✅ Pass | |
| rte_ prefix on symbols | ✅ Pass | All external symbols use `rte_flow_parser_*` |
| Header guards | ✅ Pass | `RTE_FLOW_PARSER_H` |
| Include order | ✅ Pass | System, then DPDK, then local |

### Documentation ✅

- ✅ Programmer's guide added (doc/guides/prog_guide/flow_parser_lib.rst)
- ✅ Release notes updated (doc/guides/rel_notes/release_26_03.rst)
- ✅ MAINTAINERS updated
- ✅ Doxygen comments for public APIs

### Structure Concerns

**⚠️ Warning:** New ethdev APIs added in this patch:
- rte_eth_rss_type_info_get()
- rte_eth_rss_type_from_str()
- rte_eth_rss_type_to_str()
- New typedefs: rte_port_id_t, rte_queue_id_t

These ethdev additions should ideally be in a separate patch for easier review and bisectability.

**⚠️ Warning:** The new ethdev APIs (rte_eth_rss_type_*) are marked experimental but should have testpmd hooks and tests per DPDK guidelines.

### Meson Build ✅

```python
# SPDX-License-Identifier: BSD-3-Clause

sources = files('rte_flow_parser.c')
headers = files('rte_flow_parser.h')

deps += ['cmdline', 'ethdev']
```

- 4-space indentation ✅
- Short lists on single line ✅

**Verdict: PASS with warnings**

---

## Patch 3/7: app/testpmd: integrate flow parser library

### Commit Message ✅

| Criteria | Status | Notes |
|----------|--------|-------|
| Subject ≤60 chars | ✅ Pass | 43 characters |
| Correct prefix | ✅ Pass | `app/testpmd:` |
| Signed-off-by | ✅ Pass | |

This is a large refactoring patch that moves code from testpmd to the new library. The changes look appropriate for the integration.

**Verdict: PASS**

---

## Patch 4/7: examples/flow_parsing: add flow parser demo

### Commit Message ✅

| Criteria | Status | Notes |
|----------|--------|-------|
| Subject ≤60 chars | ✅ Pass | 42 characters |
| Correct prefix | ✅ Pass | `examples/flow_parsing:` |
| Signed-off-by | ✅ Pass | |

### License ✅
- SPDX-License-Identifier: BSD-3-Clause on line 1
- Copyright on line 2
- Blank line before code

### Code ✅
- Good example demonstrating the API
- Proper include order
- Comments explain the purpose

**Verdict: PASS**

---

## Patch 5/7: Copyright attribution fix

This patch updates copyright attribution in rte_flow_parser.c to include original authors (6WIND, Mellanox) since the code derives from testpmd's cmdline_flow.c.

**Verdict: PASS** - Good practice to maintain attribution

---

## Patch 6/7: mailmap: update contributor email

### Commit Message

| Criteria | Status | Notes |
|----------|--------|-------|
| Subject ≤60 chars | ✅ Pass | 29 characters |
| Correct prefix | ✅ Pass | `mailmap:` |
| Signed-off-by | ✅ Pass | |

**❌ Error:** Commit body is empty. Per AGENTS.md guidelines, the body should describe the change.

**Recommendation:** Add body text like:

```
Update email address for Lukas Sismis from cesnet.cz to dyna-nic.com.
```

**Verdict: NEEDS WORK** - Add commit body

---

## Patch 7/7: dts: fix invalid f-string syntax in testpmd API

### Commit Message ✅

| Criteria | Status | Notes |
|----------|--------|-------|
| Subject ≤60 chars | ✅ Pass | 50 characters |
| Correct prefix | ✅ Pass | `dts:` |
| Fixes tag | ✅ Pass | Present with 12-char SHA |
| Cc: [email protected] | ✅ Pass | Present for bug fix |
| Tag order | ✅ Pass | Fixes, Cc, blank line, Signed-off-by |
| Signed-off-by | ✅ Pass | |

### Code ✅
The fix changes "" to '' inside f-strings, which is correct. Python f-strings require the inner quotes to differ from outer quotes.

**Verdict: PASS**

---

## Summary

| Patch | Status | Issues |
|-------|--------|--------|
| 1/7 cmdline | ✅ PASS | None |
| 2/7 flow_parser | ⚠️ PASS | Typo "Lightweigth", ethdev APIs should be separate patch |
| 3/7 testpmd integration | ✅ PASS | None |
| 4/7 example | ✅ PASS | None |
| 5/7 copyright | ✅ PASS | None |
| 6/7 mailmap | ❌ NEEDS WORK | Missing commit body |
| 7/7 dts fix | ✅ PASS | None |

### Required Fixes
1. **Patch 6/7:** Add commit message body describing the email update

### Recommended Improvements
1. **Patch 2/7:** Fix typo "Lightweigth" → "Lightweight" in commit body
2. **Patch 2/7:** Consider splitting ethdev API additions (rte_eth_rss_type_*, typedefs) into a separate prerequisite patch
3. **Patch 2/7:** Ensure new ethdev APIs have corresponding tests