DPDK patches and discussions
 help / color / mirror / Atom feed
From: Fan Zhang <roy.fan.zhang@intel.com>
To: dev@dpdk.org
Cc: yliu@fridaylinux.org, maxime.coquelin@redhat.com,
	jianfeng.tan@intel.com, pablo.de.lara.guarch@intel.com,
	zhihong.wang@intel.com, tiwei.bie@intel.com
Subject: [dpdk-dev] [RFC PATCH 0/6] lib/librte_vhost: introduce new vhost_user crypto backend support
Date: Thu,  2 Nov 2017 16:09:18 +0000	[thread overview]
Message-ID: <20171102160924.41266-1-roy.fan.zhang@intel.com> (raw)

This RFC patchset adds crypto backend suppport to vhost_user library,
including a proof-of-concept sample application. The implementation
follows the virtio-crypto specification and have been tested
with qemu 2.9.50 (with several patches applied, detailed later)
with Fedora 24 running in the frontend.

The vhost_user library acts as a "bridge" method that translate
the virtio-crypto crypto requests to DPDK crypto operations, so it
is purely software implementation. However it does require the user
to provide the DPDK Cryptodev ID so it knows how to handle the
virtio-crypto session creation and deletion mesages.

Currently the implementation supports AES-CBC-128 and HMAC-SHA1
cipher only/chaining modes and does not support sessionless mode
yet. The guest can use standard virtio-crypto driver to set up
session and sends encryption/decryption requests to backend. The
vhost-crypto sample application provided in this patchset will
do the actual crypto work.

To make this patchset working, a few tweaks need to be done:

In the host:
1. Download the qemu source code, and apply the patches in:
list.nongnu.org/archive/html/qemu-devel/2017-07/msg04664.html.
As the patches have been out for over 2 months, they cannot be
cleanly applied to the latest code. I have reverted the commits
back to 4c4414a to make the patches applied cleanly.

2. Recompile your qemu.

3. Apply this patchset to latest DPDK code and recompile DPDK.

4. Compile and run vhost-crypto sample application.

./examples/vhost_crypto/build/vhost-crypto -l 11,12,13 -w 0000:86:01.0 \
 --socket-mem 2048,2048

Where 0000:86:01.0 is the QAT PCI address. You may use AES-NI-MB if it is
not available. The sample application requires 3 lcores: 1 master, 1 worker,
and 1 statistics displaying worker. The application will create a UNIX socket
file /tmp/vhost_crypto1.socket.

5. Start your qemu application. Here is my command:

qemu/x86_64-softmmu/qemu-system-x86_64 -machine accel=kvm -cpu host \
-smp 2 -m 1G -hda ~/path-to-your/image.qcow \
-object memory-backend-file,id=mem,size=1G,mem-path=/dev/hugepages,share=on \
-mem-prealloc -numa node,memdev=mem -chardev \
socket,id=charcrypto0,path=/tmp/vhost_crypto1.socket \
-object cryptodev-vhost-user,id=cryptodev0,chardev=charcrypto0 \
-device virtio-crypto-pci,id=crypto0,cryptodev=cryptodev0 

6. Once guest is booted. The Linux virtio_crypto kernel module is loaded by
default. You shall see the following logs in your demsg:

[   17.611044] virtio_crypto: loading out-of-tree module taints kernel.
[   17.611083] virtio_crypto: module verification failed: signature and/or ...
[   17.611723] virtio_crypto virtio0: max_queues: 1, max_cipher_key_len: ...
[   17.612156] virtio_crypto virtio0: will run requests pump with realtime ...
[   18.376100] virtio_crypto virtio0: Accelerator is ready

The virtio_crypto driver in the guest is now up and running.

7. The rest steps can be as same as the Testing section in
https://wiki.qemu.org/Features/VirtioCrypto

