net/mvpp2: use common code to initialize DMA
Use common code to initialize MUSDK DMA memory buffers. Signed-off-by: Liron Himi <lironh@marvell.com> Reviewed-by: Natalie Samsonov <nsamsono@marvell.com>
This commit is contained in:
parent
7a39d1b099
commit
4b4ab496c9
@ -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
|
||||
|
@ -22,4 +22,4 @@ sources = files(
|
||||
'mrvl_qos.c'
|
||||
)
|
||||
|
||||
deps += ['cfgfile']
|
||||
deps += ['cfgfile', 'common_mvep']
|
||||
|
@ -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)
|
||||
|
||||
ret = rte_mvep_init(MVEP_MOD_T_PP2, kvlist);
|
||||
if (ret)
|
||||
goto out_free_kvlist;
|
||||
else
|
||||
MRVL_LOG(INFO,
|
||||
"DMA memory has been already initialized by a different driver.");
|
||||
}
|
||||
|
||||
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;
|
||||
|
Loading…
Reference in New Issue
Block a user