~jderose/ubuntu/raring/qemu/vde-again

« back to all changes in this revision

Viewing changes to hw/mipsnet.c

  • Committer: Bazaar Package Importer
  • Author(s): Riku Voipio, Josh Triplett, Riku Voipio
  • Date: 2009-07-29 13:28:05 UTC
  • mfrom: (1.4.1 upstream)
  • mto: (12.1.1 sid) (10.1.13 sid)
  • mto: This revision was merged to the branch mainline in revision 13.
  • Revision ID: james.westby@ubuntu.com-20090729132805-cau7rfexh7dawyb8
Tags: 0.10.50+git20090729-1
[ Josh Triplett ]
* Remove myself from Uploaders.

[ Riku Voipio ]
* new upstream RC version
* nuke all linux-user patches (applied upstream)
  06_exit_segfault
  12_signal_powerpc_support
  21_net_soopts
  30_syscall_ipc
  32_syscall_sysctl
  35_syscall_sockaddr
  48_signal_terminate
  55_unmux_socketcall
* nuke all other applied-upstream patches
  01_nostrip (better version upstream)
  07_i386_exec_name (can be reintroduced in debian/rules)
  50_linuxbios_isa_bios_ram (shouldn't be needed anymore)
  51_linuxbios_piix_ram_size (applied)
  56_dhcp (crap)
  60_ppc_ld (reintroduce if needed)
  64_ppc_asm_constraints (ditto)
  66_tls_ld.patch (ditto)
  81_compile_dtb.patch (applied upstream)
  82_qemu-img_decimal (ditto)
* move to git
* simplify build rules
* Correct my email address

Show diffs side-by-side

added added

removed removed

Lines of Context:
66
66
    return 0;
67
67
}
68
68
 
69
 
static int mipsnet_can_receive(void *opaque)
 
69
static int mipsnet_can_receive(VLANClientState *vc)
70
70
{
71
 
    MIPSnetState *s = opaque;
 
71
    MIPSnetState *s = vc->opaque;
72
72
 
73
73
    if (s->busy)
74
74
        return 0;
75
75
    return !mipsnet_buffer_full(s);
76
76
}
77
77
 
78
 
static void mipsnet_receive(void *opaque, const uint8_t *buf, int size)
 
78
static ssize_t mipsnet_receive(VLANClientState *vc, const uint8_t *buf, size_t size)
79
79
{
80
 
    MIPSnetState *s = opaque;
 
80
    MIPSnetState *s = vc->opaque;
81
81
 
82
82
#ifdef DEBUG_MIPSNET_RECEIVE
83
83
    printf("mipsnet: receiving len=%d\n", size);
84
84
#endif
85
 
    if (!mipsnet_can_receive(opaque))
86
 
        return;
 
85
    if (!mipsnet_can_receive(vc))
 
86
        return -1;
87
87
 
88
88
    s->busy = 1;
89
89
 
98
98
    /* Now we can signal we have received something. */
99
99
    s->intctl |= MIPSNET_INTCTL_RXDONE;
100
100
    mipsnet_update_irq(s);
 
101
 
 
102
    return size;
101
103
}
102
104
 
103
105
static uint32_t mipsnet_ioport_read(void *opaque, uint32_t addr)
261
263
    s->io_base = base;
262
264
    s->irq = irq;
263
265
    if (nd && nd->vlan) {
264
 
        s->vc = qemu_new_vlan_client(nd->vlan, nd->model, nd->name,
265
 
                                     mipsnet_receive, mipsnet_can_receive,
266
 
                                     mipsnet_cleanup, s);
 
266
        s->vc = nd->vc = qemu_new_vlan_client(nd->vlan, nd->model, nd->name,
 
267
                                              mipsnet_can_receive, mipsnet_receive,
 
268
                                              NULL, mipsnet_cleanup, s);
267
269
    } else {
268
270
        s->vc = NULL;
269
271
    }