[EXT] [PATCH v2 2/5] crypto/uadk: introduce uadk crypto driver

Zhangfei Gao zhangfei.gao at linaro.org
Thu Sep 29 05:36:40 CEST 2022


Hi, Akhil

On 2022/9/26 下午4:36, Akhil Goyal wrote:
>> Introduce a new crypto PMD for hardware accelerators based on UADK [1].
>>
>> UADK is a framework for user applications to access hardware accelerators.
>> UADK relies on IOMMU SVA (Shared Virtual Address) feature, which share
>> the same page table between IOMMU and MMU.
>> Thereby user application can directly use virtual address for device dma,
>> which enhances the performance as well as easy usability.
>>
>> This patch adds the basic framework.
>>
>> [1] https://github.com/Linaro/uadk
>>
>> Test:
>> sudo dpdk-test --vdev=crypto_uadk (--log-level=6)
>> RTE>>cryptodev_uadk_autotest
>> RTE>>quit
> Remove this test info. It can be in your last patch where test app changes are introduced.
>
>
>> Signed-off-by: Zhangfei Gao <zhangfei.gao at linaro.org>
>> ---
>>   drivers/crypto/meson.build            |   1 +
>>   drivers/crypto/uadk/meson.build       |  36 +++
>>   drivers/crypto/uadk/uadk_crypto_pmd.c | 450 ++++++++++++++++++++++++++
>>   drivers/crypto/uadk/version.map       |   3 +
>>   4 files changed, 490 insertions(+)
>>   create mode 100644 drivers/crypto/uadk/meson.build
>>   create mode 100644 drivers/crypto/uadk/uadk_crypto_pmd.c
>>   create mode 100644 drivers/crypto/uadk/version.map
>>
>> diff --git a/drivers/crypto/meson.build b/drivers/crypto/meson.build
>> index 147b8cf633..ee5377deff 100644
>> --- a/drivers/crypto/meson.build
>> +++ b/drivers/crypto/meson.build
>> @@ -18,6 +18,7 @@ drivers = [
>>           'octeontx',
>>           'openssl',
>>           'scheduler',
>> +        'uadk',
>>           'virtio',
>>   ]
>>
>> diff --git a/drivers/crypto/uadk/meson.build b/drivers/crypto/uadk/meson.build
>> new file mode 100644
>> index 0000000000..a67c6c7ca5
>> --- /dev/null
>> +++ b/drivers/crypto/uadk/meson.build
>> @@ -0,0 +1,36 @@
>> +# SPDX-License-Identifier: BSD-3-Clause
>> +# Copyright 2022-2023 Huawei Technologies Co.,Ltd. All rights reserved.
>> +# Copyright 2022-2023 Linaro ltd.
>> +
>> +if not is_linux
>> +    build = false
>> +    reason = 'only supported on Linux'
>> +    subdir_done()
>> +endif
>> +
>> +if arch_subdir != 'arm' or not dpdk_conf.get('RTE_ARCH_64')
>> +    build = false
>> +    reason = 'only supported on aarch64'
>> +    subdir_done()
>> +endif
>> +
>> +sources = files(
>> +        'uadk_crypto_pmd.c',
>> +)
>> +
>> +deps += 'bus_vdev'
>> +dep = cc.find_library('libwd_crypto', dirs: ['/usr/local/lib'], required: false)
> I believe dirs is not required. You cannot assume that the lib is installed in /usr/local/lib/.
> Check other PMDs which have such dependencies. Eg. Ipsec-mb
>
>> +if not dep.found()
>> +	build = false
>> +	reason = 'missing dependency, "libwd_crypto"'
>> +else
>> +	ext_deps += dep
>> +endif
>> +
>> +dep = cc.find_library('libwd', dirs: ['/usr/local/lib'], required: false)
>> +if not dep.found()
>> +	build = false
>> +	reason = 'missing dependency, "libwd"'
>> +else
>> +	ext_deps += dep
>> +endif
>> diff --git a/drivers/crypto/uadk/uadk_crypto_pmd.c
>> b/drivers/crypto/uadk/uadk_crypto_pmd.c
>> new file mode 100644
>> index 0000000000..aad42524d6
>> --- /dev/null
>> +++ b/drivers/crypto/uadk/uadk_crypto_pmd.c
>> @@ -0,0 +1,450 @@
>> +/* SPDX-License-Identifier: BSD-3-Clause
>> + * Copyright 2022-2023 Huawei Technologies Co.,Ltd. All rights reserved.
>> + * Copyright 2022-2023 Linaro ltd.
>> + */
>> +
>> +#include <cryptodev_pmd.h>
>> +#include <rte_bus_vdev.h>
>> +#include <rte_comp.h>
>> +#include <uadk/wd_cipher.h>
>> +#include <uadk/wd_digest.h>
>> +#include <uadk/wd_sched.h>
>> +
>> +/* Maximum length for digest (SHA-512 needs 64 bytes) */
>> +#define DIGEST_LENGTH_MAX 64
>> +
>> +struct uadk_qp {
>> +	struct rte_ring *processed_pkts;
>> +	/* Ring for placing process packets */
>> +	struct rte_cryptodev_stats qp_stats;
>> +	/* Queue pair statistics */
>> +	uint16_t id;
>> +	/* Queue Pair Identifier */
>> +	char name[RTE_CRYPTODEV_NAME_MAX_LEN];
>> +	/* Unique Queue Pair Name */
>> +	uint8_t temp_digest[DIGEST_LENGTH_MAX];
>> +	/* Buffer used to store the digest generated
>> +	 * by the driver when verifying a digest provided
>> +	 * by the user (using authentication verify operation)
>> +	 */
>> +} __rte_cache_aligned;
> These comments should be added before the variable name or else use '<'
>
> The patches are not properly organized.
> I am skipping the review for now.
>
> Please split the patches as below.
> 1. introduce driver - create files with meson.build and with probe/remove
>      and device ops defined but not implemented. You do not need to write empty functions.
>     Add basic documentation also which defines what the driver is.
>    You can explain the build dependency here.
> 2. define queue structs and setup/remove APIs
> 3. Add data path
> 4. implement cipher op. Add capabilities and documentation of what is supported in each of the patch. Add feature flags etc.
> 5. implement auth,  add capabilities and documentation
> 6. test app changes.
Have updated v3 according to your suggestion.
https://patches.dpdk.org/project/dpdk/cover/20220929032746.10659-1-zhangfei.gao@linaro.org/

Would you mind take a look, in case my misunderstanding.

Thanks for your time



More information about the dev mailing list