DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH 0/6] mvpp2 changes and features
@ 2018-08-24 12:16 Tomasz Duszynski
  2018-08-24 12:16 ` [dpdk-dev] [PATCH 1/6] drivers/common: add mvep common code for MRVL PMDs Tomasz Duszynski
                   ` (6 more replies)
  0 siblings, 7 replies; 30+ messages in thread
From: Tomasz Duszynski @ 2018-08-24 12:16 UTC (permalink / raw)
  To: dev; +Cc: nsamsono, mw, Tomasz Duszynski

This patch series introduces following changes:

* Common code responsible for DMA memory initialization
  is now available under drivers/common/mvep. MVEP stands for
  Marvell Embedded Processors. This eases maintenance and avoids
  boilerplate code across Marvell PMDs. MVEP will grow over time as new
  features and PMDs are added.

* Couple of minor fixes.

* Support for reading VLAN information from descriptor.

Liron Himi (2):
  drivers/common: add mvep common code for MRVL PMDs
  net/mvpp2: use common code to initialize DMA

Natalie Samsonov (3):
  net/mvpp2: fix comments and error messages
  net/mvpp2: make private variables static
  net/mvpp2: add VLAN packet type support for parser offload

Tomasz Duszynski (1):
  net/mvpp2: fix array initialization

 config/common_base                              |  5 ++
 devtools/test-build.sh                          |  2 +
 drivers/common/Makefile                         |  4 ++
 drivers/common/meson.build                      |  2 +-
 drivers/common/mvep/Makefile                    | 38 +++++++++++++++
 drivers/common/mvep/meson.build                 | 19 ++++++++
 drivers/common/mvep/mvep_common.c               | 45 ++++++++++++++++++
 drivers/common/mvep/rte_common_mvep_version.map |  6 +++
 drivers/common/mvep/rte_mvep_common.h           | 20 ++++++++
 drivers/net/Makefile                            |  3 ++
 drivers/net/mvpp2/Makefile                      |  3 +-
 drivers/net/mvpp2/meson.build                   |  2 +-
 drivers/net/mvpp2/mrvl_ethdev.c                 | 61 +++++++++++++------------
 drivers/net/mvpp2/mrvl_flow.c                   | 29 ++++++++----
 mk/rte.app.mk                                   |  4 ++
 15 files changed, 204 insertions(+), 39 deletions(-)
 create mode 100644 drivers/common/mvep/Makefile
 create mode 100644 drivers/common/mvep/meson.build
 create mode 100644 drivers/common/mvep/mvep_common.c
 create mode 100644 drivers/common/mvep/rte_common_mvep_version.map
 create mode 100644 drivers/common/mvep/rte_mvep_common.h

--
2.7.4

^ permalink raw reply	[flat|nested] 30+ messages in thread

* [dpdk-dev] [PATCH 1/6] drivers/common: add mvep common code for MRVL PMDs
  2018-08-24 12:16 [dpdk-dev] [PATCH 0/6] mvpp2 changes and features Tomasz Duszynski
@ 2018-08-24 12:16 ` Tomasz Duszynski
  2018-08-24 12:32   ` Ferruh Yigit
  2018-08-24 12:16 ` [dpdk-dev] [PATCH 2/6] net/mvpp2: use common code to initialize DMA Tomasz Duszynski
                   ` (5 subsequent siblings)
  6 siblings, 1 reply; 30+ messages in thread
From: Tomasz Duszynski @ 2018-08-24 12:16 UTC (permalink / raw)
  To: dev; +Cc: nsamsono, mw, Liron Himi, Tomasz Duszynski

From: Liron Himi <lironh@marvell.com>

Add MVEP (Marvell Embedded Processors) to drivers/common which
will keep code reused by current and future MRVL PMDs.
Right now we have only common DMA memory initialization routines there.

Signed-off-by: Liron Himi <lironh@marvell.com>
Signed-off-by: Tomasz Duszynski <tdu@semihalf.com>
Reviewed-by: Natalie Samsonov <nsamsono@marvell.com>
---
 config/common_base                              |  5 +++
 devtools/test-build.sh                          |  2 ++
 drivers/common/Makefile                         |  4 +++
 drivers/common/meson.build                      |  2 +-
 drivers/common/mvep/Makefile                    | 38 +++++++++++++++++++++
 drivers/common/mvep/meson.build                 | 19 +++++++++++
 drivers/common/mvep/mvep_common.c               | 45 +++++++++++++++++++++++++
 drivers/common/mvep/rte_common_mvep_version.map |  6 ++++
 drivers/common/mvep/rte_mvep_common.h           | 20 +++++++++++
 mk/rte.app.mk                                   |  4 +++
 10 files changed, 144 insertions(+), 1 deletion(-)
 create mode 100644 drivers/common/mvep/Makefile
 create mode 100644 drivers/common/mvep/meson.build
 create mode 100644 drivers/common/mvep/mvep_common.c
 create mode 100644 drivers/common/mvep/rte_common_mvep_version.map
 create mode 100644 drivers/common/mvep/rte_mvep_common.h

diff --git a/config/common_base b/config/common_base
index 4bcbaf9..978592d 100644
--- a/config/common_base
+++ b/config/common_base
@@ -395,6 +395,11 @@ CONFIG_RTE_LIBRTE_BOND_DEBUG_ALB_L1=n
 CONFIG_RTE_LIBRTE_PMD_FAILSAFE=y
 
 #
+# Compile Marvell Embedded Processors Common
+#
+CONFIG_RTE_LIBRTE_MVEP_COMMON=n
+
+#
 # Compile Marvell PMD driver
 #
 CONFIG_RTE_LIBRTE_MVPP2_PMD=n
diff --git a/devtools/test-build.sh b/devtools/test-build.sh
index 1eee241..82861b2 100755
--- a/devtools/test-build.sh
+++ b/devtools/test-build.sh
@@ -182,6 +182,8 @@ config () # <directory> <target> <options>
 		sed -ri    's,(PMD_MVSAM_CRYPTO=)n,\1y,' $1/.config
 		test -z "$LIBMUSDK_PATH" || \
 		sed -ri          's,(MVPP2_PMD=)n,\1y,' $1/.config
+		test -z "$LIBMUSDK_PATH" || \
+		sed -ri    's,(MVEP_COMMON=)n,\1y,' $1/.config
 		build_config_hook $1 $2 $3
 
 		# Explicit enabler/disabler (uppercase)
