From: Konstantin Ananyev <konstantin.ananyev@huawei.com>
To: Bruce Richardson <bruce.richardson@intel.com>,
Stephen Hemminger <stephen@networkplumber.org>
Cc: "dev@dpdk.org" <dev@dpdk.org>
Subject: RE: [RFC 1/3] flow_compile: introduce textual flow rule compiler
Date: Wed, 6 May 2026 10:10:42 +0000 [thread overview]
Message-ID: <ecdc2ac7f46f4f8095fa384121dac419@huawei.com> (raw)
In-Reply-To: <afr2frTWMC3kGKxq@bricha3-mobl1.ger.corp.intel.com>
> On Tue, May 05, 2026 at 08:29:55PM -0700, Stephen Hemminger wrote:
> > Currently the only way to compile a flow rule from text is to link
> > against testpmd's cmdline_flow.c, which is tightly coupled to
> > librte_cmdline and the testpmd command framework. Recent attempts
> > to extract it as a library have produced ad-hoc copies rather than
> > a clean separation.
> >
> > Add librte_flow_compile, modelled on libpcap's pcap_compile(): a
> > textual rule goes in, an opaque compiled object comes out, and
> > diagnostics of the form "line:col: message" go in a caller-supplied
> > buffer. Accessors return the rte_flow_attr/item/action arrays
> > ready for rte_flow_create(); a convenience entry point installs
> > the rule directly on a port.
> >
> > The parser is recursive descent driven by descriptor tables of
> > items and actions, so adding a new item type is purely a table
> > edit -- the parser has no per-type knowledge. A custom-setter
> > hook handles fields whose layout cannot be expressed as a plain
> > byte range (bitfields, indirect arrays).
> >
> > Dependencies are limited to rte_ethdev and rte_net; no
> > librte_cmdline, no flex/bison, no platform-specific headers.
> > The grammar follows testpmd's syntax so familiar rules carry
> > over and is documented in the programmer's guide.
> >
> Was there a particular reason to avoid using flex/bison here, or did their
> use just not make sense? In general I would prefer using code-generation
> tools where possible rather than maintaining (metaphorically) hand-written
> code.
In general, I like the idea of flow_compile(const char *) and the idea to make
it independent from cmdline lib.
Though I have the same question as Bruce: why not to use flex/bison here?
At first glance, that's the right tools for that kind of job and seems much better
then hand-written (AI generated) peace of code that no-one would probably understand.
Konstantin
next prev parent reply other threads:[~2026-05-06 10:10 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-05 18:39 [PATCH v12 0/6] flow_parser: add shared parser library Lukas Sismis
2026-05-05 18:39 ` [PATCH v12 1/6] cmdline: include stddef.h for MSVC compatibility Lukas Sismis
2026-05-05 18:39 ` [PATCH v12 2/6] ethdev: add RSS type helper APIs Lukas Sismis
2026-05-05 18:39 ` [PATCH v12 3/6] ethdev: add flow parser library Lukas Sismis
2026-05-05 18:39 ` [PATCH v12 4/6] app/testpmd: use flow parser from ethdev Lukas Sismis
2026-05-05 18:39 ` [PATCH v12 5/6] examples/flow_parsing: add flow parser demo Lukas Sismis
2026-05-05 18:39 ` [PATCH v12 6/6] test: add flow parser functional tests Lukas Sismis
2026-05-05 18:46 ` [PATCH v12 0/6] flow_parser: add shared parser library Lukáš Šišmiš
2026-05-05 21:59 ` Stephen Hemminger
2026-05-07 12:29 ` Lukáš Šišmiš
2026-05-06 3:29 ` [RFC PATCH 0/3] flow_compile: textual flow rule compiler Stephen Hemminger
2026-05-06 3:29 ` [RFC 1/3] flow_compile: introduce " Stephen Hemminger
2026-05-06 8:06 ` Bruce Richardson
2026-05-06 10:10 ` Konstantin Ananyev [this message]
2026-05-06 15:46 ` Stephen Hemminger
2026-05-06 15:56 ` Bruce Richardson
2026-05-06 17:11 ` Stephen Hemminger
2026-05-06 3:29 ` [RFC 2/3] doc: add programmer's guide for " Stephen Hemminger
2026-05-06 3:29 ` [RFC 3/3] test/flow_compile: add unit tests " Stephen Hemminger
2026-05-07 0:06 ` [RFC v2 0/4] flow_compile: textual " Stephen Hemminger
2026-05-07 0:06 ` [RFC v2 1/4] config: add support for using flex and bison Stephen Hemminger
2026-05-07 0:06 ` [RFC v2 2/4] flow_compile: introduce textual flow rule compiler Stephen Hemminger
2026-05-07 0:06 ` [RFC v2 3/4] doc: add programmer's guide for " Stephen Hemminger
2026-05-07 0:06 ` [RFC v2 4/4] test/flow_compile: add unit tests " Stephen Hemminger
2026-05-07 2:54 ` [RFC v2 0/4] flow_compile: textual " Stephen Hemminger
2026-05-07 8:10 ` Bruce Richardson
2026-05-07 16:09 ` Stephen Hemminger
2026-05-07 16:26 ` Bruce Richardson
2026-05-07 16:57 ` 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=ecdc2ac7f46f4f8095fa384121dac419@huawei.com \
--to=konstantin.ananyev@huawei.com \
--cc=bruce.richardson@intel.com \
--cc=dev@dpdk.org \
--cc=stephen@networkplumber.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