NULL, NULL, ð_writel,
};
-static int eth_can_rx(void *opaque)
+static int eth_can_rx(VLANClientState *vc)
{
- struct xlx_ethlite *s = opaque;
+ struct xlx_ethlite *s = vc->opaque;
int r;
r = !(s->regs[R_RX_CTRL0] & CTRL_S);
qemu_log("%s %d\n", __func__, r);
return r;
}
-static void eth_rx(void *opaque, const uint8_t *buf, int size)
+static ssize_t eth_rx(VLANClientState *vc, const uint8_t *buf, size_t size)
{
- struct xlx_ethlite *s = opaque;
+ struct xlx_ethlite *s = vc->opaque;
unsigned int rxbase = s->rxbuf * (0x800 / 4);
int i;
/* DA filter. */
if (!(buf[0] & 0x80) && memcmp(&s->macaddr[0], buf, 6))
- return;
+ return size;
if (s->regs[rxbase + R_RX_CTRL0] & CTRL_S) {
D(qemu_log("ethlite lost packet %x\n", s->regs[R_RX_CTRL0]));
- return;
+ return -1;
}
D(qemu_log("%s %d rxbase=%x\n", __func__, size, rxbase));
/* If c_rx_pingpong was set flip buffers. */
s->rxbuf ^= s->c_rx_pingpong;
- return;
+ return size;
}
static void eth_cleanup(VLANClientState *vc)
qdev_get_macaddr(&dev->qdev, s->macaddr);
s->vc = qdev_get_vlan_client(&dev->qdev,
- eth_rx, eth_can_rx, eth_cleanup, s);
+ eth_can_rx, eth_rx, NULL, eth_cleanup, s);
}
static void xilinx_ethlite_register(void)