stellaris_enet: Flush queued packets when read done
commit1ef4a6069f8b4c09c3383cd4b8e27b6ff25b2d41
authorFam Zheng <famz@redhat.com>
Wed, 15 Jul 2015 10:19:11 +0000 (15 18:19 +0800)
committerStefan Hajnoczi <stefanha@redhat.com>
Mon, 27 Jul 2015 13:12:18 +0000 (27 14:12 +0100)
tree8a4084bb796f34fcbdb5a96b781626a45d2ac899
parent1dd58ae0583c3d3fb15fa1d563d6b497558d3ad0
stellaris_enet: Flush queued packets when read done

If s->np reaches 31, the queue will be disabled by peer when it sees
stellaris_enet_can_receive() returns false, until we explicitly flushes
it which notifies the peer. Do this when guest is done reading all
existing data.

Move the semantics to stellaris_enet_receive, by returning 0 when the
buffer is full, so that new packets will be queued.  In
stellaris_enet_read, flush and restart the queue when guest has done
reading.

Signed-off-by: Fam Zheng <famz@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Jason Wang <jasowang@redhat.com>
Message-id: 1436955553-22791-11-git-send-email-famz@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
hw/net/stellaris_enet.c