[v2,01/20] regex/mlx5: add RegEx PMD layer and mlx5 driver

Message ID 1594587541-110442-2-git-send-email-orika@mellanox.com (mailing list archive)
State Superseded, archived
Delegated to: Thomas Monjalon
Headers
Series add Mellanox RegEx PMD |

Checks

Context Check Description
ci/checkpatch warning coding style issues
ci/Performance-Testing fail build patch failure
ci/Intel-compilation fail apply issues
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-testing fail Testing issues

Commit Message

Ori Kam July 12, 2020, 8:58 p.m. UTC
  From: Yuval Avnery <yuvalav@mellanox.com>

This commit introduce the RegEx poll mode drivers class, and
adds Mellanox RegEx PMD.

Signed-off-by: Yuval Avnery <yuvalav@mellanox.com>
Signed-off-by: Ori Kam <orika@mellanox.com>
---
v2:
* Add documantion.

---
 MAINTAINERS                                       |  12 +++
 config/common_base                                |   5 +
 doc/guides/index.rst                              |   1 +
 doc/guides/regexdevs/features/default.ini         |  17 ++++
 doc/guides/regexdevs/features/mlx5.ini            |  10 ++
 doc/guides/regexdevs/features_overview.rst        | 118 ++++++++++++++++++++++
 doc/guides/regexdevs/index.rst                    |  15 +++
 doc/guides/regexdevs/mlx5.rst                     |  95 +++++++++++++++++
 doc/guides/regexdevs/overview_feature_table.txt   | 105 +++++++++++++++++++
 doc/guides/rel_notes/release_20_08.rst            |   5 +
 drivers/Makefile                                  |   2 +
 drivers/common/Makefile                           |   2 +-
 drivers/common/mlx5/Makefile                      |   4 +-
 drivers/meson.build                               |   3 +-
 drivers/regex/Makefile                            |   8 ++
 drivers/regex/meson.build                         |   9 ++
 drivers/regex/mlx5/Makefile                       |  34 +++++++
 drivers/regex/mlx5/meson.build                    |  32 ++++++
 drivers/regex/mlx5/mlx5_regex.c                   |   5 +
 drivers/regex/mlx5/mlx5_regex.h                   |   8 ++
 drivers/regex/mlx5/rte_pmd_mlx5_regex_version.map |   3 +
 mk/rte.app.mk                                     |   5 +-
 22 files changed, 492 insertions(+), 6 deletions(-)
 create mode 100644 doc/guides/regexdevs/features/default.ini
 create mode 100644 doc/guides/regexdevs/features/mlx5.ini
 create mode 100644 doc/guides/regexdevs/features_overview.rst
 create mode 100644 doc/guides/regexdevs/index.rst
 create mode 100644 doc/guides/regexdevs/mlx5.rst
 create mode 100644 doc/guides/regexdevs/overview_feature_table.txt
 create mode 100644 drivers/regex/Makefile
 create mode 100644 drivers/regex/meson.build
 create mode 100644 drivers/regex/mlx5/Makefile
 create mode 100644 drivers/regex/mlx5/meson.build
 create mode 100644 drivers/regex/mlx5/mlx5_regex.c
 create mode 100644 drivers/regex/mlx5/mlx5_regex.h
 create mode 100644 drivers/regex/mlx5/rte_pmd_mlx5_regex_version.map
  

Comments

Thomas Monjalon July 15, 2020, 5:20 p.m. UTC | #1
12/07/2020 22:58, Ori Kam:
> From: Yuval Avnery <yuvalav@mellanox.com>
> 
> This commit introduce the RegEx poll mode drivers class, and
> adds Mellanox RegEx PMD.
> 
> Signed-off-by: Yuval Avnery <yuvalav@mellanox.com>
> Signed-off-by: Ori Kam <orika@mellanox.com>
> ---
> v2:
> * Add documantion.

First typo. Bad start for a doc update...

> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -453,7 +453,9 @@ F: doc/guides/compressdevs/features/default.ini
>  RegEx API - EXPERIMENTAL
>  M: Ori Kam <orika@mellanox.com>
>  F: lib/librte_regexdev/
> +F: drivers/regex/

No, please don't.

>  F: doc/guides/prog_guide/regexdev.rst
> +F: doc/guides/regexdevs/features/default.ini

> +RegEx Drivers
> +------------------

Too much underlines

[...]
> +; Features of a default RegEx driver.
> +;
> +; This file defines the features that are valid for inclusion in
> +; the other driver files and also the order that they appear in
> +; the features table in the documentation. The feature description
> +; string should not exceed feature_str_len defined in conf.py.
> +;
> +[Features]
> +ARMv7                =

obsolete

> +ARMv8                =

Should be "Armv8" (with lower cases) or aarch64.

> +Power8               =

not very used

> +x86-32               =

not very used

> +x86-64               =

You can add simply "x86".

> +Usage doc            =
> +Design doc           =
> +Perf doc             =

I think you drop docs from the features list.

[...]
> +++ b/doc/guides/regexdevs/features_overview.rst
> @@ -0,0 +1,118 @@
> +..  SPDX-License-Identifier: BSD-3-Clause
> +    Copyright 2020 Mellanox Technologies, Ltd

