virtio: use spdk_dma_zmalloc to allocate virtqueue

Removed another direct DPDK dependency.

Change-Id: I12d9a49fb16fbefad42c09f46c280f6f7be094d1
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/388300
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
This commit is contained in:
Dariusz Stojaczyk 2017-11-20 23:05:22 +01:00 committed by Jim Harris
parent 73bfcede86
commit a87768a2ea
2 changed files with 1 additions and 8 deletions

View File

@ -153,7 +153,6 @@ virtio_init_vring(struct virtqueue *vq)
static int
virtio_init_queue(struct virtio_dev *dev, uint16_t vtpci_queue_idx)
{
char vq_name[VIRTQUEUE_MAX_NAME_SZ];
void *queue_mem;
unsigned int vq_size, size;
uint64_t queue_mem_phys_addr;
@ -179,15 +178,11 @@ virtio_init_queue(struct virtio_dev *dev, uint16_t vtpci_queue_idx)
return -EINVAL;
}
snprintf(vq_name, sizeof(vq_name), "dev%d_vq%d",
dev->id, vtpci_queue_idx);
size = RTE_ALIGN_CEIL(sizeof(*vq) +
vq_size * sizeof(struct vq_desc_extra),
RTE_CACHE_LINE_SIZE);
vq = rte_zmalloc_socket(vq_name, size, RTE_CACHE_LINE_SIZE,
SOCKET_ID_ANY);
vq = spdk_dma_zmalloc(size, RTE_CACHE_LINE_SIZE, NULL);
if (vq == NULL) {
SPDK_ERRLOG("can not allocate vq\n");
return -ENOMEM;

View File

@ -46,8 +46,6 @@
#include "spdk/json.h"
#include "spdk/io_channel.h"
#define VIRTQUEUE_MAX_NAME_SZ 32
/**
* The maximum virtqueue size is 2^15. Use that value as the end of
* descriptor chain terminator since it will never be a valid index