Skip to content

RFC regex/hs: introduce Hyperscan regex PMD

Prudvi Deti dpdk-dev 3 versions – New

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v3 RFC Latest7 patches 0 repliesNew
  2. v2 RFC7 patches 0 repliesSuperseded
  3. v1 RFC7 patches 1 replySuperseded

Patches in v3 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/7regex/hs: add driver skeleton and build integration.mailmap MAINTAINERS doc/guides/regexdevs/features/hs.ini +7 more+498 -00 replies
2/7regex/hs: add device configure and queue pair setupdrivers/regex/hs/hs_regex.c+182 -00 replies
3/7regex/hs: add rule database update and compilationdoc/guides/regexdevs/hs.rst drivers/regex/hs/hs_regex.c drivers/regex/hs/hs_regex.h+508 -10 replies
4/7regex/hs: add enqueue and dequeue burst pathsdrivers/regex/hs/hs_regex.c+236 -140 replies
5/7regex/hs: add per-queue-pair extended statisticsdoc/guides/regexdevs/hs.rst drivers/regex/hs/hs_regex.c+168 -00 replies
6/7regex/hs: add start stop close and device dumpdoc/guides/regexdevs/hs.rst drivers/regex/hs/hs_regex.c drivers/regex/hs/hs_regex.h+200 -00 replies
7/7regex/hs: add Hyperscan compile flag supportdoc/guides/regexdevs/hs.rst drivers/regex/hs/hs_regex.c drivers/regex/hs/hs_regex.h+74 -130 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v3 yet.

Read the v3 thread

Cover letter [RFC v3 0/7] regex/hs: introduce Hyperscan regex PMD

This RFC series adds a new regexdev PMD based on Hyperscan.

Goal: provide a software regex PMD for environments without regex HW, while keeping compatibility with the standard ``rte_regexdev`` API. The PMD is a virtual device, created with ``--vdev=regex_hs`` at EAL init.

The series introduces:
- a new vdev driver under ``drivers/regex/hs``
- device and queue pair configuration, start/stop/close lifecycle, and device dump support
- rule database update, compile+activate, import/export of serialized Hyperscan databases
- enqueue/dequeue burst paths with per-queue-pair scratch usage and per-queue-pair extended statistics (enqueued/dequeued/matches)
- PMD-private rule flag mappings for common Hyperscan compile options (singlematch, prefilter, SOM-leftmost, combination, quiet)

Behavior notes relevant for review:
- per-op match counters are bounded by API field width (``nb_matches``/``nb_actual_matches`` are ``uint16_t``)
- payload size exposed through regexdev is ``max_payload_size = 65535`` bytes, while Hyperscan block mode itself supports larger scan buffers
- queue pairs are intended for single-thread ownership (SPSC model) with dedicated scratch per queue pair

Documentation, feature matrix integration, meson integration, and maintainers metadata are included.

Prudvi Deti (7):
regex/hs: add driver skeleton and build integration regex/hs: add device configure and queue pair setup regex/hs: add rule database update and compilation regex/hs: add enqueue and dequeue burst paths regex/hs: add per-queue-pair extended statistics regex/hs: add start stop close and device dump regex/hs: add Hyperscan compile flag support

---
v3: Addressed AI review of the driver skeleton patch:
* Fixed a resource ordering issue in hs_regex_dev_create(): the device private data is now allocated before rte_regexdev_register(), so a registration failure cannot leave a registered device with no cleanup path, and a private-data allocation failure no longer needs to unregister the device.

v2: Addressed AI reviews with the following changes:
* Fixed a queue-pair resource leak on reconfigure (stale scratch and operation ring were not freed before reallocation).
* Rejected unsupported device and queue-pair configuration flags instead of silently ignoring them.
* Fixed a rule-id hash name collision between multiple device instances by including the device id in the hash name.
* Validated rule operations and fixed rule-id hash/array consistency on add and remove failures.
* Cleared the compiled-database state on a failed rule database import so a partially failed import cannot be reported as started.
* Implemented stop-on-match request handling and saturated the per-op actual-match count instead of wrapping past 65535.
* Fixed device info to report the backing vdev device instead of NULL.
* Moved the pending-operation warning so it fires on both explicit and implicit stop.
* Documented the 20-bit match-result rule-id limit and the unsupported high-priority match request mode.
* Capped dev_dump() rule listing with a summary line for large rule counts instead of printing every rule unconditionally.
* Documented that rule_db_export()'s output buffer has no alignment requirement.
* Documented building Hyperscan 5.4.2 from source as a prerequisite.

 .mailmap                               |    1 +
 MAINTAINERS                            |    6 +
 doc/guides/regexdevs/features/hs.ini   |    8 +
 doc/guides/regexdevs/hs.rst            |  235 ++++
 doc/guides/regexdevs/index.rst         |    1 +
 doc/guides/rel_notes/release_26_11.rst |   19 +
 drivers/regex/hs/hs_regex.c            | 1447 ++++++++++++++++++++++++
 drivers/regex/hs/hs_regex.h            |  101 ++
 drivers/regex/hs/meson.build           |   19 +
 drivers/regex/meson.build              |    1 +
 10 files changed, 1838 insertions(+)
 create mode 100644 doc/guides/regexdevs/features/hs.ini
 create mode 100644 doc/guides/regexdevs/hs.rst
 create mode 100644 drivers/regex/hs/hs_regex.c
 create mode 100644 drivers/regex/hs/hs_regex.h
 create mode 100644 drivers/regex/hs/meson.build
Signature · 1 line
2.43.0