Why 4 spaces? 3 are enough (and recommended in code style I think).

> +
> +Overview of RegEx Drivers Features
> +==================================
> +
> +This section explains the supported features that are listed in the table below.
> +
> +Cross buffer
> +  Support cross buffer detection.
> +
> +PCRE start anchor
> +  Support PCRE start anchor.
> +
> +PCRE atomic grouping
> +  Support PCRE atomic grouping.
> +
> +PCRE back reference
> +  Support PCRE back regerence.
> +
> +PCRE back tracking ctrl
> +  Support PCRE back tracking ctrl.
> +
> +PCRE call outs
> +  Support PCRE call outes.
> +
> +PCRE forward reference
> +  Support Forward reference.
> +
> +PCRE greedy
> +  Support PCRE greedy mode.
> +
> +PCRE match all
> +  Support PCRE match all.
> +
> +PCRE match as end
> +  Support match as end.
> +
> +PCRE match point rst
> +  Support PCRE match point reset directive.
> +
> +PCRE New line conventions
> +  Support new line conventions.
> +
> +PCRE new line SEQ
> +  Support new line sequence.
> +
> +PCRE look around
> +  Support PCRE look around.
> +
> +PCRE possessive qualifiers
> +  Support PCRE possessive qualifiers.
> +
> +PCRE subroutine references
> +  Support PCRE subroutine references.
> +
> +PCRE UTF 8
> +  Support UTF-8.
> +
> +PCRE UTF 16
> +  Support UTF-16.
> +
> +PCRE UTF 32
> +  Support UTF-32.
> +
> +PCRE word boundary
> +  Support word boundaries.
> +
> +Run time compilation
> +  Support compilation during run time.
> +

All these features are not in features.ini

> +.. note::
> +
> +   Most of the features capabilities should be provided by the drivers via the
> +   next vDPA operations: ``get_features`` and ``get_protocol_features``.

Now I understand why we don't have doc reviews:
even the author is not reading its own doc!

> +
> +
> +References
> +==========
> +
> +  * `PCRE: PCRE patteren man page <https://www.pcre.org/original/doc/html/pcrepattern.html>`_

Typo

> +++ b/doc/guides/regexdevs/index.rst
> @@ -0,0 +1,15 @@
> +..  SPDX-License-Identifier: BSD-3-Clause
> +    Copyright 2020 Mellanox Technologies, Ltd

3 spaces are enough

> +++ b/doc/guides/regexdevs/mlx5.rst
> @@ -0,0 +1,95 @@
> +..  SPDX-License-Identifier: BSD-3-Clause
> +    Copyright 2020 Mellanox Technologies, Ltd

3 spaces are enough

> +Design
> +------
> +
> +This PMD is configuring the RegEx HW engine.
> +For the PMD to work, the application must supply
> +a precompiled rule file in rof2 format.

A link to rof2?

> +
> +The PMD can use libibverbs and libmlx5 to access the device firmware
> +or directly the hardware components.

can? or always?
s/can use/uses/

> +There are different levels of objects and bypassing abilities
> +to get the best performances:
> +
> +- Verbs is a complete high-level generic API
> +- Direct Verbs is a device-specific API
> +- DevX allows to access firmware objects
> +- Direct Rules manages flow steering at low-level hardware layer

How flow steering is related to RegEx engine?

> +
> +Enabling librte_pmd_mlx5_regex causes DPDK applications to be linked against
> +libibverbs.
> +
> +A Mellanox mlx5 PCI device can be probed by either net/mlx5 driver or regex/mlx5
> +driver but not in parallel. Hence, the user should decide the driver by dissabling

disabling

> +the net device using ``CONFIG_RTE_LIBRTE_MLX5_PMD``.

The meson disabling option is missing.

Isn't is possible to decide at runtime with devargs?

> +
> +Supported NICs
> +--------------
> +
> +* Mellanox\ |reg| BlueField 2 SmartNIC
> +
> +Prerequisites
> +-------------
> +
> +- Mellanox OFED version: **5.0**
> +  see :doc:`../../nics/mlx5` guide for more Mellanox OFED details.

Which upstream rdma-core version?

> +- Enable the RegEx caps using system call from the BlueField 2.
> +  Contact Mellanox support for detail explanation.

Why not giving the details here?
Or link to an external doc?

> +
> +Compilation options
> +~~~~~~~~~~~~~~~~~~~
> +
> +These options can be modified in the ``.config`` file.
> +
> +- ``CONFIG_RTE_LIBRTE_MLX5_REGEX_PMD`` (default **n**)
> +
> +  Toggle compilation of librte_pmd_mlx5 itself.
> +
> +- ``CONFIG_RTE_IBVERBS_LINK_DLOPEN`` (default **n**)
> +
> +  Build PMD with additional code to make it loadable without hard
> +  dependencies on **libibverbs** nor **libmlx5**, which may not be installed
> +  on the target system.
> +
> +  In this mode, their presence is still required for it to run properly,
> +  however their absence won't prevent a DPDK application from starting (with
> +  ``CONFIG_RTE_BUILD_SHARED_LIB`` disabled) and they won't show up as
> +  missing with ``ldd(1)``.
> +
> +  It works by moving these dependencies to a purpose-built rdma-core "glue"
> +  plug-in which must either be installed in a directory whose name is based
> +  on ``CONFIG_RTE_EAL_PMD_PATH`` suffixed with ``-glue`` if set, or in a
> +  standard location for the dynamic linker (e.g. ``/lib``) if left to the
> +  default empty string (``""``).
> +
> +  This option has no performance impact.
> +
> +- ``CONFIG_RTE_IBVERBS_LINK_STATIC`` (default **n**)
> +
> +  Embed static flavor of the dependencies **libibverbs** and **libmlx5**
> +  in the PMD shared library or the executable static binary.

