DPDK patches and discussions
 help / color / mirror / Atom feed
From: Tomasz Duszynski <tdu@semihalf.com>
To: dev@dpdk.org
Cc: nsamsono@marvell.com, mw@semihalf.com,
	Liron Himi <lironh@marvell.com>,
	Tomasz Duszynski <tdu@semihalf.com>
Subject: [dpdk-dev] [PATCH v2 1/6] drivers/common: add mvep common code for MRVL PMDs
Date: Fri, 24 Aug 2018 16:54:49 +0200	[thread overview]
Message-ID: <1535122494-30249-2-git-send-email-tdu@semihalf.com> (raw)
In-Reply-To: <1535122494-30249-1-git-send-email-tdu@semihalf.com>

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

  reply	other threads:[~2018-08-24 14:55 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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   ` Tomasz Duszynski [this message]
2018-08-24 16:45     ` [dpdk-dev] [PATCH v2 1/6] drivers/common: add mvep common code for MRVL PMDs 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1535122494-30249-2-git-send-email-tdu@semihalf.com \
    --to=tdu@semihalf.com \
    --cc=dev@dpdk.org \
    --cc=lironh@marvell.com \
    --cc=mw@semihalf.com \
    --cc=nsamsono@marvell.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).