@@ -3793,13 +3793,17 @@ perf_gcm_set_crypto_op(struct rte_crypto_op *op, struct rte_mbuf *m,
return op;
}
-
+#define SGL_NO 2
static struct rte_mbuf *
test_perf_create_pktmbuf_fill(struct rte_mempool *mpool,
struct perf_test_params *params,
- unsigned buf_sz, struct crypto_params *m_hlp)
+ unsigned buf_sz, struct crypto_params *m_hlp,
+ int sgl)
{
- struct rte_mbuf *m = rte_pktmbuf_alloc(mpool);
+ struct rte_mbuf *m = rte_pktmbuf_alloc(mpool), *m_2 = NULL;
+
+ if (sgl)
+ m_2 = rte_pktmbuf_alloc(mpool);
uint16_t iv_pad_len =
ALIGN_POW2_ROUNDUP(params->symmetric_op->iv_len, 16);
uint16_t aad_len = params->symmetric_op->aad_len;
@@ -3820,14 +3824,38 @@ test_perf_create_pktmbuf_fill(struct rte_mempool *mpool,
}
m_hlp->iv = (uint8_t *)p;
- p = rte_pktmbuf_append(m, buf_sz);
- if (p == NULL) {
- rte_pktmbuf_free(m);
- return NULL;
+ if (!sgl) {
+ p = rte_pktmbuf_append(m, buf_sz);
+ if (p == NULL) {
+ rte_pktmbuf_free(m);
+ return NULL;
+ }
+ rte_memcpy(p, params->symmetric_op->p_data, buf_sz);
+ } else {
+ /* 1st */
+ p = rte_pktmbuf_append(m, buf_sz / SGL_NO);
+ if (p == NULL) {
+ rte_pktmbuf_free(m);
+ return NULL;
+ }
+ rte_memcpy(p, params->symmetric_op->p_data, buf_sz / SGL_NO);
+
+ /* 2nd */
+ p = rte_pktmbuf_append(m_2, buf_sz / SGL_NO);
+ if (p == NULL) {
+ rte_pktmbuf_free(m);
+ return NULL;
+ }
+ rte_memcpy(p, params->symmetric_op->p_data + buf_sz / SGL_NO,
+ buf_sz / SGL_NO);
+
+ m->next = m_2;
}
- rte_memcpy(p, params->symmetric_op->p_data, buf_sz);
+ if (!sgl)
+ p = rte_pktmbuf_append(m, digest_size);
+ else
+ p = rte_pktmbuf_append(m_2, digest_size);
- p = rte_pktmbuf_append(m, digest_size);
if (p == NULL) {
rte_pktmbuf_free(m);
return NULL;
@@ -3839,7 +3867,7 @@ test_perf_create_pktmbuf_fill(struct rte_mempool *mpool,
static int
perf_AES_GCM(uint8_t dev_id, uint16_t queue_id,
- struct perf_test_params *pparams, uint32_t test_ops)
+ struct perf_test_params *pparams, uint32_t test_ops, int sgl)
{
int j = 0;
struct crypto_testsuite_params *ts_params = &testsuite_params;
@@ -3872,7 +3900,7 @@ perf_AES_GCM(uint8_t dev_id, uint16_t queue_id,
mbufs[i] = test_perf_create_pktmbuf_fill(
ts_params->mbuf_mp,
pparams, pparams->symmetric_op->p_len,
- &m_hlp[i]);
+ &m_hlp[i], sgl);
}
if (test_ops)
@@ -3985,7 +4013,7 @@ perf_AES_GCM(uint8_t dev_id, uint16_t queue_id,
}
static int
-test_perf_AES_GCM(int continual_buf_len, int continual_size)
+test_perf_AES_GCM(int continual_buf_len, int continual_size, int sgl)
{
uint16_t i, j, k, loops = 1;
@@ -4086,10 +4114,10 @@ test_perf_AES_GCM(int continual_buf_len, int continual_size)
ops_set[i].t_len = gcm_tests[i]->auth_tags[j].len;
/* Run is twice, one for encryption/hash checks,
- * one for perf
+ * one for perf, dont check for sgl
*/
- if (perf_AES_GCM(testsuite_params.dev_id, 0,
- ¶ms_set[i], 1))
+ if (!sgl && perf_AES_GCM(testsuite_params.dev_id, 0,
+ ¶ms_set[i], 1, sgl))
return TEST_FAILED;
for (k = 0; k < loops; k++) {
@@ -4098,7 +4126,7 @@ test_perf_AES_GCM(int continual_buf_len, int continual_size)
"Throughput(Gbps)\t"
"Retries\tEmptyPolls");
if (perf_AES_GCM(testsuite_params.dev_id, 0,
- ¶ms_set[i], 0))
+ ¶ms_set[i], 0, sgl))
return TEST_FAILED;
if (continual_buf_len)
printf("\n\nCompleted loop %i of %i ...",
@@ -4113,7 +4141,12 @@ test_perf_AES_GCM(int continual_buf_len, int continual_size)
static int test_cryptodev_perf_AES_GCM(void)
{
- return test_perf_AES_GCM(0, 0);
+ return test_perf_AES_GCM(0, 0, 0);
+}
+
+static int test_cryptodev_perf_AES_GCM_SGL_2_bufs(void)
+{
+ return test_perf_AES_GCM(0, 0, 1);
}
/*
* This function calls AES GCM performance tests providing
@@ -4122,7 +4155,7 @@ static int test_cryptodev_perf_AES_GCM(void)
*/
static int test_continual_perf_AES_GCM(void)
{
- return test_perf_AES_GCM(1024, 10);
+ return test_perf_AES_GCM(1024, 10, 0);
}
static int
@@ -4186,6 +4219,8 @@ static struct unit_test_suite cryptodev_testsuite = {
test_cryptodev_perf_AES_GCM),
TEST_CASE_ST(ut_setup, ut_teardown,
test_perf_aes_cbc_vary_burst_size),
+ TEST_CASE_ST(ut_setup, ut_teardown,
+ test_cryptodev_perf_AES_GCM_SGL_2_bufs),
TEST_CASES_END() /**< NULL terminate unit test array */
}
};