aboutsummaryrefslogtreecommitdiff
path: root/hw/stellaris_enet.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/stellaris_enet.c
parente3f5ec2b5e92706e3b807059f79b1fb5d936e567 (diff)
downloadqemu-4f1c942b7fb29864ad86cb3af9076da38f38f74e.zip
qemu-4f1c942b7fb29864ad86cb3af9076da38f38f74e.tar.gz
qemu-4f1c942b7fb29864ad86cb3af9076da38f38f74e.tar.bz2
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/stellaris_enet.c')
-rw-r--r--hw/stellaris_enet.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/hw/stellaris_enet.c b/hw/stellaris_enet.c
index 7f30829..f5b83e4 100644
--- a/hw/stellaris_enet.c
+++ b/hw/stellaris_enet.c
@@ -78,7 +78,7 @@ static void stellaris_enet_update(stellaris_enet_state *s)
}
/* TODO: Implement MAC address filtering. */
-static void stellaris_enet_receive(VLANClientState *vc, const uint8_t *buf, size_t size)
+static ssize_t stellaris_enet_receive(VLANClientState *vc, const uint8_t *buf, size_t size)
{
stellaris_enet_state *s = vc->opaque;
int n;
@@ -86,10 +86,10 @@ static void stellaris_enet_receive(VLANClientState *vc, const uint8_t *buf, size
uint32_t crc;
if ((s->rctl & SE_RCTL_RXEN) == 0)
- return;
+ return -1;
if (s->np >= 31) {
DPRINTF("Packet dropped\n");
- return;
+ return -1;
}
DPRINTF("Received packet len=%d\n", size);
@@ -116,6 +116,8 @@ static void stellaris_enet_receive(VLANClientState *vc, const uint8_t *buf, size
s->ris |= SE_INT_RX;
stellaris_enet_update(s);
+
+ return size;
}
static int stellaris_enet_can_receive(VLANClientState *vc)