static void eth_receive(void *opaque, const uint8_t *buf, size_t size)

{

    mv88w8618_eth_state *s = opaque;

    uint32_t desc_addr;

    mv88w8618_rx_desc desc;

    int i;



    for (i = 0; i < 4; i++) {

        desc_addr = s->cur_rx[i];

        if (!desc_addr)

            continue;

        do {

            eth_rx_desc_get(desc_addr, &desc);

            if ((desc.cmdstat & MP_ETH_RX_OWN) && desc.buffer_size >= size) {

                cpu_physical_memory_write(desc.buffer + s->vlan_header,

                                          buf, size);

                desc.bytes = size + s->vlan_header;

                desc.cmdstat &= ~MP_ETH_RX_OWN;

                s->cur_rx[i] = desc.next;



                s->icr |= MP_ETH_IRQ_RX;

                if (s->icr & s->imr)

                    qemu_irq_raise(s->irq);

                eth_rx_desc_put(desc_addr, &desc);

                return;

            }

            desc_addr = desc.next;

        } while (desc_addr != s->rx_queue[i]);

    }

}

static void eth_receive(void *opaque, const uint8_t *buf, size_t size)

{

    mv88w8618_eth_state *s = opaque;

    uint32_t desc_addr;

    mv88w8618_rx_desc desc;

    int i;



    for (i = 0; i < 4; i++) {

        desc_addr = s->cur_rx[i];

        if (!desc_addr)

            continue;

        do {

            eth_rx_desc_get(desc_addr, &desc);

            if ((desc.cmdstat & MP_ETH_RX_OWN) && desc.buffer_size >= size) {

                cpu_physical_memory_write(desc.buffer + s->vlan_header,

                                          buf, size);

                desc.bytes = size + s->vlan_header;

                desc.cmdstat &= ~MP_ETH_RX_OWN;

                s->cur_rx[i] = desc.next;



                s->icr |= MP_ETH_IRQ_RX;

                if (s->icr & s->imr)

                    qemu_irq_raise(s->irq);

                eth_rx_desc_put(desc_addr, &desc);

                return;

            }

            desc_addr = desc.next;

        } while (desc_addr != s->rx_queue[i]);

    }

}

static void FUNC_0(void *VAR_0, const uint8_t *VAR_1, size_t VAR_2)

{

    mv88w8618_eth_state *s = VAR_0;

    uint32_t desc_addr;

    mv88w8618_rx_desc desc;

    int VAR_3;



    for (VAR_3 = 0; VAR_3 < 4; VAR_3++) {

        desc_addr = s->cur_rx[VAR_3];

        if (!desc_addr)

            continue;

        do {

            eth_rx_desc_get(desc_addr, &desc);

            if ((desc.cmdstat & MP_ETH_RX_OWN) && desc.buffer_size >= VAR_2) {

                cpu_physical_memory_write(desc.buffer + s->vlan_header,

                                          VAR_1, VAR_2);

                desc.bytes = VAR_2 + s->vlan_header;

                desc.cmdstat &= ~MP_ETH_RX_OWN;

                s->cur_rx[VAR_3] = desc.next;



                s->icr |= MP_ETH_IRQ_RX;

                if (s->icr & s->imr)

                    qemu_irq_raise(s->irq);

                eth_rx_desc_put(desc_addr, &desc);

                return;

            }

            desc_addr = desc.next;

        } while (desc_addr != s->rx_queue[VAR_3]);

    }

}

static void FUNC_0(void *VAR_0, const uint8_t *VAR_1, size_t VAR_2)
{ mv88w8618_eth_state *s = VAR_0; uint32_t desc_addr; mv88w8618_rx_desc desc; int VAR_3; for (VAR_3 = 0; VAR_3 < 4; VAR_3++) { desc_addr = s->cur_rx[VAR_3]; if (!desc_addr)
continue; do { eth_rx_desc_get(desc_addr, &desc); if ((desc.cmdstat & MP_ETH_RX_OWN) && desc.buffer_size >= VAR_2) { cpu_physical_memory_write(desc.buffer + s->vlan_header,
VAR_1, VAR_2); desc.bytes = VAR_2 + s->vlan_header; desc.cmdstat &= ~MP_ETH_RX_OWN; s->cur_rx[VAR_3] = desc.next; s->icr |= MP_ETH_IRQ_RX; if (s->icr & s->imr)
qemu_irq_raise(s->irq); eth_rx_desc_put(desc_addr, &desc); return; } desc_addr = desc.next; } while (desc_addr != s->rx_queue[VAR_3]); } }