diff options
-rw-r--r-- | src/drivers/net/virtio-net.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/drivers/net/virtio-net.c b/src/drivers/net/virtio-net.c index 4ec154d..68c84d7 100644 --- a/src/drivers/net/virtio-net.c +++ b/src/drivers/net/virtio-net.c @@ -187,6 +187,8 @@ static int vring_get_buf(int queue_index, unsigned int *len) u32 id; int ret; + BUG_ON(!vring_more_used(queue_index)); + elem = &vr->used->ring[last_used_idx[queue_index] % vr->num]; wmb(); id = elem->id; @@ -365,6 +367,8 @@ static void virtnet_transmit(struct nic *nic, const char *destaddr, vring_add_buf(TX_INDEX, 0, 0); + vring_kick(nic, TX_INDEX, 1); + /* * http://www.etherboot.org/wiki/dev/devmanual * @@ -372,13 +376,11 @@ static void virtnet_transmit(struct nic *nic, const char *destaddr, * before returning from this routine" */ - while (vring_more_used(TX_INDEX)) { + while (!vring_more_used(TX_INDEX)) { mb(); udelay(10); } - vring_kick(nic, TX_INDEX, 1); - /* free desc */ (void)vring_get_buf(TX_INDEX, NULL); |