[01/20] regex/mlx5: add RegEx PMD layer and mlx5 driver
diff mbox series

Message ID 1593941027-86651-2-git-send-email-orika@mellanox.com
State Superseded, archived
Delegated to: Thomas Monjalon
Headers show
Series
  • add Mellanox RegEx PMD
Related show

Checks

Context Check Description
ci/iol-testing fail Testing issues
ci/iol-mellanox-Performance success Performance Testing PASS
ci/Intel-compilation success Compilation OK
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS
ci/checkpatch success coding style OK

Commit Message

Ori Kam July 5, 2020, 9:23 a.m. UTC
From: Yuval Avnery <yuvalav@mellanox.com>

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

Signed-off-by: Yuval Avnery <yuvalav@mellanox.com>
Signed-off-by: Ori Kam <orika@mellanox.com>
---
 config/common_base                                |  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                       | 55 +++++++++++++++++++++++
 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 ++-
 13 files changed, 135 insertions(+), 6 deletions(-)
 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

Wang, Haiyue July 5, 2020, 10:59 a.m. UTC | #1
> -----Original Message-----
> From: dev <dev-bounces@dpdk.org> On Behalf Of Ori Kam
> Sent: Sunday, July 5, 2020 17:23
> To: jerinj@marvell.com; Wang, Xiang W <xiang.w.wang@intel.com>; matan@mellanox.com;
> viacheslavo@mellanox.com; Thomas Monjalon <thomas@monjalon.net>; Shahaf Shuler <shahafs@mellanox.com>;
> Ray Kinsella <mdr@ashroe.eu>; Neil Horman <nhorman@tuxdriver.com>
> Cc: guyk@marvell.com; dev@dpdk.org; pbhagavatula@marvell.com; hemant.agrawal@nxp.com;
> opher@mellanox.com; alexr@mellanox.com; dovrat@marvell.com; pkapoor@marvell.com; nipun.gupta@nxp.com;
> Richardson, Bruce <bruce.richardson@intel.com>; Hong, Yang A <yang.a.hong@intel.com>; Chang, Harry
> <harry.chang@intel.com>; gu.jian1@zte.com.cn; shanjiangh@chinatelecom.cn; zhangy.yun@chinatelecom.cn;
> lixingfu@huachentel.com; wushuai@inspur.com; yuyingxia@yxlink.com; fanchenggang@sunyainfo.com;
> davidfgao@tencent.com; liuzhong1@chinaunicom.cn; zhaoyong11@huawei.com; oc@yunify.com; jim@netgate.com;
> Ni, Hongjun <hongjun.ni@intel.com>; deri@ntop.org; fc@napatech.com; arthur.su@lionic.com;
> orika@mellanox.com; rasland@mellanox.com; Yuval Avnery <yuvalav@mellanox.com>
> Subject: [dpdk-dev] [PATCH 01/20] regex/mlx5: add RegEx PMD layer and mlx5 driver
> 
> From: Yuval Avnery <yuvalav@mellanox.com>
> 
> This commit introduce the RegEx pull mode drivers class, and

I guess it should be "Poll" ? ;-)

> adds Mellanox RegEx PMD.
> 
> Signed-off-by: Yuval Avnery <yuvalav@mellanox.com>
> Signed-off-by: Ori Kam <orika@mellanox.com>
> ---

[snip]

> 1.8.3.1
Ori Kam July 5, 2020, 11:32 a.m. UTC | #2
Hi Wang,

