From c9f87b20b996b1005b646281195d61412ba2b844 Mon Sep 17 00:00:00 2001 From: Fam Zheng Date: Thu, 22 May 2014 16:22:43 +0800 Subject: [PATCH] dataplane: Support VIRTIO_BLK_T_SCSI_CMD Signed-off-by: Fam Zheng Signed-off-by: Stefan Hajnoczi --- hw/block/dataplane/virtio-blk.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/hw/block/dataplane/virtio-blk.c b/hw/block/dataplane/virtio-blk.c index 217992b666..c10b7b70fb 100644 --- a/hw/block/dataplane/virtio-blk.c +++ b/hw/block/dataplane/virtio-blk.c @@ -204,6 +204,15 @@ static void do_flush_cmd(VirtIOBlockDataPlane *s, VirtQueueElement *elem, bdrv_aio_flush(s->blk->conf.bs, complete_flush, req); } +static void do_scsi_cmd(VirtIOBlockDataPlane *s, VirtQueueElement *elem, + QEMUIOVector *inhdr) +{ + int status; + + status = virtio_blk_handle_scsi_req(VIRTIO_BLK(s->vdev), elem); + complete_request_early(s, elem, inhdr, status); +} + static int process_request(VirtIOBlockDataPlane *s, VirtQueueElement *elem) { struct iovec *iov = elem->out_sg; @@ -252,8 +261,7 @@ static int process_request(VirtIOBlockDataPlane *s, VirtQueueElement *elem) return 0; case VIRTIO_BLK_T_SCSI_CMD: - /* TODO support SCSI commands */ - complete_request_early(s, elem, inhdr, VIRTIO_BLK_S_UNSUPP); + do_scsi_cmd(s, elem, inhdr); return 0; case VIRTIO_BLK_T_FLUSH: @@ -330,12 +338,6 @@ void virtio_blk_data_plane_create(VirtIODevice *vdev, VirtIOBlkConf *blk, return; } - if (blk->scsi) { - error_setg(errp, - "device is incompatible with x-data-plane, use scsi=off"); - return; - } - /* If dataplane is (re-)enabled while the guest is running there could be * block jobs that can conflict. */ -- 2.11.4.GIT