From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lf1-f68.google.com (mail-lf1-f68.google.com [209.85.167.68]) by dpdk.org (Postfix) with ESMTP id BA7C44C95 for ; Fri, 24 Aug 2018 14:17:02 +0200 (CEST) Received: by mail-lf1-f68.google.com with SMTP id c7-v6so6554942lfe.0 for ; Fri, 24 Aug 2018 05:17:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=semihalf-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=n0MvLf+kfVEshZGY0SnGEDWIhSd1yAmtZmKSs7pexbo=; b=TyFCv4bBAVXOyc88rbUsQBp6ctxbryBvw+WZ8T1nYzMd9liz0UZV97vz6H8j6CLSqz WUgWxBdiNvxUPVsDwyKRmvGCtp+XZzEJ7GzFUTj4BJ0C2NccPT1YCqzS0z7EZgk978rW I42/FgV7YHNhUMCttAw5uYwrz/ypBr5zKmZBNliMxZEdBxv1AXVuKeuCBvBJC8j8o5aO zlm6ClBbrirep8wbPoxCq+F70Be7GTkXXdyOxj1Egqx90D6NJ7OXxtg6Ula6IJNeS1zH CnrAVkmGPzKUXyPEl6BNkScupJN3O17vKxcryr3Tmu8navvDSM7ZaYxwkaqSq28wOG58 hMZw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=n0MvLf+kfVEshZGY0SnGEDWIhSd1yAmtZmKSs7pexbo=; b=pN+9D+ZS9NRuc4xomx2LsnHgxAoih9hJDX+jXz0EfLlT6n0fTyRoiEQDq84R9JQW7h KO558woJUXp1zR8cFToSii8z8G1+q+/iMwzr14n8NHZHuRe9BAyWpTe589e/zSwZJfX2 jS10NRW6ioNeXislgHp1FTeCXEDtV83J+AJAeX7l7qpamflJOgvzOg3ctXoFnBP/Zy1C rTn67QI0DIBg6av3vp+LbVOEuZzeGIPySYlsWP3xdRqzXdGXEIh2JTJ8WytjJ7x+Cd/S JRcckWf9JMoBkzgLfoCir/JEsZ1Fhn2btQHYhnvAQFaKMWANyyV68trPFcyNVMmfmjHd xqyQ== X-Gm-Message-State: APzg51D5MFAwc40pXhmy2NfVkiWybMIqQze+T/J8XZQotcMbytL4vPVX XZIllkUhStQrJbQFq9cvrF3xEO/40v8= X-Google-Smtp-Source: ANB0VdbfQySZqiKfGtH0xJxO09yi1IrdY2IXUXcYJImjCFjm6pmpmt8IO7im/WWY8Vq5TNMoERhaSA== X-Received: by 2002:a19:f015:: with SMTP id p21-v6mr1235033lfc.56.1535113022225; Fri, 24 Aug 2018 05:17:02 -0700 (PDT) Received: from sh.semihalf.local (31-172-191-173.noc.fibertech.net.pl. [31.172.191.173]) by smtp.gmail.com with ESMTPSA id a18-v6sm1177672ljk.47.2018.08.24.05.17.01 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 24 Aug 2018 05:17:01 -0700 (PDT) From: Tomasz Duszynski To: dev@dpdk.org Cc: nsamsono@marvell.com, mw@semihalf.com, Liron Himi Date: Fri, 24 Aug 2018 14:16:42 +0200 Message-Id: <1535113006-9393-3-git-send-email-tdu@semihalf.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1535113006-9393-1-git-send-email-tdu@semihalf.com> References: <1535113006-9393-1-git-send-email-tdu@semihalf.com> Subject: [dpdk-dev] [PATCH 2/6] net/mvpp2: use common code to initialize DMA X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Aug 2018 12:17:03 -0000 From: Liron Himi Use common code to initialize MUSDK DMA memory buffers. Signed-off-by: Liron Himi Reviewed-by: Natalie Samsonov --- drivers/net/Makefile | 3 +++ drivers/net/mvpp2/Makefile | 3 ++- drivers/net/mvpp2/meson.build | 2 +- drivers/net/mvpp2/mrvl_ethdev.c | 36 +++++++++++++----------------------- 4 files changed, 19 insertions(+), 25 deletions(-) diff --git a/drivers/net/Makefile b/drivers/net/Makefile index 664398d..ecee7ba 100644 --- a/drivers/net/Makefile +++ b/drivers/net/Makefile @@ -68,6 +68,9 @@ ifeq ($(CONFIG_RTE_LIBRTE_MVPP2_PMD),y) ifeq ($(CONFIG_RTE_LIBRTE_CFGFILE),n) $(error "RTE_LIBRTE_CFGFILE must be enabled in configuration!") endif +ifeq ($(CONFIG_RTE_LIBRTE_MVEP_COMMON),n) +$(error "RTE_LIBRTE_MVEP_COMMON must be enabled in configuration!") +endif endif include $(RTE_SDK)/mk/rte.subdir.mk 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 #include +#include #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