These options are not specific to this driver.
We should link to the original explanations in the net PMD.

By the way it is missing meson explanations.

[...]
> --- /dev/null
> +++ b/doc/guides/regexdevs/overview_feature_table.txt

This generated file should not be committed in the repo.

You are missing an update in doc/guides/conf.py and .gitignore.

[...]
> +* **Added the RegEx Library, a generic RegEx service library.**

Redundant with previous lib addition.

> +
> +  Added Mellanox MLX5 RegEx PMD driver, which implements the RegEx library
> +  and allows to offload RegEx searches.
> +

Please prefer this rebased change:

   Added the RegEx library which provides an API for offload of regular
   expressions search operations to hardware or software accelerator devices.
 
+  Added Mellanox RegEx PMD, allowing to offload RegEx searches.
+

> --- a/drivers/Makefile
> +++ b/drivers/Makefile
> @@ -24,5 +24,7 @@ DIRS-$(CONFIG_RTE_LIBRTE_EVENTDEV) += event
>  DEPDIRS-event := common bus mempool net crypto
>  DIRS-$(CONFIG_RTE_LIBRTE_RAWDEV) += raw
>  DEPDIRS-raw := common bus mempool net event
> +DIRS-$(CONFIG_RTE_LIBRTE_REGEXDEV) += regex
> +DEPDIRS-regex := common

Please keep same order everywhere: regex between compressdev and eventdev.
(yes vdpa should have been just after net)

[...]
> --- a/drivers/meson.build
> +++ b/drivers/meson.build
> @@ -11,7 +11,8 @@ dpdk_driver_classes = ['common',
>  	       'compress', # depends on common, bus, mempool.
>  	       'vdpa',    # depends on common, bus and mempool.
>  	       'event',   # depends on common, bus, mempool and net.
> -	       'baseband'] # depends on common and bus.
> +	       'baseband', # depends on common and bus.
> +	       'regex'] # depends on common, bus, regexdev.

Again, please add after compress.

[...]
> +if get_option('buildtype').contains('debug')
> +	cflags += [ '-pedantic', '-DPEDANTIC' ]
> +else
> +	cflags += [ '-UPEDANTIC' ]
> +endif

Please let's stop with pedantic now.

By the way, it does not compile:
	drivers/regex/mlx5/mlx5_regex.c:6: error:
	ISO C forbids an empty translation unit [-Werror=pedantic]
  
Thomas Monjalon July 15, 2020, 5:29 p.m. UTC | #2
12/07/2020 22:58, Ori Kam:
> From: Yuval Avnery <yuvalav@mellanox.com>
[...]
> +++ b/drivers/regex/mlx5/Makefile
> +LDLIBS += -lrte_common_mlx5
> +LDLIBS += -lm
> +LDLIBS += -lrte_eal -lrte_mbuf
> +LDLIBS += -lrte_kvargs
> +LDLIBS += -lrte_bus_pci
[...]
> +++ b/drivers/regex/mlx5/meson.build
> +deps += ['common_mlx5', 'pci', 'bus_pci', 'eal', 'sched']

sched is not needed
Is 'pci' needed? It is not in the Makefile.
  

Patch

diff --git a/MAINTAINERS b/MAINTAINERS
index 3cd402b..272359f 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -453,7 +453,9 @@  F: doc/guides/compressdevs/features/default.ini
 RegEx API - EXPERIMENTAL
 M: Ori Kam <orika@mellanox.com>
 F: lib/librte_regexdev/
+F: drivers/regex/
 F: doc/guides/prog_guide/regexdev.rst
+F: doc/guides/regexdevs/features/default.ini
 
 Eventdev API
 M: Jerin Jacob <jerinj@marvell.com>
@@ -1128,6 +1130,16 @@  F: doc/guides/compressdevs/zlib.rst
 F: doc/guides/compressdevs/features/zlib.ini
 
 
+RegEx Drivers
+------------------
+
+Mellanox MLX5
+M: Ori Kam <orika@mellanox.com>
+F: drivers/regex/mlx5/
+F: doc/guides/regexdevs/mlx5.rst
+F: doc/guides/regexdevs/features/mlx5.ini
+
+
 vDPA Drivers
 ------------
 T: git://dpdk.org/next/dpdk-next-virtio
diff --git a/config/common_base b/config/common_base
index f7a8824..f76585f 100644
--- a/config/common_base
+++ b/config/common_base
@@ -375,6 +375,11 @@  CONFIG_RTE_LIBRTE_MLX5_PMD=n
 CONFIG_RTE_LIBRTE_MLX5_DEBUG=n
 
 #
