From 1152e60ebe9a4e9c7fa1c3df780fa999226fb31f Mon Sep 17 00:00:00 2001 From: Fan Zhang Date: Fri, 25 Sep 2020 22:36:04 +0100 Subject: [PATCH] dpdk: fix compile Type: fix Since DPDK is now compiled by meson but some compiles in VPP is missing. This patch fixes that. - Fixes QAT PMD not compiled. QAT meson compile, even for sym crypto PMD, is happened in drive/compress/qat. Originally all PMDs in compressdev is disabled by default. This patch fixes that. - Fixes DPDK plugin version detection. DPDK meson build generates rte_build_config.h, which containing all version information in build-dpdk instead of rte_config.h in make. This patch uses the file to detect version data. - Removed SW crypto PMD auto-creation in cryptodev engine. In case the AESNI-MB PMD required shared library is missing. Signed-off-by: Fan Zhang Change-Id: I7cd91abb5de303ff5e4c55cd05e011b57f883524 --- build/external/packages/dpdk.mk | 4 ++- src/plugins/dpdk/CMakeLists.txt | 4 +-- src/plugins/dpdk/cryptodev/cryptodev.c | 62 +++++++--------------------------- 3 files changed, 18 insertions(+), 52 deletions(-) diff --git a/build/external/packages/dpdk.mk b/build/external/packages/dpdk.mk index 49761cd56a4..06f9d193d63 100644 --- a/build/external/packages/dpdk.mk +++ b/build/external/packages/dpdk.mk @@ -39,7 +39,9 @@ endif DPDK_DRIVERS_DISABLED := baseband/\*, \ bus/dpaa, \ bus/ifpga, \ - compress/\*, \ + compress/isal, \ + compress/octeontx, \ + compress/zlib, \ crypto/ccp, \ crypto/dpaa_sec, \ crypto/openssl, \ diff --git a/src/plugins/dpdk/CMakeLists.txt b/src/plugins/dpdk/CMakeLists.txt index 4b1719d1473..0236172792d 100644 --- a/src/plugins/dpdk/CMakeLists.txt +++ b/src/plugins/dpdk/CMakeLists.txt @@ -31,11 +31,11 @@ endif() ############################################################################## # Parse DPDK config and version header files ############################################################################## - file(STRINGS ${DPDK_INCLUDE_DIR}/rte_config.h rte_config) file(STRINGS ${DPDK_INCLUDE_DIR}/rte_version.h rte_version) +file(STRINGS ${DPDK_INCLUDE_DIR}/rte_build_config.h rte_build_config) -foreach(l ${rte_config} ${rte_version}) +foreach(l ${rte_config} ${rte_build_config} ${rte_version}}) if (l MATCHES "^#define[\t ]*RTE_") STRING(REGEX REPLACE "^#define[\t ]*([A-Z1-9_]+)[\t ]*(.+)" "\\1;\\2" v "${l}") list(GET v 0 name) diff --git a/src/plugins/dpdk/cryptodev/cryptodev.c b/src/plugins/dpdk/cryptodev/cryptodev.c index 6fc09c3813e..68a9126c3ae 100644 --- a/src/plugins/dpdk/cryptodev/cryptodev.c +++ b/src/plugins/dpdk/cryptodev/cryptodev.c @@ -1079,6 +1079,9 @@ cryptodev_count_queue (u32 numa) "as %u, ignored", info.device->name, numa); continue; } + /* only device support symmetric crypto is used */ + if (!(info.feature_flags & RTE_CRYPTODEV_FF_SYMMETRIC_CRYPTO)) + continue; q_count += info.max_nb_queue_pairs; } @@ -1096,13 +1099,17 @@ cryptodev_configure (vlib_main_t *vm, uint32_t cryptodev_id) u32 i; int ret; - cdev = rte_cryptodev_pmd_get_dev (cryptodev_id); rte_cryptodev_info_get (cryptodev_id, &info); + /* do not configure the device that does not support symmetric crypto */ + if (!(info.feature_flags & RTE_CRYPTODEV_FF_SYMMETRIC_CRYPTO)) + return 0; + ret = check_cryptodev_alg_support (cryptodev_id); if (ret != 0) return ret; + cdev = rte_cryptodev_pmd_get_dev (cryptodev_id); /** If the device is already started, we reuse it, otherwise configure * both the device and queue pair. **/ @@ -1136,7 +1143,7 @@ cryptodev_configure (vlib_main_t *vm, uint32_t cryptodev_id) rte_cryptodev_start (i); } - for (i = 0; i < info.max_nb_queue_pairs; i++) + for (i = 0; i < cdev->data->nb_queue_pairs; i++) { cryptodev_inst_t *cdev_inst; vec_add2(cmt->cryptodev_inst, cdev_inst, 1); @@ -1151,38 +1158,6 @@ cryptodev_configure (vlib_main_t *vm, uint32_t cryptodev_id) return 0; } -static int -cryptodev_create_device (vlib_main_t *vm, u32 n_queues) -{ - char name[RTE_CRYPTODEV_NAME_MAX_LEN], args[128]; - u32 dev_id = 0; - int ret; - - /* find an unused name to create the device */ - while (dev_id < RTE_CRYPTO_MAX_DEVS) - { - snprintf (name, RTE_CRYPTODEV_NAME_MAX_LEN - 1, "%s%u", - RTE_STR (CRYPTODEV_DEF_DRIVE), dev_id); - if (rte_cryptodev_get_dev_id (name) < 0) - break; - dev_id++; - } - - if (dev_id == RTE_CRYPTO_MAX_DEVS) - return -1; - - snprintf (args, 127, "socket_id=%u,max_nb_queue_pairs=%u", - vm->numa_node, n_queues); - - ret = rte_vdev_init(name, args); - if (ret < 0) - return ret; - - clib_warning ("Created cryptodev device %s (%s)", name, args); - - return 0; -} - static int cryptodev_cmp (void *v1, void *v2) { @@ -1204,14 +1179,9 @@ cryptodev_probe (vlib_main_t *vm, u32 n_workers) u32 i; int ret; - /* create an AESNI_MB PMD so the service is available */ + /* If there is not enough queues, exit */ if (n_queues < n_workers) - { - u32 q_num = max_pow2 (n_workers - n_queues); - ret = cryptodev_create_device (vm, q_num); - if (ret < 0) - return ret; - } + return -1; for (i = 0; i < rte_cryptodev_count (); i++) { @@ -1229,17 +1199,11 @@ static int cryptodev_get_session_sz (vlib_main_t *vm, uint32_t n_workers) { u32 sess_data_sz = 0, i; - int ret; if (rte_cryptodev_count () == 0) { - clib_warning ("No cryptodev device available, creating..."); - ret = cryptodev_create_device (vm, max_pow2 (n_workers)); - if (ret < 0) - { - clib_warning ("Failed"); - return ret; - } + clib_warning ("No cryptodev device available"); + return -1; } for (i = 0; i < rte_cryptodev_count (); i++) -- 2.16.6