From 7f3fc78011c3915612cccf0858820d6caa8c3e08 Mon Sep 17 00:00:00 2001 From: Vlad Zolotarov <vladz@cloudius-systems.com> Date: Wed, 21 May 2014 18:13:02 +0300 Subject: [PATCH] virtio::net::txq: Fix the bug causing the false asserts vec_sz in net::txq::try_xmit_one_locked(net_req*) should be initialized to 1 and not to 0 since there is always net_hdr element and vec_sz is incremented only for fragments not taking into an account the header element. This miscalculation caused vqueue->add_buf() return false while vqueue->avail_ring_has_room(vec_sz) was returning true when the amount of elements in the avail ring was equal to vec_sz since the actual size of the _sg_vec was "vec_sz + 1". Signed-off-by: Vlad Zolotarov <vladz@cloudius-systems.com> Signed-off-by: Avi Kivity <avi@cloudius-systems.com> --- drivers/virtio-net.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/virtio-net.cc b/drivers/virtio-net.cc index 8cc6708ed..f861b319b 100644 --- a/drivers/virtio-net.cc +++ b/drivers/virtio-net.cc @@ -616,7 +616,7 @@ inline int net::txq::xmit_prep(mbuf* m_head, void*& cooky) int net::txq::try_xmit_one_locked(net_req* req) { mbuf *m_head = req->mb, *m; - u16 vec_sz = 0; + u16 vec_sz = 1; u64 tx_bytes = 0; if (_parent->_mergeable_bufs) { -- GitLab