+# Compile regex-oriented Mellanox PMD
+#
+CONFIG_RTE_LIBRTE_MLX5_REGEX_PMD=n
+
+#
 # Compile vdpa-oriented Mellanox ConnectX-6 & BlueField (MLX5) PMD
 #
 CONFIG_RTE_LIBRTE_MLX5_VDPA_PMD=n
diff --git a/doc/guides/index.rst b/doc/guides/index.rst
index 988c6ea..857f036 100644
--- a/doc/guides/index.rst
+++ b/doc/guides/index.rst
@@ -20,6 +20,7 @@  DPDK documentation
    cryptodevs/index
    compressdevs/index
    vdpadevs/index
+   regexdevs/index
    eventdevs/index
    rawdevs/index
    mempool/index
diff --git a/doc/guides/regexdevs/features/default.ini b/doc/guides/regexdevs/features/default.ini
new file mode 100644
index 0000000..4d284dd
--- /dev/null
+++ b/doc/guides/regexdevs/features/default.ini
@@ -0,0 +1,17 @@ 
+;
+; Features of a default RegEx driver.
+;
+; This file defines the features that are valid for inclusion in
+; the other driver files and also the order that they appear in
+; the features table in the documentation. The feature description
+; string should not exceed feature_str_len defined in conf.py.
+;
+[Features]
+ARMv7                =
+ARMv8                =
+Power8               =
+x86-32               =
+x86-64               =
+Usage doc            =
+Design doc           =
+Perf doc             =
diff --git a/doc/guides/regexdevs/features/mlx5.ini b/doc/guides/regexdevs/features/mlx5.ini
new file mode 100644
index 0000000..fa03d79
--- /dev/null
+++ b/doc/guides/regexdevs/features/mlx5.ini
@@ -0,0 +1,10 @@ 
+;
+; Supported features of the 'mlx5' RegEx driver.
+;
+; Refer to default.ini for the full list of available driver features.
+;
+[Features]
+ARMv8                = Y
+x86-32               = Y
+x86-64               = Y
+
diff --git a/doc/guides/regexdevs/features_overview.rst b/doc/guides/regexdevs/features_overview.rst
new file mode 100644
index 0000000..39c8e96
--- /dev/null
+++ b/doc/guides/regexdevs/features_overview.rst
@@ -0,0 +1,118 @@ 
+..  SPDX-License-Identifier: BSD-3-Clause
+    Copyright 2020 Mellanox Technologies, Ltd
+
+Overview of RegEx Drivers Features
+==================================
+
+This section explains the supported features that are listed in the table below.
+
+Cross buffer
+  Support cross buffer detection.
+
+PCRE start anchor
+  Support PCRE start anchor.
+
+PCRE atomic grouping
+  Support PCRE atomic grouping.
+
+PCRE back reference
+  Support PCRE back regerence.
+
+PCRE back tracking ctrl
+  Support PCRE back tracking ctrl.
+
+PCRE call outs
+  Support PCRE call outes.
+
+PCRE forward reference
+  Support Forward reference.
+
+PCRE greedy
+  Support PCRE greedy mode.
+
+PCRE match all
+  Support PCRE match all.
+
+PCRE match as end
+  Support match as end.
+
+PCRE match point rst
+  Support PCRE match point reset directive.
+
+PCRE New line conventions
+  Support new line conventions.
+
+PCRE new line SEQ
+  Support new line sequence.
+
+PCRE look around
+  Support PCRE look around.
+
+PCRE possessive qualifiers
+  Support PCRE possessive qualifiers.
+
+PCRE subroutine references
+  Support PCRE subroutine references.
+
+PCRE UTF 8
+  Support UTF-8.
+
+PCRE UTF 16
+  Support UTF-16.
+
+PCRE UTF 32
+  Support UTF-32.
+
+PCRE word boundary
+  Support word boundaries.
+
+Run time compilation
+  Support compilation during run time.
+
+ARMv7
+  Support armv7 architecture.
+
+ARMv8
+  Support armv8a (64bit) architecture.
+
+Power8
+  Support PowerPC architecture.
+
+x86-32
+  Support 32bits x86 architecture.
+
+x86-64
+  Support 64bits x86 architecture.
+
+Usage doc
+  Documentation describes usage, In ``doc/guides/regexdevs/``.
+
+Design doc
+  Documentation describes design. In ``doc/guides/regexdevs/``.
+
+Perf doc
+  Documentation describes performance values, In ``doc/perf/``.
+
+.. note::
+
+   Most of the features capabilities should be provided by the drivers via the
+   next vDPA operations: ``get_features`` and ``get_protocol_features``.
+
+
+References
+==========
+
+  * `PCRE: PCRE patteren man page <https://www.pcre.org/original/doc/html/pcrepattern.html>`_
+
+
+Features Table
+==============
+
+.. _table_regex_pmd_features:
+
+.. include:: overview_feature_table.txt
+
+.. Note::
+
+   Features marked with "P" are partially supported. Refer to the appropriate
+   driver guide in the following sections for details.
diff --git a/doc/guides/regexdevs/index.rst b/doc/guides/regexdevs/index.rst
new file mode 100644
index 0000000..04d8723
--- /dev/null
+++ b/doc/guides/regexdevs/index.rst
@@ -0,0 +1,15 @@ 
+..  SPDX-License-Identifier: BSD-3-Clause
+    Copyright 2020 Mellanox Technologies, Ltd
+
+REGEX Device Drivers
+====================
+
+The following are a list of RegEx (Regular Expression) device drivers,
+which can be used from an application through RegEx API.
+
+.. toctree::
+    :maxdepth: 2
+    :numbered:
+
+    features_overview
+    mlx5
diff --git a/doc/guides/regexdevs/mlx5.rst b/doc/guides/regexdevs/mlx5.rst
new file mode 100644
index 0000000..39f3067
--- /dev/null
+++ b/doc/guides/regexdevs/mlx5.rst
@@ -0,0 +1,95 @@ 
+..  SPDX-License-Identifier: BSD-3-Clause
+    Copyright 2020 Mellanox Technologies, Ltd
+
+.. include:: <isonum.txt>
+
+MLX5 RegEx driver
+=================
+
+The MLX5 RegEx (Regular Expression) driver library
+(**librte_pmd_mlx5_regex**) provides support for **Mellanox BlueField 2**
+families of 25/50/100/200 Gb/s adapters.
+
+.. note::
+
+   Due to external dependencies, this driver is disabled in default
+   configuration of the "make" build. It can be enabled with
+   ``CONFIG_RTE_LIBRTE_MLX5_REGEX_PMD=y`` or by using "meson" build system which
+   will detect dependencies.
+
+
+Design
+------
+
+This PMD is configuring the RegEx HW engine.
+For the PMD to work, the application must supply
+a precompiled rule file in rof2 format.
+
+The PMD can use libibverbs and libmlx5 to access the device firmware
+or directly the hardware components.
+There are different levels of objects and bypassing abilities
+to get the best performances:
+
+- Verbs is a complete high-level generic API
+- Direct Verbs is a device-specific API
+- DevX allows to access firmware objects
+- Direct Rules manages flow steering at low-level hardware layer
+
+Enabling librte_pmd_mlx5_regex causes DPDK applications to be linked against
+libibverbs.
+
+A Mellanox mlx5 PCI device can be probed by either net/mlx5 driver or regex/mlx5
+driver but not in parallel. Hence, the user should decide the driver by dissabling
+the net device using ``CONFIG_RTE_LIBRTE_MLX5_PMD``.
+
+Supported NICs
+--------------
+
+* Mellanox\ |reg| BlueField 2 SmartNIC
+
+Prerequisites
+-------------
+
+- Mellanox OFED version: **5.0**
+  see :doc:`../../nics/mlx5` guide for more Mellanox OFED details.
+- Enable the RegEx caps using system call from the BlueField 2.
+  Contact Mellanox support for detail explanation.
+
+Compilation options
+~~~~~~~~~~~~~~~~~~~
+
+These options can be modified in the ``.config`` file.
+
+- ``CONFIG_RTE_LIBRTE_MLX5_REGEX_PMD`` (default **n**)
+
+  Toggle compilation of librte_pmd_mlx5 itself.
+
+- ``CONFIG_RTE_IBVERBS_LINK_DLOPEN`` (default **n**)
+
+  Build PMD with additional code to make it loadable without hard
+  dependencies on **libibverbs** nor **libmlx5**, which may not be installed
+  on the target system.
+
+  In this mode, their presence is still required for it to run properly,
+  however their absence won't prevent a DPDK application from starting (with
+  ``CONFIG_RTE_BUILD_SHARED_LIB`` disabled) and they won't show up as
+  missing with ``ldd(1)``.
+
+  It works by moving these dependencies to a purpose-built rdma-core "glue"
+  plug-in which must either be installed in a directory whose name is based
+  on ``CONFIG_RTE_EAL_PMD_PATH`` suffixed with ``-glue`` if set, or in a
+  standard location for the dynamic linker (e.g. ``/lib``) if left to the
+  default empty string (``""``).
+
+  This option has no performance impact.
+
+- ``CONFIG_RTE_IBVERBS_LINK_STATIC`` (default **n**)
+
+  Embed static flavor of the dependencies **libibverbs** and **libmlx5**
+  in the PMD shared library or the executable static binary.
+
+
+Run-time configuration
+~~~~~~~~~~~~~~~~~~~~~~
+
+- **ethtool** operations on related kernel interfaces also affect the PMD.
diff --git a/doc/guides/regexdevs/overview_feature_table.txt b/doc/guides/regexdevs/overview_feature_table.txt
new file mode 100644
index 0000000..38b580e
--- /dev/null
+++ b/doc/guides/regexdevs/overview_feature_table.txt
@@ -0,0 +1,105 @@ 
+
+.. raw:: html
+
+   <style>
+      .wy-nav-content {
+         opacity: .99;
+      }
+      table#id1 {
+         cursor: default;
+         overflow: hidden;
+      }
+      table#id1 p {
+         margin: 0;
+         line-height: inherit;
+      }
+      table#id1 th, table#id1 td {
+         text-align: center;
+         border: solid 1px #ddd;
+      }
+      table#id1 th {
+         padding: 0.5em 0;
+      }
+      table#id1 th, table#id1 th p {
+         font-size: 11px;
+         white-space: pre-wrap;
+         vertical-align: top;
+         min-width: 0.9em;
+      }
+      table#id1 col:first-child {
+         width: 0;
+      }
+      table#id1 th:first-child {
+         vertical-align: bottom;
+      }
+      table#id1 td {
+         padding: 1px;
+      }
+      table#id1 td, table#id1 td p {
+         font-size: 11px;
+      }
+      table#id1 td:first-child {
+         padding-left: 1em;
+         text-align: left;
+      }
+      table#id1 tr:nth-child(2n-1) td {
+         background-color: rgba(210, 210, 210, 0.2);
+      }
+      table#id1 th:not(:first-child):hover,
+      table#id1 td:not(:first-child):hover {
+         position: relative;
+      }
+      table#id1 th:not(:first-child):hover::after,
+      table#id1 td:not(:first-child):hover::after {
+         content: '';
+         height: 6000px;
+         top: -3000px;
+         width: 100%;
+         left: 0;
+         position: absolute;
+         z-index: -1;
+         background-color: #ffb;
+      }
+      table#id1 tr:hover td {
+         background-color: #ffb;
+      }
+   </style>
+
+.. table:: Features availability in RegEx drivers
+
+   ========================== =
+   Feature                    m
+                              l
+                              x
+                              5
+   ========================== =
+   Cross buffer
+   PCRE start anchor
+   PCRE atomic grouping
+   PCRE back reference
+   PCRE back tracking ctrl
+   PCRE call outs
+   PCRE forward reference
+   PCRE greedy
+   PCRE match all
+   PCRE match as end
+   PCRE match point rst
+   PCRE new line conventions
+   PCRE new line SEQ
+   PCRE look around
+   PCRE possessive qualifiers
+   PCRE subroutine reference
+   PCRE UTF-8
+   PCRE UTF-16
+   PCRE UTF-32
+   PCRE word boundary
+   Run time compilation
+   ARMv7
+   ARMv8                      Y
+   Power8
+   x86-32                     Y
+   x86-64                     Y
+   Usage doc                  Y
+   Design doc                 Y
+   Perf doc
+   ========================== =
diff --git a/doc/guides/rel_notes/release_20_08.rst b/doc/guides/rel_notes/release_20_08.rst
index 988474c..3154272 100644
--- a/doc/guides/rel_notes/release_20_08.rst
+++ b/doc/guides/rel_notes/release_20_08.rst
@@ -81,6 +81,11 @@  New Features
   Added the RegEx library which provides an API for offload of regular
   expressions search operations to hardware or software accelerator devices.
 
