From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lf1-f65.google.com (mail-lf1-f65.google.com [209.85.167.65]) by dpdk.org (Postfix) with ESMTP id 7ED434CA1 for ; Fri, 21 Sep 2018 15:24:59 +0200 (CEST) Received: by mail-lf1-f65.google.com with SMTP id b12-v6so4124350lfa.4 for ; Fri, 21 Sep 2018 06:24:59 -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=iHNzJsEN1DmesPWsBU2inuRAfsBFcC3KdKHwdA/01Fw=; b=nzVFblrP4WlTF5O9OIxl3cc7Y1y+rR0KgQ0hRZ35XVisQx/1a5YR2FlqNT8CdHlECp u+x+/yd0AENlRsF0D6qgMNl/qUivEQNFH9WeMflCx1w4xZZYCuHlQSZvrbIU6B7ooOp0 PWICkyeQeQ5HpcROqb4SDQa51penxzeG9d79dOO05Ip3rxPcA3s1S9Db0d2lMDcZlMr2 1X4Breh3TTsKQEx4f0nI0pntrd7BOOP94Ow0azMvNEHEYW1wJLDwLtcAkml8wYm+PUZ1 uxKEElUU9LJWIH/5G7gqc5ll8WLNgLvvYgT7WoFqHWKRU/JMxuTramhNj13bykpiFvmq Up8Q== 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=iHNzJsEN1DmesPWsBU2inuRAfsBFcC3KdKHwdA/01Fw=; b=JicOf/NJpfUfLMz6RXmF1KR49wU1ziymqRncbl4QQbTuckywrQ1VM0LBX9HOC0bLRX CLHKKBBUraqkyQK9BTn2SS15/reJ5L7SMKIl8YukHFnd4OhEsQIe2j6wGKd2ugbrIysh QaDrpiNfB3yEEPpOjul6FsLNS0imN6o+Sn9mkXvF0HQEkTpOG0pEaP33l+qgUBZ/96Gq D/Es2zXPS+BpK3lpPoU0cnytE/wLrc+oyAkGeHlsawX9Cv3Osa98AwApszRYO20PxIPR k6ruAm0wTqARgeraCMlWx2NnXud6hQANLZUPhKg5vOAVhbm3xbXo+/eW0TFEPbB6fXUi XyLA== X-Gm-Message-State: APzg51ArWMUTDvmDM1tnS0jcZjFOVGnT6P8l1oj5Xv0XFUfbmeg1Kuky lC+GRzZSvrGX5GHXJzfOTQmU8GKwbiw= X-Google-Smtp-Source: ANB0VdZTrPUvxI4OaXjCuFW3Uvbgm10i3IMi4HwvbfAw1oRMXDvtFWCoSj6OoQvN3NzEnk6MeCiPww== X-Received: by 2002:a19:4c41:: with SMTP id z62-v6mr3732289lfa.127.1537536298809; Fri, 21 Sep 2018 06:24:58 -0700 (PDT) Received: from amok.semihalf.local (31-172-191-173.noc.fibertech.net.pl. [31.172.191.173]) by smtp.googlemail.com with ESMTPSA id v14-v6sm4868767lji.80.2018.09.21.06.24.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 21 Sep 2018 06:24:57 -0700 (PDT) From: Andrzej Ostruszka To: dev@dpdk.org Cc: mw@semihalf.com, nadavh@marvell.com, Dmitri Epshtein , Tomasz Duszynski Date: Fri, 21 Sep 2018 15:24:53 +0200 Message-Id: <1537536294-16703-3-git-send-email-amo@semihalf.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1537536294-16703-1-git-send-email-amo@semihalf.com> References: <1535372574-18950-1-git-send-email-tdu@semihalf.com> <1537536294-16703-1-git-send-email-amo@semihalf.com> Subject: [dpdk-dev] [PATCH v2 2/3] crypto/mvsam: use common initialization 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, 21 Sep 2018 13:24:59 -0000 From: Dmitri Epshtein Use common initialization to reduce boilerplate code. Signed-off-by: Dmitri Epshtein Signed-off-by: Tomasz Duszynski Reviewed-by: Natalie Samsonov --- drivers/common/Makefile | 4 +++- drivers/crypto/mvsam/Makefile | 3 ++- drivers/crypto/mvsam/meson.build | 2 +- drivers/crypto/mvsam/rte_mrvl_pmd.c | 31 ++++++++++++++----------------- mk/rte.app.mk | 4 +++- 5 files changed, 23 insertions(+), 21 deletions(-) diff --git a/drivers/common/Makefile b/drivers/common/Makefile index 5f72da0..0859601 100644 --- a/drivers/common/Makefile +++ b/drivers/common/Makefile @@ -8,7 +8,9 @@ ifeq ($(CONFIG_RTE_LIBRTE_PMD_OCTEONTX_SSOVF)$(CONFIG_RTE_LIBRTE_OCTEONTX_MEMPOO DIRS-y += octeontx endif -ifeq ($(CONFIG_RTE_LIBRTE_MVPP2_PMD),y) +MVEP-y += $(CONFIG_RTE_LIBRTE_MVPP2_PMD) +MVEP-y += $(CONFIG_RTE_LIBRTE_PMD_MVSAM_CRYPTO) +ifneq (,$(findstring y,$(MVEP-y))) DIRS-y += mvep endif diff --git a/drivers/crypto/mvsam/Makefile b/drivers/crypto/mvsam/Makefile index c3dc72c..9850fda 100644 --- a/drivers/crypto/mvsam/Makefile +++ b/drivers/crypto/mvsam/Makefile @@ -19,6 +19,7 @@ LIB = librte_pmd_mvsam_crypto.a # build flags CFLAGS += -O3 CFLAGS += $(WERROR_FLAGS) +CFLAGS += -I$(RTE_SDK)/drivers/common/mvep CFLAGS += -I$(LIBMUSDK_PATH)/include CFLAGS += -DMVCONF_TYPES_PUBLIC CFLAGS += -DMVCONF_DMA_PHYS_ADDR_T_PUBLIC @@ -33,7 +34,7 @@ EXPORT_MAP := rte_pmd_mvsam_version.map LDLIBS += -L$(LIBMUSDK_PATH)/lib -lmusdk LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool LDLIBS += -lrte_cryptodev -LDLIBS += -lrte_bus_vdev +LDLIBS += -lrte_bus_vdev -lrte_common_mvep # library source files SRCS-$(CONFIG_RTE_LIBRTE_PMD_MVSAM_CRYPTO) += rte_mrvl_pmd.c diff --git a/drivers/crypto/mvsam/meson.build b/drivers/crypto/mvsam/meson.build index 3c8ea3c..f1c8796 100644 --- a/drivers/crypto/mvsam/meson.build +++ b/drivers/crypto/mvsam/meson.build @@ -18,4 +18,4 @@ endif sources = files('rte_mrvl_pmd.c', 'rte_mrvl_pmd_ops.c') -deps += ['bus_vdev'] +deps += ['bus_vdev', 'common_mvep'] diff --git a/drivers/crypto/mvsam/rte_mrvl_pmd.c b/drivers/crypto/mvsam/rte_mrvl_pmd.c index 977e478..35dd659 100644 --- a/drivers/crypto/mvsam/rte_mrvl_pmd.c +++ b/drivers/crypto/mvsam/rte_mrvl_pmd.c @@ -11,11 +11,11 @@ #include #include #include +#include +#include #include "rte_mrvl_pmd_private.h" -#define MRVL_MUSDK_DMA_MEMSIZE 41943040 - #define MRVL_PMD_MAX_NB_SESS_ARG ("max_nb_sessions") #define MRVL_PMD_DEFAULT_MAX_NB_SESSIONS 2048 @@ -752,7 +752,7 @@ cryptodev_mrvl_crypto_create(const char *name, struct rte_cryptodev *dev; struct mrvl_crypto_private *internals; struct sam_init_params sam_params; - int ret; + int ret = -EINVAL; dev = rte_cryptodev_pmd_create(name, &vdev->device, &init_params->common); @@ -778,30 +778,26 @@ cryptodev_mrvl_crypto_create(const char *name, internals->max_nb_qpairs = init_params->common.max_nb_queue_pairs; internals->max_nb_sessions = init_params->max_nb_sessions; - /* - * ret == -EEXIST is correct, it means DMA - * has been already initialized. - */ - ret = mv_sys_dma_mem_init(MRVL_MUSDK_DMA_MEMSIZE); - if (ret < 0) { - if (ret != -EEXIST) - return ret; - - MRVL_CRYPTO_LOG_INFO( - "DMA memory has been already initialized by a different driver."); - } + ret = rte_mvep_init(MVEP_MOD_T_SAM, NULL); + if (ret) + goto init_error; sam_params.max_num_sessions = internals->max_nb_sessions; /* sam_set_debug_flags(3); */ - return sam_init(&sam_params); + + ret = sam_init(&sam_params); + if (ret) + goto init_error; + + return 0; init_error: MRVL_CRYPTO_LOG_ERR( "driver %s: %s failed", init_params->common.name, __func__); cryptodev_mrvl_crypto_uninit(vdev); - return -EFAULT; + return ret; } /** Parse integer from integer argument */ @@ -951,6 +947,7 @@ cryptodev_mrvl_crypto_uninit(struct rte_vdev_device *vdev) name, rte_socket_id()); sam_deinit(); + rte_mvep_deinit(MVEP_MOD_T_SAM); cryptodev = rte_cryptodev_pmd_get_named_dev(name); if (cryptodev == NULL) diff --git a/mk/rte.app.mk b/mk/rte.app.mk index 899d51a..4278ebb 100644 --- a/mk/rte.app.mk +++ b/mk/rte.app.mk @@ -98,7 +98,9 @@ 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) +MVEP-y += $(CONFIG_RTE_LIBRTE_MVPP2_PMD) +MVEP-y += $(CONFIG_RTE_LIBRTE_PMD_MVSAM_CRYPTO) +ifneq (,$(findstring y,$(MVEP-y))) _LDLIBS-y += -lrte_common_mvep -L$(LIBMUSDK_PATH)/lib -lmusdk endif -- 2.7.4