Skip to content
Snippets Groups Projects
Commit a6c674c7 authored by Dor Laor's avatar Dor Laor
Browse files

Fix a bug of updating the the next descriptor target

parent 2e8d587d
No related branches found
No related tags found
No related merge requests found
...@@ -102,13 +102,13 @@ namespace virtio { ...@@ -102,13 +102,13 @@ namespace virtio {
_cookie[idx] = cookie; _cookie[idx] = cookie;
for (auto ii = sg->_nodes.begin(); i < in + out; ii++, i++) { for (auto ii = sg->_nodes.begin(); i < in + out; ii++, i++) {
//debug(fmt("\t%s: idx=%d, len=%d, paddr=%x") % __FUNCTION__ % idx % (*ii)._len % (*ii)._paddr);
_desc[idx]._flags = vring_desc::VRING_DESC_F_NEXT; _desc[idx]._flags = vring_desc::VRING_DESC_F_NEXT;
_desc[idx]._flags |= (i>=out)? vring_desc::VRING_DESC_F_WRITE:0; _desc[idx]._flags |= (i>=out)? vring_desc::VRING_DESC_F_WRITE:0;
_desc[idx]._paddr = (*ii)._paddr; _desc[idx]._paddr = (*ii)._paddr;
_desc[idx]._len = (*ii)._len; _desc[idx]._len = (*ii)._len;
prev_idx = idx; prev_idx = idx;
idx = _desc[idx]._next; idx = _desc[idx]._next;
//debug(fmt("\t%s: idx=%d, len=%d, paddr=%x") % __FUNCTION__ % idx % (*ii)._len % (*ii)._paddr);
} }
_desc[prev_idx]._flags &= ~vring_desc::VRING_DESC_F_NEXT; _desc[prev_idx]._flags &= ~vring_desc::VRING_DESC_F_NEXT;
...@@ -120,7 +120,7 @@ namespace virtio { ...@@ -120,7 +120,7 @@ namespace virtio {
_avail_head = idx; _avail_head = idx;
//debug(fmt("\t%s: avail_head=%d, added=%d,") % __FUNCTION__ % _avail->_idx % _avail_added_since_kick); //debug(fmt("\t%s: _avail_idx=%d, added=%d,") % __FUNCTION__ % _avail->_idx % _avail_added_since_kick);
return true; return true;
} }
...@@ -154,7 +154,7 @@ namespace virtio { ...@@ -154,7 +154,7 @@ namespace virtio {
_used_guest_head++; _used_guest_head++;
_avail_count += i; _avail_count += i;
_desc[elem._id]._next = _avail_head; _desc[idx]._next = _avail_head;
_avail_head = elem._id; _avail_head = elem._id;
return cookie; return cookie;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment