From e05a4871294b304317f41c11011e5ff666ba28c4 Mon Sep 17 00:00:00 2001 From: Darek Stojaczyk Date: Fri, 5 Apr 2019 11:02:14 +0200 Subject: [PATCH] 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 Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/450258 Tested-by: SPDK CI Jenkins Reviewed-by: Ben Walker Reviewed-by: Changpeng Liu --- lib/copy/ioat/copy_engine_ioat.c | 4 ++-- lib/ioat/ioat.c | 14 +++++++------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/lib/copy/ioat/copy_engine_ioat.c b/lib/copy/ioat/copy_engine_ioat.c index 40bc6cf54..4eebe3d10 100644 --- a/lib/copy/ioat/copy_engine_ioat.c +++ b/lib/copy/ioat/copy_engine_ioat.c @@ -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; diff --git a/lib/ioat/ioat.c b/lib/ioat/ioat.c index 94a2eda33..a3e9b0bcf 100644 --- a/lib/ioat/ioat.c +++ b/lib/ioat/ioat.c @@ -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; }