Virtio handle batched and suppressed requests
This commit is contained in:
parent
03b4776881
commit
309175f23d
10
lib/9p.js
10
lib/9p.js
|
@ -116,8 +116,13 @@ function Virtio9p(filesystem, cpu, bus) {
|
|||
{
|
||||
return;
|
||||
}
|
||||
var bufchain = this.virtqueue.pop_request();
|
||||
this.ReceiveRequest(bufchain);
|
||||
while(this.virtqueue.has_request())
|
||||
{
|
||||
var bufchain = this.virtqueue.pop_request();
|
||||
this.ReceiveRequest(bufchain);
|
||||
}
|
||||
this.virtqueue.notify_me_after(0);
|
||||
this.virtqueue.flush_replies();
|
||||
},
|
||||
],
|
||||
},
|
||||
|
@ -212,7 +217,6 @@ Virtio9p.prototype.SendError = function (tag, errormsg, errorcode) {
|
|||
Virtio9p.prototype.SendReply = function (bufchain) {
|
||||
bufchain.set_next_blob(this.replybuffer.subarray(0, this.replybuffersize));
|
||||
this.virtqueue.push_reply(bufchain);
|
||||
this.virtqueue.flush_replies();
|
||||
}
|
||||
|
||||
Virtio9p.prototype.ReceiveRequest = function (bufchain) {
|
||||
|
|
|
@ -1237,6 +1237,20 @@ VirtQueue.prototype.flush_replies = function()
|
|||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* If using VIRTIO_F_RING_EVENT_IDX, device must tell driver when
|
||||
* to get notifications or else driver won't notify regularly.
|
||||
* @param {number} num_skipped_requests Zero = get notified in the next request.
|
||||
*/
|
||||
VirtQueue.prototype.notify_me_after = function(num_skipped_requests)
|
||||
{
|
||||
dbg_assert(num_skipped_requests >= 0, "Must skip a non-negative number of requests");
|
||||
|
||||
// The 16 bit idx field wraps around after 2^16
|
||||
var avail_event = this.avail.get_idx() + num_skipped_requests & 0xFFFF;
|
||||
this.used.set_avail_event(avail_event);
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {number} address
|
||||
*/
|
||||
|
|
Loading…
Reference in a new issue