bdev_virtio: minor cleanup

Fixed various minor bugs and removed unused code.

Change-Id: I24d3f10a494b9f9c69f45e888c7e1511adc268bc
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/375004
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
This commit is contained in:
Dariusz Stojaczyk 2017-08-21 18:39:07 +02:00 committed by Jim Harris
parent 305088e594
commit 0b13fffc12
3 changed files with 6 additions and 21 deletions

View File

@ -124,7 +124,7 @@ bdev_virtio_rw(struct spdk_io_channel *ch, struct spdk_bdev_io *bdev_io)
virtio_xmit_pkts(disk->hw->tx_queues[2], &vreq);
do {
cnt = virtio_recv_pkts(disk->hw->tx_queues[2], &complete, 32);
cnt = virtio_recv_pkts(disk->hw->tx_queues[2], &complete, 1);
} while (cnt == 0);
spdk_bdev_io_complete(bdev_io, SPDK_BDEV_IO_STATUS_SUCCESS);
@ -246,7 +246,7 @@ scan_target(struct virtio_hw *hw, uint8_t target)
virtio_xmit_pkts(hw->tx_queues[2], &vreq);
do {
cnt = virtio_recv_pkts(hw->tx_queues[2], &complete, 32);
cnt = virtio_recv_pkts(hw->tx_queues[2], &complete, 1);
} while (cnt == 0);
if (resp->response != VIRTIO_SCSI_S_OK || resp->status != SPDK_SCSI_STATUS_GOOD) {
@ -268,7 +268,7 @@ scan_target(struct virtio_hw *hw, uint8_t target)
virtio_xmit_pkts(hw->tx_queues[2], &vreq);
do {
cnt = virtio_recv_pkts(hw->tx_queues[2], &complete, 32);
cnt = virtio_recv_pkts(hw->tx_queues[2], &complete, 1);
} while (cnt == 0);
disk = calloc(1, sizeof(*disk));
@ -284,7 +284,7 @@ scan_target(struct virtio_hw *hw, uint8_t target)
bdev = &disk->bdev;
bdev->name = spdk_sprintf_alloc("Virtio0");
bdev->name = "Virtio SCSI Disk";
bdev->product_name = "Virtio SCSI Disk";
bdev->write_cache = 0;
bdev->blocklen = disk->block_size;
bdev->blockcnt = disk->num_blocks;

View File

@ -274,6 +274,7 @@ const char * const vhost_msg_strings[] = {
[VHOST_USER_SET_VRING_KICK] = "VHOST_SET_VRING_KICK",
[VHOST_USER_SET_MEM_TABLE] = "VHOST_SET_MEM_TABLE",
[VHOST_USER_SET_VRING_ENABLE] = "VHOST_SET_VRING_ENABLE",
[VHOST_USER_GET_QUEUE_NUM] = "VHOST_USER_GET_QUEUE_NUM"
};
static int
@ -291,7 +292,7 @@ vhost_user_sock(struct virtio_user_dev *dev,
RTE_SET_USED(m);
PMD_DRV_LOG(INFO, "%s", vhost_msg_strings[req]);
PMD_DRV_LOG(INFO, "%d = %s", req, vhost_msg_strings[req]);
msg.request = req;
msg.flags = VHOST_USER_VERSION;

View File

@ -89,7 +89,6 @@ struct virtqueue {
uint16_t vq_nentries; /**< vring desc numbers */
uint16_t vq_free_cnt; /**< num of desc available */
uint16_t vq_avail_idx; /**< sync until needed */
uint16_t vq_free_thresh; /**< free threshold */
void *vq_ring_virt_mem; /**< linear address of vring*/
unsigned int vq_ring_size;
@ -109,7 +108,6 @@ struct virtqueue {
uint16_t vq_desc_head_idx;
uint16_t vq_desc_tail_idx;
uint16_t vq_queue_index; /**< PCI queue index */
uint16_t offset; /**< relative offset to obtain addr in mbuf */
uint16_t *notify_addr;
struct vq_desc_extra vq_descx[0];
};
@ -134,20 +132,6 @@ virtqueue_disable_intr(struct virtqueue *vq)
vq->vq_ring.avail->flags |= VRING_AVAIL_F_NO_INTERRUPT;
}
/**
* Tell the backend to interrupt us.
*/
static inline void
virtqueue_enable_intr(struct virtqueue *vq)
{
vq->vq_ring.avail->flags &= (~VRING_AVAIL_F_NO_INTERRUPT);
}
/**
* Dump virtqueue internal structures, for debug purpose only.
*/
void virtqueue_dump(struct virtqueue *vq);
static inline int
virtqueue_full(const struct virtqueue *vq)
{