+* **Added the RegEx Library, a generic RegEx service library.**
+
+  Added Mellanox MLX5 RegEx PMD driver, which implements the RegEx library
+  and allows to offload RegEx searches.
+
 * **Updated PCAP driver.**
 
   Updated PCAP driver with new features and improvements, including:
diff --git a/drivers/Makefile b/drivers/Makefile
index c70bdf9..73a9a72 100644
--- a/drivers/Makefile
+++ b/drivers/Makefile
@@ -24,5 +24,7 @@  DIRS-$(CONFIG_RTE_LIBRTE_EVENTDEV) += event
 DEPDIRS-event := common bus mempool net crypto
 DIRS-$(CONFIG_RTE_LIBRTE_RAWDEV) += raw
 DEPDIRS-raw := common bus mempool net event
+DIRS-$(CONFIG_RTE_LIBRTE_REGEXDEV) += regex
+DEPDIRS-regex := common
 
 include $(RTE_SDK)/mk/rte.subdir.mk
diff --git a/drivers/common/Makefile b/drivers/common/Makefile
index df2e840..cbc7107 100644
--- a/drivers/common/Makefile
+++ b/drivers/common/Makefile
@@ -36,7 +36,7 @@  ifneq (,$(findstring y,$(IAVF-y)))
 DIRS-y += iavf
 endif
 
