static void vscsi_transfer_data(SCSIRequest *sreq, uint32_t len)

{

    VSCSIState *s = VIO_SPAPR_VSCSI_DEVICE(sreq->bus->qbus.parent);

    vscsi_req *req = sreq->hba_private;

    uint8_t *buf;

    int rc = 0;



    DPRINTF("VSCSI: SCSI xfer complete tag=0x%x len=0x%x, req=%p\n",

            sreq->tag, len, req);

    if (req == NULL) {

        fprintf(stderr, "VSCSI: Can't find request for tag 0x%x\n", sreq->tag);

        return;

    }



    if (len) {

        buf = scsi_req_get_buf(sreq);

        rc = vscsi_srp_transfer_data(s, req, req->writing, buf, len);

    }

    if (rc < 0) {

        fprintf(stderr, "VSCSI: RDMA error rc=%d!\n", rc);

        vscsi_makeup_sense(s, req, HARDWARE_ERROR, 0, 0);

        scsi_req_abort(req->sreq, CHECK_CONDITION);

        return;

    }



    /* Start next chunk */

    req->data_len -= rc;

    scsi_req_continue(sreq);

}

static void vscsi_transfer_data(SCSIRequest *sreq, uint32_t len)

{

    VSCSIState *s = VIO_SPAPR_VSCSI_DEVICE(sreq->bus->qbus.parent);

    vscsi_req *req = sreq->hba_private;

    uint8_t *buf;

    int rc = 0;



    DPRINTF("VSCSI: SCSI xfer complete tag=0x%x len=0x%x, req=%p\n",

            sreq->tag, len, req);

    if (req == NULL) {

        fprintf(stderr, "VSCSI: Can't find request for tag 0x%x\n", sreq->tag);

        return;

    }



    if (len) {

        buf = scsi_req_get_buf(sreq);

        rc = vscsi_srp_transfer_data(s, req, req->writing, buf, len);

    }

    if (rc < 0) {

        fprintf(stderr, "VSCSI: RDMA error rc=%d!\n", rc);

        vscsi_makeup_sense(s, req, HARDWARE_ERROR, 0, 0);

        scsi_req_abort(req->sreq, CHECK_CONDITION);

        return;

    }



    

    req->data_len -= rc;

    scsi_req_continue(sreq);

}

static void FUNC_0(SCSIRequest *VAR_0, uint32_t VAR_1)

{

    VSCSIState *s = VIO_SPAPR_VSCSI_DEVICE(VAR_0->bus->qbus.parent);

    vscsi_req *req = VAR_0->hba_private;

    uint8_t *buf;

    int VAR_2 = 0;



    DPRINTF("VSCSI: SCSI xfer complete tag=0x%x VAR_1=0x%x, req=%p\n",

            VAR_0->tag, VAR_1, req);

    if (req == NULL) {

        fprintf(stderr, "VSCSI: Can't find request for tag 0x%x\n", VAR_0->tag);

        return;

    }



    if (VAR_1) {

        buf = scsi_req_get_buf(VAR_0);

        VAR_2 = vscsi_srp_transfer_data(s, req, req->writing, buf, VAR_1);

    }

    if (VAR_2 < 0) {

        fprintf(stderr, "VSCSI: RDMA error VAR_2=%d!\n", VAR_2);

        vscsi_makeup_sense(s, req, HARDWARE_ERROR, 0, 0);

        scsi_req_abort(req->VAR_0, CHECK_CONDITION);

        return;

    }



    

    req->data_len -= VAR_2;

    scsi_req_continue(VAR_0);

}

static void FUNC_0(SCSIRequest *VAR_0, uint32_t VAR_1)
{ VSCSIState *s = VIO_SPAPR_VSCSI_DEVICE(VAR_0->bus->qbus.parent); vscsi_req *req = VAR_0->hba_private; uint8_t *buf; int VAR_2 = 0; DPRINTF("VSCSI: SCSI xfer complete tag=0x%x VAR_1=0x%x, req=%p\n",
VAR_0->tag, VAR_1, req); if (req == NULL) { fprintf(stderr, "VSCSI: Can't find request for tag 0x%x\n", VAR_0->tag); return; } if (VAR_1) { buf = scsi_req_get_buf(VAR_0); VAR_2 = vscsi_srp_transfer_data(s, req, req->writing, buf, VAR_1); } if (VAR_2 < 0) { fprintf(stderr, "VSCSI: RDMA error VAR_2=%d!\n", VAR_2); vscsi_makeup_sense(s, req, HARDWARE_ERROR, 0, 0); scsi_req_abort(req->VAR_0, CHECK_CONDITION); return; } req->data_len -= VAR_2; scsi_req_continue(VAR_0); }