[CPERF_AUTH_THEN_CIPHER] = "auth-then-cipher",
[CPERF_AEAD] = "aead",
[CPERF_PDCP] = "pdcp",
- [CPERF_DOCSIS] = "docsis"
+ [CPERF_DOCSIS] = "docsis",
+ [CPERF_IPSEC] = "ipsec",
+ [CPERF_ASYM_MODEX] = "modex"
};
const struct cperf_test cperf_testmap[] = {
}
};
+static int
+create_asym_op_pool_socket(int32_t socket_id, uint32_t nb_sessions)
+{
+ char mp_name[RTE_MEMPOOL_NAMESIZE];
+ struct rte_mempool *mpool = NULL;
+
+ if (session_pool_socket[socket_id].sess_mp == NULL) {
+ snprintf(mp_name, RTE_MEMPOOL_NAMESIZE, "perf_asym_sess_pool%u",
+ socket_id);
+ mpool = rte_cryptodev_asym_session_pool_create(mp_name,
+ nb_sessions, 0, 0, socket_id);
+ if (mpool == NULL) {
+ printf("Cannot create pool \"%s\" on socket %d\n",
+ mp_name, socket_id);
+ return -ENOMEM;
+ }
+ session_pool_socket[socket_id].sess_mp = mpool;
+ }
+ return 0;
+}
+
static int
fill_session_pool_socket(int32_t socket_id, uint32_t session_priv_size,
uint32_t nb_sessions)
socket_id = 0;
rte_cryptodev_info_get(cdev_id, &cdev_info);
+
+ if (opts->op_type == CPERF_ASYM_MODEX) {
+ if ((cdev_info.feature_flags &
+ RTE_CRYPTODEV_FF_ASYMMETRIC_CRYPTO) == 0)
+ continue;
+ }
+
if (opts->nb_qps > cdev_info.max_nb_queue_pairs) {
printf("Number of needed queue pairs is higher "
"than the maximum number of queue pairs "
struct rte_cryptodev_config conf = {
.nb_queue_pairs = opts->nb_qps,
.socket_id = socket_id,
- .ff_disable = RTE_CRYPTODEV_FF_ASYMMETRIC_CRYPTO,
};
- if (opts->op_type != CPERF_PDCP &&
- opts->op_type != CPERF_DOCSIS)
+ switch (opts->op_type) {
+ case CPERF_ASYM_MODEX:
+ conf.ff_disable |= (RTE_CRYPTODEV_FF_SECURITY |
+ RTE_CRYPTODEV_FF_SYMMETRIC_CRYPTO);
+ break;
+ case CPERF_CIPHER_ONLY:
+ case CPERF_AUTH_ONLY:
+ case CPERF_CIPHER_THEN_AUTH:
+ case CPERF_AUTH_THEN_CIPHER:
+ case CPERF_AEAD:
conf.ff_disable |= RTE_CRYPTODEV_FF_SECURITY;
+ /* Fall through */
+ case CPERF_PDCP:
+ case CPERF_DOCSIS:
+ case CPERF_IPSEC:
+ /* Fall through */
+ default:
+ conf.ff_disable |= RTE_CRYPTODEV_FF_ASYMMETRIC_CRYPTO;
+ }
struct rte_cryptodev_qp_conf qp_conf = {
.nb_descriptors = opts->nb_descriptors
return -ENOTSUP;
}
- ret = fill_session_pool_socket(socket_id, max_sess_size,
- sessions_needed);
+ if (opts->op_type == CPERF_ASYM_MODEX)
+ ret = create_asym_op_pool_socket(socket_id,
+ sessions_needed);
+ else
+ ret = fill_session_pool_socket(socket_id, max_sess_size,
+ sessions_needed);
if (ret < 0)
return ret;
qp_conf.mp_session_private =
session_pool_socket[socket_id].priv_mp;
+ if (opts->op_type == CPERF_ASYM_MODEX) {
+ qp_conf.mp_session = NULL;
+ qp_conf.mp_session_private = NULL;
+ }
+
ret = rte_cryptodev_configure(cdev_id, &conf);
if (ret < 0) {
printf("Failed to configure cryptodev %u", cdev_id);
{
struct rte_cryptodev_sym_capability_idx cap_idx;
const struct rte_cryptodev_symmetric_capability *capability;
+ struct rte_cryptodev_asym_capability_idx asym_cap_idx;
+ const struct rte_cryptodev_asymmetric_xform_capability *asym_capability;
+
uint8_t i, cdev_id;
int ret;
cdev_id = enabled_cdevs[i];
+ if (opts->op_type == CPERF_ASYM_MODEX) {
+ asym_cap_idx.type = RTE_CRYPTO_ASYM_XFORM_MODEX;
+ asym_capability = rte_cryptodev_asym_capability_get(
+ cdev_id, &asym_cap_idx);
+ if (asym_capability == NULL)
+ return -1;
+
+ ret = rte_cryptodev_asym_xform_capability_check_modlen(
+ asym_capability, sizeof(perf_mod_p));
+ if (ret != 0)
+ return ret;
+
+ }
+
if (opts->op_type == CPERF_AUTH_ONLY ||
opts->op_type == CPERF_CIPHER_THEN_AUTH ||
opts->op_type == CPERF_AUTH_THEN_CIPHER) {