Skip to content

Commit

Permalink
Merge pull request #1329 from cagatay-y/buffid-fix
Browse files Browse the repository at this point in the history
fix(virtq/split): return id with the correct index for the chain head
  • Loading branch information
mkroening authored Jul 22, 2024
2 parents 979e9e0 + b496e9b commit bd7dbf1
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/drivers/virtio/virtqueue/split.rs
Original file line number Diff line number Diff line change
Expand Up @@ -159,12 +159,11 @@ impl DescrRing {
// need to move [Self::used_ring_ref] lines into a separate scope.
loop {
let used_elem;
let cur_ring_index;
{
if self.read_idx == self.used_ring().idx.to_ne() {
break;
} else {
cur_ring_index = self.read_idx as usize % self.token_ring.len();
let cur_ring_index = self.read_idx as usize % self.token_ring.len();
used_elem = self.used_ring().ring()[cur_ring_index];
}
}
Expand All @@ -184,7 +183,7 @@ impl DescrRing {
queue.try_send(tkn.buff_tkn).unwrap()
}

let mut id_ret_idx = u16::try_from(cur_ring_index).unwrap();
let mut id_ret_idx = u16::try_from(used_elem.id.to_ne()).unwrap();
loop {
self.mem_pool.ret_id(super::MemDescrId(id_ret_idx));
let cur_chain_elem =
Expand Down

0 comments on commit bd7dbf1

Please sign in to comment.