diff --git a/drivers/common/Makefile b/drivers/common/Makefile
index 0fd2237..1795133 100644
--- a/drivers/common/Makefile
+++ b/drivers/common/Makefile
@@ -8,4 +8,8 @@ ifeq ($(CONFIG_RTE_LIBRTE_PMD_OCTEONTX_SSOVF)$(CONFIG_RTE_LIBRTE_OCTEONTX_MEMPOO
 DIRS-y += octeontx
 endif
 
+ifeq ($(CONFIG_RTE_LIBRTE_MVEP_COMMON),y)
+DIRS-$(CONFIG_RTE_LIBRTE_MVEP_COMMON) += mvep
+endif
+
 include $(RTE_SDK)/mk/rte.subdir.mk
diff --git a/drivers/common/meson.build b/drivers/common/meson.build
index d7b7d8c..f828ce7 100644
--- a/drivers/common/meson.build
+++ b/drivers/common/meson.build
@@ -2,6 +2,6 @@
 # Copyright(c) 2018 Cavium, Inc
 
 std_deps = ['eal']
-drivers = ['octeontx', 'qat']
+drivers = ['mvep', 'octeontx', 'qat']
 config_flag_fmt = 'RTE_LIBRTE_@0@_COMMON'
 driver_name_fmt = 'rte_common_@0@'
diff --git a/drivers/common/mvep/Makefile b/drivers/common/mvep/Makefile
new file mode 100644
index 0000000..845bb47
--- /dev/null
+++ b/drivers/common/mvep/Makefile
@@ -0,0 +1,38 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright(c) 2018 Marvell International Ltd.
+#
+
+include $(RTE_SDK)/mk/rte.vars.mk
+
+ifneq ($(MAKECMDGOALS),clean)
+ifneq ($(MAKECMDGOALS),config)
+ifeq ($(LIBMUSDK_PATH),)
+$(error "Please define LIBMUSDK_PATH environment variable")
+endif
+endif
+endif
+
+# library name
+LIB = librte_common_mvep.a
+
+# library version
+LIBABIVER := 1
+
+# versioning export map
+EXPORT_MAP := rte_common_mvep_version.map
+
+# external library dependencies
+CFLAGS += -I$($RTE_SDK)/drivers/common/mvep
+CFLAGS += -I$(LIBMUSDK_PATH)/include
+CFLAGS += -DMVCONF_TYPES_PUBLIC
+CFLAGS += -DMVCONF_DMA_PHYS_ADDR_T_PUBLIC
+CFLAGS += $(WERROR_FLAGS)
+CFLAGS += -O3
+LDLIBS += -L$(LIBMUSDK_PATH)/lib
+LDLIBS += -lmusdk
+LDLIBS += -lrte_eal -lrte_kvargs
+
+# library source files
+SRCS-$(CONFIG_RTE_LIBRTE_MVEP_COMMON) += mvep_common.c
+
+include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/drivers/common/mvep/meson.build b/drivers/common/mvep/meson.build
new file mode 100644
index 0000000..8ccfacb
--- /dev/null
+++ b/drivers/common/mvep/meson.build
@@ -0,0 +1,19 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright(c) 2018 Marvell International Ltd.
+# Copyright(c) 2018 Semihalf.
+# All rights reserved.
+#
+path = get_option('lib_musdk_dir')
+lib_dir = path + '/lib'
+inc_dir = path + '/include'
+
+lib = cc.find_library('libmusdk', dirs: [lib_dir], required: false)
+if not lib.found()
+	build = false
+else
+	ext_deps += lib
+	includes += include_directories(inc_dir)
+	cflags += ['-DMVCONF_TYPES_PUBLIC', '-DMVCONF_DMA_PHYS_ADDR_T_PUBLIC']
+endif
+
+sources = files('mvep_common.c')
diff --git a/drivers/common/mvep/mvep_common.c b/drivers/common/mvep/mvep_common.c
new file mode 100644
index 0000000..67fa65b
--- /dev/null
+++ b/drivers/common/mvep/mvep_common.c
@@ -0,0 +1,45 @@
+/*  SPDX-License-Identifier: BSD-3-Clause
+ *  Copyright(c) 2018 Marvell International Ltd.
+ */
+
+#include <rte_common.h>
+
+#include <env/mv_autogen_comp_flags.h>
+#include <env/mv_sys_dma.h>
+
+#include "rte_mvep_common.h"
+
+/* Memory size (in bytes) for MUSDK dma buffers */
+#define MRVL_MUSDK_DMA_MEMSIZE (40 * 1024 * 1024)
+
+struct mvep {
+	uint32_t ref_count;
+};
+
+static struct mvep mvep;
+
+int rte_mvep_init(enum mvep_module_type module __rte_unused,
+		  struct rte_kvargs *kvlist __rte_unused)
+{
+	int ret;
+
+	if (!mvep.ref_count) {
+		ret = mv_sys_dma_mem_init(MRVL_MUSDK_DMA_MEMSIZE);
+		if (ret)
+			return ret;
+	}
+
+	mvep.ref_count++;
+
+	return 0;
+}
+
+int rte_mvep_deinit(enum mvep_module_type module __rte_unused)
+{
+	mvep.ref_count--;
+
+	if (!mvep.ref_count)
+		mv_sys_dma_mem_destroy();
+
+	return 0;
+}
diff --git a/drivers/common/mvep/rte_common_mvep_version.map b/drivers/common/mvep/rte_common_mvep_version.map
new file mode 100644
index 0000000..fa1a1b8
--- /dev/null
+++ b/drivers/common/mvep/rte_common_mvep_version.map
@@ -0,0 +1,6 @@
+DPDK_18.08 {
+	global:
+
+	rte_mvep_init;
+	rte_mvep_deinit;
+};
diff --git a/drivers/common/mvep/rte_mvep_common.h b/drivers/common/mvep/rte_mvep_common.h
new file mode 100644
index 0000000..ba47e16
--- /dev/null
+++ b/drivers/common/mvep/rte_mvep_common.h
@@ -0,0 +1,20 @@
+/*  SPDX-License-Identifier: BSD-3-Clause
+ *  Copyright(c) 2018 Marvell International Ltd.
+ */
+
+#ifndef __RTE_MVEP_COMMON_H__
+#define __RTE_MVEP_COMMON_H__
+
+#include <rte_kvargs.h>
+
+enum mvep_module_type {
+	MVEP_MOD_T_NONE = 0,
+	MVEP_MOD_T_PP2,
+	MVEP_MOD_T_SAM,
+	MVEP_MOD_T_LAST
+};
+
+int rte_mvep_init(enum mvep_module_type module, struct rte_kvargs *kvlist);
+int rte_mvep_deinit(enum mvep_module_type module);
+
+#endif /* __RTE_MVEP_COMMON_H__ */
diff --git a/mk/rte.app.mk b/mk/rte.app.mk
index de33883..a9c9b4f 100644
--- a/mk/rte.app.mk
+++ b/mk/rte.app.mk
@@ -98,6 +98,10 @@ ifeq ($(CONFIG_RTE_LIBRTE_PMD_OCTEONTX_SSOVF)$(CONFIG_RTE_LIBRTE_OCTEONTX_MEMPOO
 _LDLIBS-y += -lrte_common_octeontx
 endif
 
+ifeq ($(CONFIG_RTE_LIBRTE_MVEP_COMMON),y)
+_LDLIBS-$(CONFIG_RTE_LIBRTE_MVEP_COMMON)    += -lrte_common_mvep -L$(LIBMUSDK_PATH)/lib -lmusdk
+endif
+
 _LDLIBS-$(CONFIG_RTE_LIBRTE_PCI_BUS)        += -lrte_bus_pci
 _LDLIBS-$(CONFIG_RTE_LIBRTE_VDEV_BUS)       += -lrte_bus_vdev
 _LDLIBS-$(CONFIG_RTE_LIBRTE_DPAA_BUS)       += -lrte_bus_dpaa
-- 
2.7.4

^ permalink raw reply	[flat|nested] 30+ messages in thread

* [dpdk-dev] [PATCH 2/6] net/mvpp2: use common code to initialize DMA
  2018-08-24 12:16 [dpdk-dev] [PATCH 0/6] mvpp2 changes and features Tomasz Duszynski
  2018-08-24 12:16 ` [dpdk-dev] [PATCH 1/6] drivers/common: add mvep common code for MRVL PMDs Tomasz Duszynski
@ 2018-08-24 12:16 ` Tomasz Duszynski
  2018-08-24 12:16 ` [dpdk-dev] [PATCH 3/6] net/mvpp2: fix array initialization Tomasz Duszynski
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 30+ messages in thread
From: Tomasz Duszynski @ 2018-08-24 12:16 UTC (permalink / raw)
  To: dev; +Cc: nsamsono, mw, Liron Himi

From: Liron Himi <lironh@marvell.com>

Use common code to initialize MUSDK DMA memory buffers.

Signed-off-by: Liron Himi <lironh@marvell.com>
Reviewed-by: Natalie Samsonov <nsamsono@marvell.com>
---
 drivers/net/Makefile            |  3 +++
 drivers/net/mvpp2/Makefile      |  3 ++-
 drivers/net/mvpp2/meson.build   |  2 +-
 drivers/net/mvpp2/mrvl_ethdev.c | 36 +++++++++++++-----------------------
 4 files changed, 19 insertions(+), 25 deletions(-)

diff --git a/drivers/net/Makefile b/drivers/net/Makefile
index 664398d..ecee7ba 100644
--- a/drivers/net/Makefile
+++ b/drivers/net/Makefile
@@ -68,6 +68,9 @@ ifeq ($(CONFIG_RTE_LIBRTE_MVPP2_PMD),y)
 ifeq ($(CONFIG_RTE_LIBRTE_CFGFILE),n)
 $(error "RTE_LIBRTE_CFGFILE must be enabled in configuration!")
 endif
+ifeq ($(CONFIG_RTE_LIBRTE_MVEP_COMMON),n)
+$(error "RTE_LIBRTE_MVEP_COMMON must be enabled in configuration!")
+endif
 endif
 
 include $(RTE_SDK)/mk/rte.subdir.mk
diff --git a/drivers/net/mvpp2/Makefile b/drivers/net/mvpp2/Makefile
index 492aef9..211d398 100644
--- a/drivers/net/mvpp2/Makefile
+++ b/drivers/net/mvpp2/Makefile
@@ -23,6 +23,7 @@ LIBABIVER := 1
 EXPORT_MAP := rte_pmd_mvpp2_version.map
 
 # external library dependencies
+CFLAGS += -I$(RTE_SDK)/drivers/common/mvep
 CFLAGS += -I$(LIBMUSDK_PATH)/include
 CFLAGS += -DMVCONF_TYPES_PUBLIC
 CFLAGS += -DMVCONF_DMA_PHYS_ADDR_T_PUBLIC
@@ -32,7 +33,7 @@ LDLIBS += -L$(LIBMUSDK_PATH)/lib
 LDLIBS += -lmusdk
 LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring
 LDLIBS += -lrte_ethdev -lrte_net -lrte_kvargs -lrte_cfgfile
-LDLIBS += -lrte_bus_vdev
+LDLIBS += -lrte_bus_vdev -lrte_common_mvep
 
 # library source files
 SRCS-$(CONFIG_RTE_LIBRTE_MVPP2_PMD) += mrvl_ethdev.c
diff --git a/drivers/net/mvpp2/meson.build b/drivers/net/mvpp2/meson.build
index e139889..3620659 100644
--- a/drivers/net/mvpp2/meson.build
+++ b/drivers/net/mvpp2/meson.build
@@ -22,4 +22,4 @@ sources = files(
 	'mrvl_qos.c'
 )
 
-deps += ['cfgfile']
+deps += ['cfgfile', 'common_mvep']
diff --git a/drivers/net/mvpp2/mrvl_ethdev.c b/drivers/net/mvpp2/mrvl_ethdev.c
index a2d0576..7ea8946 100644
--- a/drivers/net/mvpp2/mrvl_ethdev.c
+++ b/drivers/net/mvpp2/mrvl_ethdev.c
@@ -29,6 +29,7 @@
 #include <sys/stat.h>
 #include <sys/types.h>
 
+#include <rte_mvep_common.h>
 #include "mrvl_ethdev.h"
 #include "mrvl_qos.h"
 
@@ -63,9 +64,6 @@
 #define MRVL_COOKIE_HIGH_ADDR_SHIFT	(sizeof(pp2_cookie_t) * 8)
 #define MRVL_COOKIE_HIGH_ADDR_MASK	(~0ULL << MRVL_COOKIE_HIGH_ADDR_SHIFT)
 
-/* Memory size (in bytes) for MUSDK dma buffers */
-#define MRVL_MUSDK_DMA_MEMSIZE 41943040
-
 /** Port Rx offload capabilities */
 #define MRVL_RX_OFFLOADS (DEV_RX_OFFLOAD_VLAN_FILTER | \
 			  DEV_RX_OFFLOAD_JUMBO_FRAME | \
@@ -2653,24 +2651,17 @@ rte_pmd_mrvl_probe(struct rte_vdev_device *vdev)
 	if (mrvl_dev_num)
 		goto init_devices;
 
-	MRVL_LOG(INFO, "Perform MUSDK initializations");
-	/*
-	 * ret == -EEXIST is correct, it means DMA
-	 * has been already initialized (by another PMD).
-	 */
-	ret = mv_sys_dma_mem_init(MRVL_MUSDK_DMA_MEMSIZE);
-	if (ret < 0) {
-		if (ret != -EEXIST)
-			goto out_free_kvlist;
-		else
-			MRVL_LOG(INFO,
-				"DMA memory has been already initialized by a different driver.");
-	}
+	MRVL_LOG(INFO, "Perform MUSDK initializations\n");
+
+	ret = rte_mvep_init(MVEP_MOD_T_PP2, kvlist);
+	if (ret)
+		goto out_free_kvlist;
 
 	ret = mrvl_init_pp2();
 	if (ret) {
-		MRVL_LOG(ERR, "Failed to init PP!");
-		goto out_deinit_dma;
+		MRVL_LOG(ERR, "Failed to init PP!\n");
+		rte_mvep_deinit(MVEP_MOD_T_PP2);
+		goto out_free_kvlist;
 	}
 
 	memset(mrvl_port_bpool_size, 0, sizeof(mrvl_port_bpool_size));
@@ -2695,11 +2686,10 @@ rte_pmd_mrvl_probe(struct rte_vdev_device *vdev)
 	for (; i > 0; i--)
 		mrvl_eth_dev_destroy(ifnames.names[i]);
 
-	if (mrvl_dev_num == 0)
+	if (mrvl_dev_num == 0) {
 		mrvl_deinit_pp2();
-out_deinit_dma:
-	if (mrvl_dev_num == 0)
-		mv_sys_dma_mem_destroy();
+		rte_mvep_deinit(MVEP_MOD_T_PP2);
+	}
 out_free_kvlist:
 	rte_kvargs_free(kvlist);
 
@@ -2739,7 +2729,7 @@ rte_pmd_mrvl_remove(struct rte_vdev_device *vdev)
 		MRVL_LOG(INFO, "Perform MUSDK deinit");
 		mrvl_deinit_hifs();
 		mrvl_deinit_pp2();
-		mv_sys_dma_mem_destroy();
+		rte_mvep_deinit(MVEP_MOD_T_PP2);
 	}
 
 	return 0;
-- 
2.7.4

^ permalink raw reply	[flat|nested] 30+ messages in thread

* [dpdk-dev] [PATCH 3/6] net/mvpp2: fix array initialization
  2018-08-24 12:16 [dpdk-dev] [PATCH 0/6] mvpp2 changes and features Tomasz Duszynski
  2018-08-24 12:16 ` [dpdk-dev] [PATCH 1/6] drivers/common: add mvep common code for MRVL PMDs Tomasz Duszynski
  2018-08-24 12:16 ` [dpdk-dev] [PATCH 2/6] net/mvpp2: use common code to initialize DMA Tomasz Duszynski
@ 2018-08-24 12:16 ` Tomasz Duszynski
  2018-08-24 12:16 ` [dpdk-dev] [PATCH 4/6] net/mvpp2: fix comments and error messages Tomasz Duszynski
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 30+ messages in thread
From: Tomasz Duszynski @ 2018-08-24 12:16 UTC (permalink / raw)
  To: dev; +Cc: nsamsono, mw, Tomasz Duszynski, stable

Fix used_bpools array initialization by using range initializer.
This way all necessary variables are properly initialized regardless
of PP2_NUM_PKT_PROC value.

Fixes: 0ddc9b815b11 ("net/mrvl: add net PMD skeleton")
Cc: stable@dpdk.org

Signed-off-by: Tomasz Duszynski <tdu@semihalf.com>
---
 drivers/net/mvpp2/mrvl_ethdev.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/net/mvpp2/mrvl_ethdev.c b/drivers/net/mvpp2/mrvl_ethdev.c
index 7ea8946..60ca6e0 100644
--- a/drivers/net/mvpp2/mrvl_ethdev.c
+++ b/drivers/net/mvpp2/mrvl_ethdev.c
@@ -84,8 +84,7 @@ static const char * const valid_args[] = {
 static int used_hifs = MRVL_MUSDK_HIFS_RESERVED;
 static struct pp2_hif *hifs[RTE_MAX_LCORE];
 static int used_bpools[PP2_NUM_PKT_PROC] = {
-	MRVL_MUSDK_BPOOLS_RESERVED,
-	MRVL_MUSDK_BPOOLS_RESERVED
+	[0 ... PP2_NUM_PKT_PROC - 1] = MRVL_MUSDK_BPOOLS_RESERVED
 };
 
 struct pp2_bpool *mrvl_port_to_bpool_lookup[RTE_MAX_ETHPORTS];
-- 
2.7.4

^ permalink raw reply	[flat|nested] 30+ messages in thread

* [dpdk-dev] [PATCH 4/6] net/mvpp2: fix comments and error messages
  2018-08-24 12:16 [dpdk-dev] [PATCH 0/6] mvpp2 changes and features Tomasz Duszynski
                   ` (2 preceding siblings ...)
  2018-08-24 12:16 ` [dpdk-dev] [PATCH 3/6] net/mvpp2: fix array initialization Tomasz Duszynski
@ 2018-08-24 12:16 ` Tomasz Duszynski
  2018-08-24 12:16 ` [dpdk-dev] [PATCH 5/6] net/mvpp2: make private variables static Tomasz Duszynski
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 30+ messages in thread
From: Tomasz Duszynski @ 2018-08-24 12:16 UTC (permalink / raw)
  To: dev; +Cc: nsamsono, mw, tdu

From: Natalie Samsonov <nsamsono@marvell.com>

Fix comments and error messages.

Fixes: 7235341d7517 ("net/mrvl: support classifier")
Cc: tdu@semihalf.com

Signed-off-by: Natalie Samsonov <nsamsono@marvell.com>
Reviewed-by: Liron Himi <lironh@marvell.com>
---
 drivers/net/mvpp2/mrvl_flow.c | 29 +++++++++++++++++++++--------
 1 file changed, 21 insertions(+), 8 deletions(-)

diff --git a/drivers/net/mvpp2/mrvl_flow.c b/drivers/net/mvpp2/mrvl_flow.c
index ecc3419..13295e6 100644
--- a/drivers/net/mvpp2/mrvl_flow.c
+++ b/drivers/net/mvpp2/mrvl_flow.c
@@ -394,7 +394,8 @@ mrvl_parse_init(const struct rte_flow_item *item,
  *
  * @param spec Pointer to the specific flow item.
  * @param mask Pointer to the specific flow item's mask.
- * @param mask Pointer to the flow.
+ * @param parse_dst Parse either destination or source mac address.
+ * @param flow Pointer to the flow.
  * @return 0 in case of success, negative error value otherwise.
  */
 static int
@@ -613,6 +614,7 @@ mrvl_parse_ip4_dscp(const struct rte_flow_item_ipv4 *spec,
  *
  * @param spec Pointer to the specific flow item.
  * @param mask Pointer to the specific flow item's mask.
+ * @param parse_dst Parse either destination or source ip address.
  * @param flow Pointer to the flow.
  * @return 0 in case of success, negative error value otherwise.
  */
@@ -726,6 +728,7 @@ mrvl_parse_ip4_proto(const struct rte_flow_item_ipv4 *spec,
  *
  * @param spec Pointer to the specific flow item.
  * @param mask Pointer to the specific flow item's mask.
+ * @param parse_dst Parse either destination or source ipv6 address.
  * @param flow Pointer to the flow.
  * @return 0 in case of success, negative error value otherwise.
  */
@@ -874,6 +877,7 @@ mrvl_parse_ip6_next_hdr(const struct rte_flow_item_ipv6 *spec,
  *
  * @param spec Pointer to the specific flow item.
  * @param mask Pointer to the specific flow item's mask.
+ * @param parse_dst Parse either destination or source port.
  * @param flow Pointer to the flow.
  * @return 0 in case of success, negative error value otherwise.
  */
@@ -949,6 +953,7 @@ mrvl_parse_tcp_dport(const struct rte_flow_item_tcp *spec,
  *
  * @param spec Pointer to the specific flow item.
  * @param mask Pointer to the specific flow item's mask.
+ * @param parse_dst Parse either destination or source port.
  * @param flow Pointer to the flow.
  * @return 0 in case of success, negative error value otherwise.
  */
@@ -1022,7 +1027,6 @@ mrvl_parse_udp_dport(const struct rte_flow_item_udp *spec,
  * @param item Pointer to the flow item.
  * @param flow Pointer to the flow.
  * @param error Pointer to the flow error.
- * @param fields Pointer to the parsed parsed fields enum.
  * @returns 0 on success, negative value otherwise.
  */
 static int
@@ -1073,7 +1077,6 @@ mrvl_parse_eth(const struct rte_flow_item *item, struct rte_flow *flow,
  * @param item Pointer to the flow item.
  * @param flow Pointer to the flow.
  * @param error Pointer to the flow error.
- * @param fields Pointer to the parsed parsed fields enum.
  * @returns 0 on success, negative value otherwise.
  */
 static int
@@ -1139,7 +1142,6 @@ mrvl_parse_vlan(const struct rte_flow_item *item,
  * @param item Pointer to the flow item.
  * @param flow Pointer to the flow.
  * @param error Pointer to the flow error.
- * @param fields Pointer to the parsed parsed fields enum.
  * @returns 0 on success, negative value otherwise.
  */
 static int
@@ -1205,7 +1207,6 @@ mrvl_parse_ip4(const struct rte_flow_item *item,
  * @param item Pointer to the flow item.
  * @param flow Pointer to the flow.
  * @param error Pointer to the flow error.
- * @param fields Pointer to the parsed parsed fields enum.
  * @returns 0 on success, negative value otherwise.
  */
 static int
@@ -1276,7 +1277,6 @@ mrvl_parse_ip6(const struct rte_flow_item *item,
  * @param item Pointer to the flow item.
  * @param flow Pointer to the flow.
  * @param error Pointer to the flow error.
- * @param fields Pointer to the parsed parsed fields enum.
  * @returns 0 on success, negative value otherwise.
  */
 static int
@@ -1332,7 +1332,6 @@ mrvl_parse_tcp(const struct rte_flow_item *item,
  * @param item Pointer to the flow item.
  * @param flow Pointer to the flow.
  * @param error Pointer to the flow error.
- * @param fields Pointer to the parsed parsed fields enum.
  * @returns 0 on success, negative value otherwise.
  */
 static int
@@ -1981,6 +1980,7 @@ mrvl_parse_pattern_ip6_tcp(const struct rte_flow_item pattern[],
  * @param pattern Pointer to the flow pattern table.
  * @param flow Pointer to the flow.
  * @param error Pointer to the flow error.
+ * @param ip6 1 to parse ip6 item, 0 to parse ip4 item.
  * @returns 0 in case of success, negative value otherwise.
  */
 static int
@@ -2350,6 +2350,12 @@ mrvl_flow_parse(struct mrvl_priv *priv, const struct rte_flow_attr *attr,
 	return mrvl_flow_parse_actions(priv, actions, flow, error);
 }
 
+/**
+ * Get engine type for the given flow.
+ *
+ * @param field Pointer to the flow.
+ * @returns The type of the engine.
+ */
 static inline enum pp2_cls_tbl_type
 mrvl_engine_type(const struct rte_flow *flow)
 {
@@ -2369,6 +2375,13 @@ mrvl_engine_type(const struct rte_flow *flow)
 	return PP2_CLS_TBL_MASKABLE;
 }
 
+/**
+ * Create classifier table.
+ *
+ * @param dev Pointer to the device.
+ * @param flow Pointer to the very first flow.
+ * @returns 0 in case of success, negative value otherwise.
+ */
 static int
 mrvl_create_cls_table(struct rte_eth_dev *dev, struct rte_flow *first_flow)
 {
@@ -2655,7 +2668,7 @@ mrvl_flow_remove(struct mrvl_priv *priv, struct rte_flow *flow,
 /**
  * DPDK flow destroy callback called when flow is to be removed.
  *
- * @param priv Pointer to the port's private data.
+ * @param dev Pointer to the device.
  * @param flow Pointer to the flow.
  * @param error Pointer to the flow error.
  * @returns 0 in case of success, negative value otherwise.
-- 
2.7.4

^ permalink raw reply	[flat|nested] 30+ messages in thread

* [dpdk-dev] [PATCH 5/6] net/mvpp2: make private variables static
  2018-08-24 12:16 [dpdk-dev] [PATCH 0/6] mvpp2 changes and features Tomasz Duszynski
                   ` (3 preceding siblings ...)
  2018-08-24 12:16 ` [dpdk-dev] [PATCH 4/6] net/mvpp2: fix comments and error messages Tomasz Duszynski
@ 2018-08-24 12:16 ` Tomasz Duszynski
  2018-08-24 12:16 ` [dpdk-dev] [PATCH 6/6] net/mvpp2: add VLAN packet type support for parser offload Tomasz Duszynski
  2018-08-24 14:54 ` [dpdk-dev] [PATCH 0/6] net/mvpp2 changes and features Tomasz Duszynski
  6 siblings, 0 replies; 30+ messages in thread
From: Tomasz Duszynski @ 2018-08-24 12:16 UTC (permalink / raw)
  To: dev; +Cc: nsamsono, mw

From: Natalie Samsonov <nsamsono@marvell.com>

Mark internal variables static to avoid potential redefinition
errors later on.

Signed-off-by: Natalie Samsonov <nsamsono@marvell.com>
Reviewed-by: Yelena Krivosheev <yelena@marvell.com>
---
 drivers/net/mvpp2/mrvl_ethdev.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/mvpp2/mrvl_ethdev.c b/drivers/net/mvpp2/mrvl_ethdev.c
index 60ca6e0..5cd84c1 100644
--- a/drivers/net/mvpp2/mrvl_ethdev.c
+++ b/drivers/net/mvpp2/mrvl_ethdev.c
@@ -87,9 +87,9 @@ static int used_bpools[PP2_NUM_PKT_PROC] = {
 	[0 ... PP2_NUM_PKT_PROC - 1] = MRVL_MUSDK_BPOOLS_RESERVED
 };
 
-struct pp2_bpool *mrvl_port_to_bpool_lookup[RTE_MAX_ETHPORTS];
-int mrvl_port_bpool_size[PP2_NUM_PKT_PROC][PP2_BPOOL_NUM_POOLS][RTE_MAX_LCORE];
-uint64_t cookie_addr_high = MRVL_COOKIE_ADDR_INVALID;
+static struct pp2_bpool *mrvl_port_to_bpool_lookup[RTE_MAX_ETHPORTS];
+static int mrvl_port_bpool_size[PP2_NUM_PKT_PROC][PP2_BPOOL_NUM_POOLS][RTE_MAX_LCORE];
+static uint64_t cookie_addr_high = MRVL_COOKIE_ADDR_INVALID;
 
 int mrvl_logtype;
 
-- 
2.7.4

^ permalink raw reply	[flat|nested] 30+ messages in thread

* [dpdk-dev] [PATCH 6/6] net/mvpp2: add VLAN packet type support for parser offload
  2018-08-24 12:16 [dpdk-dev] [PATCH 0/6] mvpp2 changes and features Tomasz Duszynski
                   ` (4 preceding siblings ...)
  2018-08-24 12:16 ` [dpdk-dev] [PATCH 5/6] net/mvpp2: make private variables static Tomasz Duszynski
@ 2018-08-24 12:16 ` Tomasz Duszynski
  2018-08-24 14:54 ` [dpdk-dev] [PATCH 0/6] net/mvpp2 changes and features Tomasz Duszynski
  6 siblings, 0 replies; 30+ messages in thread
From: Tomasz Duszynski @ 2018-08-24 12:16 UTC (permalink / raw)
  To: dev; +Cc: nsamsono, mw

From: Natalie Samsonov <nsamsono@marvell.com>

Add VLAN packet type support for parser offload.

Signed-off-by: Natalie Samsonov <nsamsono@marvell.com>
Reviewed-by: Shlomi Gridish <sgridish@marvell.com>
Reviewed-by: Dmitri Epshtein <dima@marvell.com>
Reviewed-by: Yuval Caduri <cyuval@marvell.com>
---
 drivers/net/mvpp2/mrvl_ethdev.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/drivers/net/mvpp2/mrvl_ethdev.c b/drivers/net/mvpp2/mrvl_ethdev.c
index 5cd84c1..5b92d82 100644
--- a/drivers/net/mvpp2/mrvl_ethdev.c
+++ b/drivers/net/mvpp2/mrvl_ethdev.c
@@ -1353,6 +1353,8 @@ mrvl_dev_supported_ptypes_get(struct rte_eth_dev *dev __rte_unused)
 {
 	static const uint32_t ptypes[] = {
 		RTE_PTYPE_L2_ETHER,
+		RTE_PTYPE_L2_ETHER_VLAN,
+		RTE_PTYPE_L2_ETHER_QINQ,
 		RTE_PTYPE_L3_IPV4,
 		RTE_PTYPE_L3_IPV4_EXT,
 		RTE_PTYPE_L3_IPV4_EXT_UNKNOWN,
@@ -1922,13 +1924,27 @@ mrvl_desc_to_packet_type_and_offset(struct pp2_ppio_desc *desc,
 {
 	enum pp2_inq_l3_type l3_type;
 	enum pp2_inq_l4_type l4_type;
+	enum pp2_inq_vlan_tag vlan_tag;
 	uint64_t packet_type;
 
 	pp2_ppio_inq_desc_get_l3_info(desc, &l3_type, l3_offset);
 	pp2_ppio_inq_desc_get_l4_info(desc, &l4_type, l4_offset);
+	pp2_ppio_inq_desc_get_vlan_tag(desc, &vlan_tag);
 
 	packet_type = RTE_PTYPE_L2_ETHER;
 
+	switch (vlan_tag) {
+	case PP2_INQ_VLAN_TAG_SINGLE:
+		packet_type |= RTE_PTYPE_L2_ETHER_VLAN;
+		break;
+	case PP2_INQ_VLAN_TAG_DOUBLE:
+	case PP2_INQ_VLAN_TAG_TRIPLE:
+		packet_type |= RTE_PTYPE_L2_ETHER_QINQ;
+		break;
+	default:
+		break;
+	}
+
 	switch (l3_type) {
 	case PP2_INQ_L3_TYPE_IPV4_NO_OPTS:
 		packet_type |= RTE_PTYPE_L3_IPV4;
-- 
2.7.4

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [dpdk-dev] [PATCH 1/6] drivers/common: add mvep common code for MRVL PMDs
  2018-08-24 12:16 ` [dpdk-dev] [PATCH 1/6] drivers/common: add mvep common code for MRVL PMDs Tomasz Duszynski
@ 2018-08-24 12:32   ` Ferruh Yigit
  2018-08-24 12:49     ` Tomasz Duszynski
  0 siblings, 1 reply; 30+ messages in thread
From: Ferruh Yigit @ 2018-08-24 12:32 UTC (permalink / raw)
  To: Tomasz Duszynski, dev; +Cc: nsamsono, mw, Liron Himi

On 8/24/2018 1:16 PM, Tomasz Duszynski wrote:
> From: Liron Himi <lironh@marvell.com>
> 
> Add MVEP (Marvell Embedded Processors) to drivers/common which
> will keep code reused by current and future MRVL PMDs.
> Right now we have only common DMA memory initialization routines there.
> 
> Signed-off-by: Liron Himi <lironh@marvell.com>
> Signed-off-by: Tomasz Duszynski <tdu@semihalf.com>
> Reviewed-by: Natalie Samsonov <nsamsono@marvell.com>
> ---
>  config/common_base                              |  5 +++
>  devtools/test-build.sh                          |  2 ++
>  drivers/common/Makefile                         |  4 +++
>  drivers/common/meson.build                      |  2 +-
>  drivers/common/mvep/Makefile                    | 38 +++++++++++++++++++++
>  drivers/common/mvep/meson.build                 | 19 +++++++++++
>  drivers/common/mvep/mvep_common.c               | 45 +++++++++++++++++++++++++
>  drivers/common/mvep/rte_common_mvep_version.map |  6 ++++
>  drivers/common/mvep/rte_mvep_common.h           | 20 +++++++++++
>  mk/rte.app.mk                                   |  4 +++
>  10 files changed, 144 insertions(+), 1 deletion(-)
>  create mode 100644 drivers/common/mvep/Makefile
>  create mode 100644 drivers/common/mvep/meson.build
>  create mode 100644 drivers/common/mvep/mvep_common.c
>  create mode 100644 drivers/common/mvep/rte_common_mvep_version.map
>  create mode 100644 drivers/common/mvep/rte_mvep_common.h
> 
> diff --git a/config/common_base b/config/common_base
> index 4bcbaf9..978592d 100644
> --- a/config/common_base
> +++ b/config/common_base
> @@ -395,6 +395,11 @@ CONFIG_RTE_LIBRTE_BOND_DEBUG_ALB_L1=n
>  CONFIG_RTE_LIBRTE_PMD_FAILSAFE=y
>  
>  #
> +# Compile Marvell Embedded Processors Common
> +#
> +CONFIG_RTE_LIBRTE_MVEP_COMMON=n

Do you need a new config option for common, why not enable it if one of the
consumers of common code enabled?

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [dpdk-dev] [PATCH 1/6] drivers/common: add mvep common code for MRVL PMDs
  2018-08-24 12:32   ` Ferruh Yigit
@ 2018-08-24 12:49     ` Tomasz Duszynski
  0 siblings, 0 replies; 30+ messages in thread
From: Tomasz Duszynski @ 2018-08-24 12:49 UTC (permalink / raw)
  To: Ferruh Yigit; +Cc: Tomasz Duszynski, dev, nsamsono, mw, Liron Himi

On Fri, Aug 24, 2018 at 01:32:47PM +0100, Ferruh Yigit wrote:
> On 8/24/2018 1:16 PM, Tomasz Duszynski wrote:
> > From: Liron Himi <lironh@marvell.com>
> >
> > Add MVEP (Marvell Embedded Processors) to drivers/common which
> > will keep code reused by current and future MRVL PMDs.
> > Right now we have only common DMA memory initialization routines there.
> >
> > Signed-off-by: Liron Himi <lironh@marvell.com>
> > Signed-off-by: Tomasz Duszynski <tdu@semihalf.com>
> > Reviewed-by: Natalie Samsonov <nsamsono@marvell.com>
> > ---
> >  config/common_base                              |  5 +++
> >  devtools/test-build.sh                          |  2 ++
> >  drivers/common/Makefile                         |  4 +++
> >  drivers/common/meson.build                      |  2 +-
> >  drivers/common/mvep/Makefile                    | 38 +++++++++++++++++++++
> >  drivers/common/mvep/meson.build                 | 19 +++++++++++
> >  drivers/common/mvep/mvep_common.c               | 45 +++++++++++++++++++++++++
> >  drivers/common/mvep/rte_common_mvep_version.map |  6 ++++
> >  drivers/common/mvep/rte_mvep_common.h           | 20 +++++++++++
> >  mk/rte.app.mk                                   |  4 +++
> >  10 files changed, 144 insertions(+), 1 deletion(-)
> >  create mode 100644 drivers/common/mvep/Makefile
> >  create mode 100644 drivers/common/mvep/meson.build
> >  create mode 100644 drivers/common/mvep/mvep_common.c
> >  create mode 100644 drivers/common/mvep/rte_common_mvep_version.map
> >  create mode 100644 drivers/common/mvep/rte_mvep_common.h
> >
> > diff --git a/config/common_base b/config/common_base
> > index 4bcbaf9..978592d 100644
> > --- a/config/common_base
> > +++ b/config/common_base
> > @@ -395,6 +395,11 @@ CONFIG_RTE_LIBRTE_BOND_DEBUG_ALB_L1=n
> >  CONFIG_RTE_LIBRTE_PMD_FAILSAFE=y
> >
> >  #
> > +# Compile Marvell Embedded Processors Common
> > +#
> > +CONFIG_RTE_LIBRTE_MVEP_COMMON=n
>
> Do you need a new config option for common, why not enable it if one of the
> consumers of common code enabled?

Good point. Will rework that in v2.

--
- Tomasz Duszyński

^ permalink raw reply	[flat|nested] 30+ messages in thread

* [dpdk-dev] [PATCH 0/6] net/mvpp2 changes and features
  2018-08-24 12:16 [dpdk-dev] [PATCH 0/6] mvpp2 changes and features Tomasz Duszynski
                   ` (5 preceding siblings ...)
  2018-08-24 12:16 ` [dpdk-dev] [PATCH 6/6] net/mvpp2: add VLAN packet type support for parser offload Tomasz Duszynski
@ 2018-08-24 14:54 ` Tomasz Duszynski
  2018-08-24 14:54   ` [dpdk-dev] [PATCH v2 1/6] drivers/common: add mvep common code for MRVL PMDs Tomasz Duszynski
                     ` (6 more replies)
  6 siblings, 7 replies; 30+ messages in thread
From: Tomasz Duszynski @ 2018-08-24 14:54 UTC (permalink / raw)
  To: dev; +Cc: nsamsono, mw, Tomasz Duszynski

This patch series introduces following changes:

* Common code responsible for DMA memory initialization
  is now available under drivers/common/mvep. MVEP stands for
  Marvell Embedded Processors. This eases maintenance and avoids
  boilerplate code across Marvell PMDs. MVEP will grow over time as new
  features and PMDs are added.

* Couple of minor fixes.

* Support for reading VLAN information from descriptor.

v2:
 * Remove CONFIG_RTE_LIBRTE_MVEP_COMMON. Use CONFIG_RTE_LIBRTE_MVPP2_PMD
   to control common/mvep compilation instead.

Liron Himi (2):
  drivers/common: add mvep common code for MRVL PMDs
  net/mvpp2: use common code to initialize DMA

Natalie Samsonov (3):
  net/mvpp2: fix comments and error messages
  net/mvpp2: make private variables static
  net/mvpp2: add VLAN packet type support for parser offload

Tomasz Duszynski (1):
  net/mvpp2: fix array initialization

 drivers/common/Makefile                         |  4 ++
 drivers/common/meson.build                      |  2 +-
 drivers/common/mvep/Makefile                    | 38 +++++++++++++++
 drivers/common/mvep/meson.build                 | 19 ++++++++
 drivers/common/mvep/mvep_common.c               | 45 ++++++++++++++++++
 drivers/common/mvep/rte_common_mvep_version.map |  6 +++
 drivers/common/mvep/rte_mvep_common.h           | 20 ++++++++
 drivers/net/mvpp2/Makefile                      |  3 +-
 drivers/net/mvpp2/meson.build                   |  2 +-
 drivers/net/mvpp2/mrvl_ethdev.c                 | 61 +++++++++++++------------
 drivers/net/mvpp2/mrvl_flow.c                   | 29 ++++++++----
 mk/rte.app.mk                                   |  4 ++
 12 files changed, 194 insertions(+), 39 deletions(-)
 create mode 100644 drivers/common/mvep/Makefile
 create mode 100644 drivers/common/mvep/meson.build
 create mode 100644 drivers/common/mvep/mvep_common.c
 create mode 100644 drivers/common/mvep/rte_common_mvep_version.map
 create mode 100644 drivers/common/mvep/rte_mvep_common.h

--
2.7.4

^ permalink raw reply	[flat|nested] 30+ messages in thread

* [dpdk-dev] [PATCH v2 1/6] drivers/common: add mvep common code for MRVL PMDs
  2018-08-24 14:54 ` [dpdk-dev] [PATCH 0/6] net/mvpp2 changes and features Tomasz Duszynski
@ 2018-08-24 14:54   ` Tomasz Duszynski
  2018-08-24 16:45     ` Ferruh Yigit
  2018-08-24 14:54   ` [dpdk-dev] [PATCH v2 2/6] net/mvpp2: use common code to initialize DMA Tomasz Duszynski
                     ` (5 subsequent siblings)
  6 siblings, 1 reply; 30+ messages in thread
From: Tomasz Duszynski @ 2018-08-24 14:54 UTC (permalink / raw)
  To: dev; +Cc: nsamsono, mw, Liron Himi, Tomasz Duszynski

From: Liron Himi <lironh@marvell.com>

Add MVEP (Marvell Embedded Processors) to drivers/common which
will keep code reused by current and future MRVL PMDs.
Right now we have only common DMA memory initialization routines there.

Signed-off-by: Liron Himi <lironh@marvell.com>
Signed-off-by: Tomasz Duszynski <tdu@semihalf.com>
Reviewed-by: Natalie Samsonov <nsamsono@marvell.com>
---
 drivers/common/Makefile                         |  4 +++
 drivers/common/meson.build                      |  2 +-
 drivers/common/mvep/Makefile                    | 38 +++++++++++++++++++++
 drivers/common/mvep/meson.build                 | 19 +++++++++++
 drivers/common/mvep/mvep_common.c               | 45 +++++++++++++++++++++++++
 drivers/common/mvep/rte_common_mvep_version.map |  6 ++++
 drivers/common/mvep/rte_mvep_common.h           | 20 +++++++++++
 mk/rte.app.mk                                   |  4 +++
 8 files changed, 137 insertions(+), 1 deletion(-)
 create mode 100644 drivers/common/mvep/Makefile
 create mode 100644 drivers/common/mvep/meson.build
 create mode 100644 drivers/common/mvep/mvep_common.c
 create mode 100644 drivers/common/mvep/rte_common_mvep_version.map
 create mode 100644 drivers/common/mvep/rte_mvep_common.h

diff --git a/drivers/common/Makefile b/drivers/common/Makefile
index 0fd2237..5f72da0 100644
--- a/drivers/common/Makefile
+++ b/drivers/common/Makefile
@@ -8,4 +8,8 @@ ifeq ($(CONFIG_RTE_LIBRTE_PMD_OCTEONTX_SSOVF)$(CONFIG_RTE_LIBRTE_OCTEONTX_MEMPOO
 DIRS-y += octeontx
 endif
 
+ifeq ($(CONFIG_RTE_LIBRTE_MVPP2_PMD),y)
+DIRS-y += mvep
+endif
+
 include $(RTE_SDK)/mk/rte.subdir.mk
diff --git a/drivers/common/meson.build b/drivers/common/meson.build
index d7b7d8c..f828ce7 100644
--- a/drivers/common/meson.build
+++ b/drivers/common/meson.build
@@ -2,6 +2,6 @@
 # Copyright(c) 2018 Cavium, Inc
 
 std_deps = ['eal']
-drivers = ['octeontx', 'qat']
+drivers = ['mvep', 'octeontx', 'qat']
 config_flag_fmt = 'RTE_LIBRTE_@0@_COMMON'
 driver_name_fmt = 'rte_common_@0@'
diff --git a/drivers/common/mvep/Makefile b/drivers/common/mvep/Makefile
new file mode 100644
index 0000000..1f5f005
--- /dev/null
+++ b/drivers/common/mvep/Makefile
@@ -0,0 +1,38 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright(c) 2018 Marvell International Ltd.
+#
+
+include $(RTE_SDK)/mk/rte.vars.mk
+
+ifneq ($(MAKECMDGOALS),clean)
+ifneq ($(MAKECMDGOALS),config)
+ifeq ($(LIBMUSDK_PATH),)
+$(error "Please define LIBMUSDK_PATH environment variable")
+endif
+endif
+endif
+
+# library name
+LIB = librte_common_mvep.a
+
+# library version
+LIBABIVER := 1
+
+# versioning export map
+EXPORT_MAP := rte_common_mvep_version.map
+
+# external library dependencies
+CFLAGS += -I$($RTE_SDK)/drivers/common/mvep
+CFLAGS += -I$(LIBMUSDK_PATH)/include
+CFLAGS += -DMVCONF_TYPES_PUBLIC
+CFLAGS += -DMVCONF_DMA_PHYS_ADDR_T_PUBLIC
+CFLAGS += $(WERROR_FLAGS)
+CFLAGS += -O3
+LDLIBS += -L$(LIBMUSDK_PATH)/lib
+LDLIBS += -lmusdk
+LDLIBS += -lrte_eal -lrte_kvargs
+
+# library source files
+SRCS-y += mvep_common.c
+
+include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/drivers/common/mvep/meson.build b/drivers/common/mvep/meson.build
new file mode 100644
index 0000000..8ccfacb
--- /dev/null
+++ b/drivers/common/mvep/meson.build
@@ -0,0 +1,19 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright(c) 2018 Marvell International Ltd.
+# Copyright(c) 2018 Semihalf.
+# All rights reserved.
+#
+path = get_option('lib_musdk_dir')
+lib_dir = path + '/lib'
+inc_dir = path + '/include'
+
+lib = cc.find_library('libmusdk', dirs: [lib_dir], required: false)
+if not lib.found()
+	build = false
+else
+	ext_deps += lib
+	includes += include_directories(inc_dir)
+	cflags += ['-DMVCONF_TYPES_PUBLIC', '-DMVCONF_DMA_PHYS_ADDR_T_PUBLIC']
+endif
+
+sources = files('mvep_common.c')
diff --git a/drivers/common/mvep/mvep_common.c b/drivers/common/mvep/mvep_common.c
new file mode 100644
index 0000000..67fa65b
--- /dev/null
+++ b/drivers/common/mvep/mvep_common.c
@@ -0,0 +1,45 @@
+/*  SPDX-License-Identifier: BSD-3-Clause
+ *  Copyright(c) 2018 Marvell International Ltd.
+ */
+
+#include <rte_common.h>
+
+#include <env/mv_autogen_comp_flags.h>
+#include <env/mv_sys_dma.h>
+
+#include "rte_mvep_common.h"
+
+/* Memory size (in bytes) for MUSDK dma buffers */
+#define MRVL_MUSDK_DMA_MEMSIZE (40 * 1024 * 1024)
+
+struct mvep {
+	uint32_t ref_count;
+};
+
+static struct mvep mvep;
+
+int rte_mvep_init(enum mvep_module_type module __rte_unused,
+		  struct rte_kvargs *kvlist __rte_unused)
+{
+	int ret;
+
+	if (!mvep.ref_count) {
+		ret = mv_sys_dma_mem_init(MRVL_MUSDK_DMA_MEMSIZE);
+		if (ret)
+			return ret;
+	}
+
+	mvep.ref_count++;
+
+	return 0;
+}
+
+int rte_mvep_deinit(enum mvep_module_type module __rte_unused)
+{
+	mvep.ref_count--;
+
+	if (!mvep.ref_count)
+		mv_sys_dma_mem_destroy();
+
+	return 0;
+}
diff --git a/drivers/common/mvep/rte_common_mvep_version.map b/drivers/common/mvep/rte_common_mvep_version.map
new file mode 100644
index 0000000..fa1a1b8
--- /dev/null
+++ b/drivers/common/mvep/rte_common_mvep_version.map
@@ -0,0 +1,6 @@
+DPDK_18.08 {
+	global:
+
+	rte_mvep_init;
+	rte_mvep_deinit;
+};
diff --git a/drivers/common/mvep/rte_mvep_common.h b/drivers/common/mvep/rte_mvep_common.h
new file mode 100644
index 0000000..ba47e16
--- /dev/null
+++ b/drivers/common/mvep/rte_mvep_common.h
@@ -0,0 +1,20 @@
+/*  SPDX-License-Identifier: BSD-3-Clause
+ *  Copyright(c) 2018 Marvell International Ltd.
+ */
+
+#ifndef __RTE_MVEP_COMMON_H__
+#define __RTE_MVEP_COMMON_H__
+
+#include <rte_kvargs.h>
+
+enum mvep_module_type {
+	MVEP_MOD_T_NONE = 0,
+	MVEP_MOD_T_PP2,
+	MVEP_MOD_T_SAM,
+	MVEP_MOD_T_LAST
+};
+
+int rte_mvep_init(enum mvep_module_type module, struct rte_kvargs *kvlist);
+int rte_mvep_deinit(enum mvep_module_type module);
+
+#endif /* __RTE_MVEP_COMMON_H__ */
diff --git a/mk/rte.app.mk b/mk/rte.app.mk
index de33883..899d51a 100644
--- a/mk/rte.app.mk
+++ b/mk/rte.app.mk
@@ -98,6 +98,10 @@ ifeq ($(CONFIG_RTE_LIBRTE_PMD_OCTEONTX_SSOVF)$(CONFIG_RTE_LIBRTE_OCTEONTX_MEMPOO
 _LDLIBS-y += -lrte_common_octeontx
 endif
 
+ifeq ($(CONFIG_RTE_LIBRTE_MVPP2_PMD),y)
+_LDLIBS-y += -lrte_common_mvep -L$(LIBMUSDK_PATH)/lib -lmusdk
+endif
+
 _LDLIBS-$(CONFIG_RTE_LIBRTE_PCI_BUS)        += -lrte_bus_pci
 _LDLIBS-$(CONFIG_RTE_LIBRTE_VDEV_BUS)       += -lrte_bus_vdev
 _LDLIBS-$(CONFIG_RTE_LIBRTE_DPAA_BUS)       += -lrte_bus_dpaa
-- 
2.7.4

^ permalink raw reply	[flat|nested] 30+ messages in thread

* [dpdk-dev] [PATCH v2 2/6] net/mvpp2: use common code to initialize DMA
  2018-08-24 14:54 ` [dpdk-dev] [PATCH 0/6] net/mvpp2 changes and features Tomasz Duszynski
  2018-08-24 14:54   ` [dpdk-dev] [PATCH v2 1/6] drivers/common: add mvep common code for MRVL PMDs Tomasz Duszynski
@ 2018-08-24 14:54   ` Tomasz Duszynski
  2018-08-24 16:46     ` Ferruh Yigit
  2018-08-24 14:54   ` [dpdk-dev] [PATCH v2 3/6] net/mvpp2: fix array initialization Tomasz Duszynski
                     ` (4 subsequent siblings)
  6 siblings, 1 reply; 30+ messages in thread
From: Tomasz Duszynski @ 2018-08-24 14:54 UTC (permalink / raw)
  To: dev; +Cc: nsamsono, mw, Liron Himi

From: Liron Himi <lironh@marvell.com>

Use common code to initialize MUSDK DMA memory buffers.

Signed-off-by: Liron Himi <lironh@marvell.com>
Reviewed-by: Natalie Samsonov <nsamsono@marvell.com>
---
 drivers/net/mvpp2/Makefile      |  3 ++-
 drivers/net/mvpp2/meson.build   |  2 +-
 drivers/net/mvpp2/mrvl_ethdev.c | 36 +++++++++++++-----------------------
 3 files changed, 16 insertions(+), 25 deletions(-)

diff --git a/drivers/net/mvpp2/Makefile b/drivers/net/mvpp2/Makefile
index 492aef9..211d398 100644
--- a/drivers/net/mvpp2/Makefile
+++ b/drivers/net/mvpp2/Makefile
@@ -23,6 +23,7 @@ LIBABIVER := 1
 EXPORT_MAP := rte_pmd_mvpp2_version.map
 
 # external library dependencies
+CFLAGS += -I$(RTE_SDK)/drivers/common/mvep
 CFLAGS += -I$(LIBMUSDK_PATH)/include
 CFLAGS += -DMVCONF_TYPES_PUBLIC
 CFLAGS += -DMVCONF_DMA_PHYS_ADDR_T_PUBLIC
@@ -32,7 +33,7 @@ LDLIBS += -L$(LIBMUSDK_PATH)/lib
 LDLIBS += -lmusdk
 LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring
 LDLIBS += -lrte_ethdev -lrte_net -lrte_kvargs -lrte_cfgfile
-LDLIBS += -lrte_bus_vdev
+LDLIBS += -lrte_bus_vdev -lrte_common_mvep
 
 # library source files
 SRCS-$(CONFIG_RTE_LIBRTE_MVPP2_PMD) += mrvl_ethdev.c
diff --git a/drivers/net/mvpp2/meson.build b/drivers/net/mvpp2/meson.build
index e139889..3620659 100644
--- a/drivers/net/mvpp2/meson.build
+++ b/drivers/net/mvpp2/meson.build
@@ -22,4 +22,4 @@ sources = files(
 	'mrvl_qos.c'
 )
 
-deps += ['cfgfile']
+deps += ['cfgfile', 'common_mvep']
diff --git a/drivers/net/mvpp2/mrvl_ethdev.c b/drivers/net/mvpp2/mrvl_ethdev.c
index a2d0576..7ea8946 100644
--- a/drivers/net/mvpp2/mrvl_ethdev.c
+++ b/drivers/net/mvpp2/mrvl_ethdev.c
@@ -29,6 +29,7 @@
 #include <sys/stat.h>
 #include <sys/types.h>
 
+#include <rte_mvep_common.h>
 #include "mrvl_ethdev.h"
 #include "mrvl_qos.h"
 
@@ -63,9 +64,6 @@
 #define MRVL_COOKIE_HIGH_ADDR_SHIFT	(sizeof(pp2_cookie_t) * 8)
 #define MRVL_COOKIE_HIGH_ADDR_MASK	(~0ULL << MRVL_COOKIE_HIGH_ADDR_SHIFT)
 
-/* Memory size (in bytes) for MUSDK dma buffers */
-#define MRVL_MUSDK_DMA_MEMSIZE 41943040
-
 /** Port Rx offload capabilities */
 #define MRVL_RX_OFFLOADS (DEV_RX_OFFLOAD_VLAN_FILTER | \
 			  DEV_RX_OFFLOAD_JUMBO_FRAME | \
@@ -2653,24 +2651,17 @@ rte_pmd_mrvl_probe(struct rte_vdev_device *vdev)
 	if (mrvl_dev_num)
 		goto init_devices;
 
-	MRVL_LOG(INFO, "Perform MUSDK initializations");
-	/*
-	 * ret == -EEXIST is correct, it means DMA
-	 * has been already initialized (by another PMD).
-	 */
-	ret = mv_sys_dma_mem_init(MRVL_MUSDK_DMA_MEMSIZE);
-	if (ret < 0) {
-		if (ret != -EEXIST)
-			goto out_free_kvlist;
-		else
-			MRVL_LOG(INFO,
-				"DMA memory has been already initialized by a different driver.");
-	}
+	MRVL_LOG(INFO, "Perform MUSDK initializations\n");
+
+	ret = rte_mvep_init(MVEP_MOD_T_PP2, kvlist);
+	if (ret)
+		goto out_free_kvlist;
 
 	ret = mrvl_init_pp2();
 	if (ret) {
-		MRVL_LOG(ERR, "Failed to init PP!");
-		goto out_deinit_dma;
+		MRVL_LOG(ERR, "Failed to init PP!\n");
+		rte_mvep_deinit(MVEP_MOD_T_PP2);
+		goto out_free_kvlist;
 	}
 
 	memset(mrvl_port_bpool_size, 0, sizeof(mrvl_port_bpool_size));
@@ -2695,11 +2686,10 @@ rte_pmd_mrvl_probe(struct rte_vdev_device *vdev)
 	for (; i > 0; i--)
 		mrvl_eth_dev_destroy(ifnames.names[i]);
 
-	if (mrvl_dev_num == 0)
+	if (mrvl_dev_num == 0) {
 		mrvl_deinit_pp2();
-out_deinit_dma:
-	if (mrvl_dev_num == 0)
-		mv_sys_dma_mem_destroy();
+		rte_mvep_deinit(MVEP_MOD_T_PP2);
+	}
 out_free_kvlist:
 	rte_kvargs_free(kvlist);
 
@@ -2739,7 +2729,7 @@ rte_pmd_mrvl_remove(struct rte_vdev_device *vdev)
 		MRVL_LOG(INFO, "Perform MUSDK deinit");
 		mrvl_deinit_hifs();
 		mrvl_deinit_pp2();
-		mv_sys_dma_mem_destroy();
+		rte_mvep_deinit(MVEP_MOD_T_PP2);
 	}
 
 	return 0;
-- 
2.7.4

^ permalink raw reply	[flat|nested] 30+ messages in thread

* [dpdk-dev] [PATCH v2 3/6] net/mvpp2: fix array initialization
  2018-08-24 14:54 ` [dpdk-dev] [PATCH 0/6] net/mvpp2 changes and features Tomasz Duszynski
  2018-08-24 14:54   ` [dpdk-dev] [PATCH v2 1/6] drivers/common: add mvep common code for MRVL PMDs Tomasz Duszynski
  2018-08-24 14:54   ` [dpdk-dev] [PATCH v2 2/6] net/mvpp2: use common code to initialize DMA Tomasz Duszynski
@ 2018-08-24 14:54   ` Tomasz Duszynski
  2018-08-24 16:46     ` Ferruh Yigit
  2018-08-24 14:54   ` [dpdk-dev] [PATCH v2 4/6] net/mvpp2: fix comments and error messages Tomasz Duszynski
                     ` (3 subsequent siblings)
  6 siblings, 1 reply; 30+ messages in thread
From: Tomasz Duszynski @ 2018-08-24 14:54 UTC (permalink / raw)
  To: dev; +Cc: nsamsono, mw, Tomasz Duszynski, stable

Fix used_bpools array initialization by using range initializer.
This way all necessary variables are properly initialized regardless
of PP2_NUM_PKT_PROC value.

Fixes: 0ddc9b815b11 ("net/mrvl: add net PMD skeleton")
Cc: stable@dpdk.org

Signed-off-by: Tomasz Duszynski <tdu@semihalf.com>
---
 drivers/net/mvpp2/mrvl_ethdev.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/net/mvpp2/mrvl_ethdev.c b/drivers/net/mvpp2/mrvl_ethdev.c
index 7ea8946..60ca6e0 100644
--- a/drivers/net/mvpp2/mrvl_ethdev.c
+++ b/drivers/net/mvpp2/mrvl_ethdev.c
@@ -84,8 +84,7 @@ static const char * const valid_args[] = {
 static int used_hifs = MRVL_MUSDK_HIFS_RESERVED;
 static struct pp2_hif *hifs[RTE_MAX_LCORE];
 static int used_bpools[PP2_NUM_PKT_PROC] = {
-	MRVL_MUSDK_BPOOLS_RESERVED,
-	MRVL_MUSDK_BPOOLS_RESERVED
+	[0 ... PP2_NUM_PKT_PROC - 1] = MRVL_MUSDK_BPOOLS_RESERVED
 };
 
 struct pp2_bpool *mrvl_port_to_bpool_lookup[RTE_MAX_ETHPORTS];
-- 
2.7.4

^ permalink raw reply	[flat|nested] 30+ messages in thread

* [dpdk-dev] [PATCH v2 4/6] net/mvpp2: fix comments and error messages
  2018-08-24 14:54 ` [dpdk-dev] [PATCH 0/6] net/mvpp2 changes and features Tomasz Duszynski
                     ` (2 preceding siblings ...)
  2018-08-24 14:54   ` [dpdk-dev] [PATCH v2 3/6] net/mvpp2: fix array initialization Tomasz Duszynski
@ 2018-08-24 14:54   ` Tomasz Duszynski
  2018-08-24 14:54   ` [dpdk-dev] [PATCH v2 5/6] net/mvpp2: make private variables static Tomasz Duszynski
                     ` (2 subsequent siblings)
  6 siblings, 0 replies; 30+ messages in thread
From: Tomasz Duszynski @ 2018-08-24 14:54 UTC (permalink / raw)
  To: dev; +Cc: nsamsono, mw, tdu

From: Natalie Samsonov <nsamsono@marvell.com>

Fix comments and error messages.

Fixes: 7235341d7517 ("net/mrvl: support classifier")
Cc: tdu@semihalf.com

Signed-off-by: Natalie Samsonov <nsamsono@marvell.com>
Reviewed-by: Liron Himi <lironh@marvell.com>
---
 drivers/net/mvpp2/mrvl_flow.c | 29 +++++++++++++++++++++--------
 1 file changed, 21 insertions(+), 8 deletions(-)

diff --git a/drivers/net/mvpp2/mrvl_flow.c b/drivers/net/mvpp2/mrvl_flow.c
index ecc3419..13295e6 100644
--- a/drivers/net/mvpp2/mrvl_flow.c
+++ b/drivers/net/mvpp2/mrvl_flow.c
@@ -394,7 +394,8 @@ mrvl_parse_init(const struct rte_flow_item *item,
  *
  * @param spec Pointer to the specific flow item.
  * @param mask Pointer to the specific flow item's mask.
- * @param mask Pointer to the flow.
+ * @param parse_dst Parse either destination or source mac address.
+ * @param flow Pointer to the flow.
  * @return 0 in case of success, negative error value otherwise.
  */
 static int
@@ -613,6 +614,7 @@ mrvl_parse_ip4_dscp(const struct rte_flow_item_ipv4 *spec,
  *
  * @param spec Pointer to the specific flow item.
  * @param mask Pointer to the specific flow item's mask.
+ * @param parse_dst Parse either destination or source ip address.
  * @param flow Pointer to the flow.
  * @return 0 in case of success, negative error value otherwise.
  */
@@ -726,6 +728,7 @@ mrvl_parse_ip4_proto(const struct rte_flow_item_ipv4 *spec,
  *
  * @param spec Pointer to the specific flow item.
  * @param mask Pointer to the specific flow item's mask.
+ * @param parse_dst Parse either destination or source ipv6 address.
  * @param flow Pointer to the flow.
  * @return 0 in case of success, negative error value otherwise.
  */
@@ -874,6 +877,7 @@ mrvl_parse_ip6_next_hdr(const struct rte_flow_item_ipv6 *spec,
  *
  * @param spec Pointer to the specific flow item.
  * @param mask Pointer to the specific flow item's mask.
+ * @param parse_dst Parse either destination or source port.
  * @param flow Pointer to the flow.
  * @return 0 in case of success, negative error value otherwise.
  */
@@ -949,6 +953,7 @@ mrvl_parse_tcp_dport(const struct rte_flow_item_tcp *spec,
  *
  * @param spec Pointer to the specific flow item.
  * @param mask Pointer to the specific flow item's mask.
+ * @param parse_dst Parse either destination or source port.
  * @param flow Pointer to the flow.
  * @return 0 in case of success, negative error value otherwise.
  */
@@ -1022,7 +1027,6 @@ mrvl_parse_udp_dport(const struct rte_flow_item_udp *spec,
  * @param item Pointer to the flow item.
  * @param flow Pointer to the flow.
  * @param error Pointer to the flow error.
- * @param fields Pointer to the parsed parsed fields enum.
  * @returns 0 on success, negative value otherwise.
  */
 static int
@@ -1073,7 +1077,6 @@ mrvl_parse_eth(const struct rte_flow_item *item, struct rte_flow *flow,
  * @param item Pointer to the flow item.
  * @param flow Pointer to the flow.
  * @param error Pointer to the flow error.
- * @param fields Pointer to the parsed parsed fields enum.
  * @returns 0 on success, negative value otherwise.
  */
 static int
@@ -1139,7 +1142,6 @@ mrvl_parse_vlan(const struct rte_flow_item *item,
  * @param item Pointer to the flow item.
  * @param flow Pointer to the flow.
  * @param error Pointer to the flow error.
- * @param fields Pointer to the parsed parsed fields enum.
  * @returns 0 on success, negative value otherwise.
  */
 static int
@@ -1205,7 +1207,6 @@ mrvl_parse_ip4(const struct rte_flow_item *item,
  * @param item Pointer to the flow item.
  * @param flow Pointer to the flow.
  * @param error Pointer to the flow error.
- * @param fields Pointer to the parsed parsed fields enum.
  * @returns 0 on success, negative value otherwise.
  */
 static int
@@ -1276,7 +1277,6 @@ mrvl_parse_ip6(const struct rte_flow_item *item,
  * @param item Pointer to the flow item.
  * @param flow Pointer to the flow.
  * @param error Pointer to the flow error.
- * @param fields Pointer to the parsed parsed fields enum.
  * @returns 0 on success, negative value otherwise.
  */
 static int
@@ -1332,7 +1332,6 @@ mrvl_parse_tcp(const struct rte_flow_item *item,
  * @param item Pointer to the flow item.
  * @param flow Pointer to the flow.
  * @param error Pointer to the flow error.
- * @param fields Pointer to the parsed parsed fields enum.
  * @returns 0 on success, negative value otherwise.
  */
 static int
@@ -1981,6 +1980,7 @@ mrvl_parse_pattern_ip6_tcp(const struct rte_flow_item pattern[],
  * @param pattern Pointer to the flow pattern table.
  * @param flow Pointer to the flow.
  * @param error Pointer to the flow error.
+ * @param ip6 1 to parse ip6 item, 0 to parse ip4 item.
  * @returns 0 in case of success, negative value otherwise.
  */
 static int
@@ -2350,6 +2350,12 @@ mrvl_flow_parse(struct mrvl_priv *priv, const struct rte_flow_attr *attr,
 	return mrvl_flow_parse_actions(priv, actions, flow, error);
 }
 
+/**
+ * Get engine type for the given flow.
+ *
+ * @param field Pointer to the flow.
+ * @returns The type of the engine.
+ */
 static inline enum pp2_cls_tbl_type
 mrvl_engine_type(const struct rte_flow *flow)
 {
@@ -2369,6 +2375,13 @@ mrvl_engine_type(const struct rte_flow *flow)
 	return PP2_CLS_TBL_MASKABLE;
 }
 
+/**
+ * Create classifier table.
+ *
+ * @param dev Pointer to the device.
+ * @param flow Pointer to the very first flow.
+ * @returns 0 in case of success, negative value otherwise.
+ */
 static int
 mrvl_create_cls_table(struct rte_eth_dev *dev, struct rte_flow *first_flow)
 {
@@ -2655,7 +2668,7 @@ mrvl_flow_remove(struct mrvl_priv *priv, struct rte_flow *flow,
 /**
  * DPDK flow destroy callback called when flow is to be removed.
  *
- * @param priv Pointer to the port's private data.
+ * @param dev Pointer to the device.
  * @param flow Pointer to the flow.
  * @param error Pointer to the flow error.
  * @returns 0 in case of success, negative value otherwise.
-- 
2.7.4

^ permalink raw reply	[flat|nested] 30+ messages in thread

* [dpdk-dev] [PATCH v2 5/6] net/mvpp2: make private variables static
  2018-08-24 14:54 ` [dpdk-dev] [PATCH 0/6] net/mvpp2 changes and features Tomasz Duszynski
                     ` (3 preceding siblings ...)
  2018-08-24 14:54   ` [dpdk-dev] [PATCH v2 4/6] net/mvpp2: fix comments and error messages Tomasz Duszynski
@ 2018-08-24 14:54   ` Tomasz Duszynski
  2018-08-24 14:54   ` [dpdk-dev] [PATCH v2 6/6] net/mvpp2: add VLAN packet type support for parser offload Tomasz Duszynski
  2018-08-24 18:29   ` [dpdk-dev] [PATCH v3 0/6] net/mvpp2: changes and features Tomasz Duszynski
  6 siblings, 0 replies; 30+ messages in thread
From: Tomasz Duszynski @ 2018-08-24 14:54 UTC (permalink / raw)
  To: dev; +Cc: nsamsono, mw

From: Natalie Samsonov <nsamsono@marvell.com>

Mark internal variables static to avoid potential redefinition
errors later on.

Signed-off-by: Natalie Samsonov <nsamsono@marvell.com>
Reviewed-by: Yelena Krivosheev <yelena@marvell.com>
---
 drivers/net/mvpp2/mrvl_ethdev.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/mvpp2/mrvl_ethdev.c b/drivers/net/mvpp2/mrvl_ethdev.c
index 60ca6e0..5cd84c1 100644
--- a/drivers/net/mvpp2/mrvl_ethdev.c
+++ b/drivers/net/mvpp2/mrvl_ethdev.c
@@ -87,9 +87,9 @@ static int used_bpools[PP2_NUM_PKT_PROC] = {
 	[0 ... PP2_NUM_PKT_PROC - 1] = MRVL_MUSDK_BPOOLS_RESERVED
 };
 
-struct pp2_bpool *mrvl_port_to_bpool_lookup[RTE_MAX_ETHPORTS];
-int mrvl_port_bpool_size[PP2_NUM_PKT_PROC][PP2_BPOOL_NUM_POOLS][RTE_MAX_LCORE];
-uint64_t cookie_addr_high = MRVL_COOKIE_ADDR_INVALID;
+static struct pp2_bpool *mrvl_port_to_bpool_lookup[RTE_MAX_ETHPORTS];
+static int mrvl_port_bpool_size[PP2_NUM_PKT_PROC][PP2_BPOOL_NUM_POOLS][RTE_MAX_LCORE];
+static uint64_t cookie_addr_high = MRVL_COOKIE_ADDR_INVALID;
 
 int mrvl_logtype;
 
-- 
2.7.4

^ permalink raw reply	[flat|nested] 30+ messages in thread

* [dpdk-dev] [PATCH v2 6/6] net/mvpp2: add VLAN packet type support for parser offload
  2018-08-24 14:54 ` [dpdk-dev] [PATCH 0/6] net/mvpp2 changes and features Tomasz Duszynski
                     ` (4 preceding siblings ...)
  2018-08-24 14:54   ` [dpdk-dev] [PATCH v2 5/6] net/mvpp2: make private variables static Tomasz Duszynski
@ 2018-08-24 14:54   ` Tomasz Duszynski
  2018-08-24 18:29   ` [dpdk-dev] [PATCH v3 0/6] net/mvpp2: changes and features Tomasz Duszynski
  6 siblings, 0 replies; 30+ messages in thread
From: Tomasz Duszynski @ 2018-08-24 14:54 UTC (permalink / raw)
  To: dev; +Cc: nsamsono, mw

From: Natalie Samsonov <nsamsono@marvell.com>

Add VLAN packet type support for parser offload.

Signed-off-by: Natalie Samsonov <nsamsono@marvell.com>
Reviewed-by: Shlomi Gridish <sgridish@marvell.com>
Reviewed-by: Dmitri Epshtein <dima@marvell.com>
Reviewed-by: Yuval Caduri <cyuval@marvell.com>
---
 drivers/net/mvpp2/mrvl_ethdev.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/drivers/net/mvpp2/mrvl_ethdev.c b/drivers/net/mvpp2/mrvl_ethdev.c
index 5cd84c1..5b92d82 100644
--- a/drivers/net/mvpp2/mrvl_ethdev.c
+++ b/drivers/net/mvpp2/mrvl_ethdev.c
@@ -1353,6 +1353,8 @@ mrvl_dev_supported_ptypes_get(struct rte_eth_dev *dev __rte_unused)
 {
 	static const uint32_t ptypes[] = {
 		RTE_PTYPE_L2_ETHER,
+		RTE_PTYPE_L2_ETHER_VLAN,
+		RTE_PTYPE_L2_ETHER_QINQ,
 		RTE_PTYPE_L3_IPV4,
 		RTE_PTYPE_L3_IPV4_EXT,
 		RTE_PTYPE_L3_IPV4_EXT_UNKNOWN,
@@ -1922,13 +1924,27 @@ mrvl_desc_to_packet_type_and_offset(struct pp2_ppio_desc *desc,
 {
 	enum pp2_inq_l3_type l3_type;
 	enum pp2_inq_l4_type l4_type;
+	enum pp2_inq_vlan_tag vlan_tag;
 	uint64_t packet_type;
 
 	pp2_ppio_inq_desc_get_l3_info(desc, &l3_type, l3_offset);
 	pp2_ppio_inq_desc_get_l4_info(desc, &l4_type, l4_offset);
+	pp2_ppio_inq_desc_get_vlan_tag(desc, &vlan_tag);
 
 	packet_type = RTE_PTYPE_L2_ETHER;
 
+	switch (vlan_tag) {
+	case PP2_INQ_VLAN_TAG_SINGLE:
+		packet_type |= RTE_PTYPE_L2_ETHER_VLAN;
+		break;
+	case PP2_INQ_VLAN_TAG_DOUBLE:
+	case PP2_INQ_VLAN_TAG_TRIPLE:
+		packet_type |= RTE_PTYPE_L2_ETHER_QINQ;
+		break;
+	default:
+		break;
+	}
+
 	switch (l3_type) {
 	case PP2_INQ_L3_TYPE_IPV4_NO_OPTS:
 		packet_type |= RTE_PTYPE_L3_IPV4;
-- 
2.7.4

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [dpdk-dev] [PATCH v2 1/6] drivers/common: add mvep common code for MRVL PMDs
  2018-08-24 14:54   ` [dpdk-dev] [PATCH v2 1/6] drivers/common: add mvep common code for MRVL PMDs Tomasz Duszynski
@ 2018-08-24 16:45     ` Ferruh Yigit
  2018-08-24 17:51       ` Tomasz Duszynski
  0 siblings, 1 reply; 30+ messages in thread
From: Ferruh Yigit @ 2018-08-24 16:45 UTC (permalink / raw)
  To: Tomasz Duszynski, dev; +Cc: nsamsono, mw, Liron Himi

On 8/24/2018 3:54 PM, Tomasz Duszynski wrote:
> From: Liron Himi <lironh@marvell.com>
> 
> Add MVEP (Marvell Embedded Processors) to drivers/common which
> will keep code reused by current and future MRVL PMDs.
> Right now we have only common DMA memory initialization routines there.
> 
> Signed-off-by: Liron Himi <lironh@marvell.com>
> Signed-off-by: Tomasz Duszynski <tdu@semihalf.com>
> Reviewed-by: Natalie Samsonov <nsamsono@marvell.com>

<...>

> @@ -0,0 +1,6 @@
> +DPDK_18.08 {

DPDK_18.11

> +	global:
> +
> +	rte_mvep_init;
> +	rte_mvep_deinit;
> +};

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [dpdk-dev] [PATCH v2 2/6] net/mvpp2: use common code to initialize DMA
  2018-08-24 14:54   ` [dpdk-dev] [PATCH v2 2/6] net/mvpp2: use common code to initialize DMA Tomasz Duszynski
@ 2018-08-24 16:46     ` Ferruh Yigit
  2018-08-24 17:51       ` Tomasz Duszynski
  0 siblings, 1 reply; 30+ messages in thread
From: Ferruh Yigit @ 2018-08-24 16:46 UTC (permalink / raw)
  To: Tomasz Duszynski, dev; +Cc: nsamsono, mw, Liron Himi

On 8/24/2018 3:54 PM, Tomasz Duszynski wrote:
> From: Liron Himi <lironh@marvell.com>
> 
> Use common code to initialize MUSDK DMA memory buffers.
> 
> Signed-off-by: Liron Himi <lironh@marvell.com>
> Reviewed-by: Natalie Samsonov <nsamsono@marvell.com>

<...>

> @@ -2653,24 +2651,17 @@ rte_pmd_mrvl_probe(struct rte_vdev_device *vdev)
>  	if (mrvl_dev_num)
>  		goto init_devices;
>  
> -	MRVL_LOG(INFO, "Perform MUSDK initializations");
> -	/*
> -	 * ret == -EEXIST is correct, it means DMA
> -	 * has been already initialized (by another PMD).
> -	 */
> -	ret = mv_sys_dma_mem_init(MRVL_MUSDK_DMA_MEMSIZE);
> -	if (ret < 0) {
> -		if (ret != -EEXIST)
> -			goto out_free_kvlist;
> -		else
> -			MRVL_LOG(INFO,
> -				"DMA memory has been already initialized by a different driver.");
> -	}
> +	MRVL_LOG(INFO, "Perform MUSDK initializations\n");

MRVL_LOG already adding "\n", no need to change original log, a few more below.

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [dpdk-dev] [PATCH v2 3/6] net/mvpp2: fix array initialization
  2018-08-24 14:54   ` [dpdk-dev] [PATCH v2 3/6] net/mvpp2: fix array initialization Tomasz Duszynski
@ 2018-08-24 16:46     ` Ferruh Yigit
  2018-08-24 17:53       ` Tomasz Duszynski
  0 siblings, 1 reply; 30+ messages in thread
From: Ferruh Yigit @ 2018-08-24 16:46 UTC (permalink / raw)
  To: Tomasz Duszynski, dev; +Cc: nsamsono, mw, stable

On 8/24/2018 3:54 PM, Tomasz Duszynski wrote:
> Fix used_bpools array initialization by using range initializer.
> This way all necessary variables are properly initialized regardless
> of PP2_NUM_PKT_PROC value.
> 
> Fixes: 0ddc9b815b11 ("net/mrvl: add net PMD skeleton")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Tomasz Duszynski <tdu@semihalf.com>
> ---
>  drivers/net/mvpp2/mrvl_ethdev.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/net/mvpp2/mrvl_ethdev.c b/drivers/net/mvpp2/mrvl_ethdev.c
> index 7ea8946..60ca6e0 100644
> --- a/drivers/net/mvpp2/mrvl_ethdev.c
> +++ b/drivers/net/mvpp2/mrvl_ethdev.c
> @@ -84,8 +84,7 @@ static const char * const valid_args[] = {
>  static int used_hifs = MRVL_MUSDK_HIFS_RESERVED;
>  static struct pp2_hif *hifs[RTE_MAX_LCORE];
>  static int used_bpools[PP2_NUM_PKT_PROC] = {
> -	MRVL_MUSDK_BPOOLS_RESERVED,
> -	MRVL_MUSDK_BPOOLS_RESERVED
> +	[0 ... PP2_NUM_PKT_PROC - 1] = MRVL_MUSDK_BPOOLS_RESERVED

range initializer is not part of standard, although I am sure this won't be
first GCC extension we rely on, and I don't have any other option than memset
for this.

So just a reminder about extension usage, if you are happy with this
implementation, lets keep it.

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [dpdk-dev] [PATCH v2 2/6] net/mvpp2: use common code to initialize DMA
  2018-08-24 16:46     ` Ferruh Yigit
@ 2018-08-24 17:51       ` Tomasz Duszynski
  0 siblings, 0 replies; 30+ messages in thread
From: Tomasz Duszynski @ 2018-08-24 17:51 UTC (permalink / raw)
  To: Ferruh Yigit; +Cc: Tomasz Duszynski, dev, nsamsono, mw, Liron Himi

On Fri, Aug 24, 2018 at 05:46:21PM +0100, Ferruh Yigit wrote:
> On 8/24/2018 3:54 PM, Tomasz Duszynski wrote:
> > From: Liron Himi <lironh@marvell.com>
> >
> > Use common code to initialize MUSDK DMA memory buffers.
> >
> > Signed-off-by: Liron Himi <lironh@marvell.com>
> > Reviewed-by: Natalie Samsonov <nsamsono@marvell.com>
>
> <...>
>
> > @@ -2653,24 +2651,17 @@ rte_pmd_mrvl_probe(struct rte_vdev_device *vdev)
> >  	if (mrvl_dev_num)
> >  		goto init_devices;
> >
> > -	MRVL_LOG(INFO, "Perform MUSDK initializations");
> > -	/*
> > -	 * ret == -EEXIST is correct, it means DMA
> > -	 * has been already initialized (by another PMD).
> > -	 */
> > -	ret = mv_sys_dma_mem_init(MRVL_MUSDK_DMA_MEMSIZE);
> > -	if (ret < 0) {
> > -		if (ret != -EEXIST)
> > -			goto out_free_kvlist;
> > -		else
> > -			MRVL_LOG(INFO,
> > -				"DMA memory has been already initialized by a different driver.");
> > -	}
> > +	MRVL_LOG(INFO, "Perform MUSDK initializations\n");
>
> MRVL_LOG already adding "\n", no need to change original log, a few more below.

Good catch.

--
- Tomasz Duszyński

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [dpdk-dev] [PATCH v2 1/6] drivers/common: add mvep common code for MRVL PMDs
  2018-08-24 16:45     ` Ferruh Yigit
@ 2018-08-24 17:51       ` Tomasz Duszynski
  0 siblings, 0 replies; 30+ messages in thread
From: Tomasz Duszynski @ 2018-08-24 17:51 UTC (permalink / raw)
  To: Ferruh Yigit; +Cc: Tomasz Duszynski, dev, nsamsono, mw, Liron Himi

On Fri, Aug 24, 2018 at 05:45:48PM +0100, Ferruh Yigit wrote:
> On 8/24/2018 3:54 PM, Tomasz Duszynski wrote:
> > From: Liron Himi <lironh@marvell.com>
> >
> > Add MVEP (Marvell Embedded Processors) to drivers/common which
> > will keep code reused by current and future MRVL PMDs.
> > Right now we have only common DMA memory initialization routines there.
> >
> > Signed-off-by: Liron Himi <lironh@marvell.com>
> > Signed-off-by: Tomasz Duszynski <tdu@semihalf.com>
> > Reviewed-by: Natalie Samsonov <nsamsono@marvell.com>
>
> <...>
>
> > @@ -0,0 +1,6 @@
> > +DPDK_18.08 {
>
> DPDK_18.11
>

ACK

> > +	global:
> > +
> > +	rte_mvep_init;
> > +	rte_mvep_deinit;
> > +};

--
- Tomasz Duszyński

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [dpdk-dev] [PATCH v2 3/6] net/mvpp2: fix array initialization
  2018-08-24 16:46     ` Ferruh Yigit
@ 2018-08-24 17:53       ` Tomasz Duszynski
  0 siblings, 0 replies; 30+ messages in thread
From: Tomasz Duszynski @ 2018-08-24 17:53 UTC (permalink / raw)
  To: Ferruh Yigit; +Cc: Tomasz Duszynski, dev, nsamsono, mw, stable

On Fri, Aug 24, 2018 at 05:46:42PM +0100, Ferruh Yigit wrote:
> On 8/24/2018 3:54 PM, Tomasz Duszynski wrote:
> > Fix used_bpools array initialization by using range initializer.
> > This way all necessary variables are properly initialized regardless
> > of PP2_NUM_PKT_PROC value.
> >
> > Fixes: 0ddc9b815b11 ("net/mrvl: add net PMD skeleton")
> > Cc: stable@dpdk.org
> >
> > Signed-off-by: Tomasz Duszynski <tdu@semihalf.com>
> > ---
> >  drivers/net/mvpp2/mrvl_ethdev.c | 3 +--
> >  1 file changed, 1 insertion(+), 2 deletions(-)
> >
> > diff --git a/drivers/net/mvpp2/mrvl_ethdev.c b/drivers/net/mvpp2/mrvl_ethdev.c
> > index 7ea8946..60ca6e0 100644
> > --- a/drivers/net/mvpp2/mrvl_ethdev.c
> > +++ b/drivers/net/mvpp2/mrvl_ethdev.c
> > @@ -84,8 +84,7 @@ static const char * const valid_args[] = {
> >  static int used_hifs = MRVL_MUSDK_HIFS_RESERVED;
> >  static struct pp2_hif *hifs[RTE_MAX_LCORE];
> >  static int used_bpools[PP2_NUM_PKT_PROC] = {
> > -	MRVL_MUSDK_BPOOLS_RESERVED,
> > -	MRVL_MUSDK_BPOOLS_RESERVED
> > +	[0 ... PP2_NUM_PKT_PROC - 1] = MRVL_MUSDK_BPOOLS_RESERVED
>
> range initializer is not part of standard, although I am sure this won't be
> first GCC extension we rely on, and I don't have any other option than memset
> for this.
>
> So just a reminder about extension usage, if you are happy with this
> implementation, lets keep it.

I would prefer to leave it as is. As you pointed out DPDK has
already started using it anyway.

--
- Tomasz Duszyński

^ permalink raw reply	[flat|nested] 30+ messages in thread

* [dpdk-dev] [PATCH v3 0/6] net/mvpp2: changes and features
  2018-08-24 14:54 ` [dpdk-dev] [PATCH 0/6] net/mvpp2 changes and features Tomasz Duszynski
                     ` (5 preceding siblings ...)
  2018-08-24 14:54   ` [dpdk-dev] [PATCH v2 6/6] net/mvpp2: add VLAN packet type support for parser offload Tomasz Duszynski
@ 2018-08-24 18:29   ` Tomasz Duszynski
  2018-08-24 18:29     ` [dpdk-dev] [PATCH v3 1/6] drivers/common: add mvep common code for MRVL PMDs Tomasz Duszynski
                       ` (6 more replies)
  6 siblings, 7 replies; 30+ messages in thread
From: Tomasz Duszynski @ 2018-08-24 18:29 UTC (permalink / raw)
  To: dev; +Cc: nsamsono, mw, Tomasz Duszynski

This patch series introduces following changes:

* Common code responsible for DMA memory initialization
  is now available under drivers/common/mvep. MVEP stands for
  Marvell Embedded Processors. This eases maintenance and avoids
  boilerplate code across Marvell PMDs. MVEP will grow over time as new
  features and PMDs are added.

* Couple of minor fixes.

* Support for reading VLAN information from descriptor.

v3:
 * Change exported symbols version to 18.11.
 * Drop excessive new lines from messages passed to MRVL_LOG().

v2:
 * Remove CONFIG_RTE_LIBRTE_MVEP_COMMON. Use CONFIG_RTE_LIBRTE_MVPP2_PMD
   to control common/mvep compilation instead.

Liron Himi (2):
  drivers/common: add mvep common code for MRVL PMDs
  net/mvpp2: use common code to initialize DMA

Natalie Samsonov (3):
  net/mvpp2: fix comments and error messages
  net/mvpp2: make private variables static
  net/mvpp2: add VLAN packet type support for parser offload

Tomasz Duszynski (1):
  net/mvpp2: fix array initialization

 drivers/common/Makefile                         |  4 ++
 drivers/common/meson.build                      |  2 +-
 drivers/common/mvep/Makefile                    | 38 +++++++++++++++++
 drivers/common/mvep/meson.build                 | 19 +++++++++
 drivers/common/mvep/mvep_common.c               | 45 +++++++++++++++++++
 drivers/common/mvep/rte_common_mvep_version.map |  6 +++
 drivers/common/mvep/rte_mvep_common.h           | 20 +++++++++
 drivers/net/mvpp2/Makefile                      |  3 +-
 drivers/net/mvpp2/meson.build                   |  2 +-
 drivers/net/mvpp2/mrvl_ethdev.c                 | 57 ++++++++++++++-----------
 drivers/net/mvpp2/mrvl_flow.c                   | 29 +++++++++----
 mk/rte.app.mk                                   |  4 ++
 12 files changed, 192 insertions(+), 37 deletions(-)
 create mode 100644 drivers/common/mvep/Makefile
 create mode 100644 drivers/common/mvep/meson.build
 create mode 100644 drivers/common/mvep/mvep_common.c
 create mode 100644 drivers/common/mvep/rte_common_mvep_version.map
 create mode 100644 drivers/common/mvep/rte_mvep_common.h

--
2.7.4

^ permalink raw reply	[flat|nested] 30+ messages in thread

* [dpdk-dev] [PATCH v3 1/6] drivers/common: add mvep common code for MRVL PMDs
  2018-08-24 18:29   ` [dpdk-dev] [PATCH v3 0/6] net/mvpp2: changes and features Tomasz Duszynski
@ 2018-08-24 18:29     ` Tomasz Duszynski
  2018-08-24 18:29     ` [dpdk-dev] [PATCH v3 2/6] net/mvpp2: use common code to initialize DMA Tomasz Duszynski
                       ` (5 subsequent siblings)
  6 siblings, 0 replies; 30+ messages in thread
From: Tomasz Duszynski @ 2018-08-24 18:29 UTC (permalink / raw)
  To: dev; +Cc: nsamsono, mw, Liron Himi, Tomasz Duszynski

From: Liron Himi <lironh@marvell.com>

Add MVEP (Marvell Embedded Processors) to drivers/common which
will keep code reused by current and future MRVL PMDs.
Right now we have only common DMA memory initialization routines there.

Signed-off-by: Liron Himi <lironh@marvell.com>
Signed-off-by: Tomasz Duszynski <tdu@semihalf.com>
Reviewed-by: Natalie Samsonov <nsamsono@marvell.com>
---
 drivers/common/Makefile                         |  4 +++
 drivers/common/meson.build                      |  2 +-
 drivers/common/mvep/Makefile                    | 38 +++++++++++++++++++++
 drivers/common/mvep/meson.build                 | 19 +++++++++++
 drivers/common/mvep/mvep_common.c               | 45 +++++++++++++++++++++++++
 drivers/common/mvep/rte_common_mvep_version.map |  6 ++++
 drivers/common/mvep/rte_mvep_common.h           | 20 +++++++++++
 mk/rte.app.mk                                   |  4 +++
 8 files changed, 137 insertions(+), 1 deletion(-)
 create mode 100644 drivers/common/mvep/Makefile
 create mode 100644 drivers/common/mvep/meson.build
 create mode 100644 drivers/common/mvep/mvep_common.c
 create mode 100644 drivers/common/mvep/rte_common_mvep_version.map
 create mode 100644 drivers/common/mvep/rte_mvep_common.h

diff --git a/drivers/common/Makefile b/drivers/common/Makefile
index 0fd2237..5f72da0 100644
--- a/drivers/common/Makefile
+++ b/drivers/common/Makefile
@@ -8,4 +8,8 @@ ifeq ($(CONFIG_RTE_LIBRTE_PMD_OCTEONTX_SSOVF)$(CONFIG_RTE_LIBRTE_OCTEONTX_MEMPOO
 DIRS-y += octeontx
 endif
 
+ifeq ($(CONFIG_RTE_LIBRTE_MVPP2_PMD),y)
+DIRS-y += mvep
+endif
+
 include $(RTE_SDK)/mk/rte.subdir.mk
diff --git a/drivers/common/meson.build b/drivers/common/meson.build
index d7b7d8c..f828ce7 100644
--- a/drivers/common/meson.build
+++ b/drivers/common/meson.build
@@ -2,6 +2,6 @@
 # Copyright(c) 2018 Cavium, Inc
 
 std_deps = ['eal']
-drivers = ['octeontx', 'qat']
+drivers = ['mvep', 'octeontx', 'qat']
 config_flag_fmt = 'RTE_LIBRTE_@0@_COMMON'
 driver_name_fmt = 'rte_common_@0@'
diff --git a/drivers/common/mvep/Makefile b/drivers/common/mvep/Makefile
new file mode 100644
index 0000000..1f5f005
--- /dev/null
+++ b/drivers/common/mvep/Makefile
@@ -0,0 +1,38 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright(c) 2018 Marvell International Ltd.
+#
+
+include $(RTE_SDK)/mk/rte.vars.mk
+
+ifneq ($(MAKECMDGOALS),clean)
+ifneq ($(MAKECMDGOALS),config)
+ifeq ($(LIBMUSDK_PATH),)
+$(error "Please define LIBMUSDK_PATH environment variable")
+endif
+endif
+endif
+
+# library name
+LIB = librte_common_mvep.a
+
+# library version
+LIBABIVER := 1
+
+# versioning export map
+EXPORT_MAP := rte_common_mvep_version.map
+
+# external library dependencies
+CFLAGS += -I$($RTE_SDK)/drivers/common/mvep
+CFLAGS += -I$(LIBMUSDK_PATH)/include
+CFLAGS += -DMVCONF_TYPES_PUBLIC
+CFLAGS += -DMVCONF_DMA_PHYS_ADDR_T_PUBLIC
+CFLAGS += $(WERROR_FLAGS)
+CFLAGS += -O3
+LDLIBS += -L$(LIBMUSDK_PATH)/lib
+LDLIBS += -lmusdk
+LDLIBS += -lrte_eal -lrte_kvargs
+
+# library source files
+SRCS-y += mvep_common.c
+
+include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/drivers/common/mvep/meson.build b/drivers/common/mvep/meson.build
new file mode 100644
index 0000000..8ccfacb
--- /dev/null
+++ b/drivers/common/mvep/meson.build
@@ -0,0 +1,19 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright(c) 2018 Marvell International Ltd.
+# Copyright(c) 2018 Semihalf.
+# All rights reserved.
+#
+path = get_option('lib_musdk_dir')
+lib_dir = path + '/lib'
+inc_dir = path + '/include'
+
+lib = cc.find_library('libmusdk', dirs: [lib_dir], required: false)
+if not lib.found()
+	build = false
+else
+	ext_deps += lib
+	includes += include_directories(inc_dir)
+	cflags += ['-DMVCONF_TYPES_PUBLIC', '-DMVCONF_DMA_PHYS_ADDR_T_PUBLIC']
+endif
+
+sources = files('mvep_common.c')
diff --git a/drivers/common/mvep/mvep_common.c b/drivers/common/mvep/mvep_common.c
new file mode 100644
index 0000000..67fa65b
--- /dev/null
+++ b/drivers/common/mvep/mvep_common.c
@@ -0,0 +1,45 @@
+/*  SPDX-License-Identifier: BSD-3-Clause
+ *  Copyright(c) 2018 Marvell International Ltd.
+ */
+
+#include <rte_common.h>
+
+#include <env/mv_autogen_comp_flags.h>
+#include <env/mv_sys_dma.h>
+
+#include "rte_mvep_common.h"
+
+/* Memory size (in bytes) for MUSDK dma buffers */
+#define MRVL_MUSDK_DMA_MEMSIZE (40 * 1024 * 1024)
+
+struct mvep {
+	uint32_t ref_count;
+};
+
+static struct mvep mvep;
+
+int rte_mvep_init(enum mvep_module_type module __rte_unused,
+		  struct rte_kvargs *kvlist __rte_unused)
+{
+	int ret;
+
+	if (!mvep.ref_count) {
+		ret = mv_sys_dma_mem_init(MRVL_MUSDK_DMA_MEMSIZE);
+		if (ret)
+			return ret;
+	}
+
+	mvep.ref_count++;
+
+	return 0;
+}
+
+int rte_mvep_deinit(enum mvep_module_type module __rte_unused)
+{
+	mvep.ref_count--;
+
+	if (!mvep.ref_count)
+		mv_sys_dma_mem_destroy();
+
+	return 0;
+}
diff --git a/drivers/common/mvep/rte_common_mvep_version.map b/drivers/common/mvep/rte_common_mvep_version.map
new file mode 100644
index 0000000..c71722d
--- /dev/null
+++ b/drivers/common/mvep/rte_common_mvep_version.map
@@ -0,0 +1,6 @@
+DPDK_18.11 {
+	global:
+
+	rte_mvep_init;
+	rte_mvep_deinit;
+};
diff --git a/drivers/common/mvep/rte_mvep_common.h b/drivers/common/mvep/rte_mvep_common.h
new file mode 100644
index 0000000..ba47e16
--- /dev/null
+++ b/drivers/common/mvep/rte_mvep_common.h
@@ -0,0 +1,20 @@
+/*  SPDX-License-Identifier: BSD-3-Clause
+ *  Copyright(c) 2018 Marvell International Ltd.
+ */
+
+#ifndef __RTE_MVEP_COMMON_H__
+#define __RTE_MVEP_COMMON_H__
+
+#include <rte_kvargs.h>
+
+enum mvep_module_type {
+	MVEP_MOD_T_NONE = 0,
+	MVEP_MOD_T_PP2,
+	MVEP_MOD_T_SAM,
+	MVEP_MOD_T_LAST
+};
+
+int rte_mvep_init(enum mvep_module_type module, struct rte_kvargs *kvlist);
+int rte_mvep_deinit(enum mvep_module_type module);
+
+#endif /* __RTE_MVEP_COMMON_H__ */
diff --git a/mk/rte.app.mk b/mk/rte.app.mk
index de33883..899d51a 100644
--- a/mk/rte.app.mk
+++ b/mk/rte.app.mk
@@ -98,6 +98,10 @@ ifeq ($(CONFIG_RTE_LIBRTE_PMD_OCTEONTX_SSOVF)$(CONFIG_RTE_LIBRTE_OCTEONTX_MEMPOO
 _LDLIBS-y += -lrte_common_octeontx
 endif
 
+ifeq ($(CONFIG_RTE_LIBRTE_MVPP2_PMD),y)
+_LDLIBS-y += -lrte_common_mvep -L$(LIBMUSDK_PATH)/lib -lmusdk
+endif
+
 _LDLIBS-$(CONFIG_RTE_LIBRTE_PCI_BUS)        += -lrte_bus_pci
 _LDLIBS-$(CONFIG_RTE_LIBRTE_VDEV_BUS)       += -lrte_bus_vdev
 _LDLIBS-$(CONFIG_RTE_LIBRTE_DPAA_BUS)       += -lrte_bus_dpaa
-- 
2.7.4

^ permalink raw reply	[flat|nested] 30+ messages in thread

* [dpdk-dev] [PATCH v3 2/6] net/mvpp2: use common code to initialize DMA
  2018-08-24 18:29   ` [dpdk-dev] [PATCH v3 0/6] net/mvpp2: changes and features Tomasz Duszynski
  2018-08-24 18:29     ` [dpdk-dev] [PATCH v3 1/6] drivers/common: add mvep common code for MRVL PMDs Tomasz Duszynski
@ 2018-08-24 18:29     ` Tomasz Duszynski
  2018-08-24 18:30     ` [dpdk-dev] [PATCH v3 3/6] net/mvpp2: fix array initialization Tomasz Duszynski
                       ` (4 subsequent siblings)
  6 siblings, 0 replies; 30+ messages in thread
From: Tomasz Duszynski @ 2018-08-24 18:29 UTC (permalink / raw)
  To: dev; +Cc: nsamsono, mw, Liron Himi

From: Liron Himi <lironh@marvell.com>

Use common code to initialize MUSDK DMA memory buffers.

Signed-off-by: Liron Himi <lironh@marvell.com>
Reviewed-by: Natalie Samsonov <nsamsono@marvell.com>
---
 drivers/net/mvpp2/Makefile      |  3 ++-
 drivers/net/mvpp2/meson.build   |  2 +-
 drivers/net/mvpp2/mrvl_ethdev.c | 32 +++++++++++---------------------
 3 files changed, 14 insertions(+), 23 deletions(-)

diff --git a/drivers/net/mvpp2/Makefile b/drivers/net/mvpp2/Makefile
index 492aef9..211d398 100644
--- a/drivers/net/mvpp2/Makefile
+++ b/drivers/net/mvpp2/Makefile
@@ -23,6 +23,7 @@ LIBABIVER := 1
 EXPORT_MAP := rte_pmd_mvpp2_version.map
 
 # external library dependencies
+CFLAGS += -I$(RTE_SDK)/drivers/common/mvep
 CFLAGS += -I$(LIBMUSDK_PATH)/include
 CFLAGS += -DMVCONF_TYPES_PUBLIC
 CFLAGS += -DMVCONF_DMA_PHYS_ADDR_T_PUBLIC
@@ -32,7 +33,7 @@ LDLIBS += -L$(LIBMUSDK_PATH)/lib
 LDLIBS += -lmusdk
 LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring
 LDLIBS += -lrte_ethdev -lrte_net -lrte_kvargs -lrte_cfgfile
-LDLIBS += -lrte_bus_vdev
+LDLIBS += -lrte_bus_vdev -lrte_common_mvep
 
 # library source files
 SRCS-$(CONFIG_RTE_LIBRTE_MVPP2_PMD) += mrvl_ethdev.c
diff --git a/drivers/net/mvpp2/meson.build b/drivers/net/mvpp2/meson.build
index e139889..3620659 100644
--- a/drivers/net/mvpp2/meson.build
+++ b/drivers/net/mvpp2/meson.build
@@ -22,4 +22,4 @@ sources = files(
 	'mrvl_qos.c'
 )
 
-deps += ['cfgfile']
+deps += ['cfgfile', 'common_mvep']
diff --git a/drivers/net/mvpp2/mrvl_ethdev.c b/drivers/net/mvpp2/mrvl_ethdev.c
index a2d0576..8e1a32f 100644
--- a/drivers/net/mvpp2/mrvl_ethdev.c
+++ b/drivers/net/mvpp2/mrvl_ethdev.c
@@ -29,6 +29,7 @@
 #include <sys/stat.h>
 #include <sys/types.h>
 
+#include <rte_mvep_common.h>
 #include "mrvl_ethdev.h"
 #include "mrvl_qos.h"
 
@@ -63,9 +64,6 @@
 #define MRVL_COOKIE_HIGH_ADDR_SHIFT	(sizeof(pp2_cookie_t) * 8)
 #define MRVL_COOKIE_HIGH_ADDR_MASK	(~0ULL << MRVL_COOKIE_HIGH_ADDR_SHIFT)
 
-/* Memory size (in bytes) for MUSDK dma buffers */
-#define MRVL_MUSDK_DMA_MEMSIZE 41943040
-
 /** Port Rx offload capabilities */
 #define MRVL_RX_OFFLOADS (DEV_RX_OFFLOAD_VLAN_FILTER | \
 			  DEV_RX_OFFLOAD_JUMBO_FRAME | \
@@ -2654,23 +2652,16 @@ rte_pmd_mrvl_probe(struct rte_vdev_device *vdev)
 		goto init_devices;
 
 	MRVL_LOG(INFO, "Perform MUSDK initializations");
-	/*
-	 * ret == -EEXIST is correct, it means DMA
-	 * has been already initialized (by another PMD).
-	 */
-	ret = mv_sys_dma_mem_init(MRVL_MUSDK_DMA_MEMSIZE);
-	if (ret < 0) {
-		if (ret != -EEXIST)
-			goto out_free_kvlist;
-		else
-			MRVL_LOG(INFO,
-				"DMA memory has been already initialized by a different driver.");
-	}
+
+	ret = rte_mvep_init(MVEP_MOD_T_PP2, kvlist);
+	if (ret)
+		goto out_free_kvlist;
 
 	ret = mrvl_init_pp2();
 	if (ret) {
 		MRVL_LOG(ERR, "Failed to init PP!");
-		goto out_deinit_dma;
+		rte_mvep_deinit(MVEP_MOD_T_PP2);
+		goto out_free_kvlist;
 	}
 
 	memset(mrvl_port_bpool_size, 0, sizeof(mrvl_port_bpool_size));
@@ -2695,11 +2686,10 @@ rte_pmd_mrvl_probe(struct rte_vdev_device *vdev)
 	for (; i > 0; i--)
 		mrvl_eth_dev_destroy(ifnames.names[i]);
 
-	if (mrvl_dev_num == 0)
+	if (mrvl_dev_num == 0) {
 		mrvl_deinit_pp2();
-out_deinit_dma:
-	if (mrvl_dev_num == 0)
-		mv_sys_dma_mem_destroy();
+		rte_mvep_deinit(MVEP_MOD_T_PP2);
+	}
 out_free_kvlist:
 	rte_kvargs_free(kvlist);
 
@@ -2739,7 +2729,7 @@ rte_pmd_mrvl_remove(struct rte_vdev_device *vdev)
 		MRVL_LOG(INFO, "Perform MUSDK deinit");
 		mrvl_deinit_hifs();
 		mrvl_deinit_pp2();
-		mv_sys_dma_mem_destroy();
+		rte_mvep_deinit(MVEP_MOD_T_PP2);
 	}
 
 	return 0;
-- 
2.7.4

^ permalink raw reply	[flat|nested] 30+ messages in thread

* [dpdk-dev] [PATCH v3 3/6] net/mvpp2: fix array initialization
  2018-08-24 18:29   ` [dpdk-dev] [PATCH v3 0/6] net/mvpp2: changes and features Tomasz Duszynski
  2018-08-24 18:29     ` [dpdk-dev] [PATCH v3 1/6] drivers/common: add mvep common code for MRVL PMDs Tomasz Duszynski
  2018-08-24 18:29     ` [dpdk-dev] [PATCH v3 2/6] net/mvpp2: use common code to initialize DMA Tomasz Duszynski
@ 2018-08-24 18:30     ` Tomasz Duszynski
  2018-08-24 18:30     ` [dpdk-dev] [PATCH v3 4/6] net/mvpp2: fix comments and error messages Tomasz Duszynski
                       ` (3 subsequent siblings)
  6 siblings, 0 replies; 30+ messages in thread
From: Tomasz Duszynski @ 2018-08-24 18:30 UTC (permalink / raw)
  To: dev; +Cc: nsamsono, mw, Tomasz Duszynski, stable

Fix used_bpools array initialization by using range initializer.
This way all necessary variables are properly initialized regardless
of PP2_NUM_PKT_PROC value.

Fixes: 0ddc9b815b11 ("net/mrvl: add net PMD skeleton")
Cc: stable@dpdk.org

Signed-off-by: Tomasz Duszynski <tdu@semihalf.com>
---
 drivers/net/mvpp2/mrvl_ethdev.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/net/mvpp2/mrvl_ethdev.c b/drivers/net/mvpp2/mrvl_ethdev.c
index 8e1a32f..fdf416b 100644
--- a/drivers/net/mvpp2/mrvl_ethdev.c
+++ b/drivers/net/mvpp2/mrvl_ethdev.c
@@ -84,8 +84,7 @@ static const char * const valid_args[] = {
 static int used_hifs = MRVL_MUSDK_HIFS_RESERVED;
 static struct pp2_hif *hifs[RTE_MAX_LCORE];
 static int used_bpools[PP2_NUM_PKT_PROC] = {
-	MRVL_MUSDK_BPOOLS_RESERVED,
-	MRVL_MUSDK_BPOOLS_RESERVED
+	[0 ... PP2_NUM_PKT_PROC - 1] = MRVL_MUSDK_BPOOLS_RESERVED
 };
 
 struct pp2_bpool *mrvl_port_to_bpool_lookup[RTE_MAX_ETHPORTS];
-- 
2.7.4

^ permalink raw reply	[flat|nested] 30+ messages in thread

* [dpdk-dev] [PATCH v3 4/6] net/mvpp2: fix comments and error messages
  2018-08-24 18:29   ` [dpdk-dev] [PATCH v3 0/6] net/mvpp2: changes and features Tomasz Duszynski
                       ` (2 preceding siblings ...)
  2018-08-24 18:30     ` [dpdk-dev] [PATCH v3 3/6] net/mvpp2: fix array initialization Tomasz Duszynski
@ 2018-08-24 18:30     ` Tomasz Duszynski
  2018-08-24 18:30     ` [dpdk-dev] [PATCH v3 5/6] net/mvpp2: make private variables static Tomasz Duszynski
                       ` (2 subsequent siblings)
  6 siblings, 0 replies; 30+ messages in thread
From: Tomasz Duszynski @ 2018-08-24 18:30 UTC (permalink / raw)
  To: dev; +Cc: nsamsono, mw, tdu

From: Natalie Samsonov <nsamsono@marvell.com>

Fix comments and error messages.

Fixes: 7235341d7517 ("net/mrvl: support classifier")
Cc: tdu@semihalf.com

Signed-off-by: Natalie Samsonov <nsamsono@marvell.com>
Reviewed-by: Liron Himi <lironh@marvell.com>
---
 drivers/net/mvpp2/mrvl_flow.c | 29 +++++++++++++++++++++--------
 1 file changed, 21 insertions(+), 8 deletions(-)

diff --git a/drivers/net/mvpp2/mrvl_flow.c b/drivers/net/mvpp2/mrvl_flow.c
index ecc3419..13295e6 100644
--- a/drivers/net/mvpp2/mrvl_flow.c
+++ b/drivers/net/mvpp2/mrvl_flow.c
@@ -394,7 +394,8 @@ mrvl_parse_init(const struct rte_flow_item *item,
  *
  * @param spec Pointer to the specific flow item.
  * @param mask Pointer to the specific flow item's mask.
- * @param mask Pointer to the flow.
+ * @param parse_dst Parse either destination or source mac address.
+ * @param flow Pointer to the flow.
  * @return 0 in case of success, negative error value otherwise.
  */
 static int
@@ -613,6 +614,7 @@ mrvl_parse_ip4_dscp(const struct rte_flow_item_ipv4 *spec,
  *
  * @param spec Pointer to the specific flow item.
  * @param mask Pointer to the specific flow item's mask.
+ * @param parse_dst Parse either destination or source ip address.
  * @param flow Pointer to the flow.
  * @return 0 in case of success, negative error value otherwise.
  */
@@ -726,6 +728,7 @@ mrvl_parse_ip4_proto(const struct rte_flow_item_ipv4 *spec,
  *
  * @param spec Pointer to the specific flow item.
  * @param mask Pointer to the specific flow item's mask.
+ * @param parse_dst Parse either destination or source ipv6 address.
  * @param flow Pointer to the flow.
  * @return 0 in case of success, negative error value otherwise.
  */
@@ -874,6 +877,7 @@ mrvl_parse_ip6_next_hdr(const struct rte_flow_item_ipv6 *spec,
  *
  * @param spec Pointer to the specific flow item.
  * @param mask Pointer to the specific flow item's mask.
+ * @param parse_dst Parse either destination or source port.
  * @param flow Pointer to the flow.
  * @return 0 in case of success, negative error value otherwise.
  */
@@ -949,6 +953,7 @@ mrvl_parse_tcp_dport(const struct rte_flow_item_tcp *spec,
  *
  * @param spec Pointer to the specific flow item.
  * @param mask Pointer to the specific flow item's mask.
+ * @param parse_dst Parse either destination or source port.
  * @param flow Pointer to the flow.
  * @return 0 in case of success, negative error value otherwise.
  */
@@ -1022,7 +1027,6 @@ mrvl_parse_udp_dport(const struct rte_flow_item_udp *spec,
  * @param item Pointer to the flow item.
  * @param flow Pointer to the flow.
  * @param error Pointer to the flow error.
- * @param fields Pointer to the parsed parsed fields enum.
  * @returns 0 on success, negative value otherwise.
  */
 static int
@@ -1073,7 +1077,6 @@ mrvl_parse_eth(const struct rte_flow_item *item, struct rte_flow *flow,
  * @param item Pointer to the flow item.
  * @param flow Pointer to the flow.
  * @param error Pointer to the flow error.
- * @param fields Pointer to the parsed parsed fields enum.
  * @returns 0 on success, negative value otherwise.
  */
 static int
@@ -1139,7 +1142,6 @@ mrvl_parse_vlan(const struct rte_flow_item *item,
  * @param item Pointer to the flow item.
  * @param flow Pointer to the flow.
  * @param error Pointer to the flow error.
- * @param fields Pointer to the parsed parsed fields enum.
  * @returns 0 on success, negative value otherwise.
  */
 static int
@@ -1205,7 +1207,6 @@ mrvl_parse_ip4(const struct rte_flow_item *item,
  * @param item Pointer to the flow item.
  * @param flow Pointer to the flow.
  * @param error Pointer to the flow error.
- * @param fields Pointer to the parsed parsed fields enum.
  * @returns 0 on success, negative value otherwise.
  */
 static int
@@ -1276,7 +1277,6 @@ mrvl_parse_ip6(const struct rte_flow_item *item,
  * @param item Pointer to the flow item.
  * @param flow Pointer to the flow.
  * @param error Pointer to the flow error.
- * @param fields Pointer to the parsed parsed fields enum.
  * @returns 0 on success, negative value otherwise.
  */
 static int
@@ -1332,7 +1332,6 @@ mrvl_parse_tcp(const struct rte_flow_item *item,
  * @param item Pointer to the flow item.
  * @param flow Pointer to the flow.
  * @param error Pointer to the flow error.
- * @param fields Pointer to the parsed parsed fields enum.
  * @returns 0 on success, negative value otherwise.
  */
 static int
@@ -1981,6 +1980,7 @@ mrvl_parse_pattern_ip6_tcp(const struct rte_flow_item pattern[],
  * @param pattern Pointer to the flow pattern table.
  * @param flow Pointer to the flow.
  * @param error Pointer to the flow error.
+ * @param ip6 1 to parse ip6 item, 0 to parse ip4 item.
  * @returns 0 in case of success, negative value otherwise.
  */
 static int
@@ -2350,6 +2350,12 @@ mrvl_flow_parse(struct mrvl_priv *priv, const struct rte_flow_attr *attr,
 	return mrvl_flow_parse_actions(priv, actions, flow, error);
 }
 
+/**
+ * Get engine type for the given flow.
+ *
+ * @param field Pointer to the flow.
+ * @returns The type of the engine.
+ */
 static inline enum pp2_cls_tbl_type
 mrvl_engine_type(const struct rte_flow *flow)
 {
@@ -2369,6 +2375,13 @@ mrvl_engine_type(const struct rte_flow *flow)
 	return PP2_CLS_TBL_MASKABLE;
 }
 
+/**
+ * Create classifier table.
+ *
+ * @param dev Pointer to the device.
+ * @param flow Pointer to the very first flow.
+ * @returns 0 in case of success, negative value otherwise.
+ */
 static int
 mrvl_create_cls_table(struct rte_eth_dev *dev, struct rte_flow *first_flow)
 {
@@ -2655,7 +2668,7 @@ mrvl_flow_remove(struct mrvl_priv *priv, struct rte_flow *flow,
 /**
  * DPDK flow destroy callback called when flow is to be removed.
  *
- * @param priv Pointer to the port's private data.
+ * @param dev Pointer to the device.
  * @param flow Pointer to the flow.
  * @param error Pointer to the flow error.
  * @returns 0 in case of success, negative value otherwise.
-- 
2.7.4

^ permalink raw reply	[flat|nested] 30+ messages in thread

* [dpdk-dev] [PATCH v3 5/6] net/mvpp2: make private variables static
  2018-08-24 18:29   ` [dpdk-dev] [PATCH v3 0/6] net/mvpp2: changes and features Tomasz Duszynski
                       ` (3 preceding siblings ...)
  2018-08-24 18:30     ` [dpdk-dev] [PATCH v3 4/6] net/mvpp2: fix comments and error messages Tomasz Duszynski
@ 2018-08-24 18:30     ` Tomasz Duszynski
  2018-08-24 18:30     ` [dpdk-dev] [PATCH v3 6/6] net/mvpp2: add VLAN packet type support for parser offload Tomasz Duszynski
  2018-08-27 12:18     ` [dpdk-dev] [PATCH v3 0/6] net/mvpp2: changes and features Ferruh Yigit
  6 siblings, 0 replies; 30+ messages in thread
From: Tomasz Duszynski @ 2018-08-24 18:30 UTC (permalink / raw)
  To: dev; +Cc: nsamsono, mw

From: Natalie Samsonov <nsamsono@marvell.com>

Mark internal variables static to avoid potential redefinition
errors later on.

Signed-off-by: Natalie Samsonov <nsamsono@marvell.com>
Reviewed-by: Yelena Krivosheev <yelena@marvell.com>
---
 drivers/net/mvpp2/mrvl_ethdev.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/mvpp2/mrvl_ethdev.c b/drivers/net/mvpp2/mrvl_ethdev.c
index fdf416b..6f18315 100644
--- a/drivers/net/mvpp2/mrvl_ethdev.c
+++ b/drivers/net/mvpp2/mrvl_ethdev.c
@@ -87,9 +87,9 @@ static int used_bpools[PP2_NUM_PKT_PROC] = {
 	[0 ... PP2_NUM_PKT_PROC - 1] = MRVL_MUSDK_BPOOLS_RESERVED
 };
 
-struct pp2_bpool *mrvl_port_to_bpool_lookup[RTE_MAX_ETHPORTS];
-int mrvl_port_bpool_size[PP2_NUM_PKT_PROC][PP2_BPOOL_NUM_POOLS][RTE_MAX_LCORE];
-uint64_t cookie_addr_high = MRVL_COOKIE_ADDR_INVALID;
+static struct pp2_bpool *mrvl_port_to_bpool_lookup[RTE_MAX_ETHPORTS];
+static int mrvl_port_bpool_size[PP2_NUM_PKT_PROC][PP2_BPOOL_NUM_POOLS][RTE_MAX_LCORE];
+static uint64_t cookie_addr_high = MRVL_COOKIE_ADDR_INVALID;
 
 int mrvl_logtype;
 
-- 
2.7.4

^ permalink raw reply	[flat|nested] 30+ messages in thread

* [dpdk-dev] [PATCH v3 6/6] net/mvpp2: add VLAN packet type support for parser offload
  2018-08-24 18:29   ` [dpdk-dev] [PATCH v3 0/6] net/mvpp2: changes and features Tomasz Duszynski
                       ` (4 preceding siblings ...)
  2018-08-24 18:30     ` [dpdk-dev] [PATCH v3 5/6] net/mvpp2: make private variables static Tomasz Duszynski
@ 2018-08-24 18:30     ` Tomasz Duszynski
  2018-08-27 12:18     ` [dpdk-dev] [PATCH v3 0/6] net/mvpp2: changes and features Ferruh Yigit
  6 siblings, 0 replies; 30+ messages in thread
From: Tomasz Duszynski @ 2018-08-24 18:30 UTC (permalink / raw)
  To: dev; +Cc: nsamsono, mw

From: Natalie Samsonov <nsamsono@marvell.com>

Add VLAN packet type support for parser offload.

Signed-off-by: Natalie Samsonov <nsamsono@marvell.com>
Reviewed-by: Shlomi Gridish <sgridish@marvell.com>
Reviewed-by: Dmitri Epshtein <dima@marvell.com>
Reviewed-by: Yuval Caduri <cyuval@marvell.com>
---
 drivers/net/mvpp2/mrvl_ethdev.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/drivers/net/mvpp2/mrvl_ethdev.c b/drivers/net/mvpp2/mrvl_ethdev.c
index 6f18315..6824445 100644
--- a/drivers/net/mvpp2/mrvl_ethdev.c
+++ b/drivers/net/mvpp2/mrvl_ethdev.c
@@ -1353,6 +1353,8 @@ mrvl_dev_supported_ptypes_get(struct rte_eth_dev *dev __rte_unused)
 {
 	static const uint32_t ptypes[] = {
 		RTE_PTYPE_L2_ETHER,
+		RTE_PTYPE_L2_ETHER_VLAN,
+		RTE_PTYPE_L2_ETHER_QINQ,
 		RTE_PTYPE_L3_IPV4,
 		RTE_PTYPE_L3_IPV4_EXT,
 		RTE_PTYPE_L3_IPV4_EXT_UNKNOWN,
@@ -1922,13 +1924,27 @@ mrvl_desc_to_packet_type_and_offset(struct pp2_ppio_desc *desc,
 {
 	enum pp2_inq_l3_type l3_type;
 	enum pp2_inq_l4_type l4_type;
+	enum pp2_inq_vlan_tag vlan_tag;
 	uint64_t packet_type;
 
 	pp2_ppio_inq_desc_get_l3_info(desc, &l3_type, l3_offset);
 	pp2_ppio_inq_desc_get_l4_info(desc, &l4_type, l4_offset);
+	pp2_ppio_inq_desc_get_vlan_tag(desc, &vlan_tag);
 
 	packet_type = RTE_PTYPE_L2_ETHER;
 
+	switch (vlan_tag) {
+	case PP2_INQ_VLAN_TAG_SINGLE:
+		packet_type |= RTE_PTYPE_L2_ETHER_VLAN;
+		break;
+	case PP2_INQ_VLAN_TAG_DOUBLE:
+	case PP2_INQ_VLAN_TAG_TRIPLE:
+		packet_type |= RTE_PTYPE_L2_ETHER_QINQ;
+		break;
+	default:
+		break;
+	}
+
 	switch (l3_type) {
 	case PP2_INQ_L3_TYPE_IPV4_NO_OPTS:
 		packet_type |= RTE_PTYPE_L3_IPV4;
-- 
2.7.4

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [dpdk-dev] [PATCH v3 0/6] net/mvpp2: changes and features
  2018-08-24 18:29   ` [dpdk-dev] [PATCH v3 0/6] net/mvpp2: changes and features Tomasz Duszynski
                       ` (5 preceding siblings ...)
  2018-08-24 18:30     ` [dpdk-dev] [PATCH v3 6/6] net/mvpp2: add VLAN packet type support for parser offload Tomasz Duszynski
@ 2018-08-27 12:18     ` Ferruh Yigit
  6 siblings, 0 replies; 30+ messages in thread
From: Ferruh Yigit @ 2018-08-27 12:18 UTC (permalink / raw)
  To: Tomasz Duszynski, dev; +Cc: nsamsono, mw

On 8/24/2018 7:29 PM, Tomasz Duszynski wrote:
> This patch series introduces following changes:
> 
> * Common code responsible for DMA memory initialization
>   is now available under drivers/common/mvep. MVEP stands for
>   Marvell Embedded Processors. This eases maintenance and avoids
>   boilerplate code across Marvell PMDs. MVEP will grow over time as new
>   features and PMDs are added.
> 
> * Couple of minor fixes.
> 
> * Support for reading VLAN information from descriptor.
> 
> v3:
>  * Change exported symbols version to 18.11.
>  * Drop excessive new lines from messages passed to MRVL_LOG().
> 
> v2:
>  * Remove CONFIG_RTE_LIBRTE_MVEP_COMMON. Use CONFIG_RTE_LIBRTE_MVPP2_PMD
>    to control common/mvep compilation instead.
> 
> Liron Himi (2):
>   drivers/common: add mvep common code for MRVL PMDs
>   net/mvpp2: use common code to initialize DMA
> 
> Natalie Samsonov (3):
>   net/mvpp2: fix comments and error messages
>   net/mvpp2: make private variables static
>   net/mvpp2: add VLAN packet type support for parser offload
> 
> Tomasz Duszynski (1):
>   net/mvpp2: fix array initialization

Series applied to dpdk-next-net/master, thanks.

^ permalink raw reply	[flat|nested] 30+ messages in thread

end of thread, other threads:[~2018-08-27 12:18 UTC | newest]

Thread overview: 30+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-08-24 12:16 [dpdk-dev] [PATCH 0/6] mvpp2 changes and features Tomasz Duszynski
2018-08-24 12:16 ` [dpdk-dev] [PATCH 1/6] drivers/common: add mvep common code for MRVL PMDs Tomasz Duszynski
2018-08-24 12:32   ` Ferruh Yigit
2018-08-24 12:49     ` Tomasz Duszynski
2018-08-24 12:16 ` [dpdk-dev] [PATCH 2/6] net/mvpp2: use common code to initialize DMA Tomasz Duszynski
2018-08-24 12:16 ` [dpdk-dev] [PATCH 3/6] net/mvpp2: fix array initialization Tomasz Duszynski
2018-08-24 12:16 ` [dpdk-dev] [PATCH 4/6] net/mvpp2: fix comments and error messages Tomasz Duszynski
2018-08-24 12:16 ` [dpdk-dev] [PATCH 5/6] net/mvpp2: make private variables static Tomasz Duszynski
2018-08-24 12:16 ` [dpdk-dev] [PATCH 6/6] net/mvpp2: add VLAN packet type support for parser offload Tomasz Duszynski
2018-08-24 14:54 ` [dpdk-dev] [PATCH 0/6] net/mvpp2 changes and features Tomasz Duszynski
2018-08-24 14:54   ` [dpdk-dev] [PATCH v2 1/6] drivers/common: add mvep common code for MRVL PMDs Tomasz Duszynski
2018-08-24 16:45     ` Ferruh Yigit
2018-08-24 17:51       ` Tomasz Duszynski
2018-08-24 14:54   ` [dpdk-dev] [PATCH v2 2/6] net/mvpp2: use common code to initialize DMA Tomasz Duszynski
2018-08-24 16:46     ` Ferruh Yigit
2018-08-24 17:51       ` Tomasz Duszynski
2018-08-24 14:54   ` [dpdk-dev] [PATCH v2 3/6] net/mvpp2: fix array initialization Tomasz Duszynski
2018-08-24 16:46     ` Ferruh Yigit
2018-08-24 17:53       ` Tomasz Duszynski
2018-08-24 14:54   ` [dpdk-dev] [PATCH v2 4/6] net/mvpp2: fix comments and error messages Tomasz Duszynski
2018-08-24 14:54   ` [dpdk-dev] [PATCH v2 5/6] net/mvpp2: make private variables static Tomasz Duszynski
2018-08-24 14:54   ` [dpdk-dev] [PATCH v2 6/6] net/mvpp2: add VLAN packet type support for parser offload Tomasz Duszynski
2018-08-24 18:29   ` [dpdk-dev] [PATCH v3 0/6] net/mvpp2: changes and features Tomasz Duszynski
2018-08-24 18:29     ` [dpdk-dev] [PATCH v3 1/6] drivers/common: add mvep common code for MRVL PMDs Tomasz Duszynski
2018-08-24 18:29     ` [dpdk-dev] [PATCH v3 2/6] net/mvpp2: use common code to initialize DMA Tomasz Duszynski
2018-08-24 18:30     ` [dpdk-dev] [PATCH v3 3/6] net/mvpp2: fix array initialization Tomasz Duszynski
2018-08-24 18:30     ` [dpdk-dev] [PATCH v3 4/6] net/mvpp2: fix comments and error messages Tomasz Duszynski
2018-08-24 18:30     ` [dpdk-dev] [PATCH v3 5/6] net/mvpp2: make private variables static Tomasz Duszynski
2018-08-24 18:30     ` [dpdk-dev] [PATCH v3 6/6] net/mvpp2: add VLAN packet type support for parser offload Tomasz Duszynski
2018-08-27 12:18     ` [dpdk-dev] [PATCH v3 0/6] net/mvpp2: changes and features Ferruh Yigit

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).