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>
Subject: [dpdk-dev] [PATCH v2 2/6] net/mvpp2: use common code to initialize DMA
Date: Fri, 24 Aug 2018 16:54:50 +0200	[thread overview]
Message-ID: <1535122494-30249-3-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>

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

  parent 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   ` [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   ` Tomasz Duszynski [this message]
2018-08-24 16:46     ` [dpdk-dev] [PATCH v2 2/6] net/mvpp2: use common code to initialize DMA 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-3-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).