@@ -39,7 +39,6 @@ initialize_virtqueue(
IN VOID (*notify)(struct virtqueue *));
-//#define to_vvq(_vq) container_of(_vq, struct vring_virtqueue, vq)
#define to_vvq(_vq) (struct vring_virtqueue *)_vq
static
@@ -119,7 +118,7 @@ vring_add_buf(
RhelDbgPrint(TRACE_LEVEL_VERBOSE, ("%s: Added buffer head %i to %p\n",
__FUNCTION__, head, vq) );
- return 0;
+ return vq->num_free;
}
static
@@ -54,6 +54,8 @@ RhelDoReadWrite(PVOID DeviceExtension,
PVOID DataBuffer;
PADAPTER_EXTENSION adaptExt;
PRHEL_SRB_EXTENSION srbExt;
+ int num_free;
+
cdb = (PCDB)&Srb->Cdb[0];
srbExt = (PRHEL_SRB_EXTENSION)Srb->SrbExtension;
adaptExt = (PADAPTER_EXTENSION)DeviceExtension;
@@ -88,20 +90,21 @@ RhelDoReadWrite(PVOID DeviceExtension,
srbExt->vbr.sg[sgElement].physAddr = ScsiPortGetPhysicalAddress(DeviceExtension, NULL,&srbExt->vbr.status,&fragLen);
srbExt->vbr.sg[sgElement].ulSize = sizeof(srbExt->vbr.status);
-
-
- if (adaptExt->pci_vq_info.vq->vq_ops->add_buf(adaptExt->pci_vq_info.vq,
+ num_free = adaptExt->pci_vq_info.vq->vq_ops->add_buf(adaptExt->pci_vq_info.vq,
&srbExt->vbr.sg[0],
srbExt->out, srbExt->in,
-&srbExt->vbr) == 0) {
+&srbExt->vbr);
+ if ( num_free>= 0) {
InsertTailList(&adaptExt->list_head,&srbExt->vbr.list_entry);
adaptExt->pci_vq_info.vq->vq_ops->kick(adaptExt->pci_vq_info.vq);
- if(++adaptExt->requests< adaptExt->queue_depth) {
+ srbExt->call_next = FALSE;
+ if(num_free< VIRTIO_MAX_SG) {
+ srbExt->call_next = TRUE;
+ } else {
ScsiPortNotification(NextLuRequest, DeviceExtension, Srb->PathId, Srb->TargetId, Srb->Lun);
}
- return TRUE;
}
- return FALSE;
+ return TRUE;
}
#endif