aboutsummaryrefslogtreecommitdiff
path: root/net.c
diff options
context:
space:
mode:
authorMark McLoughlin <markmc@redhat.com>2009-04-29 11:34:52 +0100
committerMark McLoughlin <markmc@redhat.com>2009-06-09 11:38:50 +0100
commit3e021d40b7548b2eeec62a082411c0745a5c635f (patch)
treeaa51710f211d9b0ee4869acf5681bbeb70b6ab32 /net.c
parent4f1c942b7fb29864ad86cb3af9076da38f38f74e (diff)
net: return status from qemu_deliver_packet()
Will allow qemu_send_packet() handle queue full condition. Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Diffstat (limited to 'net.c')
-rw-r--r--net.c20
1 files changed, 17 insertions, 3 deletions
diff --git a/net.c b/net.c
index 8403120750..e48b0fe5e7 100644
--- a/net.c
+++ b/net.c
@@ -409,16 +409,30 @@ int qemu_can_send_packet(VLANClientState *sender)
return 0;
}
-static void
+static int
qemu_deliver_packet(VLANClientState *sender, const uint8_t *buf, int size)
{
VLANClientState *vc;
+ int ret = -1;
for (vc = sender->vlan->first_client; vc != NULL; vc = vc->next) {
- if (vc != sender && !vc->link_down) {
- vc->receive(vc, buf, size);
+ ssize_t len;
+
+ if (vc == sender) {
+ continue;
+ }
+
+ if (vc->link_down) {
+ ret = size;
+ continue;
}
+
+ len = vc->receive(vc, buf, size);
+
+ ret = (ret >= 0) ? ret : len;
}
+
+ return ret;
}
void qemu_send_packet(VLANClientState *vc, const uint8_t *buf, int size)