test/crypto: refactor scheduler workers init
Previously, the scheduler unit test only created and attached 1 or 2 AESNI-MB cryptodev PMDs as workers if less than 2 AESNI-MB PMDs had already been initialized. This commit changes this to always create and attach 2 new AESNI-MB cryptodev PMDs, regardless of previously initialized AESNI-MB PMDs. Signed-off-by: Rebecca Troy <rebecca.troy@intel.com> Acked-by: Fan Zhang <roy.fan.zhang@intel.com>
This commit is contained in:
parent
394407f50c
commit
9772dcf7c1
@ -13475,31 +13475,32 @@ test_scheduler_attach_worker_op(void)
|
|||||||
{
|
{
|
||||||
struct crypto_testsuite_params *ts_params = &testsuite_params;
|
struct crypto_testsuite_params *ts_params = &testsuite_params;
|
||||||
uint8_t sched_id = ts_params->valid_devs[0];
|
uint8_t sched_id = ts_params->valid_devs[0];
|
||||||
uint32_t nb_devs, i, nb_devs_attached = 0;
|
uint32_t i, nb_devs_attached = 0;
|
||||||
int ret;
|
int ret;
|
||||||
char vdev_name[32];
|
char vdev_name[32];
|
||||||
|
unsigned int count = rte_cryptodev_count();
|
||||||
|
|
||||||
/* create 2 AESNI_MB if necessary */
|
/* create 2 AESNI_MB vdevs on top of existing devices */
|
||||||
nb_devs = rte_cryptodev_device_count_by_driver(
|
for (i = count; i < count + 2; i++) {
|
||||||
rte_cryptodev_driver_id_get(
|
snprintf(vdev_name, sizeof(vdev_name), "%s_%u",
|
||||||
RTE_STR(CRYPTODEV_NAME_AESNI_MB_PMD)));
|
RTE_STR(CRYPTODEV_NAME_AESNI_MB_PMD),
|
||||||
if (nb_devs < 2) {
|
i);
|
||||||
for (i = nb_devs; i < 2; i++) {
|
ret = rte_vdev_init(vdev_name, NULL);
|
||||||
snprintf(vdev_name, sizeof(vdev_name), "%s_%u",
|
|
||||||
RTE_STR(CRYPTODEV_NAME_AESNI_MB_PMD),
|
|
||||||
i);
|
|
||||||
ret = rte_vdev_init(vdev_name, NULL);
|
|
||||||
|
|
||||||
TEST_ASSERT(ret == 0,
|
TEST_ASSERT(ret == 0,
|
||||||
"Failed to create instance %u of"
|
"Failed to create instance %u of"
|
||||||
" pmd : %s",
|
" pmd : %s",
|
||||||
i, RTE_STR(CRYPTODEV_NAME_AESNI_MB_PMD));
|
i, RTE_STR(CRYPTODEV_NAME_AESNI_MB_PMD));
|
||||||
|
|
||||||
|
if (ret < 0) {
|
||||||
|
RTE_LOG(ERR, USER1,
|
||||||
|
"Failed to create 2 AESNI MB PMDs.\n");
|
||||||
|
return TEST_SKIPPED;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* attach 2 AESNI_MB cdevs */
|
/* attach 2 AESNI_MB cdevs */
|
||||||
for (i = 0; i < rte_cryptodev_count() && nb_devs_attached < 2;
|
for (i = count; i < count + 2; i++) {
|
||||||
i++) {
|
|
||||||
struct rte_cryptodev_info info;
|
struct rte_cryptodev_info info;
|
||||||
unsigned int session_size;
|
unsigned int session_size;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user