* Copyright (c) 2019 Intel Corporation
*/
+#ifndef RTE_EXEC_ENV_WINDOWS
+
#include <rte_bus_vdev.h>
#include <rte_common.h>
#include <rte_hexdump.h>
#include <rte_pause.h>
#include <rte_cryptodev.h>
-#include <rte_cryptodev_pmd.h>
#include <rte_crypto.h>
#include "test_cryptodev.h"
#define TEST_VECTOR_SIZE 256
static int gbl_driver_id;
-struct crypto_testsuite_params {
+struct crypto_testsuite_params_asym {
struct rte_mempool *op_mpool;
struct rte_mempool *session_mpool;
struct rte_cryptodev_config conf;
static uint32_t test_index;
-static struct crypto_testsuite_params testsuite_params = { NULL };
+static struct crypto_testsuite_params_asym testsuite_params = { NULL };
static int
queue_ops_rsa_sign_verify(struct rte_cryptodev_asym_session *sess)
{
- struct crypto_testsuite_params *ts_params = &testsuite_params;
+ struct crypto_testsuite_params_asym *ts_params = &testsuite_params;
struct rte_mempool *op_mpool = ts_params->op_mpool;
uint8_t dev_id = ts_params->valid_devs[0];
struct rte_crypto_op *op, *result_op;
static int
queue_ops_rsa_enc_dec(struct rte_cryptodev_asym_session *sess)
{
- struct crypto_testsuite_params *ts_params = &testsuite_params;
+ struct crypto_testsuite_params_asym *ts_params = &testsuite_params;
struct rte_mempool *op_mpool = ts_params->op_mpool;
uint8_t dev_id = ts_params->valid_devs[0];
struct rte_crypto_op *op, *result_op;
}
static int
-test_cryptodev_asym_op(struct crypto_testsuite_params *ts_params,
+test_cryptodev_asym_op(struct crypto_testsuite_params_asym *ts_params,
union test_case_structure *data_tc,
char *test_msg, int sessionless, enum rte_crypto_asym_op_type type,
enum rte_crypto_rsa_priv_key_type key_type)
test_one_by_one(void)
{
int status = TEST_SUCCESS;
- struct crypto_testsuite_params *ts_params = &testsuite_params;
+ struct crypto_testsuite_params_asym *ts_params = &testsuite_params;
uint32_t i = 0;
uint8_t dev_id = ts_params->valid_devs[0];
struct rte_cryptodev_info dev_info;
static int
test_rsa_sign_verify(void)
{
- struct crypto_testsuite_params *ts_params = &testsuite_params;
+ struct crypto_testsuite_params_asym *ts_params = &testsuite_params;
struct rte_mempool *sess_mpool = ts_params->session_mpool;
uint8_t dev_id = ts_params->valid_devs[0];
struct rte_cryptodev_asym_session *sess;
static int
test_rsa_enc_dec(void)
{
- struct crypto_testsuite_params *ts_params = &testsuite_params;
+ struct crypto_testsuite_params_asym *ts_params = &testsuite_params;
struct rte_mempool *sess_mpool = ts_params->session_mpool;
uint8_t dev_id = ts_params->valid_devs[0];
struct rte_cryptodev_asym_session *sess;
static int
test_rsa_sign_verify_crt(void)
{
- struct crypto_testsuite_params *ts_params = &testsuite_params;
+ struct crypto_testsuite_params_asym *ts_params = &testsuite_params;
struct rte_mempool *sess_mpool = ts_params->session_mpool;
uint8_t dev_id = ts_params->valid_devs[0];
struct rte_cryptodev_asym_session *sess;
static int
test_rsa_enc_dec_crt(void)
{
- struct crypto_testsuite_params *ts_params = &testsuite_params;
+ struct crypto_testsuite_params_asym *ts_params = &testsuite_params;
struct rte_mempool *sess_mpool = ts_params->session_mpool;
uint8_t dev_id = ts_params->valid_devs[0];
struct rte_cryptodev_asym_session *sess;
static int
testsuite_setup(void)
{
- struct crypto_testsuite_params *ts_params = &testsuite_params;
+ struct crypto_testsuite_params_asym *ts_params = &testsuite_params;
uint8_t valid_devs[RTE_CRYPTO_MAX_DEVS];
struct rte_cryptodev_info info;
int ret, dev_id = -1;
static void
testsuite_teardown(void)
{
- struct crypto_testsuite_params *ts_params = &testsuite_params;
+ struct crypto_testsuite_params_asym *ts_params = &testsuite_params;
if (ts_params->op_mpool != NULL) {
RTE_LOG(DEBUG, USER1, "CRYPTO_OP_POOL count %u\n",
}
static int
-ut_setup(void)
+ut_setup_asym(void)
{
- struct crypto_testsuite_params *ts_params = &testsuite_params;
+ struct crypto_testsuite_params_asym *ts_params = &testsuite_params;
uint16_t qp_id;
}
static void
-ut_teardown(void)
+ut_teardown_asym(void)
{
- struct crypto_testsuite_params *ts_params = &testsuite_params;
+ struct crypto_testsuite_params_asym *ts_params = &testsuite_params;
struct rte_cryptodev_stats stats;
rte_cryptodev_stats_get(ts_params->valid_devs[0], &stats);
static int
test_capability(void)
{
- struct crypto_testsuite_params *ts_params = &testsuite_params;
+ struct crypto_testsuite_params_asym *ts_params = &testsuite_params;
uint8_t dev_id = ts_params->valid_devs[0];
struct rte_cryptodev_info dev_info;
const struct rte_cryptodev_capabilities *dev_capa;
static int
test_dh_gen_shared_sec(struct rte_crypto_asym_xform *xfrm)
{
- struct crypto_testsuite_params *ts_params = &testsuite_params;
+ struct crypto_testsuite_params_asym *ts_params = &testsuite_params;
struct rte_mempool *op_mpool = ts_params->op_mpool;
struct rte_mempool *sess_mpool = ts_params->session_mpool;
uint8_t dev_id = ts_params->valid_devs[0];
static int
test_dh_gen_priv_key(struct rte_crypto_asym_xform *xfrm)
{
- struct crypto_testsuite_params *ts_params = &testsuite_params;
+ struct crypto_testsuite_params_asym *ts_params = &testsuite_params;
struct rte_mempool *op_mpool = ts_params->op_mpool;
struct rte_mempool *sess_mpool = ts_params->session_mpool;
uint8_t dev_id = ts_params->valid_devs[0];
static int
test_dh_gen_pub_key(struct rte_crypto_asym_xform *xfrm)
{
- struct crypto_testsuite_params *ts_params = &testsuite_params;
+ struct crypto_testsuite_params_asym *ts_params = &testsuite_params;
struct rte_mempool *op_mpool = ts_params->op_mpool;
struct rte_mempool *sess_mpool = ts_params->session_mpool;
uint8_t dev_id = ts_params->valid_devs[0];
static int
test_dh_gen_kp(struct rte_crypto_asym_xform *xfrm)
{
- struct crypto_testsuite_params *ts_params = &testsuite_params;
+ struct crypto_testsuite_params_asym *ts_params = &testsuite_params;
struct rte_mempool *op_mpool = ts_params->op_mpool;
struct rte_mempool *sess_mpool = ts_params->session_mpool;
uint8_t dev_id = ts_params->valid_devs[0];
static int
test_mod_inv(void)
{
- struct crypto_testsuite_params *ts_params = &testsuite_params;
+ struct crypto_testsuite_params_asym *ts_params = &testsuite_params;
struct rte_mempool *op_mpool = ts_params->op_mpool;
struct rte_mempool *sess_mpool = ts_params->session_mpool;
uint8_t dev_id = ts_params->valid_devs[0];
static int
test_mod_exp(void)
{
- struct crypto_testsuite_params *ts_params = &testsuite_params;
+ struct crypto_testsuite_params_asym *ts_params = &testsuite_params;
struct rte_mempool *op_mpool = ts_params->op_mpool;
struct rte_mempool *sess_mpool = ts_params->session_mpool;
uint8_t dev_id = ts_params->valid_devs[0];
static int
test_dsa_sign(void)
{
- struct crypto_testsuite_params *ts_params = &testsuite_params;
+ struct crypto_testsuite_params_asym *ts_params = &testsuite_params;
struct rte_mempool *op_mpool = ts_params->op_mpool;
struct rte_mempool *sess_mpool = ts_params->session_mpool;
uint8_t dev_id = ts_params->valid_devs[0];
static int
test_ecdsa_sign_verify(enum curve curve_id)
{
- struct crypto_testsuite_params *ts_params = &testsuite_params;
+ struct crypto_testsuite_params_asym *ts_params = &testsuite_params;
struct rte_mempool *sess_mpool = ts_params->session_mpool;
struct rte_mempool *op_mpool = ts_params->op_mpool;
struct crypto_testsuite_ecdsa_params input_params;
static int
test_ecpm(enum curve curve_id)
{
- struct crypto_testsuite_params *ts_params = &testsuite_params;
+ struct crypto_testsuite_params_asym *ts_params = &testsuite_params;
struct rte_mempool *sess_mpool = ts_params->session_mpool;
struct rte_mempool *op_mpool = ts_params->op_mpool;
struct crypto_testsuite_ecpm_params input_params;
.setup = testsuite_setup,
.teardown = testsuite_teardown,
.unit_test_cases = {
- TEST_CASE_ST(ut_setup, ut_teardown, test_capability),
- TEST_CASE_ST(ut_setup, ut_teardown, test_dsa),
- TEST_CASE_ST(ut_setup, ut_teardown, test_dh_keygenration),
- TEST_CASE_ST(ut_setup, ut_teardown, test_rsa_enc_dec),
- TEST_CASE_ST(ut_setup, ut_teardown, test_rsa_sign_verify),
- TEST_CASE_ST(ut_setup, ut_teardown, test_rsa_enc_dec_crt),
- TEST_CASE_ST(ut_setup, ut_teardown, test_rsa_sign_verify_crt),
- TEST_CASE_ST(ut_setup, ut_teardown, test_mod_inv),
- TEST_CASE_ST(ut_setup, ut_teardown, test_mod_exp),
- TEST_CASE_ST(ut_setup, ut_teardown, test_one_by_one),
+ TEST_CASE_ST(ut_setup_asym, ut_teardown_asym, test_capability),
+ TEST_CASE_ST(ut_setup_asym, ut_teardown_asym, test_dsa),
+ TEST_CASE_ST(ut_setup_asym, ut_teardown_asym,
+ test_dh_keygenration),
+ TEST_CASE_ST(ut_setup_asym, ut_teardown_asym, test_rsa_enc_dec),
+ TEST_CASE_ST(ut_setup_asym, ut_teardown_asym,
+ test_rsa_sign_verify),
+ TEST_CASE_ST(ut_setup_asym, ut_teardown_asym,
+ test_rsa_enc_dec_crt),
+ TEST_CASE_ST(ut_setup_asym, ut_teardown_asym,
+ test_rsa_sign_verify_crt),
+ TEST_CASE_ST(ut_setup_asym, ut_teardown_asym, test_mod_inv),
+ TEST_CASE_ST(ut_setup_asym, ut_teardown_asym, test_mod_exp),
+ TEST_CASE_ST(ut_setup_asym, ut_teardown_asym, test_one_by_one),
TEST_CASES_END() /**< NULL terminate unit test array */
}
};
.setup = testsuite_setup,
.teardown = testsuite_teardown,
.unit_test_cases = {
- TEST_CASE_ST(ut_setup, ut_teardown, test_one_by_one),
+ TEST_CASE_ST(ut_setup_asym, ut_teardown_asym, test_one_by_one),
TEST_CASES_END() /**< NULL terminate unit test array */
}
};
.setup = testsuite_setup,
.teardown = testsuite_teardown,
.unit_test_cases = {
- TEST_CASE_ST(ut_setup, ut_teardown, test_capability),
- TEST_CASE_ST(ut_setup, ut_teardown, test_rsa_enc_dec_crt),
- TEST_CASE_ST(ut_setup, ut_teardown, test_rsa_sign_verify_crt),
- TEST_CASE_ST(ut_setup, ut_teardown, test_mod_exp),
- TEST_CASE_ST(ut_setup, ut_teardown,
+ TEST_CASE_ST(ut_setup_asym, ut_teardown_asym, test_capability),
+ TEST_CASE_ST(ut_setup_asym, ut_teardown_asym,
+ test_rsa_enc_dec_crt),
+ TEST_CASE_ST(ut_setup_asym, ut_teardown_asym,
+ test_rsa_sign_verify_crt),
+ TEST_CASE_ST(ut_setup_asym, ut_teardown_asym, test_mod_exp),
+ TEST_CASE_ST(ut_setup_asym, ut_teardown_asym,
test_ecdsa_sign_verify_all_curve),
- TEST_CASE_ST(ut_setup, ut_teardown, test_ecpm_all_curve),
+ TEST_CASE_ST(ut_setup_asym, ut_teardown_asym,
+ test_ecpm_all_curve),
TEST_CASES_END() /**< NULL terminate unit test array */
}
};
}
static int
-test_cryptodev_octeontx2_asym(void)
+test_cryptodev_cn9k_asym(void)
+{
+ gbl_driver_id = rte_cryptodev_driver_id_get(
+ RTE_STR(CRYPTODEV_NAME_CN9K_PMD));
+ if (gbl_driver_id == -1) {
+ RTE_LOG(ERR, USER1, "CN9K PMD must be loaded.\n");
+ return TEST_FAILED;
+ }
+
+ /* Use test suite registered for crypto_octeontx PMD */
+ return unit_test_suite_runner(&cryptodev_octeontx_asym_testsuite);
+}
+
+static int
+test_cryptodev_cn10k_asym(void)
{
gbl_driver_id = rte_cryptodev_driver_id_get(
- RTE_STR(CRYPTODEV_NAME_OCTEONTX2_PMD));
+ RTE_STR(CRYPTODEV_NAME_CN10K_PMD));
if (gbl_driver_id == -1) {
- RTE_LOG(ERR, USER1, "OCTEONTX2 PMD must be loaded.\n");
+ RTE_LOG(ERR, USER1, "CN10K PMD must be loaded.\n");
return TEST_FAILED;
}
REGISTER_TEST_COMMAND(cryptodev_octeontx_asym_autotest,
test_cryptodev_octeontx_asym);
+REGISTER_TEST_COMMAND(cryptodev_cn9k_asym_autotest, test_cryptodev_cn9k_asym);
+REGISTER_TEST_COMMAND(cryptodev_cn10k_asym_autotest, test_cryptodev_cn10k_asym);
-REGISTER_TEST_COMMAND(cryptodev_octeontx2_asym_autotest,
- test_cryptodev_octeontx2_asym);
+#endif /* !RTE_EXEC_ENV_WINDOWS */