summaryrefslogtreecommitdiff
path: root/hw/dp8393x.c
diff options
context:
space:
mode:
authorMark McLoughlin <markmc@redhat.com>2009-05-18 13:40:55 +0100
committerMark McLoughlin <markmc@redhat.com>2009-06-09 11:38:49 +0100
commit4f1c942b7fb29864ad86cb3af9076da38f38f74e (patch)
tree2f51a121e715476c3986c0ae0b4513be555d8ee8 /hw/dp8393x.c
parente3f5ec2b5e92706e3b807059f79b1fb5d936e567 (diff)
downloadqemu-4f1c942b7fb29864ad86cb3af9076da38f38f74e.tar.gz
qemu-4f1c942b7fb29864ad86cb3af9076da38f38f74e.tar.bz2
qemu-4f1c942b7fb29864ad86cb3af9076da38f38f74e.zip
net: add return value to packet receive handler
This allows us to handle queue full conditions rather than dropping the packet on the floor. Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Diffstat (limited to 'hw/dp8393x.c')
-rw-r--r--hw/dp8393x.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/hw/dp8393x.c b/hw/dp8393x.c
index de399837b9..cff84aa0a1 100644
--- a/hw/dp8393x.c
+++ b/hw/dp8393x.c
@@ -725,7 +725,7 @@ static int receive_filter(dp8393xState *s, const uint8_t * buf, int size)
return -1;
}
-static void nic_receive(VLANClientState *vc, const uint8_t * buf, size_t size)
+static ssize_t nic_receive(VLANClientState *vc, const uint8_t * buf, size_t size)
{
uint16_t data[10];
dp8393xState *s = vc->opaque;
@@ -742,7 +742,7 @@ static void nic_receive(VLANClientState *vc, const uint8_t * buf, size_t size)
packet_type = receive_filter(s, buf, size);
if (packet_type < 0) {
DPRINTF("packet not for netcard\n");
- return;
+ return -1;
}
/* XXX: Check byte ordering */
@@ -755,7 +755,7 @@ static void nic_receive(VLANClientState *vc, const uint8_t * buf, size_t size)
s->memory_rw(s->mem_opaque, address, (uint8_t*)data, size, 0);
if (data[0 * width] & 0x1) {
/* Still EOL ; stop reception */
- return;
+ return -1;
} else {
s->regs[SONIC_CRDA] = s->regs[SONIC_LLFA];
}
@@ -833,6 +833,8 @@ static void nic_receive(VLANClientState *vc, const uint8_t * buf, size_t size)
/* Done */
dp8393x_update_irq(s);
+
+ return size;
}
static void nic_reset(void *opaque)