[Accel-config] [PATCH v1 01/11] accel-config/test: Move macro ADDR_ALIGNMENT to common file

Li Zhang <li4.zhang at intel.com> Tue, 17 May 2022 18:48:23 +0800
Newsgroups dev.linux.lists.accel-config
Message-ID <[email protected]>
Move macro ADDR_ALIGNMENT from dsa.h to accel_test.h for
aligned memory allocation.

Signed-off-by: Li Zhang <li4.zhang(a)intel.com>
---
 test/accel_test.h | 1 +
 test/dsa.h        | 2 --
 test/iaa.c        | 2 +-
 3 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/test/accel_test.h b/test/accel_test.h
index d61e075..c461fe7 100644
--- a/test/accel_test.h
+++ b/test/accel_test.h
@@ -9,6 +9,7 @@
 #define SHARED 1
 #define DEDICATED 0
 
+#define ADDR_ALIGNMENT 32
 #define MAX_PATH_LENGTH 1024
 
 #define ACCTEST_DEVICE_ID_NO_INPUT -1
diff --git a/test/dsa.h b/test/dsa.h
index 1e4c2cb..cd57b01 100644
--- a/test/dsa.h
+++ b/test/dsa.h
@@ -33,8 +33,6 @@
 #define DIF_INVERT_CRC_SEED         ((unsigned long)(1 << 2))
 #define DIF_INVERT_CRC_RESULT       ((unsigned long)(1 << 3))
 
-#define ADDR_ALIGNMENT 32
-
 #define MIN_DELTA_RECORD_SIZE 80
 
 /* dump all sub descriptors for a batch task */
diff --git a/test/iaa.c b/test/iaa.c
index e422790..ea65541 100644
--- a/test/iaa.c
+++ b/test/iaa.c
@@ -25,7 +25,7 @@ static int init_crc64(struct task *tsk, int tflags, int opcode, unsigned long sr
 	tsk->test_flags = tflags;
 	tsk->xfer_size = src1_xfer_size;
 
-	tsk->src1 = malloc(src1_xfer_size);
+	tsk->src1 = aligned_alloc(ADDR_ALIGNMENT, src1_xfer_size);
 	if (!tsk->src1)
 		return -ENOMEM;
 	memset_pattern(tsk->src1, tsk->pattern, src1_xfer_size);
-- 
2.25.1