aboutsummaryrefslogtreecommitdiff
path: root/hw/pcnet.c
diff options
context:
space:
mode:
Diffstat (limited to 'hw/pcnet.c')
-rw-r--r--hw/pcnet.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/hw/pcnet.c b/hw/pcnet.c
index c44ba7edf4..b5793ff246 100644
--- a/hw/pcnet.c
+++ b/hw/pcnet.c
@@ -1062,9 +1062,9 @@ static int pcnet_tdte_poll(PCNetState *s)
return !!(CSR_CXST(s) & 0x8000);
}
-static int pcnet_can_receive(void *opaque)
+static int pcnet_can_receive(VLANClientState *vc)
{
- PCNetState *s = opaque;
+ PCNetState *s = vc->opaque;
if (CSR_STOP(s) || CSR_SPND(s))
return 0;
@@ -1076,16 +1076,17 @@ static int pcnet_can_receive(void *opaque)
#define MIN_BUF_SIZE 60
-static void pcnet_receive(void *opaque, const uint8_t *buf, int size)
+static ssize_t pcnet_receive(VLANClientState *vc, const uint8_t *buf, size_t size_)
{
- PCNetState *s = opaque;
+ 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(void *opaque, const uint8_t *buf, int size)
pcnet_poll(s);
pcnet_update_irq(s);
+
+ return size_;
}
static void pcnet_transmit(PCNetState *s)
@@ -1302,7 +1305,7 @@ static void pcnet_transmit(PCNetState *s)
if (BCR_SWSTYLE(s) == 1)
add_crc = !GET_FIELD(tmd.status, TMDS, NOFCS);
s->looptest = add_crc ? PCNET_LOOPTEST_CRC : PCNET_LOOPTEST_NOCRC;
- pcnet_receive(s, s->buffer, s->xmit_pos);
+ pcnet_receive(s->vc, s->buffer, s->xmit_pos);
s->looptest = 0;
} else
if (s->vc)
@@ -1952,7 +1955,7 @@ static void pcnet_common_init(DeviceState *dev, PCNetState *s,
qdev_get_macaddr(dev, s->macaddr);
s->vc = qdev_get_vlan_client(dev,
- pcnet_receive, pcnet_can_receive,
+ pcnet_can_receive, pcnet_receive, NULL,
cleanup, s);
pcnet_h_reset(s);
register_savevm("pcnet", -1, 2, pcnet_save, pcnet_load, s);