aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/dpdk/cryptodev/cryptodev.c
diff options
context:
space:
mode:
authorFan Zhang <roy.fan.zhang@intel.com>2020-09-25 22:36:04 +0100
committerDamjan Marion <dmarion@me.com>2020-09-29 09:00:40 +0000
commit1152e60ebe9a4e9c7fa1c3df780fa999226fb31f (patch)
tree2bd66e0d38647e5a1f918251e98bda6940794078 /src/plugins/dpdk/cryptodev/cryptodev.c
parent8b388e35b2aeca39c277453337751d14aeba0d40 (diff)
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 <roy.fan.zhang@intel.com> Change-Id: I7cd91abb5de303ff5e4c55cd05e011b57f883524
Diffstat (limited to 'src/plugins/dpdk/cryptodev/cryptodev.c')
-rw-r--r--src/plugins/dpdk/cryptodev/cryptodev.c62
1 files changed, 13 insertions, 49 deletions
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);
@@ -1152,38 +1159,6 @@ cryptodev_configure (vlib_main_t *vm, uint32_t cryptodev_id)
}
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)
{
cryptodev_inst_t *a1 = v1;
@@ -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++)