From 76981be4776ff608e0274156c3269d4f367a1ece Mon Sep 17 00:00:00 2001 From: Darek Stojaczyk Date: Wed, 6 Feb 2019 16:30:46 +0100 Subject: [PATCH] ut/crypto: align rte_crypto_op to 64B The original struct in DPDK requires 64B alignment. Change-Id: Ica41edbeff6b281e753107dd863aaee882cf7bed Signed-off-by: Darek Stojaczyk Reviewed-on: https://review.gerrithub.io/c/443590 Reviewed-by: Jim Harris Reviewed-by: Ben Walker Reviewed-by: Shuhei Matsumoto Tested-by: SPDK CI Jenkins --- test/unit/lib/bdev/crypto.c/crypto_ut.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/test/unit/lib/bdev/crypto.c/crypto_ut.c b/test/unit/lib/bdev/crypto.c/crypto_ut.c index c5c16c638..c0e37d38c 100644 --- a/test/unit/lib/bdev/crypto.c/crypto_ut.c +++ b/test/unit/lib/bdev/crypto.c/crypto_ut.c @@ -291,7 +291,7 @@ rte_crypto_op_attach_sym_session(struct rte_crypto_op *op, static int test_setup(void) { - int i; + int i, rc; /* Prepare essential variables for test routines */ g_bdev_io = calloc(1, sizeof(struct spdk_bdev_io) + sizeof(struct crypto_bdev_io)); @@ -319,8 +319,13 @@ test_setup(void) * same coverage just calloc them here. */ for (i = 0; i < MAX_TEST_BLOCKS; i++) { - g_test_crypto_ops[i] = calloc(1, sizeof(struct rte_crypto_op) + - sizeof(struct rte_crypto_sym_op)); + rc = posix_memalign((void **)&g_test_crypto_ops[i], 64, + sizeof(struct rte_crypto_op) + sizeof(struct rte_crypto_sym_op)); + if (rc != 0) { + assert(false); + } + memset(g_test_crypto_ops[i], 0, sizeof(struct rte_crypto_op) + + sizeof(struct rte_crypto_sym_op)); } return 0; }