unsigned int cipher_key_len,
enum rte_crypto_auth_algorithm auth_algo);
static struct rte_cryptodev_sym_session *
-test_perf_create_libcrypto_session(uint8_t dev_id, enum chain_mode chain,
+test_perf_create_openssl_session(uint8_t dev_id, enum chain_mode chain,
enum rte_crypto_cipher_algorithm cipher_algo,
unsigned int cipher_key_len,
enum rte_crypto_auth_algorithm auth_algo);
}
}
- /* Create 2 LIBCRYPTO devices if required */
- if (gbl_cryptodev_perftest_devtype == RTE_CRYPTODEV_LIBCRYPTO_PMD) {
-#ifndef RTE_LIBRTE_PMD_LIBCRYPTO
- RTE_LOG(ERR, USER1, "CONFIG_RTE_LIBRTE_PMD_LIBCRYPTO must be"
+ /* Create 2 OPENSSL devices if required */
+ if (gbl_cryptodev_perftest_devtype == RTE_CRYPTODEV_OPENSSL_PMD) {
+#ifndef RTE_LIBRTE_PMD_OPENSSL
+ RTE_LOG(ERR, USER1, "CONFIG_RTE_LIBRTE_PMD_OPENSSL must be"
" enabled in config file to run this testsuite.\n");
return TEST_FAILED;
#endif
nb_devs = rte_cryptodev_count_devtype(
- RTE_CRYPTODEV_LIBCRYPTO_PMD);
+ RTE_CRYPTODEV_OPENSSL_PMD);
if (nb_devs < 2) {
for (i = nb_devs; i < 2; i++) {
ret = rte_eal_vdev_init(
- RTE_STR(CRYPTODEV_NAME_LIBCRYPTO_PMD),
+ RTE_STR(CRYPTODEV_NAME_OPENSSL_PMD),
NULL);
TEST_ASSERT(ret == 0, "Failed to create "
"instance %u of pmd : %s", i,
- RTE_STR(CRYPTODEV_NAME_LIBCRYPTO_PMD));
+ RTE_STR(CRYPTODEV_NAME_OPENSSL_PMD));
}
}
}
rte_cryptodev_info_get(ts_params->dev_id, &info);
- ts_params->conf.nb_queue_pairs = DEFAULT_NUM_QPS_PER_QAT_DEVICE;
+ ts_params->conf.nb_queue_pairs = info.max_nb_queue_pairs;
ts_params->conf.socket_id = SOCKET_ID_ANY;
ts_params->conf.session_mp.nb_objs = info.sym.max_nb_sessions;
}
static int
-test_perf_libcrypto_optimise_cyclecount(struct perf_test_params *pparams)
+test_perf_openssl_optimise_cyclecount(struct perf_test_params *pparams)
{
uint32_t num_to_submit = pparams->total_operations;
struct rte_crypto_op *c_ops[num_to_submit];
}
/* Create Crypto session*/
- sess = test_perf_create_libcrypto_session(ts_params->dev_id,
+ sess = test_perf_create_openssl_session(ts_params->dev_id,
pparams->chain, pparams->cipher_algo,
pparams->cipher_key_length, pparams->auth_algo);
TEST_ASSERT_NOT_NULL(sess, "Session creation failed");
}
}
+#define SNOW3G_CIPHER_IV_LENGTH 16
+
static struct rte_cryptodev_sym_session *
test_perf_create_snow3g_session(uint8_t dev_id, enum chain_mode chain,
enum rte_crypto_cipher_algorithm cipher_algo, unsigned cipher_key_len,
auth_xform.auth.op = RTE_CRYPTO_AUTH_OP_GENERATE;
auth_xform.auth.algo = auth_algo;
+ auth_xform.auth.add_auth_data_length = SNOW3G_CIPHER_IV_LENGTH;
auth_xform.auth.key.data = snow3g_hash_key;
auth_xform.auth.key.length = get_auth_key_max_length(auth_algo);
auth_xform.auth.digest_length = get_auth_digest_length(auth_algo);
}
static struct rte_cryptodev_sym_session *
-test_perf_create_libcrypto_session(uint8_t dev_id, enum chain_mode chain,
+test_perf_create_openssl_session(uint8_t dev_id, enum chain_mode chain,
enum rte_crypto_cipher_algorithm cipher_algo,
unsigned int cipher_key_len,
enum rte_crypto_auth_algorithm auth_algo)
#define TRIPLE_DES_BLOCK_SIZE 8
#define TRIPLE_DES_CIPHER_IV_LENGTH 8
-#define SNOW3G_CIPHER_IV_LENGTH 16
-
static struct rte_mbuf *
test_perf_create_pktmbuf(struct rte_mempool *mpool, unsigned buf_sz)
{
}
/* Authentication Parameters */
- op->sym->auth.digest.data = (uint8_t *)m->buf_addr +
- (m->data_off + data_len);
- op->sym->auth.digest.phys_addr = rte_pktmbuf_mtophys_offset(m, data_len);
+ op->sym->auth.digest.data = rte_pktmbuf_mtod_offset(m, uint8_t *,
+ AES_CIPHER_IV_LENGTH + data_len);
+ op->sym->auth.digest.phys_addr = rte_pktmbuf_mtophys_offset(m,
+ AES_CIPHER_IV_LENGTH + data_len);
op->sym->auth.digest.length = digest_len;
op->sym->auth.aad.data = aes_iv;
op->sym->auth.aad.length = AES_CIPHER_IV_LENGTH;
/* Cipher Parameters */
- op->sym->cipher.iv.data = aes_iv;
+ op->sym->cipher.iv.data = rte_pktmbuf_mtod(m, uint8_t *);
+ op->sym->cipher.iv.phys_addr = rte_pktmbuf_mtophys(m);
op->sym->cipher.iv.length = AES_CIPHER_IV_LENGTH;
+ rte_memcpy(op->sym->cipher.iv.data, aes_iv, AES_CIPHER_IV_LENGTH);
+
/* Data lengths/offsets Parameters */
- op->sym->auth.data.offset = 0;
+ op->sym->auth.data.offset = AES_CIPHER_IV_LENGTH;
op->sym->auth.data.length = data_len;
- op->sym->cipher.data.offset = AES_BLOCK_SIZE;
- op->sym->cipher.data.length = data_len - AES_BLOCK_SIZE;
+ op->sym->cipher.data.offset = AES_CIPHER_IV_LENGTH;
+ op->sym->cipher.data.length = data_len;
op->sym->m_src = m;
return op;
}
+static inline struct rte_crypto_op *
+test_perf_set_crypto_op_snow3g_cipher(struct rte_crypto_op *op,
+ struct rte_mbuf *m,
+ struct rte_cryptodev_sym_session *sess,
+ unsigned data_len)
+{
+ if (rte_crypto_op_attach_sym_session(op, sess) != 0) {
+ rte_crypto_op_free(op);
+ return NULL;
+ }
+
+ /* Cipher Parameters */
+ op->sym->cipher.iv.data = rte_pktmbuf_mtod(m, uint8_t *);
+ op->sym->cipher.iv.length = SNOW3G_CIPHER_IV_LENGTH;
+ rte_memcpy(op->sym->cipher.iv.data, snow3g_iv, SNOW3G_CIPHER_IV_LENGTH);
+ op->sym->cipher.iv.phys_addr = rte_pktmbuf_mtophys(m);
+
+ op->sym->cipher.data.offset = SNOW3G_CIPHER_IV_LENGTH;
+ op->sym->cipher.data.length = data_len << 3;
+
+ op->sym->m_src = m;
+
+ return op;
+}
+
+
+static inline struct rte_crypto_op *
+test_perf_set_crypto_op_snow3g_hash(struct rte_crypto_op *op,
+ struct rte_mbuf *m,
+ struct rte_cryptodev_sym_session *sess,
+ unsigned data_len,
+ unsigned digest_len)
+{
+ if (rte_crypto_op_attach_sym_session(op, sess) != 0) {
+ rte_crypto_op_free(op);
+ return NULL;
+ }
+
+ /* Authentication Parameters */
+
+ op->sym->auth.digest.data =
+ (uint8_t *)rte_pktmbuf_mtod_offset(m, uint8_t *,
+ data_len);
+ op->sym->auth.digest.phys_addr =
+ rte_pktmbuf_mtophys_offset(m, data_len +
+ SNOW3G_CIPHER_IV_LENGTH);
+ op->sym->auth.digest.length = digest_len;
+ op->sym->auth.aad.data = rte_pktmbuf_mtod(m, uint8_t *);
+ op->sym->auth.aad.length = SNOW3G_CIPHER_IV_LENGTH;
+ rte_memcpy(op->sym->auth.aad.data, snow3g_iv,
+ SNOW3G_CIPHER_IV_LENGTH);
+ op->sym->auth.aad.phys_addr = rte_pktmbuf_mtophys(m);
+
+ /* Data lengths/offsets Parameters */
+ op->sym->auth.data.offset = SNOW3G_CIPHER_IV_LENGTH;
+ op->sym->auth.data.length = data_len << 3;
+
+ op->sym->m_src = m;
+
+ return op;
+}
+
+
static inline struct rte_crypto_op *
test_perf_set_crypto_op_3des(struct rte_crypto_op *op, struct rte_mbuf *m,
struct rte_cryptodev_sym_session *sess, unsigned int data_len,
rte_pktmbuf_free(mbufs[k]);
return -1;
}
-
+ /* Make room for Digest and IV in mbuf */
+ rte_pktmbuf_append(mbufs[i], digest_length);
+ rte_pktmbuf_prepend(mbufs[i], AES_CIPHER_IV_LENGTH);
}
/* Generate a burst of crypto operations */
for (i = 0; i < (pparams->burst_size * NUM_MBUF_SETS); i++) {
+ /*
+ * Buffer size + iv/aad len is allocated, for perf tests they
+ * are equal + digest len.
+ */
mbufs[i] = test_perf_create_pktmbuf(
ts_params->mbuf_mp,
- pparams->buf_size);
+ pparams->buf_size + SNOW3G_CIPHER_IV_LENGTH +
+ digest_length);
if (mbufs[i] == NULL) {
printf("\nFailed to get mbuf - freeing the rest.\n");
/*Don't exit, dequeue, more ops should become available*/
} else {
for (i = 0; i < ops_needed; i++) {
- ops[i+op_offset] =
- test_perf_set_crypto_op_snow3g(ops[i+op_offset],
- mbufs[i +
- (pparams->burst_size * (j % NUM_MBUF_SETS))],
- sess,
- pparams->buf_size, digest_length);
+ if (pparams->chain == HASH_ONLY)
+ ops[i+op_offset] =
+ test_perf_set_crypto_op_snow3g_hash(ops[i+op_offset],
+ mbufs[i +
+ (pparams->burst_size * (j % NUM_MBUF_SETS))],
+ sess,
+ pparams->buf_size, digest_length);
+ else if (pparams->chain == CIPHER_ONLY)
+ ops[i+op_offset] =
+ test_perf_set_crypto_op_snow3g_cipher(ops[i+op_offset],
+ mbufs[i +
+ (pparams->burst_size * (j % NUM_MBUF_SETS))],
+ sess,
+ pparams->buf_size);
+ else
+ return 1;
}
/* enqueue burst */
}
static int
-test_perf_libcrypto(uint8_t dev_id, uint16_t queue_id,
+test_perf_openssl(uint8_t dev_id, uint16_t queue_id,
struct perf_test_params *pparams)
{
uint16_t i, k, l, m;
}
/* Create Crypto session*/
- sess = test_perf_create_libcrypto_session(ts_params->dev_id,
+ sess = test_perf_create_openssl_session(ts_params->dev_id,
pparams->chain, pparams->cipher_algo,
pparams->cipher_key_length, pparams->auth_algo);
TEST_ASSERT_NOT_NULL(sess, "Session creation failed");
unsigned total_operations = 1000000;
uint8_t i, j;
unsigned k;
- uint16_t burst_sizes[] = {64};
- uint16_t buf_lengths[] = {40, 64, 80, 120, 240, 256, 400, 512, 600, 1024, 2048};
+ uint16_t burst_sizes[] = { 64 };
+ uint16_t buf_lengths[] = { 40, 64, 80, 120, 240, 256, 400, 512, 600, 1024, 2048 };
struct perf_test_params params_set[] = {
{
}
static int
-test_perf_libcrypto_vary_pkt_size(void)
+test_perf_openssl_vary_pkt_size(void)
{
- unsigned int total_operations = 1000000;
+ unsigned int total_operations = 10000;
unsigned int burst_size = { 64 };
unsigned int buf_lengths[] = { 64, 128, 256, 512, 768, 1024, 1280, 1536,
1792, 2048 };
"EmptyPolls\n");
for (j = 0; j < RTE_DIM(buf_lengths); j++) {
params_set[i].buf_size = buf_lengths[j];
- test_perf_libcrypto(testsuite_params.dev_id, 0,
+ test_perf_openssl(testsuite_params.dev_id, 0,
¶ms_set[i]);
}
}
}
static int
-test_perf_libcrypto_vary_burst_size(void)
+test_perf_openssl_vary_burst_size(void)
{
unsigned int total_operations = 4096;
uint16_t buf_lengths[] = { 40 };
for (j = 0; j < RTE_DIM(buf_lengths); j++) {
params_set[i].buf_size = buf_lengths[j];
- test_perf_libcrypto_optimise_cyclecount(¶ms_set[i]);
+ test_perf_openssl_optimise_cyclecount(¶ms_set[i]);
}
}
}
static int
-test_perf_AES_GCM(void)
+test_perf_AES_GCM(int continual_buf_len, int continual_size)
{
- uint16_t i, j;
+ uint16_t i, j, k, loops = 1;
uint16_t buf_lengths[] = { 64, 128, 256, 512, 1024, 1536, 2048 };
&AES_GCM_128_12IV_0AAD
};
+ if (continual_buf_len)
+ loops = continual_size;
+
int TEST_CASES_GCM = RTE_DIM(gcm_tests);
const unsigned burst_size = 32;
params_set[i].chain = CIPHER_HASH;
params_set[i].session_attrs = &session_attrs[i];
params_set[i].symmetric_op = &ops_set[i];
- params_set[i].total_operations = 1000000;
+ if (continual_buf_len)
+ params_set[i].total_operations = 0xFFFFFF;
+ else
+ params_set[i].total_operations = 1000000;
+
params_set[i].burst_size = burst_size;
}
+ if (continual_buf_len)
+ printf("\nCipher algo: %s Cipher hash: %s cipher key size: %ub"
+ " burst size: %u", "AES_GCM", "AES_GCM",
+ gcm_test->key.len << 3, burst_size);
+
for (i = 0; i < RTE_DIM(gcm_tests); i++) {
- printf("\nCipher algo: %s Cipher hash: %s cipher key size: %ub"
+ if (!continual_buf_len) {
+ printf("\nCipher algo: %s Cipher hash: %s cipher key size: %ub"
" burst size: %u", "AES_GCM", "AES_GCM",
- gcm_test->key.len << 3, burst_size
- );
- printf("\nBuffer Size(B)\tOPS(M)\tThroughput(Gbps)\t"
- " Retries\tEmptyPolls");
+ gcm_test->key.len << 3, burst_size);
+ printf("\nBuffer Size(B)\tOPS(M)\tThroughput(Gbps)\t"
+ " Retries\tEmptyPolls");
+ }
- for (j = 0; j < RTE_DIM(buf_lengths); ++j) {
+ uint16_t len = RTE_DIM(buf_lengths);
+ uint16_t p = 0;
+
+ if (continual_buf_len) {
+ for (k = 0; k < RTE_DIM(buf_lengths); k++)
+ if (buf_lengths[k] == continual_buf_len) {
+ len = k + 1;
+ p = k;
+ break;
+ }
+ }
+ for (j = p; j < len; ++j) {
params_set[i].symmetric_op->c_len = buf_lengths[j];
params_set[i].symmetric_op->p_len = buf_lengths[j];
¶ms_set[i], 1))
return TEST_FAILED;
- if (perf_AES_GCM(testsuite_params.dev_id, 0,
- ¶ms_set[i], 0))
- return TEST_FAILED;
+ for (k = 0; k < loops; k++) {
+ if (continual_buf_len)
+ printf("\n\nBuffer Size(B)\tOPS(M)\t"
+ "Throughput(Gbps)\t"
+ "Retries\tEmptyPolls");
+ if (perf_AES_GCM(testsuite_params.dev_id, 0,
+ ¶ms_set[i], 0))
+ return TEST_FAILED;
+ if (continual_buf_len)
+ printf("\n\nCompleted loop %i of %i ...",
+ k+1, loops);
+ }
}
}
return 0;
}
+static int test_cryptodev_perf_AES_GCM(void)
+{
+ return test_perf_AES_GCM(0, 0);
+}
+/*
+ * This function calls AES GCM performance tests providing
+ * size of packet as an argument. If size of packet is not
+ * in the buf_lengths array, all sizes will be used
+ */
+static int test_continual_perf_AES_GCM(void)
+{
+ return test_perf_AES_GCM(1024, 10);
+}
+
+static int
+test_perf_continual_performance_test(void)
+{
+ unsigned int total_operations = 0xFFFFFF;
+ unsigned int total_loops = 10;
+ unsigned int burst_size = 32;
+ uint8_t i;
+
+ struct perf_test_params params_set = {
+ .total_operations = total_operations,
+ .burst_size = burst_size,
+ .buf_size = 1024,
+
+ .chain = CIPHER_HASH,
+
+ .cipher_algo = RTE_CRYPTO_CIPHER_AES_CBC,
+ .cipher_key_length = 16,
+ .auth_algo = RTE_CRYPTO_AUTH_SHA1_HMAC
+ };
+
+ for (i = 1; i <= total_loops; ++i) {
+ printf("\n%s. cipher algo: %s auth algo: %s cipher key size=%u."
+ " burst_size: %d ops\n",
+ chain_mode_name(params_set.chain),
+ cipher_algo_name(params_set.cipher_algo),
+ auth_algo_name(params_set.auth_algo),
+ params_set.cipher_key_length,
+ burst_size);
+ printf("\nBuffer Size(B)\tOPS(M)\tThroughput(Gbps)\t"
+ "Retries\tEmptyPolls\n");
+ test_perf_aes_sha(testsuite_params.dev_id, 0,
+ ¶ms_set);
+ printf("\nCompleted loop %i of %i ...", i, total_loops);
+ }
+ return 0;
+}
+
+static struct unit_test_suite cryptodev_qat_continual_testsuite = {
+ .suite_name = "Crypto Device Continual Performance Test",
+ .setup = testsuite_setup,
+ .teardown = testsuite_teardown,
+ .unit_test_cases = {
+ TEST_CASE_ST(ut_setup, ut_teardown,
+ test_perf_continual_performance_test),
+ TEST_CASE_ST(ut_setup, ut_teardown,
+ test_continual_perf_AES_GCM),
+ TEST_CASES_END() /**< NULL terminate unit test array */
+ }
+};
+
static struct unit_test_suite cryptodev_testsuite = {
.suite_name = "Crypto Device Unit Test Suite",
.setup = testsuite_setup,
TEST_CASE_ST(ut_setup, ut_teardown,
test_perf_aes_cbc_encrypt_digest_vary_pkt_size),
TEST_CASE_ST(ut_setup, ut_teardown,
- test_perf_AES_GCM),
+ test_cryptodev_perf_AES_GCM),
TEST_CASE_ST(ut_setup, ut_teardown,
test_perf_aes_cbc_vary_burst_size),
TEST_CASES_END() /**< NULL terminate unit test array */
.teardown = testsuite_teardown,
.unit_test_cases = {
TEST_CASE_ST(ut_setup, ut_teardown,
- test_perf_AES_GCM),
+ test_cryptodev_perf_AES_GCM),
TEST_CASES_END() /**< NULL terminate unit test array */
}
};
}
};
-static struct unit_test_suite cryptodev_libcrypto_testsuite = {
- .suite_name = "Crypto Device LIBCRYPTO Unit Test Suite",
+static struct unit_test_suite cryptodev_openssl_testsuite = {
+ .suite_name = "Crypto Device OPENSSL Unit Test Suite",
.setup = testsuite_setup,
.teardown = testsuite_teardown,
.unit_test_cases = {
TEST_CASE_ST(ut_setup, ut_teardown,
- test_perf_libcrypto_vary_pkt_size),
+ test_perf_openssl_vary_pkt_size),
TEST_CASE_ST(ut_setup, ut_teardown,
- test_perf_libcrypto_vary_burst_size),
+ test_perf_openssl_vary_burst_size),
TEST_CASES_END() /**< NULL terminate unit test array */
}
};
}
static int
-perftest_libcrypto_cryptodev(void /*argv __rte_unused, int argc __rte_unused*/)
+perftest_openssl_cryptodev(void /*argv __rte_unused, int argc __rte_unused*/)
{
- gbl_cryptodev_perftest_devtype = RTE_CRYPTODEV_LIBCRYPTO_PMD;
+ gbl_cryptodev_perftest_devtype = RTE_CRYPTODEV_OPENSSL_PMD;
+
+ return unit_test_suite_runner(&cryptodev_openssl_testsuite);
+}
+
+static int
+perftest_qat_continual_cryptodev(void)
+{
+ gbl_cryptodev_perftest_devtype = RTE_CRYPTODEV_QAT_SYM_PMD;
- return unit_test_suite_runner(&cryptodev_libcrypto_testsuite);
+ return unit_test_suite_runner(&cryptodev_qat_continual_testsuite);
}
REGISTER_TEST_COMMAND(cryptodev_aesni_mb_perftest, perftest_aesni_mb_cryptodev);
REGISTER_TEST_COMMAND(cryptodev_sw_snow3g_perftest, perftest_sw_snow3g_cryptodev);
REGISTER_TEST_COMMAND(cryptodev_qat_snow3g_perftest, perftest_qat_snow3g_cryptodev);
REGISTER_TEST_COMMAND(cryptodev_aesni_gcm_perftest, perftest_aesni_gcm_cryptodev);
-REGISTER_TEST_COMMAND(cryptodev_libcrypto_perftest,
- perftest_libcrypto_cryptodev);
+REGISTER_TEST_COMMAND(cryptodev_openssl_perftest,
+ perftest_openssl_cryptodev);
+REGISTER_TEST_COMMAND(cryptodev_qat_continual_perftest,
+ perftest_qat_continual_cryptodev);