aboutsummaryrefslogtreecommitdiff
path: root/hw/etraxfs_eth.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/etraxfs_eth.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/etraxfs_eth.c')
-rw-r--r--hw/etraxfs_eth.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/hw/etraxfs_eth.c b/hw/etraxfs_eth.c
index 78af76b9bb..c7df44ee45 100644
--- a/hw/etraxfs_eth.c
+++ b/hw/etraxfs_eth.c
@@ -501,7 +501,7 @@ static int eth_can_receive(VLANClientState *vc)
return 1;
}
-static void eth_receive(VLANClientState *vc, const uint8_t *buf, size_t size)
+static ssize_t eth_receive(VLANClientState *vc, const uint8_t *buf, size_t size)
{
unsigned char sa_bcast[6] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
struct fs_eth *eth = vc->opaque;
@@ -510,7 +510,7 @@ static void eth_receive(VLANClientState *vc, const uint8_t *buf, size_t size)
int r_bcast = eth->regs[RW_REC_CTRL] & 8;
if (size < 12)
- return;
+ return -1;
D(printf("%x.%x.%x.%x.%x.%x ma=%d %d bc=%d\n",
buf[0], buf[1], buf[2], buf[3], buf[4], buf[5],
@@ -521,10 +521,12 @@ static void eth_receive(VLANClientState *vc, const uint8_t *buf, size_t size)
&& (!use_ma1 || memcmp(buf, eth->macaddr[1], 6))
&& (!r_bcast || memcmp(buf, sa_bcast, 6))
&& !eth_match_groupaddr(eth, buf))
- return;
+ return size;
/* FIXME: Find another way to pass on the fake csum. */
etraxfs_dmac_input(eth->dma_in, (void *)buf, size + 4, 1);
+
+ return size;
}
static int eth_tx_push(void *opaque, unsigned char *buf, int len)