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

Function test_null_burst_operation

dpdk/app/test/test_cryptodev.c:13480–13562  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

13478#define NULL_BURST_LENGTH (32)
13479
13480static int
13481test_null_burst_operation(void)
13482{
13483 struct crypto_testsuite_params *ts_params = &testsuite_params;
13484 struct crypto_unittest_params *ut_params = &unittest_params;
13485
13486 unsigned i, burst_len = NULL_BURST_LENGTH;
13487
13488 struct rte_crypto_op *burst[NULL_BURST_LENGTH] = { NULL };
13489 struct rte_crypto_op *burst_dequeued[NULL_BURST_LENGTH] = { NULL };
13490
13491 /* This test is for NULL PMD only */
13492 if (gbl_driver_id != rte_cryptodev_driver_id_get(
13493 RTE_STR(CRYPTODEV_NAME_NULL_PMD)))
13494 return TEST_SKIPPED;
13495
13496 /* Setup Cipher Parameters */
13497 ut_params->cipher_xform.type = RTE_CRYPTO_SYM_XFORM_CIPHER;
13498 ut_params->cipher_xform.next = &ut_params->auth_xform;
13499
13500 ut_params->cipher_xform.cipher.algo = RTE_CRYPTO_CIPHER_NULL;
13501 ut_params->cipher_xform.cipher.op = RTE_CRYPTO_CIPHER_OP_ENCRYPT;
13502
13503 /* Setup HMAC Parameters */
13504 ut_params->auth_xform.type = RTE_CRYPTO_SYM_XFORM_AUTH;
13505 ut_params->auth_xform.next = NULL;
13506
13507 ut_params->auth_xform.auth.algo = RTE_CRYPTO_AUTH_NULL;
13508 ut_params->auth_xform.auth.op = RTE_CRYPTO_AUTH_OP_GENERATE;
13509
13510 /* Create Crypto session*/
13511 ut_params->sess = rte_cryptodev_sym_session_create(
13512 ts_params->valid_devs[0],
13513 &ut_params->auth_xform,
13514 ts_params->session_mpool);
13515 if (ut_params->sess == NULL && rte_errno == ENOTSUP)
13516 return TEST_SKIPPED;
13517 TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
13518
13519 TEST_ASSERT_EQUAL(rte_crypto_op_bulk_alloc(ts_params->op_mpool,
13520 RTE_CRYPTO_OP_TYPE_SYMMETRIC, burst, burst_len),
13521 burst_len, "failed to generate burst of crypto ops");
13522
13523 /* Generate an operation for each mbuf in burst */
13524 for (i = 0; i < burst_len; i++) {
13525 struct rte_mbuf *m = rte_pktmbuf_alloc(ts_params->mbuf_pool);
13526
13527 TEST_ASSERT_NOT_NULL(m, "Failed to allocate mbuf");
13528
13529 unsigned *data = (unsigned *)rte_pktmbuf_append(m,
13530 sizeof(unsigned));
13531 *data = i;
13532
13533 rte_crypto_op_attach_sym_session(burst[i], ut_params->sess);
13534
13535 burst[i]->sym->m_src = m;
13536 }
13537

Callers

nothing calls this directly

Calls 10

rte_crypto_op_bulk_allocFunction · 0.85
rte_pktmbuf_allocFunction · 0.85
rte_pktmbuf_appendFunction · 0.85
rte_pktmbuf_freeFunction · 0.85
rte_crypto_op_freeFunction · 0.85

Tested by

no test coverage detected