common/mvep: add common code for Marvell drivers
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>
This commit is contained in:
parent
b8ac090835
commit
7a39d1b099
@ -581,6 +581,7 @@ Marvell mvpp2
|
||||
M: Tomasz Duszynski <tdu@semihalf.com>
|
||||
M: Dmitri Epshtein <dima@marvell.com>
|
||||
M: Natalie Samsonov <nsamsono@marvell.com>
|
||||
F: drivers/common/mvep/
|
||||
F: drivers/net/mvpp2/
|
||||
F: doc/guides/nics/mvpp2.rst
|
||||
F: doc/guides/nics/features/mvpp2.ini
|
||||
|
@ -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
|
||||
|
@ -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@'
|
||||
|
38
drivers/common/mvep/Makefile
Normal file
38
drivers/common/mvep/Makefile
Normal file
@ -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
|
19
drivers/common/mvep/meson.build
Normal file
19
drivers/common/mvep/meson.build
Normal file
@ -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')
|
45
drivers/common/mvep/mvep_common.c
Normal file
45
drivers/common/mvep/mvep_common.c
Normal file
@ -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;
|
||||
}
|
6
drivers/common/mvep/rte_common_mvep_version.map
Normal file
6
drivers/common/mvep/rte_common_mvep_version.map
Normal file
@ -0,0 +1,6 @@
|
||||
DPDK_18.11 {
|
||||
global:
|
||||
|
||||
rte_mvep_init;
|
||||
rte_mvep_deinit;
|
||||
};
|
20
drivers/common/mvep/rte_mvep_common.h
Normal file
20
drivers/common/mvep/rte_mvep_common.h
Normal file
@ -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__ */
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user