From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR02-VE1-obe.outbound.protection.outlook.com (mail-eopbgr20042.outbound.protection.outlook.com [40.107.2.42]) by dpdk.org (Postfix) with ESMTP id AB0D04F91 for ; Thu, 13 Sep 2018 08:09:27 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=rIO+WtYBx6ydrKeWr2e3leiSAbpnWm4rYH/1lhko6xk=; b=BEH1sHvJqG/4zKyhQuMxllwsl+weJ2Nw7R4FKOZcfhHNHbSOzLjoF+LgBgIcBp/lgghcD4hgxHOKYNQKQDwXVPYmT3jTNiOMXNamEa2UEPm9l17+/1MlFBU/Je9AiLJ7cEVx2XdsSrpqQdNY4ykqzxh9gjBsyYcJcjjpQ921Nks= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=G.Singh@nxp.com; Received: from Tophie.ap.freescale.net (14.142.187.166) by HE1PR04MB1529.eurprd04.prod.outlook.com (2a01:111:e400:59a8::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1143.15; Thu, 13 Sep 2018 06:09:24 +0000 From: Gagandeep Singh To: dev@dpdk.org, akhil.goyal@nxp.com Cc: Hemant Agrawal , Gagandeep Singh Date: Thu, 13 Sep 2018 11:38:38 +0530 Message-Id: <20180913060846.29930-3-g.singh@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180913060846.29930-1-g.singh@nxp.com> References: <20180913060846.29930-1-g.singh@nxp.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [14.142.187.166] X-ClientProxiedBy: BM1PR01CA0095.INDPRD01.PROD.OUTLOOK.COM (2603:1096:b00::11) To HE1PR04MB1529.eurprd04.prod.outlook.com (2a01:111:e400:59a8::19) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: b5dde0c4-dbd8-44a2-b6a6-08d6193f750f X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989137)(4534165)(7168020)(4627221)(201703031133081)(201702281549075)(8990107)(5600074)(711020)(4618075)(2017052603328)(7153060)(7193020); SRVR:HE1PR04MB1529; X-Microsoft-Exchange-Diagnostics: 1; HE1PR04MB1529; 3:JXW4Bi0cSVDIVUH1/h0hll4+6Lsemgr0j7kgDD9REw/K4yy8rMHbY5MRkswU0J7pN7hlScDxcDTcJuMujNBSMG6PguTFVqNQlBnYFfNZKaa8e13uNw8AvQA6+49hX22qPtjJw99vG3yMfhXhwxXmXsUJOfVzJdWp5yZPqmtviA/H1oqbfGqRUAnwDXpb7l0gL32JrNWMXd0AKXynekhoPr7fCGwTdr9DqJJLH67cDlx5uFjqxN9hDMV8J9W+YlGx; 25:kKpf/y19jgDz9z8JPNvyCeNIThiLfGMR93uSJb+z8va+bcap7QmfifurnbPU9v4ggwUD/SvhL4H+FtZNJc3yqvfjO1/KKwG1Udn1/DDmJu+JuoX3ZDDke1HbTVJbGI5VW+bjcn/A4mXwI9Z3ppAU68LxAIh9ymByQoqVHrfOhD8KW7VqqQGViH3qBSBgR/w6bR50vqZ5+/dO4/FRo+2TP8AViwy+wps4FUkqpxaizq0eu6M2BiIbGYf3rOG1pLRkh+gBD6p45nu3U/VV6Z6NAjuyqftYlZCAl13RPeLBv2rRV9yQ6R4PTppwhBEkeI8JqxeBGVhN285SKUM44KEuDw==; 31:e9h/MeE6Xdo2TEZLEb9+Dg8/MfjyY9N/qQ4yffoxmH9QRYPxprIxzcvMDF3/yOVAU98f7bR0/vgXMqaW+vHt1lLNMqUe1l08eGuLFheEvntxCDwYm5FAdWbaIpq2hCW9J2Zzm+URolBVHzhr16r4VWrImQ22Lbcq8eNONrgNPFnLbD2CC6MeAhKaBmxudOhcy7QUDnZO2QOskhrOQUWctg3wg7AlBdHHRhUp2+UAG+Q= X-MS-TrafficTypeDiagnostic: HE1PR04MB1529: X-Microsoft-Exchange-Diagnostics: 1; HE1PR04MB1529; 20:D3vDxZq9BQggsRgQVUjvoLnA3spbyfZbS2NNGII36Exsg4wQKiN5WdfNt0ff9t64OlNHp6vi9dqa5WYPbeizGAjR7MMbm2iNXk7R9e+KLfVsoSZfuoU1YxyyRh+jEPCC/HUCYKc8HTxYOIM+xbakQLZIZlFrLApnHlqZ/f7YXXIR92q01BANwqWdTpOZTzBorX6Sje7iVsc9QEEl7ZvH8USGTbLNjHTwo6DViaR/1ALZMBc+r4kCMxoIFTSYL9/08T8s8A3jAxal0SbVjSH4X26aW2z6aZBCxDu/EJre+CcvBUiOoCS2R9ojO+tduCM2K2EVYTMZFk1usWK2V+uaI0yC4Dh0bjh/0KOR0jmE+znwkTH0hhXu2rEIRChE++jUiTyqTeu2HGMoPsp5g8bPlB/R8JVdqCrluXjGbR4LLi7qgJWsde9WN+BAbd5rf8QYctKGEULZKcjvFq1oaygzalKjQlWQiVJqARKy5vthl4DoSBgBfqucdInxspPmsiFB; 4:932pCe0FxTgovKSyPy7Fn23shr4I+ZTj/2YHs16vJnFsQ15W667hTyRjx8Q/3LMqhFBNPxncAEKIX7GjBCGl/d5JG9k2i7PFLLo04y/sn6JtKXlcplHcgee70SldGaFLPEXhhuCZqIBMMUq3q7eZEfjnHk7ypdE/f9f02uZem8oH0mdLBMVFXn1ous70cXK9ePwibW2yTOD/2fQN5GPL4niAES9VjeN9O/HwvaBMdVAAuubHuHT2Xvc8OdN+TF2WIBaTojqtqPaZPn+I65k8Y8tV+9tSZlJaJzioiPkgi2KT7n3S7imhoRJWdr8/M+05BazWCRc8haI8MDGbkltykYU5at2YlPhPEMRc454Ziw4= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(192374486261705)(185117386973197); X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(823301075)(3231311)(944501410)(52105095)(3002001)(93006095)(93001095)(10201501046)(6055026)(149027)(150027)(6041310)(20161123558120)(20161123562045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(201708071742011)(7699050); SRVR:HE1PR04MB1529; BCL:0; PCL:0; RULEID:; SRVR:HE1PR04MB1529; X-Forefront-PRVS: 07943272E1 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(366004)(376002)(39860400002)(136003)(346002)(396003)(189003)(199004)(2906002)(6506007)(386003)(5009440100003)(6486002)(51416003)(6512007)(52116002)(486006)(2616005)(68736007)(956004)(53936002)(476003)(446003)(11346002)(305945005)(26005)(7736002)(55236004)(76176011)(186003)(16526019)(50226002)(478600001)(47776003)(1076002)(3846002)(6116002)(48376002)(105586002)(106356001)(25786009)(14444005)(50466002)(5660300001)(36756003)(72206003)(66066001)(316002)(97736004)(8936002)(81166006)(4326008)(8676002)(86362001)(6636002)(6666003)(575784001)(54906003)(81156014)(16586007)(110426005); DIR:OUT; SFP:1101; SCL:1; SRVR:HE1PR04MB1529; H:Tophie.ap.freescale.net; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; Received-SPF: None (protection.outlook.com: nxp.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; HE1PR04MB1529; 23:7t1VZB/dXw97kg8dwQnwsgJ7V9IFUxEe5M20347XU?= =?us-ascii?Q?4nknbS1vyr4+elhP8UFsIHV5hgMGfZqwsRWsgSxuQrvXUdLchDbmb2khfLew?= =?us-ascii?Q?m5a2PDIRmkNPkCWckim4V9fg8M2Z/jJ+aJwYH2/BFne/Pvj6vDutJjKxk0vH?= =?us-ascii?Q?ULW4F+EyZNQa1tqRW/5NISNxFOEIyGz12USYK5wUR8o7KntZOabqzo/toONm?= =?us-ascii?Q?kuKrbTd9D4qiROTOT56ZiOyL6DLrK+V7kBYXbzN+vmQ/NwIjvT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xdp7U0enP3iyw0HiZxic8WRhb1VLQKMwOdLbsA/bxIeRRW2u0WTbcDPpAM+OvwMt+rDPfVOtM62EluMVo20OLNuJ5BMJh4QNJy5zrO0Yaw==; 5:9lsF1tSNXlnXB3YKxTJoqsQ1IKRavZETFahPmECv9MF8hPxFCIQ3qT0MbepfogawjgYA9p7hrDZMxfN2cBX4GwhPnhBplSvfTGGSmk0A28ZWr7kiIhASrHYzfxlj8xFqwwBOD0HjW7pgxwsVFcEoAF9zjRe2m7JU5hHW6w1Qk7c=; 7:GiGN7nwm2CUaBJxHczNrLpGQCVSxuok/Liip0ioHuRnRJyVXh2m2nMyxARVAc+0iEmySPq62i5/BO2RX7+uRwkBGg8kZpzTTpRDT8d0CSTbjysuFi4h6dfL0z4AFzOWSSzRy0mBHQ9YK7MTC37cBevaSHzrfBAgVl/3CEAXgS+DXjhADq0JuCZfSUdT4/dE+JHGnvymMCJFp5FH1L7gs72JC+RYgdpO8Rzx5a+YN5s8ldK//KnfhBLyad/+SWd9N SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Sep 2018 06:09:24.5382 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b5dde0c4-dbd8-44a2-b6a6-08d6193f750f X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR04MB1529 Subject: [dpdk-dev] [PATCH 02/10] crypto/caam_jr: introduce basic driver 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: Thu, 13 Sep 2018 06:09:28 -0000 From: Hemant Agrawal This patch introduces basic support for caam_jr crypto driver. Signed-off-by: Gagandeep Singh Signed-off-by: Hemant Agrawal --- config/common_base | 8 + config/common_linuxapp | 1 + config/defconfig_arm64-dpaa-linuxapp-gcc | 4 + drivers/crypto/Makefile | 1 + drivers/crypto/caam_jr/Makefile | 40 +++++ drivers/crypto/caam_jr/caam_jr.c | 157 ++++++++++++++++++ drivers/crypto/caam_jr/caam_jr_log.h | 42 +++++ drivers/crypto/caam_jr/meson.build | 11 ++ .../caam_jr/rte_pmd_caam_jr_version.map | 4 + drivers/crypto/meson.build | 2 +- 10 files changed, 269 insertions(+), 1 deletion(-) create mode 100644 drivers/crypto/caam_jr/Makefile create mode 100644 drivers/crypto/caam_jr/caam_jr.c create mode 100644 drivers/crypto/caam_jr/caam_jr_log.h create mode 100644 drivers/crypto/caam_jr/meson.build create mode 100644 drivers/crypto/caam_jr/rte_pmd_caam_jr_version.map diff --git a/config/common_base b/config/common_base index 4bcbaf923..a73f063d1 100644 --- a/config/common_base +++ b/config/common_base @@ -479,6 +479,14 @@ CONFIG_RTE_CRYPTO_MAX_DEVS=64 CONFIG_RTE_LIBRTE_PMD_ARMV8_CRYPTO=n CONFIG_RTE_LIBRTE_PMD_ARMV8_CRYPTO_DEBUG=n +# +# Compile NXP CAAM JR crypto Driver +# +CONFIG_RTE_LIBRTE_PMD_CAAM_JR=n +CONFIG_RTE_LIBRTE_PMD_CAAM_JR_BE=n +CONFIG_RTE_LIBRTE_PMD_CAAM_JR_DEBUG=n +CONFIG_RTE_CAAM_JR_PMD_MAX_NB_SESSIONS=2048 + # # Compile NXP DPAA2 crypto sec driver for CAAM HW # diff --git a/config/common_linuxapp b/config/common_linuxapp index 9c5ea9d89..c1c7c4287 100644 --- a/config/common_linuxapp +++ b/config/common_linuxapp @@ -35,6 +35,7 @@ CONFIG_RTE_LIBRTE_DPAA_MEMPOOL=y CONFIG_RTE_LIBRTE_DPAA_PMD=y CONFIG_RTE_LIBRTE_PMD_DPAA_EVENTDEV=y CONFIG_RTE_LIBRTE_PMD_DPAA_SEC=y +CONFIG_RTE_LIBRTE_PMD_CAAM_JR=y # NXP FSLMC BUS and DPAA2 drivers CONFIG_RTE_LIBRTE_FSLMC_BUS=y diff --git a/config/defconfig_arm64-dpaa-linuxapp-gcc b/config/defconfig_arm64-dpaa-linuxapp-gcc index c47aec0a6..e5343f7a9 100644 --- a/config/defconfig_arm64-dpaa-linuxapp-gcc +++ b/config/defconfig_arm64-dpaa-linuxapp-gcc @@ -21,3 +21,7 @@ CONFIG_RTE_PKTMBUF_HEADROOM=128 # NXP DPAA Bus CONFIG_RTE_LIBRTE_DPAA_DEBUG_DRIVER=n CONFIG_RTE_LIBRTE_DPAA_HWDEBUG=n + +# NXP CAAM_JR driver +CONFIG_RTE_LIBRTE_PMD_CAAM_JR=y +CONFIG_RTE_LIBRTE_PMD_CAAM_JR_BE=y diff --git a/drivers/crypto/Makefile b/drivers/crypto/Makefile index c480cbd37..e3711d703 100644 --- a/drivers/crypto/Makefile +++ b/drivers/crypto/Makefile @@ -6,6 +6,7 @@ include $(RTE_SDK)/mk/rte.vars.mk DIRS-$(CONFIG_RTE_LIBRTE_PMD_AESNI_GCM) += aesni_gcm DIRS-$(CONFIG_RTE_LIBRTE_PMD_AESNI_MB) += aesni_mb DIRS-$(CONFIG_RTE_LIBRTE_PMD_ARMV8_CRYPTO) += armv8 +DIRS-$(CONFIG_RTE_LIBRTE_PMD_CAAM_JR) += caam_jr DIRS-$(CONFIG_RTE_LIBRTE_PMD_CCP) += ccp DIRS-$(CONFIG_RTE_LIBRTE_PMD_OPENSSL) += openssl DIRS-$(CONFIG_RTE_LIBRTE_PMD_CRYPTO_SCHEDULER) += scheduler diff --git a/drivers/crypto/caam_jr/Makefile b/drivers/crypto/caam_jr/Makefile new file mode 100644 index 000000000..46d752af7 --- /dev/null +++ b/drivers/crypto/caam_jr/Makefile @@ -0,0 +1,40 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright 2017 NXP + +include $(RTE_SDK)/mk/rte.vars.mk + +# +# library name +# +LIB = librte_pmd_caam_jr.a + +# build flags +CFLAGS += -DALLOW_EXPERIMENTAL_API +CFLAGS += -D _GNU_SOURCE +ifeq ($(CONFIG_RTE_LIBRTE_CAAM_JR_DEBUG),y) +CFLAGS += -O0 -g +CFLAGS += "-Wno-error" +else +CFLAGS += -O3 +CFLAGS += $(WERROR_FLAGS) +endif + +CFLAGS += -I$(RTE_SDK)/drivers/crypto/caam_jr +CFLAGS += -I$(RTE_SDK)/lib/librte_eal/common/include +CFLAGS += -I$(RTE_SDK)/lib/librte_eal/linuxapp/eal + +# versioning export map +EXPORT_MAP := rte_pmd_caam_jr_version.map + +# library version +LIBABIVER := 1 + +# library source files +SRCS-$(CONFIG_RTE_LIBRTE_PMD_CAAM_JR) += caam_jr.c +# library dependencies + +LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring +LDLIBS += -lrte_cryptodev +LDLIBS += -lrte_bus_vdev + +include $(RTE_SDK)/mk/rte.lib.mk diff --git a/drivers/crypto/caam_jr/caam_jr.c b/drivers/crypto/caam_jr/caam_jr.c new file mode 100644 index 000000000..68779cba5 --- /dev/null +++ b/drivers/crypto/caam_jr/caam_jr.c @@ -0,0 +1,157 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright 2017-2018 NXP + */ + +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#define CRYPTODEV_NAME_CAAM_JR_PMD crypto_caam_jr +static uint8_t cryptodev_driver_id; +int caam_jr_logtype; + + +/* + * @brief Release the resources used by the SEC user space driver. + * + * Reset and release SEC's job rings indicated by the User Application at + * init_job_ring() and free any memory allocated internally. + * Call once during application tear down. + * + * @note In case there are any descriptors in-flight (descriptors received by + * SEC driver for processing and for which no response was yet provided to UA), + * the descriptors are discarded without any notifications to User Application. + * + * @retval ::0 is returned for a successful execution + * @retval ::-1 is returned if SEC driver release is in progress + */ + +static int +caam_jr_dev_uninit(struct rte_cryptodev *dev) +{ + + if (dev == NULL) + return -ENODEV; + + + CAAM_JR_INFO("Closing DPAA_SEC device %s", dev->data->name); + + + return 0; +} + +static int +caam_jr_dev_init(const char *name, + struct rte_vdev_device *vdev, + struct rte_cryptodev_pmd_init_params *init_params) +{ + struct rte_cryptodev *dev; + + PMD_INIT_FUNC_TRACE(); + + dev = rte_cryptodev_pmd_create(name, &vdev->device, init_params); + if (dev == NULL) { + CAAM_JR_ERR("failed to create cryptodev vdev"); + goto cleanup; + } + + dev->driver_id = cryptodev_driver_id; + dev->dev_ops = NULL; + + /* For secondary processes, we don't initialise any further as primary + * has already done this work. Only check we don't need a different + * RX function + */ + if (rte_eal_process_type() != RTE_PROC_PRIMARY) { + CAAM_JR_WARN("Device already init by primary process"); + return 0; + } + + RTE_LOG(INFO, PMD, "%s cryptodev init\n", dev->data->name); + + return 0; + +cleanup: + CAAM_JR_ERR("driver %s: cryptodev_caam_jr_create failed", + init_params->name); + + return -ENXIO; +} + +/** Initialise CAAM JR crypto device */ +static int +cryptodev_caam_jr_probe(struct rte_vdev_device *vdev) +{ + struct rte_cryptodev_pmd_init_params init_params = { + "", + 128, + rte_socket_id(), + RTE_CRYPTODEV_PMD_DEFAULT_MAX_NB_QUEUE_PAIRS + }; + const char *name; + const char *input_args; + + name = rte_vdev_device_name(vdev); + if (name == NULL) + return -EINVAL; + + input_args = rte_vdev_device_args(vdev); + rte_cryptodev_pmd_parse_input_args(&init_params, input_args); + + return caam_jr_dev_init(name, vdev, &init_params); +} + +/** Uninitialise CAAM JR crypto device */ +static int +cryptodev_caam_jr_remove(struct rte_vdev_device *vdev) +{ + struct rte_cryptodev *cryptodev; + const char *name; + + name = rte_vdev_device_name(vdev); + if (name == NULL) + return -EINVAL; + + cryptodev = rte_cryptodev_pmd_get_named_dev(name); + if (cryptodev == NULL) + return -ENODEV; + + caam_jr_dev_uninit(cryptodev); + + return rte_cryptodev_pmd_destroy(cryptodev); +} + +static struct rte_vdev_driver cryptodev_caam_jr_drv = { + .probe = cryptodev_caam_jr_probe, + .remove = cryptodev_caam_jr_remove +}; + +static struct cryptodev_driver caam_jr_crypto_drv; + +RTE_PMD_REGISTER_VDEV(CRYPTODEV_NAME_CAAM_JR_PMD, cryptodev_caam_jr_drv); +RTE_PMD_REGISTER_PARAM_STRING(CRYPTODEV_NAME_CAAM_JR_PMD, + "max_nb_queue_pairs=" + "max_nb_sessions=" + "socket_id="); +RTE_PMD_REGISTER_CRYPTO_DRIVER(caam_jr_crypto_drv, cryptodev_caam_jr_drv.driver, + cryptodev_driver_id); + +RTE_INIT(caam_jr_init_log) +{ + caam_jr_logtype = rte_log_register("pmd.crypto.caam"); + if (caam_jr_logtype >= 0) + rte_log_set_level(caam_jr_logtype, RTE_LOG_NOTICE); +} diff --git a/drivers/crypto/caam_jr/caam_jr_log.h b/drivers/crypto/caam_jr/caam_jr_log.h new file mode 100644 index 000000000..106ff07a7 --- /dev/null +++ b/drivers/crypto/caam_jr/caam_jr_log.h @@ -0,0 +1,42 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright 2017-2018 NXP + */ + +#ifndef _CAAM_JR_LOG_H_ +#define _CAAM_JR_LOG_H_ + +#include + +extern int caam_jr_logtype; + +#define CAAM_JR_LOG(level, fmt, args...) \ + rte_log(RTE_LOG_ ## level, caam_jr_logtype, "caam_jr: " \ + fmt "\n", ##args) + +#define CAAM_JR_DEBUG(fmt, args...) \ + rte_log(RTE_LOG_DEBUG, caam_jr_logtype, "caam_jr: %s(): " \ + fmt "\n", __func__, ##args) + +#define PMD_INIT_FUNC_TRACE() CAAM_JR_DEBUG(" >>") + +#define CAAM_JR_INFO(fmt, args...) \ + CAAM_JR_LOG(INFO, fmt, ## args) +#define CAAM_JR_ERR(fmt, args...) \ + CAAM_JR_LOG(ERR, fmt, ## args) +#define CAAM_JR_WARN(fmt, args...) \ + CAAM_JR_LOG(WARNING, fmt, ## args) + +/* DP Logs, toggled out at compile time if level lower than current level */ +#define CAAM_JR_DP_LOG(level, fmt, args...) \ + RTE_LOG_DP(level, PMD, fmt "\n", ## args) + +#define CAAM_JR_DP_DEBUG(fmt, args...) \ + CAAM_JR_DP_LOG(DEBUG, fmt, ## args) +#define CAAM_JR_DP_INFO(fmt, args...) \ + CAAM_JR_DP_LOG(INFO, fmt, ## args) +#define CAAM_JR_DP_WARN(fmt, args...) \ + CAAM_JR_DP_LOG(WARNING, fmt, ## args) +#define CAAM_JR_DP_ERR(fmt, args...) \ + CAAM_JR_DP_LOG(ERR, fmt, ## args) + +#endif /* _CAAM_JR_LOG_H_ */ diff --git a/drivers/crypto/caam_jr/meson.build b/drivers/crypto/caam_jr/meson.build new file mode 100644 index 000000000..3edd0a212 --- /dev/null +++ b/drivers/crypto/caam_jr/meson.build @@ -0,0 +1,11 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright 2018 NXP + +if host_machine.system() != 'linux' + build = false +endif + +deps += ['bus_vdev', 'bus_dpaa', 'security'] +sources = files('caam_jr.c') + +allow_experimental_apis = true diff --git a/drivers/crypto/caam_jr/rte_pmd_caam_jr_version.map b/drivers/crypto/caam_jr/rte_pmd_caam_jr_version.map new file mode 100644 index 000000000..521e51f41 --- /dev/null +++ b/drivers/crypto/caam_jr/rte_pmd_caam_jr_version.map @@ -0,0 +1,4 @@ +DPDK_18.11 { + + local: *; +}; diff --git a/drivers/crypto/meson.build b/drivers/crypto/meson.build index d64ca418b..f4390581c 100644 --- a/drivers/crypto/meson.build +++ b/drivers/crypto/meson.build @@ -1,7 +1,7 @@ # SPDX-License-Identifier: BSD-3-Clause # Copyright(c) 2017 Intel Corporation -drivers = ['ccp', 'dpaa_sec', 'dpaa2_sec', 'mvsam', +drivers = ['caam_jr', 'ccp', 'dpaa_sec', 'dpaa2_sec', 'mvsam', 'null', 'openssl', 'qat', 'virtio'] std_deps = ['cryptodev'] # cryptodev pulls in all other needed deps -- 2.17.1