diff --git a/vioscsi/helper.c b/vioscsi/helper.c index 9574a3111..1a08bd21f 100755 --- a/vioscsi/helper.c +++ b/vioscsi/helper.c @@ -109,7 +109,7 @@ ENTER_FN_SRB(); srbExt->out, srbExt->in, &srbExt->cmd, va, pa); - if (res >= 0) { + if (res == VQ_ADD_BUFFER_SUCCESS) { element = &adaptExt->processing_srbs[index]; InsertTailList(&element->srb_list, &srbExt->list_entry); element->srb_cnt++; @@ -120,13 +120,16 @@ ENTER_FN_SRB(); virtqueue_notify(adaptExt->vq[QueueNumber]); } } else { + // virtqueue_add_buf() returned -28 (ENOSPC), i.e. no space for buffer, or some other error virtqueue_notify(adaptExt->vq[QueueNumber]); ScsiStatus = SCSISTAT_QUEUE_FULL; SRB_SET_SRB_STATUS(Srb, SRB_STATUS_BUSY); SRB_SET_SCSI_STATUS(Srb, ScsiStatus); StorPortBusy(DeviceExtension, 10); + RhelDbgPrint(TRACE_LEVEL_WARNING, + " Could not put an SRB into a VQ, so complete it with SRB_STATUS_BUSY. QueueNumber = %lu, SRB = 0x%p, Lun = %d, TimeOut = %d.\n", + QueueNumber, srbExt->Srb, SRB_LUN(Srb), Srb->TimeOutValue); CompleteRequest(DeviceExtension, Srb); - RhelDbgPrint(TRACE_LEVEL_FATAL, " Could not put an SRB into a VQ, so complete it with SRB_STATUS_BUSY. QueueNumber = %d, SRB = 0x%p, Lun = %d, TimeOut = %d.\n", QueueNumber, srbExt->Srb, SRB_LUN(Srb), Srb->TimeOutValue); } EXIT_FN_SRB(); diff --git a/vioscsi/helper.h b/vioscsi/helper.h index ac38977f0..408b20b4a 100755 --- a/vioscsi/helper.h +++ b/vioscsi/helper.h @@ -49,6 +49,8 @@ #define CACHE_LINE_SIZE 64 #define ROUND_TO_CACHE_LINES(Size) (((ULONG_PTR)(Size) + CACHE_LINE_SIZE - 1) & ~(CACHE_LINE_SIZE - 1)) +#define VQ_ADD_BUFFER_SUCCESS 0 + #include // Note: SrbGetCdbLength is defined in srbhelper.h