1.. SPDX-License-Identifier: BSD-3-Clause 2 Copyright 2022-2023 Huawei Technologies Co.,Ltd. All rights reserved. 3 Copyright 2022-2023 Linaro ltd. 4 5UADK Crypto Poll Mode Driver 6============================ 7 8This code provides the initial implementation of the UADK poll mode driver. 9All cryptographic operations are using UADK library crypto API, 10which is algorithm level API, abstracting accelerators' low level implementations. 11 12UADK crypto PMD relies on `UADK library <https://github.com/Linaro/uadk>`_. 13 14UADK is a framework for user applications to access hardware accelerators. 15UADK relies on IOMMU SVA (Shared Virtual Address) feature, 16which share the same page table between IOMMU and MMU. 17As a result, user application can directly use virtual address for device DMA, 18which enhances the performance as well as easy usability. 19 20 21Features 22-------- 23 24UADK crypto PMD has support for: 25 26Cipher algorithms: 27 28* ``RTE_CRYPTO_CIPHER_AES_ECB`` 29* ``RTE_CRYPTO_CIPHER_AES_CBC`` 30* ``RTE_CRYPTO_CIPHER_AES_XTS`` 31* ``RTE_CRYPTO_CIPHER_DES_CBC`` 32 33Hash algorithms: 34 35* ``RTE_CRYPTO_AUTH_MD5`` 36* ``RTE_CRYPTO_AUTH_MD5_HMAC`` 37* ``RTE_CRYPTO_AUTH_SHA1`` 38* ``RTE_CRYPTO_AUTH_SHA1_HMAC`` 39* ``RTE_CRYPTO_AUTH_SHA224`` 40* ``RTE_CRYPTO_AUTH_SHA224_HMAC`` 41* ``RTE_CRYPTO_AUTH_SHA256`` 42* ``RTE_CRYPTO_AUTH_SHA256_HMAC`` 43* ``RTE_CRYPTO_AUTH_SHA384`` 44* ``RTE_CRYPTO_AUTH_SHA384_HMAC`` 45* ``RTE_CRYPTO_AUTH_SHA512`` 46* ``RTE_CRYPTO_AUTH_SHA512_HMAC`` 47 48Test steps 49---------- 50 51 52#. Build UADK 53 54 .. code-block:: console 55 56 git clone https://github.com/Linaro/uadk.git 57 cd uadk 58 mkdir build 59 ./autogen.sh 60 ./configure --prefix=$PWD/build 61 make 62 make install 63 64 .. note:: 65 66 Without ``--prefix``, UADK will be installed to ``/usr/local/lib`` by default. 67 68 .. note:: 69 70 If get error: "cannot find -lnuma", please install the libnuma-dev. 71 72#. Run pkg-config libwd to ensure env is setup correctly 73 74 .. code-block:: console 75 76 export PKG_CONFIG_PATH=$PWD/build/lib/pkgconfig 77 pkg-config libwd --cflags --libs -I/usr/local/include -L/usr/local/lib -lwd 78 79 .. note:: 80 81 export ``PKG_CONFIG_PATH`` is required on demand, 82 not needed if UADK is installed to ``/usr/local/lib``. 83 84#. Build DPDK 85 86 .. code-block:: console 87 88 cd dpdk 89 mkdir build 90 meson setup build (--reconfigure) 91 cd build 92 ninja 93 sudo meson install 94 95#. Prepare hugepages for DPDK (see also :doc:`../tools/hugepages`) 96 97 .. code-block:: console 98 99 echo 1024 > /sys/devices/system/node/node0/hugepages/hugepages-2048kB/nr_hugepages 100 echo 1024 > /sys/devices/system/node/node1/hugepages/hugepages-2048kB/nr_hugepages 101 echo 1024 > /sys/devices/system/node/node2/hugepages/hugepages-2048kB/nr_hugepages 102 echo 1024 > /sys/devices/system/node/node3/hugepages/hugepages-2048kB/nr_hugepages 103 mkdir -p /mnt/huge_2mb 104 mount -t hugetlbfs none /mnt/huge_2mb -o pagesize=2MB 105 106#. Run test app 107 108 .. code-block:: console 109 110 sudo dpdk-test --vdev=crypto_uadk --log-level=6 111 RTE>>cryptodev_uadk_autotest 112 RTE>>quit 113 114 115Initialization 116-------------- 117 118To use the PMD in an application, the user must: 119 120* Call ``rte_vdev_init("crypto_uadk")`` within the application. 121 122* Use ``--vdev="crypto_uadk"`` in the EAL options, 123 which will call rte_vdev_init() internally. 124 125The following parameters (all optional) can be provided in the previous two calls: 126 127``max_nb_queue_pairs`` 128 Specify the maximum number of queue pairs in the device (8 by default). 129 The maximum value can be queried from the device property ``available_instances``. 130 Property ``available_instances`` value may differ from the devices and platforms. 131 Allocating queue pairs bigger than ``available_instances`` will fail. 132 133Example: 134 135.. code-block:: console 136 137 cat /sys/class/uacce/hisi_sec2-2/available_instances 138 256 139 140 sudo dpdk-test-crypto-perf -l 0-10 --vdev crypto_uadk,max_nb_queue_pairs=10 \ 141 -- --devtype crypto_uadk --optype cipher-only --buffer-sz 8192 142