> -----Original Message-----
> From: Wang, Haiyue <haiyue.wang@intel.com>
> Sent: Sunday, July 5, 2020 1:59 PM
> To: Ori Kam <orika@mellanox.com>; jerinj@marvell.com; Wang, Xiang W
> <xiang.w.wang@intel.com>; Matan Azrad <matan@mellanox.com>; Slava
> Ovsiienko <viacheslavo@mellanox.com>; Thomas Monjalon
> <thomas@monjalon.net>; Shahaf Shuler <shahafs@mellanox.com>; Ray
> Kinsella <mdr@ashroe.eu>; Neil Horman <nhorman@tuxdriver.com>
> Cc: guyk@marvell.com; dev@dpdk.org; pbhagavatula@marvell.com;
> hemant.agrawal@nxp.com; Opher Reviv <opher@mellanox.com>; Alex
> Rosenbaum <alexr@mellanox.com>; dovrat@marvell.com;
> pkapoor@marvell.com; nipun.gupta@nxp.com; Richardson, Bruce
> <bruce.richardson@intel.com>; Hong, Yang A <yang.a.hong@intel.com>;
> Chang, Harry <harry.chang@intel.com>; gu.jian1@zte.com.cn;
> shanjiangh@chinatelecom.cn; zhangy.yun@chinatelecom.cn;
> lixingfu@huachentel.com; wushuai@inspur.com; yuyingxia@yxlink.com;
> fanchenggang@sunyainfo.com; davidfgao@tencent.com;
> liuzhong1@chinaunicom.cn; zhaoyong11@huawei.com; oc@yunify.com;
> jim@netgate.com; Ni, Hongjun <hongjun.ni@intel.com>; deri@ntop.org;
> fc@napatech.com; arthur.su@lionic.com; Raslan Darawsheh
> <rasland@mellanox.com>; Yuval Avnery <yuvalav@mellanox.com>
> Subject: RE: [dpdk-dev] [PATCH 01/20] regex/mlx5: add RegEx PMD layer and
> mlx5 driver
> 
> > -----Original Message-----
> > From: dev <dev-bounces@dpdk.org> On Behalf Of Ori Kam
> > Sent: Sunday, July 5, 2020 17:23
> > To: jerinj@marvell.com; Wang, Xiang W <xiang.w.wang@intel.com>;
> matan@mellanox.com;
> > viacheslavo@mellanox.com; Thomas Monjalon <thomas@monjalon.net>;
> Shahaf Shuler <shahafs@mellanox.com>;
> > Ray Kinsella <mdr@ashroe.eu>; Neil Horman <nhorman@tuxdriver.com>
> > Cc: guyk@marvell.com; dev@dpdk.org; pbhagavatula@marvell.com;
> hemant.agrawal@nxp.com;
> > opher@mellanox.com; alexr@mellanox.com; dovrat@marvell.com;
> pkapoor@marvell.com; nipun.gupta@nxp.com;
> > Richardson, Bruce <bruce.richardson@intel.com>; Hong, Yang A
> <yang.a.hong@intel.com>; Chang, Harry
> > <harry.chang@intel.com>; gu.jian1@zte.com.cn;
> shanjiangh@chinatelecom.cn; zhangy.yun@chinatelecom.cn;
> > lixingfu@huachentel.com; wushuai@inspur.com; yuyingxia@yxlink.com;
> fanchenggang@sunyainfo.com;
> > davidfgao@tencent.com; liuzhong1@chinaunicom.cn;
> zhaoyong11@huawei.com; oc@yunify.com; jim@netgate.com;
> > Ni, Hongjun <hongjun.ni@intel.com>; deri@ntop.org; fc@napatech.com;
> arthur.su@lionic.com;
> > orika@mellanox.com; rasland@mellanox.com; Yuval Avnery
> <yuvalav@mellanox.com>
> > Subject: [dpdk-dev] [PATCH 01/20] regex/mlx5: add RegEx PMD layer and
> mlx5 driver
> >
> > From: Yuval Avnery <yuvalav@mellanox.com>
> >
> > This commit introduce the RegEx pull mode drivers class, and
> 
> I guess it should be "Poll" ? ;-)

Yep my bad, will fix.

> 
> > adds Mellanox RegEx PMD.
> >
> > Signed-off-by: Yuval Avnery <yuvalav@mellanox.com>
> > Signed-off-by: Ori Kam <orika@mellanox.com>
> > ---
> 
> [snip]
> 
> > 1.8.3.1
Thomas Monjalon July 6, 2020, 10:47 p.m. UTC | #3
Dim 05 juil 2020, à 11:23, Ori Kam a écrit :
> +++ b/drivers/regex/mlx5/Makefile
> +# memseg walk is not part of stable API
> +CFLAGS += -DALLOW_EXPERIMENTAL_API

Not needed

> +# DEBUG which is usually provided on the command-line may enable
> +# CONFIG_RTE_LIBRTE_MLX5_DEBUG.
> +ifeq ($(DEBUG),1)
> +CONFIG_RTE_LIBRTE_MLX5_DEBUG := y
> +endif

I think you would prefer a regex specific flag.
In near future, we'll try to convert these debug flags to something more common
or something more dynamic like tracing.

> +# User-defined CFLAGS.
> +ifeq ($(CONFIG_RTE_LIBRTE_MLX5_DEBUG),y)
> +CFLAGS += -pedantic -UNDEBUG
> +ifneq ($(CONFIG_RTE_TOOLCHAIN_ICC),y)
> +CFLAGS += -DPEDANTIC
> +endif
> +AUTO_CONFIG_CFLAGS += -Wno-pedantic
> +else
> +CFLAGS += -DNDEBUG -UPEDANTIC
> +endif

Please give up with pedantic compilation.

Patch
diff mbox series

diff --git a/config/common_base b/config/common_base
index e15517b..c97f8c5 100644
--- a/config/common_base
+++ b/config/common_base
@@ -374,6 +374,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/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 01c860c..3319c6d 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..2ddad2d
--- /dev/null
+++ b/drivers/regex/mlx5/Makefile
@@ -0,0 +1,55 @@ 
+# 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
+
+# memseg walk is not part of stable API
+CFLAGS += -DALLOW_EXPERIMENTAL_API
+
+# DEBUG which is usually provided on the command-line may enable
+# CONFIG_RTE_LIBRTE_MLX5_DEBUG.
+ifeq ($(DEBUG),1)
+CONFIG_RTE_LIBRTE_MLX5_DEBUG := y
+endif
+
+# User-defined CFLAGS.
+ifeq ($(CONFIG_RTE_LIBRTE_MLX5_DEBUG),y)
+CFLAGS += -pedantic -UNDEBUG
+ifneq ($(CONFIG_RTE_TOOLCHAIN_ICC),y)
+CFLAGS += -DPEDANTIC
+endif
+AUTO_CONFIG_CFLAGS += -Wno-pedantic
+else
+CFLAGS += -DNDEBUG -UPEDANTIC
+endif
+
+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..768a9d1
--- /dev/null
+++ b/drivers/regex/mlx5/meson.build
@@ -0,0 +1,32 @@ 
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright 2019 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