aboutsummaryrefslogtreecommitdiffstats
path: root/hw/mipsnet.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/mipsnet.c
parente3f5ec2b5e92706e3b807059f79b1fb5d936e567 (diff)
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/mipsnet.c')
-rw-r--r--hw/mipsnet.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/hw/mipsnet.c b/hw/mipsnet.c
index e9128cbb3..803522949 100644
--- a/hw/mipsnet.c
+++ b/hw/mipsnet.c
@@ -75,7 +75,7 @@ static int mipsnet_can_receive(VLANClientState *vc)
return !mipsnet_buffer_full(s);
}
-static void mipsnet_receive(VLANClientState *vc, const uint8_t *buf, size_t size)
+static ssize_t mipsnet_receive(VLANClientState *vc, const uint8_t *buf, size_t size)
{
MIPSnetState *s = vc->opaque;
@@ -83,7 +83,7 @@ static void mipsnet_receive(VLANClientState *vc, const uint8_t *buf, size_t size
printf("mipsnet: receiving len=%d\n", size);
#endif
if (!mipsnet_can_receive(vc))
- return;
+ return -1;
s->busy = 1;
@@ -98,6 +98,8 @@ static void mipsnet_receive(VLANClientState *vc, const uint8_t *buf, size_t size
/* Now we can signal we have received something. */
s->intctl |= MIPSNET_INTCTL_RXDONE;
mipsnet_update_irq(s);
+
+ return size;
}
static uint32_t mipsnet_ioport_read(void *opaque, uint32_t addr)