nvmf/vfio-user: don't allocate internal data buffers for vfio-user target

Change-Id: I75f1f1a493a480aadbc233b4583616886559565c
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8474
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: <dongx.yi@intel.com>
Reviewed-by: John Levon <levon@movementarian.org>
This commit is contained in:
Changpeng Liu 2021-06-23 17:04:05 +08:00 committed by Jim Harris
parent 563f69ebe8
commit c138dfd3c0
2 changed files with 13 additions and 12 deletions

View File

@ -201,16 +201,18 @@ spdk_nvmf_transport_create(const char *transport_name, struct spdk_nvmf_transpor
return NULL;
}
transport->data_buf_pool = spdk_mempool_create(spdk_mempool_name,
opts_local.num_shared_buffers,
opts_local.io_unit_size + NVMF_DATA_BUFFER_ALIGNMENT,
SPDK_MEMPOOL_DEFAULT_CACHE_SIZE,
SPDK_ENV_SOCKET_ID_ANY);
if (opts_local.num_shared_buffers) {
transport->data_buf_pool = spdk_mempool_create(spdk_mempool_name,
opts_local.num_shared_buffers,
opts_local.io_unit_size + NVMF_DATA_BUFFER_ALIGNMENT,
SPDK_MEMPOOL_DEFAULT_CACHE_SIZE,
SPDK_ENV_SOCKET_ID_ANY);
if (!transport->data_buf_pool) {
SPDK_ERRLOG("Unable to allocate buffer pool for poll group\n");
ops->destroy(transport, NULL, NULL);
return NULL;
if (!transport->data_buf_pool) {
SPDK_ERRLOG("Unable to allocate buffer pool for poll group\n");
ops->destroy(transport, NULL, NULL);
return NULL;
}
}
return transport;
@ -239,10 +241,9 @@ spdk_nvmf_transport_destroy(struct spdk_nvmf_transport *transport,
spdk_mempool_count(transport->data_buf_pool),
transport->opts.num_shared_buffers);
}
spdk_mempool_free(transport->data_buf_pool);
}
spdk_mempool_free(transport->data_buf_pool);
return transport->ops->destroy(transport, cb_fn, cb_arg);
}

View File

@ -57,7 +57,7 @@
#define NVMF_VFIO_USER_DEFAULT_IN_CAPSULE_DATA_SIZE 0
#define NVMF_VFIO_USER_DEFAULT_MAX_IO_SIZE ((NVMF_REQ_MAX_BUFFERS - 1) << SHIFT_4KB)
#define NVMF_VFIO_USER_DEFAULT_IO_UNIT_SIZE NVMF_VFIO_USER_DEFAULT_MAX_IO_SIZE
#define NVMF_VFIO_USER_DEFAULT_NUM_SHARED_BUFFERS 512 /* internal buf size */
#define NVMF_VFIO_USER_DEFAULT_NUM_SHARED_BUFFERS 0 /* internal buf size */
#define NVMF_VFIO_USER_DEFAULT_BUFFER_CACHE_SIZE 0
#define NVMF_VFIO_USER_DOORBELLS_OFFSET 0x1000