static ssize_t eth_rx(NetClientState *nc, const uint8_t *buf, size_t size)

{

    struct xlx_ethlite *s = qemu_get_nic_opaque(nc);

    unsigned int rxbase = s->rxbuf * (0x800 / 4);



    /* DA filter.  */

    if (!(buf[0] & 0x80) && memcmp(&s->conf.macaddr.a[0], buf, 6))

        return size;



    if (s->regs[rxbase + R_RX_CTRL0] & CTRL_S) {

        D(qemu_log("ethlite lost packet %x\n", s->regs[R_RX_CTRL0]));





    D(qemu_log("%s %zd rxbase=%x\n", __func__, size, rxbase));





    memcpy(&s->regs[rxbase + R_RX_BUF0], buf, size);



    s->regs[rxbase + R_RX_CTRL0] |= CTRL_S;

    if (s->regs[R_RX_CTRL0] & CTRL_I) {

        eth_pulse_irq(s);




    /* If c_rx_pingpong was set flip buffers.  */

    s->rxbuf ^= s->c_rx_pingpong;

    return size;

static ssize_t eth_rx(NetClientState *nc, const uint8_t *buf, size_t size)

{

    struct xlx_ethlite *s = qemu_get_nic_opaque(nc);

    unsigned int rxbase = s->rxbuf * (0x800 / 4);



    

    if (!(buf[0] & 0x80) && memcmp(&s->conf.macaddr.a[0], buf, 6))

        return size;



    if (s->regs[rxbase + R_RX_CTRL0] & CTRL_S) {

        D(qemu_log("ethlite lost packet %x\n", s->regs[R_RX_CTRL0]));





    D(qemu_log("%s %zd rxbase=%x\n", __func__, size, rxbase));





    memcpy(&s->regs[rxbase + R_RX_BUF0], buf, size);



    s->regs[rxbase + R_RX_CTRL0] |= CTRL_S;

    if (s->regs[R_RX_CTRL0] & CTRL_I) {

        eth_pulse_irq(s);




    

    s->rxbuf ^= s->c_rx_pingpong;

    return size;

static ssize_t FUNC_0(NetClientState *nc, const uint8_t *buf, size_t size)

{

    struct xlx_ethlite *VAR_0 = qemu_get_nic_opaque(nc);

    unsigned int VAR_1 = VAR_0->rxbuf * (0x800 / 4);



    

    if (!(buf[0] & 0x80) && memcmp(&VAR_0->conf.macaddr.a[0], buf, 6))

        return size;



    if (VAR_0->regs[VAR_1 + R_RX_CTRL0] & CTRL_S) {

        D(qemu_log("ethlite lost packet %x\n", VAR_0->regs[R_RX_CTRL0]));





    D(qemu_log("%VAR_0 %zd VAR_1=%x\n", __func__, size, VAR_1));





    memcpy(&VAR_0->regs[VAR_1 + R_RX_BUF0], buf, size);



    VAR_0->regs[VAR_1 + R_RX_CTRL0] |= CTRL_S;

    if (VAR_0->regs[R_RX_CTRL0] & CTRL_I) {

        eth_pulse_irq(VAR_0);




    

    VAR_0->rxbuf ^= VAR_0->c_rx_pingpong;

    return size;

static ssize_t FUNC_0(NetClientState *nc, const uint8_t *buf, size_t size)
{ struct xlx_ethlite *VAR_0 = qemu_get_nic_opaque(nc); unsigned int VAR_1 = VAR_0->rxbuf * (0x800 / 4); if (!(buf[0] & 0x80) && memcmp(&VAR_0->conf.macaddr.a[0], buf, 6))
return size; if (VAR_0->regs[VAR_1 + R_RX_CTRL0] & CTRL_S) { D(qemu_log("ethlite lost packet %x\n", VAR_0->regs[R_RX_CTRL0])); D(qemu_log("%VAR_0 %zd VAR_1=%x\n", __func__, size, VAR_1)); memcpy(&VAR_0->regs[VAR_1 + R_RX_BUF0], buf, size); VAR_0->regs[VAR_1 + R_RX_CTRL0] |= CTRL_S; if (VAR_0->regs[R_RX_CTRL0] & CTRL_I) { eth_pulse_irq(VAR_0); VAR_0->rxbuf ^= VAR_0->c_rx_pingpong; return size;