ioat: allocate device struct using regular calloc

spdk_dma_malloc() is not required here, as the device
struct is neither DMA-able nor shared between processes.

While here, also allocate various ioat buffers using
spdk_zmalloc() instead of spdk_dma_zmalloc(), as
spdk_dma_*malloc() is about to be deprecated.

Change-Id: I4ffa40a59f48b2854ba3b35a759e4778007b47b7
Signed-off-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/450258
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
This commit is contained in:
Darek Stojaczyk 2019-04-05 11:02:14 +02:00 committed by Changpeng Liu
parent 20d575bba5
commit e05a487129
2 changed files with 9 additions and 9 deletions

View File

@ -138,7 +138,7 @@ copy_engine_ioat_exit(void *ctx)
TAILQ_REMOVE(&g_devices, dev, tailq);
spdk_ioat_detach(dev->ioat);
ioat_free_device(dev);
spdk_dma_free(dev);
free(dev);
}
spdk_copy_engine_module_finish();
}
@ -268,7 +268,7 @@ attach_cb(void *cb_ctx, struct spdk_pci_device *pci_dev, struct spdk_ioat_chan *
{
struct ioat_device *dev;
dev = spdk_dma_zmalloc(sizeof(*dev), 0, NULL);
dev = calloc(1, sizeof(*dev));
if (dev == NULL) {
SPDK_ERRLOG("Failed to allocate device struct\n");
return;

View File

@ -363,11 +363,11 @@ ioat_channel_destruct(struct spdk_ioat_chan *ioat)
}
if (ioat->hw_ring) {
spdk_dma_free(ioat->hw_ring);
spdk_free(ioat->hw_ring);
}
if (ioat->comp_update) {
spdk_dma_free((void *)ioat->comp_update);
spdk_free((void *)ioat->comp_update);
ioat->comp_update = NULL;
}
}
@ -413,15 +413,15 @@ ioat_channel_start(struct spdk_ioat_chan *ioat)
ioat->max_xfer_size = 1U << xfercap;
}
ioat->comp_update = spdk_dma_zmalloc(sizeof(*ioat->comp_update), SPDK_IOAT_CHANCMP_ALIGN,
NULL);
ioat->comp_update = spdk_zmalloc(sizeof(*ioat->comp_update), SPDK_IOAT_CHANCMP_ALIGN,
NULL, SPDK_ENV_LCORE_ID_ANY, SPDK_MALLOC_DMA);
if (ioat->comp_update == NULL) {
return -1;
}
comp_update_bus_addr = spdk_vtophys((void *)ioat->comp_update, NULL);
if (comp_update_bus_addr == SPDK_VTOPHYS_ERROR) {
spdk_dma_free((void *)ioat->comp_update);
spdk_free((void *)ioat->comp_update);
return -1;
}
@ -434,8 +434,8 @@ ioat_channel_start(struct spdk_ioat_chan *ioat)
return -1;
}
ioat->hw_ring = spdk_dma_zmalloc(num_descriptors * sizeof(union spdk_ioat_hw_desc), 64,
NULL);
ioat->hw_ring = spdk_zmalloc(num_descriptors * sizeof(union spdk_ioat_hw_desc), 64,
NULL, SPDK_ENV_LCORE_ID_ANY, SPDK_MALLOC_DMA);
if (!ioat->hw_ring) {
return -1;
}