Fan Zhang (6):
  lib/librte_vhost: add vhost_user private info structure
  lib/librte_vhost: add virtio-crypto spec support
  lib/librte_vhost: add vhost_user backend support
  config/common_base: add vhost_crypto configuration items
  lib/librte_vhost: update Makefile for vhost_crypto
  example/vhost_crypto: add vhost_crypto sample application

 config/common_base                  |    1 +
 examples/vhost_crypto/Makefile      |   59 ++
 examples/vhost_crypto/main.c        |  617 +++++++++++++++++
 lib/librte_vhost/Makefile           |    5 +-
 lib/librte_vhost/rte_vhost_crypto.h |  150 +++++
 lib/librte_vhost/vhost_crypto.c     | 1254 +++++++++++++++++++++++++++++++++++
 lib/librte_vhost/vhost_user.c       |   13 +-
 lib/librte_vhost/vhost_user.h       |   34 +-
 8 files changed, 2128 insertions(+), 5 deletions(-)
 create mode 100644 examples/vhost_crypto/Makefile
 create mode 100644 examples/vhost_crypto/main.c
 create mode 100644 lib/librte_vhost/rte_vhost_crypto.h
 create mode 100644 lib/librte_vhost/vhost_crypto.c

-- 
2.9.5

             reply	other threads:[~2017-11-02 16:09 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-02 16:09 Fan Zhang [this message]
2017-11-02 16:09 ` [dpdk-dev] [RFC PATCH 1/6] lib/librte_vhost: add vhost_user private info structure Fan Zhang
2017-11-02 16:09 ` [dpdk-dev] [RFC PATCH 2/6] lib/librte_vhost: add virtio-crypto spec support Fan Zhang
2017-11-02 16:09 ` [dpdk-dev] [RFC PATCH 3/6] lib/librte_vhost: add vhost_user backend support Fan Zhang
2017-11-02 16:09 ` [dpdk-dev] [RFC PATCH 4/6] config/common_base: add vhost_crypto configuration items Fan Zhang
2017-11-02 16:09 ` [dpdk-dev] [RFC PATCH 5/6] lib/librte_vhost: update Makefile for vhost_crypto Fan Zhang
2017-11-02 16:09 ` [dpdk-dev] [RFC PATCH 6/6] example/vhost_crypto: add vhost_crypto sample application Fan Zhang
2017-11-02 20:10 ` [dpdk-dev] [RFC PATCH v2 0/7] lib/librte_vhost: introduce new vhost_user crypto backend support Fan Zhang
2017-11-02 20:10   ` [dpdk-dev] [RFC PATCH v2 1/7] lib/librte_vhost: add private data field Fan Zhang
2017-11-02 20:10   ` [dpdk-dev] [RFC PATCH v2 2/7] lib/librte_vhost: add vhost_user private info structure Fan Zhang
2017-11-02 20:10   ` [dpdk-dev] [RFC PATCH v2 3/7] lib/librte_vhost: add virtio-crypto spec support Fan Zhang
2017-11-02 20:10   ` [dpdk-dev] [RFC PATCH v2 4/7] lib/librte_vhost: add vhost_user backend support Fan Zhang
2017-11-02 20:10   ` [dpdk-dev] [RFC PATCH v2 5/7] config/common_base: add vhost_crypto configuration items Fan Zhang
2017-11-02 20:10   ` [dpdk-dev] [RFC PATCH v2 6/7] lib/librte_vhost: update Makefile for vhost_crypto Fan Zhang
2017-11-02 20:10   ` [dpdk-dev] [RFC PATCH v2 7/7] example/vhost_crypto: add vhost_crypto sample application Fan Zhang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171102160924.41266-1-roy.fan.zhang@intel.com \
    --to=roy.fan.zhang@intel.com \
    --cc=dev@dpdk.org \
    --cc=jianfeng.tan@intel.com \
    --cc=maxime.coquelin@redhat.com \
    --cc=pablo.de.lara.guarch@intel.com \
    --cc=tiwei.bie@intel.com \
    --cc=yliu@fridaylinux.org \
    --cc=zhihong.wang@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).