examples/accel_perf: add support for dual cast
Dual-cast copies the same source to two separate destination buffers. Signed-off-by: paul luse <paul.e.luse@intel.com> Change-Id: I0535720b2b167ee8191e90998e55c2d5ac4ce6ef Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/2130 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Community-CI: Mellanox Build Bot Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
parent
a68b315772
commit
0ef079c6e5
@ -41,6 +41,7 @@
|
|||||||
#include "spdk/crc32.h"
|
#include "spdk/crc32.h"
|
||||||
|
|
||||||
#define DATA_PATTERN 0x5a
|
#define DATA_PATTERN 0x5a
|
||||||
|
#define ALIGN_4K 0x1000
|
||||||
|
|
||||||
static uint64_t g_tsc_rate;
|
static uint64_t g_tsc_rate;
|
||||||
static uint64_t g_tsc_us_rate;
|
static uint64_t g_tsc_us_rate;
|
||||||
@ -75,6 +76,7 @@ struct worker_thread {
|
|||||||
struct ap_task {
|
struct ap_task {
|
||||||
void *src;
|
void *src;
|
||||||
void *dst;
|
void *dst;
|
||||||
|
void *dst2;
|
||||||
struct worker_thread *worker;
|
struct worker_thread *worker;
|
||||||
int status;
|
int status;
|
||||||
int expected_status; /* used for compare */
|
int expected_status; /* used for compare */
|
||||||
@ -119,7 +121,7 @@ usage(void)
|
|||||||
printf("\t[-n number of channels]\n");
|
printf("\t[-n number of channels]\n");
|
||||||
printf("\t[-o transfer size in bytes]\n");
|
printf("\t[-o transfer size in bytes]\n");
|
||||||
printf("\t[-t time in seconds]\n");
|
printf("\t[-t time in seconds]\n");
|
||||||
printf("\t[-w workload type must be one of these: copy, fill, crc32c, compare\n");
|
printf("\t[-w workload type must be one of these: copy, fill, crc32c, compare, dualcast\n");
|
||||||
printf("\t[-s for crc32c workload, use this seed value (default 0)\n");
|
printf("\t[-s for crc32c workload, use this seed value (default 0)\n");
|
||||||
printf("\t[-P for compare workload, percentage of operations that should miscompare (percent, default 0)\n");
|
printf("\t[-P for compare workload, percentage of operations that should miscompare (percent, default 0)\n");
|
||||||
printf("\t[-y verify result if this switch is on]\n");
|
printf("\t[-y verify result if this switch is on]\n");
|
||||||
@ -157,6 +159,8 @@ parse_args(int argc, char *argv)
|
|||||||
g_workload_selection = ACCEL_CRC32C;
|
g_workload_selection = ACCEL_CRC32C;
|
||||||
} else if (!strcmp(g_workload_type, "compare")) {
|
} else if (!strcmp(g_workload_type, "compare")) {
|
||||||
g_workload_selection = ACCEL_COMPARE;
|
g_workload_selection = ACCEL_COMPARE;
|
||||||
|
} else if (!strcmp(g_workload_type, "dualcast")) {
|
||||||
|
g_workload_selection = ACCEL_DUALCAST;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@ -226,6 +230,11 @@ _submit_single(void *arg1, void *arg2)
|
|||||||
worker->ch, task->dst, task->src,
|
worker->ch, task->dst, task->src,
|
||||||
g_xfer_size_bytes, accel_done);
|
g_xfer_size_bytes, accel_done);
|
||||||
break;
|
break;
|
||||||
|
case ACCEL_DUALCAST:
|
||||||
|
rc = spdk_accel_submit_dualcast(__accel_task_from_ap_task(task),
|
||||||
|
worker->ch, task->dst, task->dst2,
|
||||||
|
task->src, g_xfer_size_bytes, accel_done);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
assert(false);
|
assert(false);
|
||||||
break;
|
break;
|
||||||
@ -263,6 +272,16 @@ _accel_done(void *arg1)
|
|||||||
worker->xfer_failed++;
|
worker->xfer_failed++;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case ACCEL_DUALCAST:
|
||||||
|
if (memcmp(task->src, task->dst, g_xfer_size_bytes)) {
|
||||||
|
SPDK_NOTICELOG("Data miscompare, first destination\n");
|
||||||
|
worker->xfer_failed++;
|
||||||
|
}
|
||||||
|
if (memcmp(task->src, task->dst2, g_xfer_size_bytes)) {
|
||||||
|
SPDK_NOTICELOG("Data miscompare, second destination\n");
|
||||||
|
worker->xfer_failed++;
|
||||||
|
}
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
assert(false);
|
assert(false);
|
||||||
break;
|
break;
|
||||||
@ -285,6 +304,9 @@ _accel_done(void *arg1)
|
|||||||
} else {
|
} else {
|
||||||
spdk_free(task->src);
|
spdk_free(task->src);
|
||||||
spdk_free(task->dst);
|
spdk_free(task->dst);
|
||||||
|
if (g_workload_selection == ACCEL_DUALCAST) {
|
||||||
|
spdk_free(task->dst2);
|
||||||
|
}
|
||||||
spdk_mempool_put(worker->task_pool, task);
|
spdk_mempool_put(worker->task_pool, task);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -373,6 +395,7 @@ _init_thread(void *arg1)
|
|||||||
char task_pool_name[30];
|
char task_pool_name[30];
|
||||||
struct ap_task *task;
|
struct ap_task *task;
|
||||||
int i;
|
int i;
|
||||||
|
uint32_t align = 0;
|
||||||
|
|
||||||
worker = calloc(1, sizeof(*worker));
|
worker = calloc(1, sizeof(*worker));
|
||||||
if (worker == NULL) {
|
if (worker == NULL) {
|
||||||
@ -380,6 +403,13 @@ _init_thread(void *arg1)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* For dualcast, the DSA HW requires 4K alignment on destination addresses but
|
||||||
|
* we do this for all engines to keep it simple.
|
||||||
|
*/
|
||||||
|
if (g_workload_selection == ACCEL_DUALCAST) {
|
||||||
|
align = ALIGN_4K;
|
||||||
|
}
|
||||||
|
|
||||||
worker->core = spdk_env_get_current_core();
|
worker->core = spdk_env_get_current_core();
|
||||||
worker->thread = spdk_get_thread();
|
worker->thread = spdk_get_thread();
|
||||||
worker->next = g_workers;
|
worker->next = g_workers;
|
||||||
@ -420,11 +450,21 @@ _init_thread(void *arg1)
|
|||||||
}
|
}
|
||||||
memset(task->src, DATA_PATTERN, g_xfer_size_bytes);
|
memset(task->src, DATA_PATTERN, g_xfer_size_bytes);
|
||||||
|
|
||||||
task->dst = spdk_dma_zmalloc(g_xfer_size_bytes, 0, NULL);
|
task->dst = spdk_dma_zmalloc(g_xfer_size_bytes, align, NULL);
|
||||||
if (task->dst == NULL) {
|
if (task->dst == NULL) {
|
||||||
fprintf(stderr, "Unable to alloc dst buffer\n");
|
fprintf(stderr, "Unable to alloc dst buffer\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (g_workload_selection == ACCEL_DUALCAST) {
|
||||||
|
task->dst2 = spdk_dma_zmalloc(g_xfer_size_bytes, align, NULL);
|
||||||
|
if (task->dst2 == NULL) {
|
||||||
|
fprintf(stderr, "Unable to alloc dst buffer\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
memset(task->dst2, ~DATA_PATTERN, g_xfer_size_bytes);
|
||||||
|
}
|
||||||
|
|
||||||
/* For compare we want the buffers to match, otherwise not. */
|
/* For compare we want the buffers to match, otherwise not. */
|
||||||
if (g_workload_selection == ACCEL_COMPARE) {
|
if (g_workload_selection == ACCEL_COMPARE) {
|
||||||
memset(task->dst, DATA_PATTERN, g_xfer_size_bytes);
|
memset(task->dst, DATA_PATTERN, g_xfer_size_bytes);
|
||||||
@ -494,7 +534,8 @@ main(int argc, char **argv)
|
|||||||
if ((g_workload_selection != ACCEL_COPY) &&
|
if ((g_workload_selection != ACCEL_COPY) &&
|
||||||
(g_workload_selection != ACCEL_FILL) &&
|
(g_workload_selection != ACCEL_FILL) &&
|
||||||
(g_workload_selection != ACCEL_CRC32C) &&
|
(g_workload_selection != ACCEL_CRC32C) &&
|
||||||
(g_workload_selection != ACCEL_COMPARE)) {
|
(g_workload_selection != ACCEL_COMPARE) &&
|
||||||
|
(g_workload_selection != ACCEL_DUALCAST)) {
|
||||||
usage();
|
usage();
|
||||||
rc = -1;
|
rc = -1;
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
Loading…
Reference in New Issue
Block a user