qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v4 14/18] virtio-scsi: process control queue req


From: Hu Tao
Subject: Re: [Qemu-devel] [PATCH v4 14/18] virtio-scsi: process control queue requests
Date: Fri, 24 Feb 2012 15:54:37 +0800
User-agent: Mutt/1.5.21 (2010-09-15)

On Wed, Feb 22, 2012 at 03:33:52PM +0100, Paolo Bonzini wrote:
> Reviewed-by: Stefan Hajnoczi <address@hidden>
> Signed-off-by: Paolo Bonzini <address@hidden>
> ---
>  hw/virtio-scsi.c |  134 ++++++++++++++++++++++++++++++++++++++++++++++++++---
>  1 files changed, 126 insertions(+), 8 deletions(-)
> 
> diff --git a/hw/virtio-scsi.c b/hw/virtio-scsi.c
> index f4eb8c7..380073a 100644
> --- a/hw/virtio-scsi.c
> +++ b/hw/virtio-scsi.c
> @@ -134,6 +134,7 @@ typedef struct {
>      VirtQueue *cmd_vq;
>      uint32_t sense_size;
>      uint32_t cdb_size;
> +    int resetting;
>  } VirtIOSCSI;
>  
>  typedef struct VirtIOSCSIReq {
> @@ -236,15 +237,104 @@ static VirtIOSCSIReq *virtio_scsi_pop_req(VirtIOSCSI 
> *s, VirtQueue *vq)
>      return req;
>  }
>  
> -static void virtio_scsi_fail_ctrl_req(VirtIOSCSIReq *req)
> +static void virtio_scsi_do_tmf(VirtIOSCSI *s, VirtIOSCSIReq *req)
>  {
> -    if (req->req.tmf->type == VIRTIO_SCSI_T_TMF) {
> -        req->resp.tmf->response = VIRTIO_SCSI_S_FAILURE;
> -    } else {
> -        req->resp.an->response = VIRTIO_SCSI_S_FAILURE;
> +    SCSIDevice *d = virtio_scsi_device_find(s, req->req.cmd->lun);

should be req->req.tmf->lun here and elsewhere in this function?

diff --git a/hw/virtio-scsi.c b/hw/virtio-scsi.c
index 380073a..1f3b851 100644
--- a/hw/virtio-scsi.c
+++ b/hw/virtio-scsi.c
@@ -239,7 +239,7 @@ static VirtIOSCSIReq *virtio_scsi_pop_req(VirtIOSCSI *s, 
VirtQueue *vq)
 
 static void virtio_scsi_do_tmf(VirtIOSCSI *s, VirtIOSCSIReq *req)
 {
-    SCSIDevice *d = virtio_scsi_device_find(s, req->req.cmd->lun);
+    SCSIDevice *d = virtio_scsi_device_find(s, req->req.tmf->lun);
     SCSIRequest *r, *next;
     DeviceState *qdev;
     int target;
@@ -253,11 +253,11 @@ static void virtio_scsi_do_tmf(VirtIOSCSI *s, 
VirtIOSCSIReq *req)
         if (!d) {
             goto fail;
         }
-        if (d->lun != virtio_scsi_get_lun(req->req.cmd->lun)) {
+        if (d->lun != virtio_scsi_get_lun(req->req.tmf->lun)) {
             goto incorrect_lun;
         }
         QTAILQ_FOREACH_SAFE(r, &d->requests, next, next) {
-            if (r->tag == req->req.cmd->tag) {
+            if (r->tag == req->req.tmf->tag) {
                 break;
             }
         }
@@ -277,7 +277,7 @@ static void virtio_scsi_do_tmf(VirtIOSCSI *s, VirtIOSCSIReq 
*req)
         if (!d) {
             goto fail;
         }
-        if (d->lun != virtio_scsi_get_lun(req->req.cmd->lun)) {
+        if (d->lun != virtio_scsi_get_lun(req->req.tmf->lun)) {
             goto incorrect_lun;
         }
         s->resetting++;
@@ -291,7 +291,7 @@ static void virtio_scsi_do_tmf(VirtIOSCSI *s, VirtIOSCSIReq 
*req)
         if (!d) {
             goto fail;
         }
-        if (d->lun != virtio_scsi_get_lun(req->req.cmd->lun)) {
+        if (d->lun != virtio_scsi_get_lun(req->req.tmf->lun)) {
             goto incorrect_lun;
         }
         QTAILQ_FOREACH_SAFE(r, &d->requests, next, next) {
@@ -310,7 +310,7 @@ static void virtio_scsi_do_tmf(VirtIOSCSI *s, VirtIOSCSIReq 
*req)
         break;
 
     case VIRTIO_SCSI_T_TMF_I_T_NEXUS_RESET:
-        target = req->req.cmd->lun[1];
+        target = req->req.tmf->lun[1];
         s->resetting++;
         QTAILQ_FOREACH(qdev, &s->bus.qbus.children, sibling) {
              d = DO_UPCAST(SCSIDevice, qdev, qdev);

-- 
Thanks,
Hu Tao



reply via email to

[Prev in Thread] Current Thread [Next in Thread]