test/idxd: fix allocation issue with unit test

Fixes issue #1847

Signed-off-by: paul luse <paul.e.luse@intel.com>
Change-Id: I34109935b5e8187192239fa34ff43946d0e7632f
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7016
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Karol Latecki <karol.latecki@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: <dongx.yi@intel.com>
This commit is contained in:
paul luse 2021-03-23 18:41:33 +00:00 committed by Tomasz Zawadzki
parent 26fdb2d8b3
commit 48c057814b

View File

@ -39,6 +39,9 @@
#include "idxd/idxd.h"
#define FAKE_REG_SIZE 0x800
#define GRP_CFG_OFFSET 0x400
#define MAX_TOKENS 0x40
#define MAX_ARRAY_SIZE 0x20
DEFINE_STUB(spdk_pci_idxd_get_driver, struct spdk_pci_driver *, (void), NULL);
@ -102,6 +105,10 @@ test_idxd_wq_config(void)
idxd.reg_base = calloc(1, FAKE_REG_SIZE);
SPDK_CU_ASSERT_FATAL(idxd.reg_base != NULL);
SPDK_CU_ASSERT_FATAL(g_dev_cfg->num_groups <= MAX_ARRAY_SIZE);
idxd.groups = calloc(g_dev_cfg->num_groups, sizeof(struct idxd_group));
SPDK_CU_ASSERT_FATAL(idxd.groups != NULL);
idxd.registers.wqcap.total_wq_size = TOTAL_WQE_SIZE;
idxd.registers.wqcap.num_wqs = g_dev_cfg->total_wqs;
idxd.registers.gencap.max_batch_shift = LOG2_WQ_MAX_BATCH;
@ -132,14 +139,11 @@ test_idxd_wq_config(void)
free(idxd.queues);
free(idxd.reg_base);
free(idxd.groups);
return 0;
}
#define GRP_CFG_OFFSET 0x400
#define MAX_TOKENS 0x40
#define MAX_ARRAY_SIZE 0x20
static int
test_idxd_group_config(void)
{