-ifeq ($(findstring y,$(CONFIG_RTE_LIBRTE_MLX5_PMD)$(CONFIG_RTE_LIBRTE_MLX5_VDPA_PMD)),y)
+ifeq ($(findstring y,$(CONFIG_RTE_LIBRTE_MLX5_PMD)$(CONFIG_RTE_LIBRTE_MLX5_VDPA_PMD)$(CONFIG_RTE_LIBRTE_MLX5_REGEX_PMD)),y)
 DIRS-y += mlx5
 endif
 
diff --git a/drivers/common/mlx5/Makefile b/drivers/common/mlx5/Makefile
index f6c762b..5f12be3 100644
--- a/drivers/common/mlx5/Makefile
+++ b/drivers/common/mlx5/Makefile
@@ -10,7 +10,7 @@  LIB_GLUE_BASE = librte_pmd_mlx5_glue.so
 LIB_GLUE_VERSION = 20.02.0
 
 # Sources.
-ifeq ($(findstring y,$(CONFIG_RTE_LIBRTE_MLX5_PMD)$(CONFIG_RTE_LIBRTE_MLX5_VDPA_PMD)),y)
+ifeq ($(findstring y,$(CONFIG_RTE_LIBRTE_MLX5_PMD)$(CONFIG_RTE_LIBRTE_MLX5_VDPA_PMD)$(CONFIG_RTE_LIBRTE_MLX5_REGEX_PMD)),y)
 ifneq ($(CONFIG_RTE_IBVERBS_LINK_DLOPEN),y)
 SRCS-y += linux/mlx5_glue.c
 endif
