summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrederic Barrat <fbarrat@linux.ibm.com>2020-04-22 10:00:42 +0200
committerfbarrat <fbarrat@linux.ibm.com>2020-05-04 15:51:08 +0200
commitb515b3159993333f1d2cf8246025f18b51581f5e (patch)
tree3b5ef6f3b55041914b71a50e551f4d1cf8db6e2b
parent2b643255c1547fe7dd38821ee624b1878271b50f (diff)
ocxl_memcpy: Don't ignore buffer size argument
The memcpy AFU supports memory copy commands of size 64B to 2KB in 64B increments. Signed-off-by: Frederic Barrat <fbarrat@linux.ibm.com>
-rw-r--r--afutests/memcpy/ocxl_memcpy.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/afutests/memcpy/ocxl_memcpy.c b/afutests/memcpy/ocxl_memcpy.c
index 99743e1..842f32f 100644
--- a/afutests/memcpy/ocxl_memcpy.c
+++ b/afutests/memcpy/ocxl_memcpy.c
@@ -378,10 +378,6 @@ int test_afu_memcpy(struct memcpy_test_args *args)
ocxl_event event;
ocxl_mmio_h pp_mmio;
- /* max buffer size supported by AFU */
- if (args->size > 2048)
- return -1;
-
pid = getpid();
/* Allocate memory areas for afu to copy to/from */
@@ -700,11 +696,11 @@ void usage(char *name)
int main(int argc, char *argv[])
{
struct memcpy_test_args args;
- int rc, c, i, j, buflen = 2048, processes = 1;
+ int rc, c, i, j, processes = 1;
pid_t pid, failing;
args.loop_count = 1;
- args.size = buflen;
+ args.size = 2048;
args.irq = 0;
args.completion_timeout = -1;
args.reallocate = 0;
@@ -734,7 +730,7 @@ int main(int argc, char *argv[])
processes = atoi(optarg);
break;
case 's':
- buflen = atoi(optarg);
+ args.size = atoi(optarg);
break;
case 'i':
args.irq = 1;
@@ -805,6 +801,12 @@ int main(int argc, char *argv[])
usage(argv[0]);
}
+ /* max buffer size supported by AFU */
+ if (args.size > 2048 || args.size % 64) {
+ fprintf(stderr, "invalid buffer size %d\n", args.size);
+ return -1;
+ }
+
rc = global_setup(&args);
if (rc)
exit(1);