MCPcopy Create free account
hub / github.com/F-Stack/f-stack / test_scheduler_attach_worker_op

Function test_scheduler_attach_worker_op

dpdk/app/test/test_cryptodev.c:16067–16153  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

16065}
16066
16067static int
16068test_scheduler_attach_worker_op(void)
16069{
16070 struct crypto_testsuite_params *ts_params = &testsuite_params;
16071 uint8_t sched_id = ts_params->valid_devs[0];
16072 uint32_t i, nb_devs_attached = 0;
16073 int ret;
16074 char vdev_name[32];
16075 unsigned int count = rte_cryptodev_count();
16076
16077 /* create 2 AESNI_MB vdevs on top of existing devices */
16078 for (i = count; i < count + 2; i++) {
16079 snprintf(vdev_name, sizeof(vdev_name), "%s_%u",
16080 RTE_STR(CRYPTODEV_NAME_AESNI_MB_PMD),
16081 i);
16082 ret = rte_vdev_init(vdev_name, NULL);
16083
16084 TEST_ASSERT(ret == 0,
16085 "Failed to create instance %u of"
16086 " pmd : %s",
16087 i, RTE_STR(CRYPTODEV_NAME_AESNI_MB_PMD));
16088
16089 if (ret < 0) {
16090 RTE_LOG(ERR, USER1,
16091 "Failed to create 2 AESNI MB PMDs.\n");
16092 return TEST_SKIPPED;
16093 }
16094 }
16095
16096 /* attach 2 AESNI_MB cdevs */
16097 for (i = count; i < count + 2; i++) {
16098 struct rte_cryptodev_info info;
16099 unsigned int session_size;
16100
16101 rte_cryptodev_info_get(i, &info);
16102 if (info.driver_id != rte_cryptodev_driver_id_get(
16103 RTE_STR(CRYPTODEV_NAME_AESNI_MB_PMD)))
16104 continue;
16105
16106 session_size = rte_cryptodev_sym_get_private_session_size(i);
16107 /*
16108 * Create the session mempool again, since now there are new devices
16109 * to use the mempool.
16110 */
16111 if (ts_params->session_mpool) {
16112 rte_mempool_free(ts_params->session_mpool);
16113 ts_params->session_mpool = NULL;
16114 }
16115
16116 if (info.sym.max_nb_sessions != 0 &&
16117 info.sym.max_nb_sessions < MAX_NB_SESSIONS) {
16118 RTE_LOG(ERR, USER1,
16119 "Device does not support "
16120 "at least %u sessions\n",
16121 MAX_NB_SESSIONS);
16122 return TEST_FAILED;
16123 }
16124 /*

Calls 9

rte_cryptodev_countFunction · 0.85
snprintfFunction · 0.85
rte_vdev_initFunction · 0.85
rte_cryptodev_info_getFunction · 0.85
rte_mempool_freeFunction · 0.85

Tested by

no test coverage detected