numam-dpdk/drivers/common/mvep/mvep_common.c
Liron Himi 7a39d1b099 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>
2018-08-28 15:27:39 +02:00

46 lines
794 B
C

/* 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;
}