diff options
author | Anthony Liguori | 2009-06-11 01:05:55 +0200 |
---|---|---|
committer | Anthony Liguori | 2009-06-11 01:08:35 +0200 |
commit | f8e76fbf5190575c0f927fe3c5b0ec6934c6c3fc (patch) | |
tree | c67bf81b0bfa6b897f4fb7a236962a85819e15f7 /hw/dp8393x.c | |
parent | Fix "defined but not used" warning (diff) | |
parent | virtio-net: Increase filter and control limits (diff) | |
download | qemu-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/dp8393x.c')
-rw-r--r-- | hw/dp8393x.c | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/hw/dp8393x.c b/hw/dp8393x.c index 5aa12119cb..cff84aa0a1 100644 --- a/hw/dp8393x.c +++ b/hw/dp8393x.c @@ -407,9 +407,9 @@ static void do_transmit_packets(dp8393xState *s) if (s->regs[SONIC_RCR] & (SONIC_RCR_LB1 | SONIC_RCR_LB0)) { /* Loopback */ s->regs[SONIC_TCR] |= SONIC_TCR_CRSL; - if (s->vc->fd_can_read(s)) { + if (s->vc->can_receive(s->vc)) { s->loopback_packet = 1; - s->vc->fd_read(s, s->tx_buffer, tx_len); + s->vc->receive(s->vc, s->tx_buffer, tx_len); } } else { /* Transmit packet */ @@ -676,9 +676,9 @@ static CPUWriteMemoryFunc *dp8393x_write[3] = { dp8393x_writel, }; -static int nic_can_receive(void *opaque) +static int nic_can_receive(VLANClientState *vc) { - dp8393xState *s = opaque; + dp8393xState *s = vc->opaque; if (!(s->regs[SONIC_CR] & SONIC_CR_RXEN)) return 0; @@ -725,10 +725,10 @@ static int receive_filter(dp8393xState *s, const uint8_t * buf, int size) return -1; } -static void nic_receive(void *opaque, const uint8_t * buf, int size) +static ssize_t nic_receive(VLANClientState *vc, const uint8_t * buf, size_t size) { uint16_t data[10]; - dp8393xState *s = opaque; + dp8393xState *s = vc->opaque; int packet_type; uint32_t available, address; int width, rx_len = size; @@ -742,7 +742,7 @@ static void nic_receive(void *opaque, const uint8_t * buf, int size) packet_type = receive_filter(s, buf, size); if (packet_type < 0) { DPRINTF("packet not for netcard\n"); - return; + return -1; } /* XXX: Check byte ordering */ @@ -755,7 +755,7 @@ static void nic_receive(void *opaque, const uint8_t * buf, int size) s->memory_rw(s->mem_opaque, address, (uint8_t*)data, size, 0); if (data[0 * width] & 0x1) { /* Still EOL ; stop reception */ - return; + return -1; } else { s->regs[SONIC_CRDA] = s->regs[SONIC_LLFA]; } @@ -833,6 +833,8 @@ static void nic_receive(void *opaque, const uint8_t * buf, int size) /* Done */ dp8393x_update_irq(s); + + return size; } static void nic_reset(void *opaque) @@ -888,8 +890,8 @@ void dp83932_init(NICInfo *nd, target_phys_addr_t base, int it_shift, s->watchdog = qemu_new_timer(vm_clock, dp8393x_watchdog, s); s->regs[SONIC_SR] = 0x0004; /* only revision recognized by Linux */ - s->vc = qemu_new_vlan_client(nd->vlan, nd->model, nd->name, - nic_receive, nic_can_receive, nic_cleanup, s); + s->vc = qemu_new_vlan_client(nd->vlan, nd->model, nd->name, nic_can_receive, + nic_receive, NULL, nic_cleanup, s); qemu_format_nic_info_str(s->vc, nd->macaddr); qemu_register_reset(nic_reset, 0, s); |