aboutsummaryrefslogtreecommitdiffstats
path: root/hw/pcnet.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/pcnet.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/pcnet.c')
-rw-r--r--hw/pcnet.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/hw/pcnet.c b/hw/pcnet.c
index a8297df2a..b5793ff24 100644
--- a/hw/pcnet.c
+++ b/hw/pcnet.c
@@ -1076,16 +1076,17 @@ static int pcnet_can_receive(VLANClientState *vc)
#define MIN_BUF_SIZE 60
-static void pcnet_receive(VLANClientState *vc, const uint8_t *buf, size_t size)
+static ssize_t pcnet_receive(VLANClientState *vc, const uint8_t *buf, size_t size_)
{
PCNetState *s = vc->opaque;
int is_padr = 0, is_bcast = 0, is_ladr = 0;
uint8_t buf1[60];
int remaining;
int crc_err = 0;
+ int size = size_;
if (CSR_DRX(s) || CSR_STOP(s) || CSR_SPND(s) || !size)
- return;
+ return -1;
#ifdef PCNET_DEBUG
printf("pcnet_receive size=%d\n", size);
@@ -1252,6 +1253,8 @@ static void pcnet_receive(VLANClientState *vc, const uint8_t *buf, size_t size)
pcnet_poll(s);
pcnet_update_irq(s);
+
+ return size_;
}
static void pcnet_transmit(PCNetState *s)