void * cperf_pmd_cyclecount_test_constructor(struct rte_mempool *sess_mp, uint8_t dev_id, uint16_t qp_id, const struct cperf_options *options, const struct cperf_test_vector *test_vector, const struct cperf_op_fns *op_fns) { struct cperf_pmd_cyclecount_ctx *ctx = NULL; /* preallocate buffers for crypto ops as they can get quite big */ size_t alloc_sz = sizeof(struct rte_crypto_op *) * options->nb_descriptors; ctx = rte_malloc(NULL, sizeof(struct cperf_pmd_cyclecount_ctx), 0); if (ctx == NULL) goto err; ctx->dev_id = dev_id; ctx->qp_id = qp_id; ctx->populate_ops = op_fns->populate_ops; ctx->options = options; ctx->test_vector = test_vector; /* IV goes at the end of the crypto operation */ uint16_t iv_offset = sizeof(struct rte_crypto_op) + sizeof(struct rte_crypto_sym_op); ctx->sess = op_fns->sess_create( sess_mp, dev_id, options, test_vector, iv_offset); if (ctx->sess == NULL) goto err; if (cperf_alloc_common_memory(options, test_vector, dev_id, qp_id, 0, &ctx->src_buf_offset, &ctx->dst_buf_offset, &ctx->pool) < 0) goto err; ctx->ops = rte_malloc("ops", alloc_sz, 0); if (!ctx->ops) goto err; ctx->ops_processed = rte_malloc("ops_processed", alloc_sz, 0); if (!ctx->ops_processed) goto err; return ctx; err: cperf_pmd_cyclecount_test_free(ctx); return NULL; }
void * cperf_verify_test_constructor(struct rte_mempool *sess_mp, uint8_t dev_id, uint16_t qp_id, const struct cperf_options *options, const struct cperf_test_vector *test_vector, const struct cperf_op_fns *op_fns) { struct cperf_verify_ctx *ctx = NULL; ctx = rte_malloc(NULL, sizeof(struct cperf_verify_ctx), 0); if (ctx == NULL) goto err; ctx->dev_id = dev_id; ctx->qp_id = qp_id; ctx->populate_ops = op_fns->populate_ops; ctx->options = options; ctx->test_vector = test_vector; /* IV goes at the end of the crypto operation */ uint16_t iv_offset = sizeof(struct rte_crypto_op) + sizeof(struct rte_crypto_sym_op); ctx->sess = op_fns->sess_create(sess_mp, dev_id, options, test_vector, iv_offset); if (ctx->sess == NULL) goto err; if (cperf_alloc_common_memory(options, test_vector, dev_id, qp_id, 0, &ctx->src_buf_offset, &ctx->dst_buf_offset, &ctx->pool) < 0) goto err; return ctx; err: cperf_verify_test_free(ctx); return NULL; }