From 23fd32ce2f918fa86936fb9e3f0ca69c8fa30762 Mon Sep 17 00:00:00 2001 From: Tomasz Zawadzki Date: Thu, 12 Dec 2019 11:41:13 -0500 Subject: [PATCH] ut/crypto: redirect mock rte_lcore_count With DPDK 19.11 rte_eal_get_configuration() and rte_config structure were made private. Those were only used in the inline rte_lcore_count() included from DPDK. After the update they were no longer available. Since only rte_lcore_count() was used directly in crypto, mock that and return 1, as was done previously. This was tested with DPDK 19.08 and DPDK 19.11. Signed-off-by: Tomasz Zawadzki Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/477841 (master) Community-CI: SPDK CI Jenkins (cherry picked from commit 1d11ab120dfc3236d0fff859a659d3fcd352c461) Change-Id: I13e4d9743b17a34ad786283f8b567d01e036d368 Signed-off-by: Tomasz Zawadzki Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/478360 Tested-by: SPDK CI Jenkins Reviewed-by: Jim Harris Reviewed-by: Shuhei Matsumoto --- test/unit/lib/bdev/crypto.c/crypto_ut.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/test/unit/lib/bdev/crypto.c/crypto_ut.c b/test/unit/lib/bdev/crypto.c/crypto_ut.c index 72660fcb0..09a343069 100644 --- a/test/unit/lib/bdev/crypto.c/crypto_ut.c +++ b/test/unit/lib/bdev/crypto.c/crypto_ut.c @@ -136,6 +136,13 @@ mock_rte_crypto_op_attach_sym_session(struct rte_crypto_op *op, return ut_rte_crypto_op_attach_sym_session; } +#define rte_lcore_count mock_rte_lcore_count +static inline unsigned +mock_rte_lcore_count(void) +{ + return 1; +} + #include "bdev/crypto/vbdev_crypto.c" /* SPDK stubs */ @@ -168,7 +175,6 @@ DEFINE_STUB(spdk_bdev_register, int, (struct spdk_bdev *vbdev), 0); /* DPDK stubs */ DEFINE_STUB(rte_cryptodev_count, uint8_t, (void), 0); -DEFINE_STUB(rte_eal_get_configuration, struct rte_config *, (void), NULL); DEFINE_STUB_V(rte_mempool_free, (struct rte_mempool *mp)); DEFINE_STUB(rte_mempool_create, struct rte_mempool *, (const char *name, unsigned n, unsigned elt_size, @@ -214,7 +220,6 @@ struct crypto_io_channel *g_crypto_ch; struct spdk_io_channel *g_io_ch; struct vbdev_dev g_device; struct vbdev_crypto g_crypto_bdev; -struct rte_config *g_test_config; struct device_qp g_dev_qp; void @@ -319,8 +324,6 @@ test_setup(void) g_io_ctx->crypto_ch = g_crypto_ch; g_io_ctx->crypto_bdev = &g_crypto_bdev; g_crypto_ch->device_qp = &g_dev_qp; - g_test_config = calloc(1, sizeof(struct rte_config)); - g_test_config->lcore_count = 1; TAILQ_INIT(&g_crypto_ch->pending_cry_ios); /* Allocate a real mbuf pool so we can test error paths */ @@ -350,7 +353,6 @@ test_cleanup(void) { int i; - free(g_test_config); spdk_mempool_free(g_mbuf_mp); for (i = 0; i < MAX_TEST_BLOCKS; i++) { free(g_test_crypto_ops[i]); @@ -719,7 +721,6 @@ test_initdrivers(void) g_mbuf_mp = NULL; /* No drivers available, not an error though */ - MOCK_SET(rte_eal_get_configuration, g_test_config); MOCK_SET(rte_cryptodev_count, 0); rc = vbdev_crypto_init_crypto_drivers(); CU_ASSERT(rc == 0);