From 51baf04dc6bdbf4d11c980e5f933a39ed044472a Mon Sep 17 00:00:00 2001 From: Seth Howell Date: Mon, 22 Oct 2018 17:00:33 -0700 Subject: [PATCH] vbdev_crypto.c: Always initialize crypto drivers up front This helps us avoid situations where other bdev modules will break the rte_pci_bus mappings for qat devices before we have an opportunity to initialize the qat pmd. Also, update the blobstore match file to handle the possibility of using a crypto driver and improve the json_config and spdkcli scripts to handle allocating qat_crypto drivers. Change-Id: I7359c67d1992df1d5bb85585eca6d5c342787649 Signed-off-by: Seth Howell Reviewed-on: https://review.gerrithub.io/430393 Chandler-Test-Pool: SPDK Automated Test System Reviewed-by: Jim Harris Reviewed-by: Ben Walker Tested-by: SPDK CI Jenkins --- dpdk | 2 +- lib/bdev/crypto/vbdev_crypto.c | 18 +++++++++++------- test/blobstore/btest.out.ignore | 2 ++ test/blobstore/btest.out.match | 5 +++++ test/json_config/common.sh | 8 ++++++-- test/spdkcli/common.sh | 2 +- 6 files changed, 26 insertions(+), 11 deletions(-) diff --git a/dpdk b/dpdk index 812c579bd..96fae0e24 160000 --- a/dpdk +++ b/dpdk @@ -1 +1 @@ -Subproject commit 812c579bd2167a736d5f0e7f9ea74c6487ccfb7c +Subproject commit 96fae0e24c9088d9690c38098b25646f861a664b diff --git a/lib/bdev/crypto/vbdev_crypto.c b/lib/bdev/crypto/vbdev_crypto.c index 440801fe8..510e84964 100644 --- a/lib/bdev/crypto/vbdev_crypto.c +++ b/lib/bdev/crypto/vbdev_crypto.c @@ -1176,6 +1176,13 @@ vbdev_crypto_init(void) int rc = 0; const char *key = NULL; + /* Fully configure both SW and HW drivers. */ + rc = vbdev_crypto_init_crypto_drivers(); + if (rc) { + SPDK_ERRLOG("Error setting up crypto devices\n"); + return rc; + } + sp = spdk_conf_find_section(NULL, "crypto"); if (sp == NULL) { return 0; @@ -1219,13 +1226,6 @@ vbdev_crypto_init(void) } } - /* Fully configure both SW and HW drivers. */ - rc = vbdev_crypto_init_crypto_drivers(); - if (rc) { - SPDK_ERRLOG("Error setting up crypto devices\n"); - return rc; - } - return rc; } @@ -1256,6 +1256,10 @@ vbdev_crypto_finish(void) TAILQ_REMOVE(&g_device_qp, dev_qp, link); free(dev_qp); } + + rte_mempool_free(g_crypto_op_mp); + spdk_mempool_free(g_mbuf_mp); + spdk_mempool_free(g_session_mp); } /* During init we'll be asked how much memory we'd like passed to us diff --git a/test/blobstore/btest.out.ignore b/test/blobstore/btest.out.ignore index fe7f16979..d7aa1120a 100644 --- a/test/blobstore/btest.out.ignore +++ b/test/blobstore/btest.out.ignore @@ -1,3 +1,5 @@ DPDK EAL +CRYPTODEV + .... diff --git a/test/blobstore/btest.out.match b/test/blobstore/btest.out.match index 13eecab17..62e492877 100644 --- a/test/blobstore/btest.out.match +++ b/test/blobstore/btest.out.match @@ -16,6 +16,11 @@ EAL: probe driver: 8086:2f25 spdk_ioat EAL: PCI device 0000:00:04.6 on NUMA socket 0 EAL: probe driver: 8086:2f26 spdk_ioat EAL: PCI device 0000:00:04.7 on NUMA socket 0 +CRYPTODEV: [crypto_aesni_mb] - Creating cryptodev crypto_aesni_mb + +CRYPTODEV: [crypto_aesni_mb] - Initialisation parameters - name: crypto_aesni_mb,socket id: 0, max queue pairs: 8 +$(OPT)cryptodev_aesni_mb_create() line 976: IPSec Multi-buffer library version used: 0.49.0 + EAL: probe driver: 8086:2f27 spdk_ioat EAL: PCI device 0000:80:04.0 on NUMA socket 1 EAL: probe driver: 8086:2f20 spdk_ioat diff --git a/test/json_config/common.sh b/test/json_config/common.sh index bb1de7ff7..a0a56951a 100644 --- a/test/json_config/common.sh +++ b/test/json_config/common.sh @@ -16,7 +16,7 @@ null_json_config=$JSON_DIR/null_json_config.json function run_spdk_tgt() { echo "Running spdk target" - $SPDK_BUILD_DIR/app/spdk_tgt/spdk_tgt -m 0x1 -p 0 -s 1024 --wait-for-rpc & + $SPDK_BUILD_DIR/app/spdk_tgt/spdk_tgt -m 0x1 -p 0 -s 4096 --wait-for-rpc & spdk_tgt_pid=$! echo "Waiting for app to run..." @@ -150,7 +150,11 @@ function create_bdev_subsystem_config() { $rpc_py construct_malloc_bdev 8 1024 --name Malloc2 if [ $SPDK_TEST_CRYPTO -eq 1 ]; then $rpc_py construct_malloc_bdev 8 1024 --name Malloc3 - $rpc_py construct_crypto_bdev -b Malloc3 -c CryMalloc3 -d crypto_aesni_mb -k 0123456789123456 + if [ $(lspci -d:37c8 | wc -l) -eq 0 ]; then + $rpc_py construct_crypto_bdev -b Malloc3 -c CryMalloc3 -d crypto_aesni_mb -k 0123456789123456 + else + $rpc_py construct_crypto_bdev -b Malloc3 -c CryMalloc3 -d crypto_qat -k 0123456789123456 + fi fi $rpc_py construct_error_bdev Malloc2 if [ $(uname -s) = Linux ]; then diff --git a/test/spdkcli/common.sh b/test/spdkcli/common.sh index da61e6f57..80ea6ab18 100644 --- a/test/spdkcli/common.sh +++ b/test/spdkcli/common.sh @@ -14,7 +14,7 @@ function on_error_exit() { } function run_spdk_tgt() { - $SPDKCLI_BUILD_DIR/app/spdk_tgt/spdk_tgt -m 0x3 -p 0 -s 1024 & + $SPDKCLI_BUILD_DIR/app/spdk_tgt/spdk_tgt -m 0x3 -p 0 -s 4096 & spdk_tgt_pid=$! waitforlisten $spdk_tgt_pid }