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 <tomasz.zawadzki@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/477841 (master)
Community-CI: SPDK CI Jenkins <sys_sgci@intel.com>
(cherry picked from commit 1d11ab120d
)
Change-Id: I13e4d9743b17a34ad786283f8b567d01e036d368
Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/478360
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
This commit is contained in:
parent
1f7c38b94d
commit
23fd32ce2f
@ -136,6 +136,13 @@ mock_rte_crypto_op_attach_sym_session(struct rte_crypto_op *op,
|
|||||||
return ut_rte_crypto_op_attach_sym_session;
|
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"
|
#include "bdev/crypto/vbdev_crypto.c"
|
||||||
|
|
||||||
/* SPDK stubs */
|
/* SPDK stubs */
|
||||||
@ -168,7 +175,6 @@ DEFINE_STUB(spdk_bdev_register, int, (struct spdk_bdev *vbdev), 0);
|
|||||||
|
|
||||||
/* DPDK stubs */
|
/* DPDK stubs */
|
||||||
DEFINE_STUB(rte_cryptodev_count, uint8_t, (void), 0);
|
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_V(rte_mempool_free, (struct rte_mempool *mp));
|
||||||
DEFINE_STUB(rte_mempool_create, struct rte_mempool *, (const char *name, unsigned n,
|
DEFINE_STUB(rte_mempool_create, struct rte_mempool *, (const char *name, unsigned n,
|
||||||
unsigned elt_size,
|
unsigned elt_size,
|
||||||
@ -214,7 +220,6 @@ struct crypto_io_channel *g_crypto_ch;
|
|||||||
struct spdk_io_channel *g_io_ch;
|
struct spdk_io_channel *g_io_ch;
|
||||||
struct vbdev_dev g_device;
|
struct vbdev_dev g_device;
|
||||||
struct vbdev_crypto g_crypto_bdev;
|
struct vbdev_crypto g_crypto_bdev;
|
||||||
struct rte_config *g_test_config;
|
|
||||||
struct device_qp g_dev_qp;
|
struct device_qp g_dev_qp;
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -319,8 +324,6 @@ test_setup(void)
|
|||||||
g_io_ctx->crypto_ch = g_crypto_ch;
|
g_io_ctx->crypto_ch = g_crypto_ch;
|
||||||
g_io_ctx->crypto_bdev = &g_crypto_bdev;
|
g_io_ctx->crypto_bdev = &g_crypto_bdev;
|
||||||
g_crypto_ch->device_qp = &g_dev_qp;
|
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);
|
TAILQ_INIT(&g_crypto_ch->pending_cry_ios);
|
||||||
|
|
||||||
/* Allocate a real mbuf pool so we can test error paths */
|
/* Allocate a real mbuf pool so we can test error paths */
|
||||||
@ -350,7 +353,6 @@ test_cleanup(void)
|
|||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
free(g_test_config);
|
|
||||||
spdk_mempool_free(g_mbuf_mp);
|
spdk_mempool_free(g_mbuf_mp);
|
||||||
for (i = 0; i < MAX_TEST_BLOCKS; i++) {
|
for (i = 0; i < MAX_TEST_BLOCKS; i++) {
|
||||||
free(g_test_crypto_ops[i]);
|
free(g_test_crypto_ops[i]);
|
||||||
@ -719,7 +721,6 @@ test_initdrivers(void)
|
|||||||
g_mbuf_mp = NULL;
|
g_mbuf_mp = NULL;
|
||||||
|
|
||||||
/* No drivers available, not an error though */
|
/* No drivers available, not an error though */
|
||||||
MOCK_SET(rte_eal_get_configuration, g_test_config);
|
|
||||||
MOCK_SET(rte_cryptodev_count, 0);
|
MOCK_SET(rte_cryptodev_count, 0);
|
||||||
rc = vbdev_crypto_init_crypto_drivers();
|
rc = vbdev_crypto_init_crypto_drivers();
|
||||||
CU_ASSERT(rc == 0);
|
CU_ASSERT(rc == 0);
|
||||||
|
Loading…
Reference in New Issue
Block a user