git: f7c086f2c27d - stable/13 - bhyve virtio-scsi: Fix residual reporting.

From: Alexander Motin <mav_at_FreeBSD.org>
Date: Sat, 17 Dec 2022 19:19:00 UTC
The branch stable/13 has been updated by mav:

URL: https://cgit.FreeBSD.org/src/commit/?id=f7c086f2c27d185ee831947378de9671298387db

commit f7c086f2c27d185ee831947378de9671298387db
Author:     Alexander Motin <mav@FreeBSD.org>
AuthorDate: 2022-12-03 15:08:20 +0000
Commit:     Alexander Motin <mav@FreeBSD.org>
CommitDate: 2022-12-17 19:18:38 +0000

    bhyve virtio-scsi: Fix residual reporting.
    
    CTL does not really use residual field and it always returned zero.
    Use ext_data_filled instead.
    
    MFC after:      2 weeks
    
    (cherry picked from commit b81ac5cdc355029b4d5723fcdfcbcbedeb94dcd9)
---
 usr.sbin/bhyve/pci_virtio_scsi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/usr.sbin/bhyve/pci_virtio_scsi.c b/usr.sbin/bhyve/pci_virtio_scsi.c
index 563798f19b07..e00591a603e0 100644
--- a/usr.sbin/bhyve/pci_virtio_scsi.c
+++ b/usr.sbin/bhyve/pci_virtio_scsi.c
@@ -559,7 +559,7 @@ pci_vtscsi_request_handle(struct pci_vtscsi_queue *q, struct iovec *iov_in,
 	} else {
 		cmd_wr->sense_len = MIN(io->scsiio.sense_len,
 		    sc->vss_config.sense_size);
-		cmd_wr->residual = io->scsiio.residual;
+		cmd_wr->residual = ext_data_len - io->scsiio.ext_data_filled;
 		cmd_wr->status = io->scsiio.scsi_status;
 		cmd_wr->response = VIRTIO_SCSI_S_OK;
 		memcpy(&cmd_wr->sense, &io->scsiio.sense_data,