crypto: add virtio poll mode driver
Subsystems (3)
v5 cover crypto: add virtio poll mode driver
This patch series introduce virtio crypto poll mode driver.
Since it is limited by the vhost crypto backend of the virtio-crypto, this patch series only supports a limited subset of crypto services. Only the following algorithms are tested:
Cipher algorithms:
- RTE_CRYPTO_CIPHER_AES_CBC (128-bit, 192-bit and 256-bit keys)
Cipher then hash algorithms:
- RTE_CRYPTO_CIPHER_AES_CBC with RTE_CRYPTO_AUTH_SHA1_HMAC
The qemu side has supported vhost crypto and the vhost user crypto server side patches had been sent to DPDK community, pls see
[PATCH v2 00/10] lib/librte_vhost: introduce new vhost user crypto backend support
https://dpdk.org/ml/archives/dev/2018-February/091594.html
Firstly run DPDK vhost crypto sample as a server side and build QEMU with vhost crypto enabled.
QEMU can then be started using the following parameters:
qemu-system-x86_64 \
[...] \
-chardev socket,id=charcrypto0,path=/path/to/your/socket \
-object cryptodev-vhost-user,id=cryptodev0,chardev=charcrypto0 \
-device virtio-crypto-pci,id=crypto0,cryptodev=cryptodev0
[...]Bind the uio_generic driver for the virtio-crypto device. For example, 0000:00:04.0 is the domain, bus, device and function number of the virtio-crypto device:
modprobe uio_pci_generic
echo -n 0000:00:04.0 > /sys/bus/pci/drivers/virtio-pci/unbind
echo "1af4 1054" > /sys/bus/pci/drivers/uio_pci_generic/new_idThe front-end virtio crypto PMD driver can be installed:
cd to the top-level DPDK directory
sed -i 's,\(CONFIG_RTE_LIBRTE_PMD_VIRTIO_CRYPTO\)=n,\1=y,' config/common_base make config T=x86_64-native-linuxapp-gcc
make install T=x86_64-native-linuxapp-gcc
The unit test cases can be compiled as below:
cd to the top-level DPDK directory
export RTE_TARGET=x86_64-native-linuxapp-gcc export RTE_SDK=pwd
cd to test/test
make
./test (MUST reserve enough huge pages memory) type the command "cryptodev_virtio_autotest" to test
The result should be like this:
RTE>>cryptodev_virtio_autotest
+ ------------------------------------------------------- +
+ Test Suite : Crypto VIRTIO Unit Test Suite
+ ------------------------------------------------------- +
0) TestCase AES-128-CBC Encryption PASS
1) TestCase AES-128-CBC Decryption PASS
2) TestCase AES-192-CBC Encryption PASS
3) TestCase AES-192-CBC Decryption PASS
4) TestCase AES-256-CBC Encryption PASS
5) TestCase AES-256-CBC Decryption PASS
6) TestCase AES-256-CBC OOP Encryption PASS
7) TestCase AES-256-CBC OOP Decryption PASS
+ TestCase [ 0] : test_AES_cipheronly_virtio_all succeeded
+ ------------------------------------------------------- +
+ Test Suite Summary
+ Tests Total : 1 + Tests Skipped : 0 + Tests Executed : 1 + Tests Unsupported: 0 + Tests Passed : 1 + Tests Failed : 0
+ ------------------------------------------------------- +
Test OK
The performance can be tested as below:
reserve enough huge pages
cd to the top-level DPDK directory
export RTE_TARGET=x86_64-native-linuxapp-gcc
export RTE_SDK=pwd
cd to app/test-crypto-perf
type the command "make" to compile
run the tests with the following command:
./dpdk-test-crypto-perf -l 0,1 -- --devtype crypto_virtio \
--ptest throughput --optype cipher-then-auth --cipher-algo aes-cbc \
--cipher-op encrypt --cipher-key-sz 16 --auth-algo sha1-hmac \
--auth-op generate --auth-key-sz 64 --digest-sz 12 \
--total-ops 100000000 --burst-sz 64 --buffer-sz 2048
Please help to review, thanks!
Changes in v5:
- rebased on the newest dpdk-next-crypto
Changes in v4:
- using dynamic logging [Pablo]
- elaborate on the core code [Pablo]
- delete algorithms which can not be tested [Pablo]
- rebased on dpdk-next-crypto [Pablo]
- fix doc compilation error [Pablo]
- add release note for this PMD [Pablo]
- add R-b from Fan Zhang
- fix some typos
Changes in v3:
- set up capabilities for virtio crypto PMD [Fan]
- delete AES-CTR unit test cases since vhost_user crypto backend does not support [Fan]
- fix a variable uninitialized in virtio_crypto_queue_setup() [Xin, Fan]
- fix a bug in virtqueue_dequeue_burst_rx()
Changes in v2:
- using pre-allocated mempool instead of rte_malloc to improve performance [Fan]
- split the patch into a patchset [Fan]
- using linux/virtio_crypto.h instead of creating a copy of the file [Fan]
- update doc/guides/cryptodevs for describing virtio crypto PMD [Fan]
- update copyright
- delete virtio legacy mode code since virtio-crypto conforms to virtio-1.0
- refine the function and variable names
- fix errors and warnings reported by checkpatch
Jay Zhou (7):
crypto/virtio: add virtio related fundamental functions crypto/virtio: add crypto related session structure crypto/virtio: core code of virtio crypto PMD crypto/virtio: add makefile
doc: add virtio crypto PMD guide
test/crypto: add function tests for virtio crypto PMD
MAINTAINERS: add myself as virtio crypto PMD maintainer
MAINTAINERS | 6 + config/common_base | 14 + doc/guides/cryptodevs/features/virtio.ini | 26 + doc/guides/cryptodevs/index.rst | 1 + doc/guides/cryptodevs/virtio.rst | 117 ++ doc/guides/rel_notes/release_18_05.rst | 6 + drivers/crypto/Makefile | 1 + drivers/crypto/virtio/Makefile | 31 + .../virtio/rte_pmd_virtio_crypto_version.map | 3 + drivers/crypto/virtio/virtio_crypto_algs.h | 27 + drivers/crypto/virtio/virtio_crypto_capabilities.h | 51 + drivers/crypto/virtio/virtio_cryptodev.c | 1508 ++++++++++++++++++++ drivers/crypto/virtio/virtio_cryptodev.h | 66 + drivers/crypto/virtio/virtio_logs.h | 91 ++ drivers/crypto/virtio/virtio_pci.c | 460 ++++++ drivers/crypto/virtio/virtio_pci.h | 253 ++++ drivers/crypto/virtio/virtio_ring.h | 137 ++ drivers/crypto/virtio/virtio_rxtx.c | 541 +++++++ drivers/crypto/virtio/virtqueue.c | 43 + drivers/crypto/virtio/virtqueue.h | 172 +++ mk/rte.app.mk | 1 + test/test/test_cryptodev.c | 48 + test/test/test_cryptodev.h | 1 + test/test/test_cryptodev_aes_test_vectors.h | 24 +- test/test/test_cryptodev_blockcipher.c | 9 +- test/test/test_cryptodev_blockcipher.h | 1 + 26 files changed, 3629 insertions(+), 9 deletions(-) create mode 100644 doc/guides/cryptodevs/features/virtio.ini create mode 100644 doc/guides/cryptodevs/virtio.rst create mode 100644 drivers/crypto/virtio/Makefile create mode 100644 drivers/crypto/virtio/rte_pmd_virtio_crypto_version.map create mode 100644 drivers/crypto/virtio/virtio_crypto_algs.h create mode 100644 drivers/crypto/virtio/virtio_crypto_capabilities.h create mode 100644 drivers/crypto/virtio/virtio_cryptodev.c create mode 100644 drivers/crypto/virtio/virtio_cryptodev.h create mode 100644 drivers/crypto/virtio/virtio_logs.h create mode 100644 drivers/crypto/virtio/virtio_pci.c create mode 100644 drivers/crypto/virtio/virtio_pci.h create mode 100644 drivers/crypto/virtio/virtio_ring.h create mode 100644 drivers/crypto/virtio/virtio_rxtx.c create mode 100644 drivers/crypto/virtio/virtqueue.c create mode 100644 drivers/crypto/virtio/virtqueue.h
Signature · 1 line
1.8.3.1
PATCH v5 1/7 crypto/virtio: add virtio related fundamental functions
Since there does not have the common virtio library, we have to put these files here. They are basically the same with virtio net related files with some minor changes.
Meanwhile, adding virtio crypto PMD related release note for 18.05.
--- config/common_base | 14 + doc/guides/rel_notes/release_18_05.rst | 6 + drivers/crypto/virtio/virtio_logs.h | 91 +++++++ drivers/crypto/virtio/virtio_pci.c | 460 +++++++++++++++++++++++++++++++++ drivers/crypto/virtio/virtio_pci.h | 253 ++++++++++++++++++ drivers/crypto/virtio/virtio_ring.h | 137 ++++++++++ drivers/crypto/virtio/virtqueue.c | 43 +++ drivers/crypto/virtio/virtqueue.h | 172 ++++++++++++ 8 files changed, 1176 insertions(+) create mode 100644 drivers/crypto/virtio/virtio_logs.h create mode 100644 drivers/crypto/virtio/virtio_pci.c create mode 100644 drivers/crypto/virtio/virtio_pci.h create mode 100644 drivers/crypto/virtio/virtio_ring.h create mode 100644 drivers/crypto/virtio/virtqueue.c create mode 100644 drivers/crypto/virtio/virtqueue.h
config/common_base +14 -0
@@ -486,6 +486,20 @@ CONFIG_RTE_LIBRTE_PMD_QAT_DEBUG_DRIVER=n CONFIG_RTE_QAT_PMD_MAX_NB_SESSIONS=2048 # +# Compile PMD for virtio crypto devices +# +CONFIG_RTE_LIBRTE_PMD_VIRTIO_CRYPTO=n +# +# Number of maximum virtio crypto devices +# +CONFIG_RTE_MAX_VIRTIO_CRYPTO=32 +# +# Number of sessions to create in the session memory pool +# on a single virtio crypto device. +# +CONFIG_RTE_VIRTIO_CRYPTO_PMD_MAX_NB_SESSIONS=1024 + +# # Compile PMD for AESNI backed device # CONFIG_RTE_LIBRTE_PMD_AESNI_MB=n
doc/guides/rel_notes/release_18_05.rst +6 -0
@@ -53,6 +53,12 @@ New Features :doc:`../cryptodevs/ccp` crypto driver guide for more details on this new driver. +* **Added the virtio crypto PMD.** + + Added a new virtio crypto PMD, which provides AES-CBC ciphering and + AES-CBC with HMAC-SHA1 algorithm-chaining. See the + :doc:`../cryptodevs/virtio` crypto driver guide for more details on + this new driver. API Changes -----------
drivers/crypto/virtio/virtio_logs.h new file +91 -0
91 lines not on this page · raw message
drivers/crypto/virtio/virtio_pci.c new file +460 -0
460 lines not on this page · raw message
drivers/crypto/virtio/virtio_pci.h new file +253 -0
253 lines not on this page · raw message
drivers/crypto/virtio/virtio_ring.h new file +137 -0
137 lines not on this page · raw message
drivers/crypto/virtio/virtqueue.c new file +43 -0
43 lines not on this page · raw message
drivers/crypto/virtio/virtqueue.h new file +172 -0
172 lines not on this page · raw message
Signature · 1 line
1.8.3.1
PATCH v5 3/7 crypto/virtio: core code of virtio crypto PMD
In reply to Jay ZhouThe virtio crypto device has two types of queues, data
queue and control queue. It has one data queue at least and has one and only one control queue. For example, if a virtio crypto device has N queues, then [0, N-2] is the data queue index, N-1 is the control queue index.
The virtio crypto PMD provides poll mode driver support for the virtio crypto device.
The cryptodev is created at the virtio crypto pci device probing stage. For now, it only supports the session-oriented API implementation, the supported symmetrical algorithms are AES-CBC ciphering and AES-CBC with HMAC-SHA1 algorithm-chaining. The function virtio_crypto_sym_configure_session() is used to create a session, then virtio_crypto_pkt_tx_burst() can be used to burst transfer packets and virtio_crypto_pkt_rx_burst() can be used to burst receive packets.
--- drivers/crypto/virtio/virtio_crypto_capabilities.h | 51 + drivers/crypto/virtio/virtio_cryptodev.c | 1508 ++++++++++++++++++++ drivers/crypto/virtio/virtio_cryptodev.h | 66 + drivers/crypto/virtio/virtio_rxtx.c | 541 +++++++ 4 files changed, 2166 insertions(+) create mode 100644 drivers/crypto/virtio/virtio_crypto_capabilities.h create mode 100644 drivers/crypto/virtio/virtio_cryptodev.c create mode 100644 drivers/crypto/virtio/virtio_cryptodev.h create mode 100644 drivers/crypto/virtio/virtio_rxtx.c
drivers/crypto/virtio/virtio_crypto_capabilities.h new file +51 -0
@@ -0,0 +1,51 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright(c) 2018 HUAWEI TECHNOLOGIES CO., LTD. +*/ + +#ifndef _VIRTIO_CRYPTO_CAPABILITIES_H_ +#define _VIRTIO_CRYPTO_CAPABILITIES_H_ + +#define VIRTIO_SYM_CAPABILITIES \ + { /* SHA1 HMAC */ \ + .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC, \ + {.sym = { \ + .xform_type = RTE_CRYPTO_SYM_XFORM_AUTH, \ + {.auth = { \ + .algo = RTE_CRYPTO_AUTH_SHA1_HMAC, \ + .block_size = 64, \ + .key_size = { \ + .min = 1, \ + .max = 64, \ + .increment = 1 \ + }, \ + .digest_size = { \ + .min = 1, \ + .max = 20, \ + .increment = 1 \ + }, \ + .iv_size = { 0 } \ + }, } \ + }, } \ + }, \ + { /* AES CBC */ \ + .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC, \ + {.sym = { \ + .xform_type = RTE_CRYPTO_SYM_XFORM_CIPHER, \ + {.cipher = { \ + .algo = RTE_CRYPTO_CIPHER_AES_CBC, \ + .block_size = 16, \ + .key_size = { \ + .min = 16, \ + .max = 32, \ + .increment = 8 \ + }, \ + .iv_size = { \ + .min = 16, \ + .max = 16, \ + .increment = 0 \ + } \ + }, } \ + }, } \ + } + +#endif /* _VIRTIO_CRYPTO_CAPABILITIES_H_ */
drivers/crypto/virtio/virtio_cryptodev.c new file +1508 -0
1,508 lines not on this page · raw message
drivers/crypto/virtio/virtio_cryptodev.h new file +66 -0
66 lines not on this page · raw message
drivers/crypto/virtio/virtio_rxtx.c new file +541 -0
541 lines not on this page · raw message
Signature · 1 line
1.8.3.1
PATCH v5 4/7 crypto/virtio: add makefile
In reply to Jay ZhouThe virtio crypto PMD driver can be compiled now.
--- drivers/crypto/Makefile | 1 + drivers/crypto/virtio/Makefile | 31 ++++++++++++++++++++++ .../virtio/rte_pmd_virtio_crypto_version.map | 3 +++ mk/rte.app.mk | 1 + 4 files changed, 36 insertions(+) create mode 100644 drivers/crypto/virtio/Makefile create mode 100644 drivers/crypto/virtio/rte_pmd_virtio_crypto_version.map
drivers/crypto/Makefile +1 -0
@@ -21,5 +21,6 @@ ifeq ($(CONFIG_RTE_LIBRTE_DPAA_BUS),y) DIRS-$(CONFIG_RTE_LIBRTE_PMD_DPAA_SEC) += dpaa_sec endif DIRS-$(CONFIG_RTE_LIBRTE_PMD_CCP) += ccp +DIRS-$(CONFIG_RTE_LIBRTE_PMD_VIRTIO_CRYPTO) += virtio include $(RTE_SDK)/mk/rte.subdir.mk
drivers/crypto/virtio/Makefile new file +31 -0
@@ -0,0 +1,31 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(c) 2018 HUAWEI TECHNOLOGIES CO., LTD. + +include $(RTE_SDK)/mk/rte.vars.mk + +# +# library name +# +LIB = librte_pmd_virtio_crypto.a + +CFLAGS += -O3 +CFLAGS += $(WERROR_FLAGS) + +EXPORT_MAP := rte_pmd_virtio_crypto_version.map + +LIBABIVER := 1 + +# +# all source are stored in SRCS-y +# +SRCS-$(CONFIG_RTE_LIBRTE_PMD_VIRTIO_CRYPTO) += virtqueue.c +SRCS-$(CONFIG_RTE_LIBRTE_PMD_VIRTIO_CRYPTO) += virtio_pci.c +SRCS-$(CONFIG_RTE_LIBRTE_PMD_VIRTIO_CRYPTO) += virtio_rxtx.c +SRCS-$(CONFIG_RTE_LIBRTE_PMD_VIRTIO_CRYPTO) += virtio_cryptodev.c + +# this lib depends upon: +DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_VIRTIO_CRYPTO) += lib/librte_eal +DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_VIRTIO_CRYPTO) += lib/librte_mempool lib/librte_mbuf +DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_VIRTIO_CRYPTO) += lib/librte_cryptodev + +include $(RTE_SDK)/mk/rte.lib.mk
drivers/crypto/virtio/rte_pmd_virtio_crypto_version.map new file +3 -0
@@ -0,0 +1,3 @@ +DPDK_18.05 { + local: *; +};
mk/rte.app.mk +1 -0
@@ -204,6 +204,7 @@ _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_AESNI_GCM) += -lIPSec_MB _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_OPENSSL) += -lrte_pmd_openssl -lcrypto _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_NULL_CRYPTO) += -lrte_pmd_null_crypto _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_QAT) += -lrte_pmd_qat -lcrypto +_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_VIRTIO_CRYPTO) += -lrte_pmd_virtio_crypto -lcrypto _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_SNOW3G) += -lrte_pmd_snow3g _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_SNOW3G) += -L$(LIBSSO_SNOW3G_PATH)/build -lsso_snow3g _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_KASUMI) += -lrte_pmd_kasumi
Signature · 1 line
1.8.3.1
PATCH v5 6/7 test/crypto: add function tests for virtio crypto PMD
In reply to Jay ZhouOnly RTE_CRYPTO_CIPHER_AES_CBC cipher
algorithm are tested as unit test, it is supported both by the cryptodev-backend-builtin and cryptodev-vhost-user of qemu side.
--- test/test/test_cryptodev.c | 48 +++++++++++++++++++++++++++++ test/test/test_cryptodev.h | 1 + test/test/test_cryptodev_aes_test_vectors.h | 24 ++++++++++----- test/test/test_cryptodev_blockcipher.c | 9 +++++- test/test/test_cryptodev_blockcipher.h | 1 + 5 files changed, 74 insertions(+), 9 deletions(-)
test/test/test_cryptodev.c +48 -0
@@ -1820,6 +1820,25 @@ struct crypto_unittest_params { }static int +test_AES_cipheronly_virtio_all (void ) +{ +struct crypto_testsuite_params *ts_params = &testsuite_params; +int status; + + status =test_blockcipher_all_tests (ts_params->mbuf_pool, + ts_params->op_mpool, + ts_params->session_mpool, + ts_params->valid_devs[0 ], +rte_cryptodev_driver_id_get ( +RTE_STR (CRYPTODEV_NAME_VIRTIO_PMD )), +BLKCIPHER_AES_CIPHERONLY_TYPE ); + +TEST_ASSERT_EQUAL (status,0 ,"Test failed" ); + +return TEST_SUCCESS ; +} + +static int test_AES_chain_dpaa_sec_all (void ) {struct crypto_testsuite_params *ts_params = &testsuite_params;
@@ -8879,6 +8898,18 @@ struct test_crypto_vector { } }; +static struct unit_test_suite cryptodev_virtio_testsuite = { + .suite_name ="Crypto VIRTIO Unit Test Suite" , + .setup = testsuite_setup, + .teardown = testsuite_teardown, + .unit_test_cases = { +TEST_CASE_ST (ut_setup, ut_teardown, + test_AES_cipheronly_virtio_all), + +TEST_CASES_END ()/**< NULL terminate unit test array */ + } +}; +static struct unit_test_suite cryptodev_aesni_mb_testsuite = { .suite_name ="Crypto Device AESNI MB Unit Test Suite" , .setup = testsuite_setup,
@@ -9808,6 +9839,22 @@ struct test_crypto_vector { }static int +test_cryptodev_virtio (void /*argv __rte_unused, int argc __rte_unused*/ ) +{ + gbl_driver_id =rte_cryptodev_driver_id_get ( +RTE_STR (CRYPTODEV_NAME_VIRTIO_PMD )); + +if (gbl_driver_id ==-1 ) { +RTE_LOG (ERR ,USER1 ,"VIRTIO PMD must be loaded. Check if " +"CONFIG_RTE_LIBRTE_PMD_VIRTIO_CRYPTO is enabled " +"in config file to run this testsuite.\n" ); +return TEST_FAILED ; + } + +return unit_test_suite_runner (&cryptodev_virtio_testsuite); +} + +static int test_cryptodev_aesni_mb (void /*argv __rte_unused, int argc __rte_unused*/ ) { gbl_driver_id = rte_cryptodev_driver_id_get(
@@ -10040,3 +10087,4 @@ struct test_crypto_vector {REGISTER_TEST_COMMAND (cryptodev_dpaa2_sec_autotest, test_cryptodev_dpaa2_sec);REGISTER_TEST_COMMAND (cryptodev_dpaa_sec_autotest, test_cryptodev_dpaa_sec);REGISTER_TEST_COMMAND (cryptodev_ccp_autotest, test_cryptodev_ccp); +REGISTER_TEST_COMMAND (cryptodev_virtio_autotest, test_cryptodev_virtio);
test/test/test_cryptodev.h +1 -0
@@ -62,6 +62,7 @@#define CRYPTODEV_NAME_SCHEDULER_PMD crypto_scheduler#define CRYPTODEV_NAME_MRVL_PMD crypto_mrvl#define CRYPTODEV_NAME_CCP_PMD crypto_ccp +#define CRYPTODEV_NAME_VIRTIO_PMD crypto_virtio/** * Write (spread) data from buffer to mbuf data
test/test/test_cryptodev_aes_test_vectors.h +16 -8
@@ -1544,7 +1544,8 @@BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC |BLOCKCIPHER_TEST_TARGET_PMD_DPAA_SEC |BLOCKCIPHER_TEST_TARGET_PMD_MRVL | -BLOCKCIPHER_TEST_TARGET_PMD_CCP +BLOCKCIPHER_TEST_TARGET_PMD_CCP | +BLOCKCIPHER_TEST_TARGET_PMD_VIRTIO }, { .test_descr = "AES-128-CBC Decryption",
@@ -1557,7 +1558,8 @@BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC |BLOCKCIPHER_TEST_TARGET_PMD_DPAA_SEC |BLOCKCIPHER_TEST_TARGET_PMD_MRVL | -BLOCKCIPHER_TEST_TARGET_PMD_CCP +BLOCKCIPHER_TEST_TARGET_PMD_CCP | +BLOCKCIPHER_TEST_TARGET_PMD_VIRTIO }, { .test_descr = "AES-192-CBC Encryption",
@@ -1569,7 +1571,8 @@BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER |BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC |BLOCKCIPHER_TEST_TARGET_PMD_DPAA_SEC | -BLOCKCIPHER_TEST_TARGET_PMD_CCP +BLOCKCIPHER_TEST_TARGET_PMD_CCP | +BLOCKCIPHER_TEST_TARGET_PMD_VIRTIO }, { .test_descr = "AES-192-CBC Encryption Scater gather",
@@ -1591,7 +1594,8 @@BLOCKCIPHER_TEST_TARGET_PMD_SCHEDULER |BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC |BLOCKCIPHER_TEST_TARGET_PMD_DPAA_SEC | -BLOCKCIPHER_TEST_TARGET_PMD_CCP +BLOCKCIPHER_TEST_TARGET_PMD_CCP | +BLOCKCIPHER_TEST_TARGET_PMD_VIRTIO }, { .test_descr = "AES-192-CBC Decryption Scatter Gather",
@@ -1612,7 +1616,8 @@BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC |BLOCKCIPHER_TEST_TARGET_PMD_DPAA_SEC |BLOCKCIPHER_TEST_TARGET_PMD_MRVL | -BLOCKCIPHER_TEST_TARGET_PMD_CCP +BLOCKCIPHER_TEST_TARGET_PMD_CCP | +BLOCKCIPHER_TEST_TARGET_PMD_VIRTIO }, { .test_descr = "AES-256-CBC Decryption",
@@ -1625,7 +1630,8 @@BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC |BLOCKCIPHER_TEST_TARGET_PMD_DPAA_SEC |BLOCKCIPHER_TEST_TARGET_PMD_MRVL | -BLOCKCIPHER_TEST_TARGET_PMD_CCP +BLOCKCIPHER_TEST_TARGET_PMD_CCP | +BLOCKCIPHER_TEST_TARGET_PMD_VIRTIO }, { .test_descr = "AES-256-CBC OOP Encryption",
@@ -1636,7 +1642,8 @@BLOCKCIPHER_TEST_TARGET_PMD_QAT |BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC |BLOCKCIPHER_TEST_TARGET_PMD_DPAA_SEC | -BLOCKCIPHER_TEST_TARGET_PMD_CCP +BLOCKCIPHER_TEST_TARGET_PMD_CCP | +BLOCKCIPHER_TEST_TARGET_PMD_VIRTIO }, { .test_descr = "AES-256-CBC OOP Decryption",
@@ -1647,7 +1654,8 @@BLOCKCIPHER_TEST_TARGET_PMD_QAT |BLOCKCIPHER_TEST_TARGET_PMD_DPAA2_SEC |BLOCKCIPHER_TEST_TARGET_PMD_DPAA_SEC | -BLOCKCIPHER_TEST_TARGET_PMD_CCP +BLOCKCIPHER_TEST_TARGET_PMD_CCP | +BLOCKCIPHER_TEST_TARGET_PMD_VIRTIO }, { .test_descr = "AES-128-CTR Encryption",
test/test/test_cryptodev_blockcipher.c +8 -1
@@ -70,6 +70,8 @@ RTE_STR(CRYPTODEV_NAME_DPAA_SEC_PMD));int mrvl_pmd =rte_cryptodev_driver_id_get (RTE_STR (CRYPTODEV_NAME_MRVL_PMD )); +int virtio_pmd =rte_cryptodev_driver_id_get ( +RTE_STR (CRYPTODEV_NAME_VIRTIO_PMD ));int nb_segs =1 ;
@@ -97,7 +99,8 @@ driver_id == openssl_pmd || driver_id == armv8_pmd || driver_id == mrvl_pmd || - driver_id == ccp_pmd) { /* Fall through */ + driver_id == ccp_pmd || + driver_id == virtio_pmd) { /* Fall through */ digest_len = tdata->digest.len; } else if (driver_id == aesni_mb_pmd || driver_id == scheduler_pmd) {
@@ -574,6 +577,8 @@ RTE_STR(CRYPTODEV_NAME_QAT_SYM_PMD));int mrvl_pmd =rte_cryptodev_driver_id_get (RTE_STR (CRYPTODEV_NAME_MRVL_PMD )); +int virtio_pmd =rte_cryptodev_driver_id_get ( +RTE_STR (CRYPTODEV_NAME_VIRTIO_PMD ));switch (test_type) {case BLKCIPHER_AES_CHAIN_TYPE :
@@ -638,6 +643,8 @@ target_pmd_mask =BLOCKCIPHER_TEST_TARGET_PMD_DPAA_SEC ; else if (driver_id == mrvl_pmd) target_pmd_mask =BLOCKCIPHER_TEST_TARGET_PMD_MRVL ; + else if (driver_id == virtio_pmd) + target_pmd_mask =BLOCKCIPHER_TEST_TARGET_PMD_VIRTIO ; else TEST_ASSERT(0, "Unrecognized cryptodev type");
test/test/test_cryptodev_blockcipher.h +1 -0
@@ -28,6 +28,7 @@#define BLOCKCIPHER_TEST_TARGET_PMD_DPAA_SEC 0x0040/* DPAA_SEC flag */ #define BLOCKCIPHER_TEST_TARGET_PMD_MRVL 0x0080/* Marvell flag */ #define BLOCKCIPHER_TEST_TARGET_PMD_CCP 0x0040/* CCP flag */ +#define BLOCKCIPHER_TEST_TARGET_PMD_VIRTIO 0x0200/* VIRTIO flag */ #define BLOCKCIPHER_TEST_OP_CIPHER (BLOCKCIPHER_TEST_OP_ENCRYPT | \ BLOCKCIPHER_TEST_OP_DECRYPT)
Signature · 1 line
1.8.3.1
PATCH v5 5/7 doc: add virtio crypto PMD guide
In reply to Jay Zhou--- doc/guides/cryptodevs/features/virtio.ini | 26 +++++++ doc/guides/cryptodevs/index.rst | 1 + doc/guides/cryptodevs/virtio.rst | 117 ++++++++++++++++++++++++++++++ 3 files changed, 144 insertions(+) create mode 100644 doc/guides/cryptodevs/features/virtio.ini create mode 100644 doc/guides/cryptodevs/virtio.rst
doc/guides/cryptodevs/features/virtio.ini new file +26 -0
@@ -0,0 +1,26 @@ +; Supported features of the 'virtio' crypto driver. +; +; Refer to default.ini for the full list of available PMD features. +; +[Features] +Symmetric crypto = Y +Sym operation chaining = Y + +; +; Supported crypto algorithms of the 'virtio' crypto driver. +; +[Cipher] +AES CBC (128) = Y +AES CBC (192) = Y +AES CBC (256) = Y + +; +; Supported authentication algorithms of the 'virtio' crypto driver. +; +[Auth] +SHA1 HMAC = Y + +; +; Supported AEAD algorithms of the 'virtio' crypto driver. +; +[AEAD]
doc/guides/cryptodevs/index.rst +1 -0
@@ -23,4 +23,5 @@ Crypto Device Drivers scheduler snow3g qat + virtio zuc
doc/guides/cryptodevs/virtio.rst new file +117 -0
117 lines not on this page · raw message
Signature · 1 line
1.8.3.1
PATCH v5 2/7 crypto/virtio: add crypto related session structure
In reply to Jay ZhouThis structure will be used in the following patches, especially at creating and destroying crypto sessions.
--- drivers/crypto/virtio/virtio_crypto_algs.h | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 drivers/crypto/virtio/virtio_crypto_algs.h
drivers/crypto/virtio/virtio_crypto_algs.h new file +27 -0
@@ -0,0 +1,27 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright(c) 2018 HUAWEI TECHNOLOGIES CO., LTD. +*/ + +#ifndef _VIRTIO_CRYPTO_ALGS_H_ +#define _VIRTIO_CRYPTO_ALGS_H_ + +#include <rte_memory.h> +#include <linux/virtio_crypto.h> + +struct virtio_crypto_session { +uint64_t session_id; + +struct { +uint16_t offset; +uint16_t length; + } iv; + +struct { +uint32_t length; +phys_addr_t phys_addr; + } aad; + +struct virtio_crypto_op_ctrl_req ctrl; +}; + +#endif /* _VIRTIO_CRYPTO_ALGS_H_ */
Signature · 1 line
1.8.3.1
PATCH v5 7/7 MAINTAINERS: add myself as virtio crypto PMD maintainer
In reply to Jay Zhou--- MAINTAINERS | 6 ++++++ 1 file changed, 6 insertions(+)
MAINTAINERS +6 -0
@@ -724,6 +724,12 @@ F: drivers/crypto/snow3g/ F: doc/guides/cryptodevs/snow3g.rst F: doc/guides/cryptodevs/features/snow3g.ini +Virtio +M: Jay Zhou <[email protected]> +F: drivers/crypto/virtio/ +F: doc/guides/cryptodevs/virtio.rst +F: doc/guides/cryptodevs/features/virtio.ini + ZUC M: Pablo de Lara <[email protected]> F: drivers/crypto/zuc/
Signature · 1 line
1.8.3.1
Hi Jay,
Quoted 11 lines
-----Original Message-----
From: Jay Zhou [mailto:[email protected]]
Sent: Saturday, March 31, 2018 10:19 AM
To: [email protected]
Cc: De Lara Guarch, Pablo <[email protected]>; Zhang, Roy Fan <[email protected]>; [email protected]; [email protected]; Zeng, Xin <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]
Subject: [PATCH v5 0/7] crypto: add virtio poll mode driver
Quoted 2 lines
This patch series introduce virtio crypto poll mode driver.
Thanks for the work. As a last thing from my side,
could I ask you to enable the compilation of the driver from the beginning? In DPDK we try to enable it from the beginning of the patchsets. The AMD CCP PMD is a good example on how to do this and
how to split the patches in a more functional way.
Sorry for missing this earlier and giving this feedback a bit late. Let me know if you need some help on this.
Thanks,
Pablo
Hi Pablo,
Quoted 23 lines
-----Original Message-----
From: De Lara Guarch, Pablo [mailto:[email protected]]
Sent: Monday, April 02, 2018 7:53 PM
To: Zhoujian (jay) <[email protected]>; [email protected]
Cc: Zhang, Roy Fan <[email protected]>; [email protected]; Gonglei (Arei) <[email protected]>; Zeng, Xin <[email protected]>; Huangweidong (C) <[email protected]>; wangxin (U) <[email protected]>; longpeng <[email protected]>
Subject: RE: [PATCH v5 0/7] crypto: add virtio poll mode driverHi Jay,
Quoted 11 lines
-----Original Message-----
From: Jay Zhou [mailto:[email protected]]
Sent: Saturday, March 31, 2018 10:19 AM
To: [email protected]
Cc: De Lara Guarch, Pablo <[email protected]>; Zhang, Roy Fan <[email protected]>; [email protected]; [email protected]; Zeng, Xin <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]
Subject: [PATCH v5 0/7] crypto: add virtio poll mode driver
Quoted 6 lines
Quoted 2 lines
This patch series introduce virtio crypto poll mode driver.
Thanks for the work. As a last thing from my side, could I ask you to enable the compilation of the driver from the beginning?
In DPDK we try to enable it from the beginning of the patchsets.
Yes, it's ok.
Quoted 5 lines
The AMD CCP PMD is a good example on how to do this and how to split the patches in a more functional way.
Sorry for missing this earlier and giving this feedback a bit late. Let me know if you need some help on this.
Okay. I'll try to reorganize this patchset, pls help to review the next version :)
Regards,
Jay
Quoted 3 lines
Thanks,
Pablo