@@ -344,7 +344,7 @@  mlx5_autoconf.h: mlx5_autoconf.h.new
 		cmp '$<' '$@' $(AUTOCONF_OUTPUT) || \
 		mv '$<' '$@'
 
-ifeq ($(findstring y,$(CONFIG_RTE_LIBRTE_MLX5_PMD)$(CONFIG_RTE_LIBRTE_MLX5_VDPA_PMD)),y)
+ifeq ($(findstring y,$(CONFIG_RTE_LIBRTE_MLX5_PMD)$(CONFIG_RTE_LIBRTE_MLX5_VDPA_PMD)$(CONFIG_RTE_LIBRTE_MLX5_REGEX_PMD)),y)
 $(SRCS-y:.c=.o): mlx5_autoconf.h
 endif
 
diff --git a/drivers/meson.build b/drivers/meson.build
index 161cfda..cebf9cd 100644
--- a/drivers/meson.build
+++ b/drivers/meson.build
@@ -11,7 +11,8 @@  dpdk_driver_classes = ['common',
 	       'compress', # depends on common, bus, mempool.
 	       'vdpa',    # depends on common, bus and mempool.
 	       'event',   # depends on common, bus, mempool and net.
-	       'baseband'] # depends on common and bus.
+	       'baseband', # depends on common and bus.
+	       'regex'] # depends on common, bus, regexdev.
 
 disabled_drivers = run_command(list_dir_globs, get_option('disable_drivers'),
 		).stdout().split()
diff --git a/drivers/regex/Makefile b/drivers/regex/Makefile
new file mode 100644
index 0000000..906b205
--- /dev/null
+++ b/drivers/regex/Makefile
@@ -0,0 +1,8 @@ 
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright 2020 Mellanox Technologies, Ltd
+
+include $(RTE_SDK)/mk/rte.vars.mk
+
+DIRS-$(CONFIG_RTE_LIBRTE_MLX5_REGEX_PMD) += mlx5
+
+include $(RTE_SDK)/mk/rte.subdir.mk
diff --git a/drivers/regex/meson.build b/drivers/regex/meson.build
new file mode 100644
index 0000000..75522e3
--- /dev/null
+++ b/drivers/regex/meson.build
@@ -0,0 +1,9 @@ 
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright 2020 Mellanox Technologies, Ltd
+
+drivers = ['mlx5']
+std_deps = ['ethdev', 'kvargs'] # 'ethdev' also pulls in mbuf, net, eal etc
+std_deps += ['bus_pci']         # very many PMDs depend on PCI, so make std
+std_deps += ['bus_vdev']        # same with vdev bus
+config_flag_fmt = 'RTE_LIBRTE_@0@_PMD'
+driver_name_fmt = 'rte_pmd_@0@'
diff --git a/drivers/regex/mlx5/Makefile b/drivers/regex/mlx5/Makefile
new file mode 100644
index 0000000..1a16ab2
--- /dev/null
+++ b/drivers/regex/mlx5/Makefile
@@ -0,0 +1,34 @@ 
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright 2020 Mellanox Technologies, Ltd
+
+include $(RTE_SDK)/mk/rte.vars.mk
+
+# Library name.
+LIB = librte_pmd_mlx5_regex.a
+
+# Sources.
+SRCS-$(CONFIG_RTE_LIBRTE_MLX5_REGEX_PMD) += mlx5_regex.c
+
+# Basic CFLAGS.
+CFLAGS += -O3
+CFLAGS += -std=c11 -Wall -Wextra
+CFLAGS += -g
+CFLAGS += -I$(RTE_SDK)/drivers/common/mlx5
+CFLAGS += -I$(BUILDDIR)/drivers/common/mlx5
+CFLAGS += -D_BSD_SOURCE
+CFLAGS += -D_DEFAULT_SOURCE
+CFLAGS += -D_XOPEN_SOURCE=600
+CFLAGS += $(WERROR_FLAGS)
+CFLAGS += -Wno-strict-prototypes
+LDLIBS += -lrte_common_mlx5
+LDLIBS += -lm
+LDLIBS += -lrte_eal -lrte_mbuf
+LDLIBS += -lrte_kvargs
+LDLIBS += -lrte_bus_pci
+
+# A few warnings cannot be avoided in external headers.
+CFLAGS += -Wno-error=cast-qual
+
+EXPORT_MAP := rte_pmd_mlx5_regex_version.map
+
+include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/drivers/regex/mlx5/meson.build b/drivers/regex/mlx5/meson.build
new file mode 100644
index 0000000..e31b34a
--- /dev/null
+++ b/drivers/regex/mlx5/meson.build
@@ -0,0 +1,32 @@ 
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright 2020 Mellanox Technologies, Ltd
+
+if not is_linux
+	build = false
+	reason = 'only supported on Linux'
+	subdir_done()
+endif
+
+fmt_name = 'mlx5_regex'
+deps += ['common_mlx5', 'pci', 'bus_pci', 'eal', 'sched']
+sources = files(
+	'mlx5_regex.c',
+)
+cflags_options = [
+	'-std=c11',
+	'-Wno-strict-prototypes',
+	'-D_BSD_SOURCE',
+	'-D_DEFAULT_SOURCE',
+	'-D_XOPEN_SOURCE=600'
+]
+foreach option:cflags_options
+	if cc.has_argument(option)
+		cflags += option
+	endif
+endforeach
+
+if get_option('buildtype').contains('debug')
+	cflags += [ '-pedantic', '-DPEDANTIC' ]
+else
+	cflags += [ '-UPEDANTIC' ]
+endif
diff --git a/drivers/regex/mlx5/mlx5_regex.c b/drivers/regex/mlx5/mlx5_regex.c
new file mode 100644
index 0000000..b942a75
--- /dev/null
+++ b/drivers/regex/mlx5/mlx5_regex.c
@@ -0,0 +1,5 @@ 
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright 2020 Mellanox Technologies, Ltd
+ */
+
+#include "mlx5_regex.h"
diff --git a/drivers/regex/mlx5/mlx5_regex.h b/drivers/regex/mlx5/mlx5_regex.h
new file mode 100644
index 0000000..0e0495c
--- /dev/null
+++ b/drivers/regex/mlx5/mlx5_regex.h
@@ -0,0 +1,8 @@ 
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright 2020 Mellanox Technologies, Ltd
+ */
+
+#ifndef MLX5_REGEX_H
+#define MLX5_REGEX_H
+
+#endif /* MLX5_REGEX_H */
diff --git a/drivers/regex/mlx5/rte_pmd_mlx5_regex_version.map b/drivers/regex/mlx5/rte_pmd_mlx5_regex_version.map
new file mode 100644
index 0000000..4a76d1d
--- /dev/null
+++ b/drivers/regex/mlx5/rte_pmd_mlx5_regex_version.map
@@ -0,0 +1,3 @@ 
+DPDK_21 {
+	local: *;
+};
diff --git a/mk/rte.app.mk b/mk/rte.app.mk
index 0ce8cf5..1b9551e 100644
--- a/mk/rte.app.mk
+++ b/mk/rte.app.mk
@@ -201,11 +201,12 @@  endif
 _LDLIBS-$(CONFIG_RTE_LIBRTE_LIO_PMD)        += -lrte_pmd_lio
 _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_MEMIF)      += -lrte_pmd_memif
 _LDLIBS-$(CONFIG_RTE_LIBRTE_MLX4_PMD)       += -lrte_pmd_mlx4
