Changeset 417aaafb in mainline for uspace/lib/virtio/virtio.c
- Timestamp:
- 2018-06-25T21:37:48Z (6 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- e3107e2
- Parents:
- ea6840d
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/virtio/virtio.c
rea6840d r417aaafb 63 63 virtq_t *q = &vdev->queues[num]; 64 64 65 fibril_mutex_lock(&q->lock); 65 66 uint16_t idx = pio_read_le16(&q->avail->idx); 66 67 pio_write_le16(&q->avail->ring[idx % q->queue_size], descno); … … 69 70 write_barrier(); 70 71 pio_write_le16(q->notify, num); 72 fibril_mutex_unlock(&q->lock); 71 73 } 72 74 … … 76 78 virtq_t *q = &vdev->queues[num]; 77 79 80 fibril_mutex_lock(&q->lock); 78 81 uint16_t last_idx = q->used_last_idx % q->queue_size; 79 if (last_idx == (pio_read_le16(&q->used->idx) % q->queue_size)) 82 if (last_idx == (pio_read_le16(&q->used->idx) % q->queue_size)) { 83 fibril_mutex_unlock(&q->lock); 80 84 return false; 85 } 81 86 82 87 *descno = (uint16_t) pio_read_le32(&q->used->ring[last_idx].id); … … 84 89 85 90 q->used_last_idx++; 91 fibril_mutex_unlock(&q->lock); 86 92 87 93 return true; … … 132 138 } 133 139 140 fibril_mutex_initialize(&q->lock); 141 134 142 q->size = mem_size; 135 143 q->queue_size = size;
Note:
See TracChangeset
for help on using the changeset viewer.