summaryrefslogtreecommitdiffstats
path: root/hw/stellaris_enet.c
diff options
context:
space:
mode:
authorAnthony Liguori2009-06-11 01:05:55 +0200
committerAnthony Liguori2009-06-11 01:08:35 +0200
commitf8e76fbf5190575c0f927fe3c5b0ec6934c6c3fc (patch)
treec67bf81b0bfa6b897f4fb7a236962a85819e15f7 /hw/stellaris_enet.c
parentFix "defined but not used" warning (diff)
parentvirtio-net: Increase filter and control limits (diff)
downloadqemu-f8e76fbf5190575c0f927fe3c5b0ec6934c6c3fc.tar.gz
qemu-f8e76fbf5190575c0f927fe3c5b0ec6934c6c3fc.tar.xz
qemu-f8e76fbf5190575c0f927fe3c5b0ec6934c6c3fc.zip
Merge branch 'net-queue'
* net-queue: (28 commits) virtio-net: Increase filter and control limits virtio-net: Add new RX filter controls virtio-net: MAC filter optimization virtio-net: Fix MAC filter overflow handling virtio-net: reorganize receive_filter() virtio-net: Use a byte to store RX mode flags virtio-net: Add version_id 7 placeholder for vnet header support virtio-net: implement rx packet queueing net: make use of async packet sending API in tap client net: add qemu_send_packet_async() net: split out packet queueing and flushing into separate functions net: return status from qemu_deliver_packet() net: add return value to packet receive handler net: pass VLANClientState* as first arg to receive handlers net: re-name vc->fd_read() to vc->receive() net: add fd_readv() handler to qemu_new_vlan_client() args net: only read from tapfd when we can send net: vlan clients with no fd_can_read() can always receive net: move the tap buffer into TAPState net: factor tap_read_packet() out of tap_send() ... Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'hw/stellaris_enet.c')
-rw-r--r--hw/stellaris_enet.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/hw/stellaris_enet.c b/hw/stellaris_enet.c
index 36fabd3260..f5b83e445c 100644
--- a/hw/stellaris_enet.c
+++ b/hw/stellaris_enet.c
@@ -78,18 +78,18 @@ static void stellaris_enet_update(stellaris_enet_state *s)
}
/* TODO: Implement MAC address filtering. */
-static void stellaris_enet_receive(void *opaque, const uint8_t *buf, int size)
+static ssize_t stellaris_enet_receive(VLANClientState *vc, const uint8_t *buf, size_t size)
{
- stellaris_enet_state *s = (stellaris_enet_state *)opaque;
+ stellaris_enet_state *s = vc->opaque;
int n;
uint8_t *p;
uint32_t crc;
if ((s->rctl & SE_RCTL_RXEN) == 0)
- return;
+ return -1;
if (s->np >= 31) {
DPRINTF("Packet dropped\n");
- return;
+ return -1;
}
DPRINTF("Received packet len=%d\n", size);
@@ -116,11 +116,13 @@ static void stellaris_enet_receive(void *opaque, const uint8_t *buf, int size)
s->ris |= SE_INT_RX;
stellaris_enet_update(s);
+
+ return size;
}
-static int stellaris_enet_can_receive(void *opaque)
+static int stellaris_enet_can_receive(VLANClientState *vc)
{
- stellaris_enet_state *s = (stellaris_enet_state *)opaque;
+ stellaris_enet_state *s = vc->opaque;
if ((s->rctl & SE_RCTL_RXEN) == 0)
return 1;
@@ -128,9 +130,9 @@ static int stellaris_enet_can_receive(void *opaque)
return (s->np < 31);
}
-static uint32_t stellaris_enet_read(void *opaque, target_phys_addr_t offset)
+static uint32_t stellaris_enet_read(VLANClientState *vc, target_phys_addr_t offset)
{
- stellaris_enet_state *s = (stellaris_enet_state *)opaque;
+ stellaris_enet_state *s = vc->opaque;
uint32_t val;
switch (offset) {
@@ -405,8 +407,8 @@ static void stellaris_enet_init(SysBusDevice *dev)
qdev_get_macaddr(&dev->qdev, s->macaddr);
s->vc = qdev_get_vlan_client(&dev->qdev,
- stellaris_enet_receive,
stellaris_enet_can_receive,
+ stellaris_enet_receive, NULL,
stellaris_enet_cleanup, s);
qemu_format_nic_info_str(s->vc, s->macaddr);