-ifeq ($(findstring y,$(CONFIG_RTE_LIBRTE_MLX5_PMD)$(CONFIG_RTE_LIBRTE_MLX5_VDPA_PMD)),y)
+ifeq ($(findstring y,$(CONFIG_RTE_LIBRTE_MLX5_PMD)$(CONFIG_RTE_LIBRTE_MLX5_VDPA_PMD)$(CONFIG_RTE_LIBRTE_MLX5_REGEX_PMD)),y)
 _LDLIBS-y                                   += -lrte_common_mlx5
 endif
 _LDLIBS-$(CONFIG_RTE_LIBRTE_MLX5_PMD)       += -lrte_pmd_mlx5
 _LDLIBS-$(CONFIG_RTE_LIBRTE_MLX5_VDPA_PMD)  += -lrte_pmd_mlx5_vdpa
+_LDLIBS-$(CONFIG_RTE_LIBRTE_MLX5_REGEX_PMD)  += -lrte_pmd_mlx5_regex
 ifeq ($(CONFIG_RTE_IBVERBS_LINK_DLOPEN),y)
 _LDLIBS-y                                   += -ldl
 else ifeq ($(CONFIG_RTE_IBVERBS_LINK_STATIC),y)
@@ -214,7 +215,7 @@  _LDLIBS-y                                   += --no-whole-archive
 _LDLIBS-y                                   += $(LIBS_IBVERBS_STATIC)
 _LDLIBS-y                                   += --whole-archive
 else
-ifeq ($(findstring y,$(CONFIG_RTE_LIBRTE_MLX5_PMD)$(CONFIG_RTE_LIBRTE_MLX5_VDPA_PMD)),y)
+ifeq ($(findstring y,$(CONFIG_RTE_LIBRTE_MLX5_PMD)$(CONFIG_RTE_LIBRTE_MLX5_VDPA_PMD)$(CONFIG_RTE_LIBRTE_MLX5_REGEX_PMD)),y)
 _LDLIBS-y                                   += -libverbs -lmlx5
 endif
 _LDLIBS-$(CONFIG_RTE_LIBRTE_MLX4_PMD)       += -libverbs -lmlx4