1f5188211SFan Zhang.. SPDX-License-Identifier: BSD-3-Clause 2f5188211SFan Zhang Copyright(c) 2017-2018 Intel Corporation. 3f5188211SFan Zhang 4f5188211SFan ZhangVhost_Crypto Sample Application 5f5188211SFan Zhang=============================== 6f5188211SFan Zhang 7f5188211SFan ZhangThe vhost_crypto sample application implemented a simple Crypto device, 8f5188211SFan Zhangwhich used as the backend of Qemu vhost-user-crypto device. Similar with 9f5188211SFan Zhangvhost-user-net and vhost-user-scsi device, the sample application used 10f5188211SFan Zhangdomain socket to communicate with Qemu, and the virtio ring was processed 11f5188211SFan Zhangby vhost_crypto sample application. 12f5188211SFan Zhang 13f5188211SFan ZhangTesting steps 14f5188211SFan Zhang------------- 15f5188211SFan Zhang 16f5188211SFan ZhangThis section shows the steps how to start a VM with the crypto device as 17f5188211SFan Zhangfast data path for critical application. 18f5188211SFan Zhang 19f5188211SFan ZhangCompiling the Application 20f5188211SFan Zhang------------------------- 21f5188211SFan Zhang 22f5188211SFan ZhangTo compile the sample application see :doc:`compiling`. 23f5188211SFan Zhang 24f5188211SFan ZhangThe application is located in the ``examples`` sub-directory. 25f5188211SFan Zhang 26f5188211SFan ZhangStart the vhost_crypto example 27f5188211SFan Zhang~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 28f5188211SFan Zhang 29f5188211SFan Zhang.. code-block:: console 30f5188211SFan Zhang 31*e2a94f9aSCiara Power ./dpdk-vhost_crypto [EAL options] -- 32709521f4SFan Zhang --config (lcore,cdev-id,queue-id)[,(lcore,cdev-id,queue-id)] 33cef5df19SFan Zhang --socket-file lcore,PATH 34709521f4SFan Zhang [--zero-copy] 35709521f4SFan Zhang [--guest-polling] 36f5188211SFan Zhang 37f5188211SFan Zhangwhere, 38f5188211SFan Zhang 39709521f4SFan Zhang* config (lcore,cdev-id,queue-id): build the lcore-cryptodev id-queue id 40709521f4SFan Zhang connection. Once specified, the specified lcore will only work with 41709521f4SFan Zhang specified cryptodev's queue. 42f5188211SFan Zhang 43709521f4SFan Zhang* socket-file lcore,PATH: the path of UNIX socket file to be created and 44709521f4SFan Zhang the lcore id that will deal with the all workloads of the socket. Multiple 45709521f4SFan Zhang instances of this config item is supported and one lcore supports processing 46709521f4SFan Zhang multiple sockets. 47f5188211SFan Zhang 48f5188211SFan Zhang* zero-copy: the presence of this item means the ZERO-COPY feature will be 49f5188211SFan Zhang enabled. Otherwise it is disabled. PLEASE NOTE the ZERO-COPY feature is still 50f5188211SFan Zhang in experimental stage and may cause the problem like segmentation fault. If 51f5188211SFan Zhang the user wants to use LKCF in the guest, this feature shall be turned off. 52f5188211SFan Zhang 53f5188211SFan Zhang* guest-polling: the presence of this item means the application assumes the 54f5188211SFan Zhang guest works in polling mode, thus will NOT notify the guest completion of 55f5188211SFan Zhang processing. 56f5188211SFan Zhang 57f5188211SFan ZhangThe application requires that crypto devices capable of performing 58f5188211SFan Zhangthe specified crypto operation are available on application initialization. 59f5188211SFan ZhangThis means that HW crypto device/s must be bound to a DPDK driver or 60f5188211SFan Zhanga SW crypto device/s (virtual crypto PMD) must be created (using --vdev). 61f5188211SFan Zhang 62f5188211SFan Zhang.. _vhost_crypto_app_run_vm: 63f5188211SFan Zhang 64f5188211SFan ZhangStart the VM 65f5188211SFan Zhang~~~~~~~~~~~~ 66f5188211SFan Zhang 67f5188211SFan Zhang.. code-block:: console 68f5188211SFan Zhang 69f5188211SFan Zhang qemu-system-x86_64 -machine accel=kvm \ 70f5188211SFan Zhang -m $mem -object memory-backend-file,id=mem,size=$mem,\ 71f5188211SFan Zhang mem-path=/dev/hugepages,share=on -numa node,memdev=mem \ 72f5188211SFan Zhang -drive file=os.img,if=none,id=disk \ 73f5188211SFan Zhang -device ide-hd,drive=disk,bootindex=0 \ 74f5188211SFan Zhang -chardev socket,id={chardev_id},path={PATH} \ 75f5188211SFan Zhang -object cryptodev-vhost-user,id={obj_id},chardev={chardev_id} \ 76f5188211SFan Zhang -device virtio-crypto-pci,id={dev_id},cryptodev={obj_id} \ 77f5188211SFan Zhang ... 78f5188211SFan Zhang 79f5188211SFan Zhang.. note:: 80f5188211SFan Zhang You must check whether your Qemu can support "vhost-user-crypto" or not. 81