uint32_t src_buf_offset __rte_unused,
uint32_t dst_buf_offset __rte_unused, uint16_t nb_ops,
struct rte_cryptodev_sym_session *sess,
- const struct cperf_options *options __rte_unused,
+ const struct cperf_options *options,
const struct cperf_test_vector *test_vector __rte_unused,
uint16_t iv_offset __rte_unused,
uint32_t *imix_idx __rte_unused,
struct rte_crypto_asym_op *asym_op = ops[i]->asym;
ops[i]->status = RTE_CRYPTO_OP_STATUS_NOT_PROCESSED;
- asym_op->modex.base.data = perf_base;
- asym_op->modex.base.length = sizeof(perf_base);
- asym_op->modex.result.data = perf_mod_result;
- asym_op->modex.result.length = sizeof(perf_mod_result);
+ asym_op->modex.base.data = options->modex_data->base.data;
+ asym_op->modex.base.length = options->modex_data->base.len;
+ asym_op->modex.result.data = options->modex_data->result.data;
+ asym_op->modex.result.length = options->modex_data->result.len;
rte_crypto_op_attach_asym_session(ops[i], asym_sess);
}
return 0;
if ((options->aead_op == RTE_CRYPTO_AEAD_OP_ENCRYPT) ||
(options->cipher_op == RTE_CRYPTO_CIPHER_OP_ENCRYPT)) {
- memcpy(ip, test_vector->plaintext.data, m->data_len);
+ memcpy(ip, test_vector->plaintext.data,
+ sizeof(struct rte_ipv4_hdr));
ip->total_length = rte_cpu_to_be_16(m->data_len);
}
uint16_t iv_offset __rte_unused, uint32_t *imix_idx,
uint64_t *tsc_start)
{
- uint64_t tsc_start_temp, tsc_end_temp;
uint16_t i;
for (i = 0; i < nb_ops; i++) {
sym_op->m_src = (struct rte_mbuf *)((uint8_t *)ops[i] +
src_buf_offset);
- if (options->op_type == CPERF_PDCP ||
- options->op_type == CPERF_IPSEC) {
- /* In case of IPsec, headroom is consumed by PMD,
- * hence resetting it.
- */
- sym_op->m_src->data_off = options->headroom_sz;
-
+ if (options->op_type == CPERF_PDCP) {
sym_op->m_src->buf_len = options->segment_sz;
sym_op->m_src->data_len = options->test_buffer_size;
sym_op->m_src->pkt_len = sym_op->m_src->data_len;
-
- if ((options->op_type == CPERF_IPSEC) &&
- (options->test_file == NULL) &&
- (options->test == CPERF_TEST_TYPE_THROUGHPUT)) {
- tsc_start_temp = rte_rdtsc_precise();
- test_ipsec_vec_populate(sym_op->m_src, options,
- test_vector);
- tsc_end_temp = rte_rdtsc_precise();
-
- *tsc_start += (tsc_end_temp - tsc_start_temp);
- }
}
if (options->op_type == CPERF_DOCSIS) {
dst_buf_offset);
}
+ RTE_SET_USED(tsc_start);
+ RTE_SET_USED(test_vector);
+
return 0;
}
+
+static int
+cperf_set_ops_security_ipsec(struct rte_crypto_op **ops,
+ uint32_t src_buf_offset __rte_unused,
+ uint32_t dst_buf_offset __rte_unused,
+ uint16_t nb_ops, struct rte_cryptodev_sym_session *sess,
+ const struct cperf_options *options,
+ const struct cperf_test_vector *test_vector,
+ uint16_t iv_offset __rte_unused, uint32_t *imix_idx,
+ uint64_t *tsc_start)
+{
+ struct rte_security_session *sec_sess =
+ (struct rte_security_session *)sess;
+ const uint32_t test_buffer_size = options->test_buffer_size;
+ const uint32_t headroom_sz = options->headroom_sz;
+ const uint32_t segment_sz = options->segment_sz;
+ uint64_t tsc_start_temp, tsc_end_temp;
+ uint16_t i = 0;
+
+ RTE_SET_USED(imix_idx);
+
+ for (i = 0; i < nb_ops; i++) {
+ struct rte_crypto_sym_op *sym_op = ops[i]->sym;
+ struct rte_mbuf *m = sym_op->m_src;
+
+ ops[i]->status = RTE_CRYPTO_OP_STATUS_NOT_PROCESSED;
+ rte_security_attach_session(ops[i], sec_sess);
+ sym_op->m_src = (struct rte_mbuf *)((uint8_t *)ops[i] +
+ src_buf_offset);
+
+ /* In case of IPsec, headroom is consumed by PMD,
+ * hence resetting it.
+ */
+ m->data_off = headroom_sz;
+
+ m->buf_len = segment_sz;
+ m->data_len = test_buffer_size;
+ m->pkt_len = test_buffer_size;
+
+ sym_op->m_dst = NULL;
+ }
+
+ if (options->test_file != NULL)
+ return 0;
+
+ tsc_start_temp = rte_rdtsc_precise();
+
+ for (i = 0; i < nb_ops; i++) {
+ struct rte_crypto_sym_op *sym_op = ops[i]->sym;
+ struct rte_mbuf *m = sym_op->m_src;
+
+ test_ipsec_vec_populate(m, options, test_vector);
+ }
+
+ tsc_end_temp = rte_rdtsc_precise();
+ *tsc_start += tsc_end_temp - tsc_start_temp;
+
+ return 0;
+}
+
#endif
static int
} else
sym_op->cipher.data.length = options->test_buffer_size;
+ if ((options->auth_op == RTE_CRYPTO_AUTH_OP_GENERATE) &&
+ (options->op_type == CPERF_AUTH_THEN_CIPHER))
+ sym_op->cipher.data.length += options->digest_sz;
+
if (options->cipher_algo == RTE_CRYPTO_CIPHER_SNOW3G_UEA2 ||
options->cipher_algo == RTE_CRYPTO_CIPHER_KASUMI_F8 ||
options->cipher_algo == RTE_CRYPTO_CIPHER_ZUC_EEA3)
}
}
- if (options->test == CPERF_TEST_TYPE_VERIFY) {
+ if ((options->test == CPERF_TEST_TYPE_VERIFY) ||
+ (options->test == CPERF_TEST_TYPE_LATENCY)) {
for (i = 0; i < nb_ops; i++) {
uint8_t *iv_ptr = rte_crypto_op_ctod_offset(ops[i],
uint8_t *, iv_offset);
struct rte_crypto_sym_xform auth_xform;
struct rte_crypto_sym_xform aead_xform;
struct rte_cryptodev_sym_session *sess = NULL;
+ void *asym_sess = NULL;
struct rte_crypto_asym_xform xform = {0};
+ int ret;
if (options->op_type == CPERF_ASYM_MODEX) {
xform.next = NULL;
xform.xform_type = RTE_CRYPTO_ASYM_XFORM_MODEX;
- xform.modex.modulus.data = perf_mod_p;
- xform.modex.modulus.length = sizeof(perf_mod_p);
- xform.modex.exponent.data = perf_mod_e;
- xform.modex.exponent.length = sizeof(perf_mod_e);
-
- sess = (void *)rte_cryptodev_asym_session_create(dev_id, &xform, sess_mp);
- if (sess == NULL)
+ xform.modex.modulus.data = options->modex_data->modulus.data;
+ xform.modex.modulus.length = options->modex_data->modulus.len;
+ xform.modex.exponent.data = options->modex_data->exponent.data;
+ xform.modex.exponent.length = options->modex_data->exponent.len;
+
+ ret = rte_cryptodev_asym_session_create(dev_id, &xform,
+ sess_mp, &asym_sess);
+ if (ret < 0) {
+ RTE_LOG(ERR, USER1, "Asym session create failed\n");
return NULL;
-
- return sess;
+ }
+ return asym_sess;
}
#ifdef RTE_LIB_SECURITY
/*
.hfn = options->pdcp_ses_hfn_en ?
PDCP_DEFAULT_HFN : 0,
.hfn_threshold = 0x70C0A,
+ .sdap_enabled = options->pdcp_sdap,
.hfn_ovrd = !(options->pdcp_ses_hfn_en),
} },
.crypto_xform = &cipher_xform
break;
#ifdef RTE_LIB_SECURITY
case CPERF_PDCP:
- case CPERF_IPSEC:
case CPERF_DOCSIS:
op_fns->populate_ops = cperf_set_ops_security;
break;
+ case CPERF_IPSEC:
+ op_fns->populate_ops = cperf_set_ops_security_ipsec;
+ break;
#endif
default:
return -1;