13a78b2f7SJay Zhou.. SPDX-License-Identifier: BSD-3-Clause 23a78b2f7SJay Zhou Copyright(c) 2018 HUAWEI TECHNOLOGIES CO., LTD. 33a78b2f7SJay Zhou 43a78b2f7SJay ZhouVirtio Crypto Poll Mode Driver 53a78b2f7SJay Zhou============================== 63a78b2f7SJay Zhou 73a78b2f7SJay ZhouThe virtio crypto PMD provides poll mode driver support for the virtio crypto 83a78b2f7SJay Zhoudevice. 93a78b2f7SJay Zhou 103a78b2f7SJay ZhouFeatures 113a78b2f7SJay Zhou-------- 123a78b2f7SJay Zhou 133a78b2f7SJay ZhouThe virtio crypto PMD has support for: 143a78b2f7SJay Zhou 153a78b2f7SJay ZhouCipher algorithms: 163a78b2f7SJay Zhou 173a78b2f7SJay Zhou* ``RTE_CRYPTO_CIPHER_AES_CBC`` 183a78b2f7SJay Zhou 193a78b2f7SJay ZhouHash algorithms: 203a78b2f7SJay Zhou 213a78b2f7SJay Zhou* ``RTE_CRYPTO_AUTH_SHA1_HMAC`` 223a78b2f7SJay Zhou 233a78b2f7SJay ZhouLimitations 243a78b2f7SJay Zhou----------- 253a78b2f7SJay Zhou 263a78b2f7SJay Zhou* Only supports the session-oriented API implementation (session-less APIs are 273a78b2f7SJay Zhou not supported). 283a78b2f7SJay Zhou* Only supports modern mode since virtio crypto conforms to virtio-1.0. 293a78b2f7SJay Zhou* Only has two types of queues: data queue and control queue. These two queues 303a78b2f7SJay Zhou only support indirect buffers to communication with the virtio backend. 313a78b2f7SJay Zhou* Only supports AES_CBC cipher only algorithm and AES_CBC with HMAC_SHA1 323a78b2f7SJay Zhou chaining algorithm since the vhost crypto backend only these algorithms 333a78b2f7SJay Zhou are supported. 343a78b2f7SJay Zhou* Does not support Link State interrupt. 353a78b2f7SJay Zhou* Does not support runtime configuration. 363a78b2f7SJay Zhou 373a78b2f7SJay ZhouVirtio crypto PMD Rx/Tx Callbacks 383a78b2f7SJay Zhou--------------------------------- 393a78b2f7SJay Zhou 403a78b2f7SJay ZhouRx callbacks: 413a78b2f7SJay Zhou 423a78b2f7SJay Zhou* ``virtio_crypto_pkt_rx_burst`` 433a78b2f7SJay Zhou 443a78b2f7SJay ZhouTx callbacks: 453a78b2f7SJay Zhou 463a78b2f7SJay Zhou* ``virtio_crypto_pkt_tx_burst`` 473a78b2f7SJay Zhou 483a78b2f7SJay ZhouInstallation 493a78b2f7SJay Zhou------------ 503a78b2f7SJay Zhou 513a78b2f7SJay ZhouQuick instructions are as follows: 523a78b2f7SJay Zhou 533a78b2f7SJay ZhouFirstly run DPDK vhost crypto sample as a server side and build QEMU with 543a78b2f7SJay Zhouvhost crypto enabled. 553a78b2f7SJay ZhouQEMU can then be started using the following parameters: 563a78b2f7SJay Zhou 573a78b2f7SJay Zhou.. code-block:: console 583a78b2f7SJay Zhou 593a78b2f7SJay Zhou qemu-system-x86_64 \ 603a78b2f7SJay Zhou [...] \ 613a78b2f7SJay Zhou -chardev socket,id=charcrypto0,path=/path/to/your/socket \ 623a78b2f7SJay Zhou -object cryptodev-vhost-user,id=cryptodev0,chardev=charcrypto0 \ 633a78b2f7SJay Zhou -device virtio-crypto-pci,id=crypto0,cryptodev=cryptodev0 643a78b2f7SJay Zhou [...] 653a78b2f7SJay Zhou 66b7fe612aSThomas MonjalonSecondly bind the uio_pci_generic driver for the virtio-crypto device. 673a78b2f7SJay ZhouFor example, 0000:00:04.0 is the domain, bus, device and function 683a78b2f7SJay Zhounumber of the virtio-crypto device: 693a78b2f7SJay Zhou 703a78b2f7SJay Zhou.. code-block:: console 713a78b2f7SJay Zhou 723a78b2f7SJay Zhou modprobe uio_pci_generic 733a78b2f7SJay Zhou echo -n 0000:00:04.0 > /sys/bus/pci/drivers/virtio-pci/unbind 743a78b2f7SJay Zhou echo "1af4 1054" > /sys/bus/pci/drivers/uio_pci_generic/new_id 753a78b2f7SJay Zhou 76*f8dbaebbSSean MorrisseyFinally the front-end virtio crypto PMD can be installed. 773a78b2f7SJay Zhou 783a78b2f7SJay ZhouTests 793a78b2f7SJay Zhou----- 803a78b2f7SJay Zhou 813a78b2f7SJay ZhouThe unit test cases can be tested as below: 823a78b2f7SJay Zhou 833a78b2f7SJay Zhou.. code-block:: console 843a78b2f7SJay Zhou 853a78b2f7SJay Zhou reserve enough huge pages 86fd5f9fb9SCiara Power cd to <build_dir> 87fd5f9fb9SCiara Power meson test cryptodev_virtio_autotest 883a78b2f7SJay Zhou 893a78b2f7SJay ZhouThe performance can be tested as below: 903a78b2f7SJay Zhou 913a78b2f7SJay Zhou.. code-block:: console 923a78b2f7SJay Zhou 933a78b2f7SJay Zhou reserve enough huge pages 94fd5f9fb9SCiara Power cd to <build_dir> 953a78b2f7SJay Zhou 96fd5f9fb9SCiara Power ./app/dpdk-test-crypto-perf -l 0,1 -- --devtype crypto_virtio \ 973a78b2f7SJay Zhou --ptest throughput --optype cipher-then-auth --cipher-algo aes-cbc \ 983a78b2f7SJay Zhou --cipher-op encrypt --cipher-key-sz 16 --auth-algo sha1-hmac \ 993a78b2f7SJay Zhou --auth-op generate --auth-key-sz 64 --digest-sz 12 \ 1003a78b2f7SJay Zhou --total-ops 100000000 --burst-sz 64 --buffer-sz 2048 101