X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=drivers%2Fcrypto%2Fmrvl%2Frte_mrvl_pmd.c;h=f778a80fce490bfb2fca829b581e856cc618a1b2;hb=6b663dae3f7d0bc0e1f3f35f1ae561ab72f276cb;hp=0c540fae9cca98f43c8fd3e2b2b7a329e27e43ad;hpb=8a61c83af2fae1008e3519d6bb800325888a845f;p=dpdk.git diff --git a/drivers/crypto/mrvl/rte_mrvl_pmd.c b/drivers/crypto/mrvl/rte_mrvl_pmd.c index 0c540fae9c..f778a80fce 100644 --- a/drivers/crypto/mrvl/rte_mrvl_pmd.c +++ b/drivers/crypto/mrvl/rte_mrvl_pmd.c @@ -1,7 +1,9 @@ /*- * BSD LICENSE * - * Copyright (C) Semihalf 2017. All rights reserved. + * Copyright(c) 2017 Marvell International Ltd. + * Copyright(c) 2017 Semihalf. + * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -13,7 +15,7 @@ * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. - * * Neither the name of Semihalf nor the names of its + * * Neither the name of the copyright holder nor the names of its * contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * @@ -34,16 +36,13 @@ #include #include #include -#include #include #include #include #include "rte_mrvl_pmd_private.h" -#ifndef RTE_MRVL_MUSDK_DMA_MEMSIZE -#define RTE_MRVL_MUSDK_DMA_MEMSIZE 41943040 -#endif +#define MRVL_MUSDK_DMA_MEMSIZE 41943040 static uint8_t cryptodev_driver_id; @@ -481,7 +480,7 @@ mrvl_request_prepare(struct sam_cio_op_params *request, request->num_bufs = 1; request->src = src_bd; src_bd->vaddr = rte_pktmbuf_mtod(op->sym->m_src, void *); - src_bd->paddr = rte_pktmbuf_mtophys(op->sym->m_src); + src_bd->paddr = rte_pktmbuf_iova(op->sym->m_src); src_bd->len = rte_pktmbuf_data_len(op->sym->m_src); /* Empty source. */ @@ -503,7 +502,7 @@ mrvl_request_prepare(struct sam_cio_op_params *request, request->dst = dst_bd; dst_bd->vaddr = rte_pktmbuf_mtod(dst_mbuf, void *); - dst_bd->paddr = rte_pktmbuf_mtophys(dst_mbuf); + dst_bd->paddr = rte_pktmbuf_iova(dst_mbuf); /* * We can use all available space in dst_mbuf, @@ -720,26 +719,14 @@ mrvl_crypto_pmd_dequeue_burst(void *queue_pair, static int cryptodev_mrvl_crypto_create(const char *name, struct rte_vdev_device *vdev, - struct rte_crypto_vdev_init_params *init_params) + struct rte_cryptodev_pmd_init_params *init_params) { struct rte_cryptodev *dev; struct mrvl_crypto_private *internals; struct sam_init_params sam_params; int ret; - if (init_params->name[0] == '\0') { - ret = rte_cryptodev_pmd_create_dev_name( - init_params->name, name); - - if (ret < 0) { - MRVL_CRYPTO_LOG_ERR("failed to create unique name"); - return ret; - } - } - - dev = rte_cryptodev_vdev_pmd_init(init_params->name, - sizeof(struct mrvl_crypto_private), - init_params->socket_id, vdev); + dev = rte_cryptodev_pmd_create(name, &vdev->device, init_params); if (dev == NULL) { MRVL_CRYPTO_LOG_ERR("failed to create cryptodev vdev"); goto init_error; @@ -766,9 +753,14 @@ cryptodev_mrvl_crypto_create(const char *name, * ret == -EEXIST is correct, it means DMA * has been already initialized. */ - ret = mv_sys_dma_mem_init(RTE_MRVL_MUSDK_DMA_MEMSIZE); - if ((ret < 0) && (ret != -EEXIST)) - return ret; + 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."); + } sam_params.max_num_sessions = internals->max_nb_sessions; @@ -791,40 +783,28 @@ init_error: static int cryptodev_mrvl_crypto_init(struct rte_vdev_device *vdev) { - struct rte_crypto_vdev_init_params init_params = { }; - const char *name; - const char *input_args; + struct rte_cryptodev_pmd_init_params init_params = { }; + const char *name, *args; int ret; name = rte_vdev_device_name(vdev); if (name == NULL) return -EINVAL; - input_args = rte_vdev_device_args(vdev); - - if (!input_args) - return -EINVAL; + args = rte_vdev_device_args(vdev); + init_params.private_data_size = sizeof(struct mrvl_crypto_private); init_params.max_nb_queue_pairs = sam_get_num_inst() * SAM_HW_RING_NUM; init_params.max_nb_sessions = - RTE_CRYPTODEV_VDEV_DEFAULT_MAX_NB_SESSIONS; + RTE_CRYPTODEV_PMD_DEFAULT_MAX_NB_SESSIONS; init_params.socket_id = rte_socket_id(); - ret = rte_cryptodev_vdev_parse_init_params(&init_params, input_args); + ret = rte_cryptodev_pmd_parse_input_args(&init_params, args); if (ret) { - RTE_LOG(ERR, PMD, "Failed to parse input arguments\n"); - return ret; - } - - RTE_LOG(INFO, PMD, "Initialising %s on NUMA node %d\n", name, - init_params.socket_id); - if (init_params.name[0] != '\0') { - RTE_LOG(INFO, PMD, " User defined name = %s\n", - init_params.name); + RTE_LOG(ERR, PMD, + "Failed to parse initialisation arguments[%s]\n", + args); + return -EINVAL; } - RTE_LOG(INFO, PMD, " Max number of queue pairs = %d\n", - init_params.max_nb_queue_pairs); - RTE_LOG(INFO, PMD, " Max number of sessions = %d\n", - init_params.max_nb_sessions); return cryptodev_mrvl_crypto_create(name, vdev, &init_params); } @@ -838,6 +818,7 @@ cryptodev_mrvl_crypto_init(struct rte_vdev_device *vdev) static int cryptodev_mrvl_crypto_uninit(struct rte_vdev_device *vdev) { + struct rte_cryptodev *cryptodev; const char *name = rte_vdev_device_name(vdev); if (name == NULL) @@ -849,7 +830,11 @@ cryptodev_mrvl_crypto_uninit(struct rte_vdev_device *vdev) sam_deinit(); - return 0; + cryptodev = rte_cryptodev_pmd_get_named_dev(name); + if (cryptodev == NULL) + return -ENODEV; + + return rte_cryptodev_pmd_destroy(cryptodev); } /**