Revision 4f1c942b hw/smc91c111.c
b/hw/smc91c111.c | ||
---|---|---|
602 | 602 |
return 1; |
603 | 603 |
} |
604 | 604 |
|
605 |
static void smc91c111_receive(VLANClientState *vc, const uint8_t *buf, size_t size)
|
|
605 |
static ssize_t smc91c111_receive(VLANClientState *vc, const uint8_t *buf, size_t size)
|
|
606 | 606 |
{ |
607 | 607 |
smc91c111_state *s = vc->opaque; |
608 | 608 |
int status; |
... | ... | |
612 | 612 |
uint8_t *p; |
613 | 613 |
|
614 | 614 |
if ((s->rcr & RCR_RXEN) == 0 || (s->rcr & RCR_SOFT_RST)) |
615 |
return; |
|
615 |
return -1;
|
|
616 | 616 |
/* Short packets are padded with zeros. Receiving a packet |
617 | 617 |
< 64 bytes long is considered an error condition. */ |
618 | 618 |
if (size < 64) |
... | ... | |
625 | 625 |
packetsize += 4; |
626 | 626 |
/* TODO: Flag overrun and receive errors. */ |
627 | 627 |
if (packetsize > 2048) |
628 |
return; |
|
628 |
return -1;
|
|
629 | 629 |
packetnum = smc91c111_allocate_packet(s); |
630 | 630 |
if (packetnum == 0x80) |
631 |
return; |
|
631 |
return -1;
|
|
632 | 632 |
s->rx_fifo[s->rx_fifo_len++] = packetnum; |
633 | 633 |
|
634 | 634 |
p = &s->data[packetnum][0]; |
... | ... | |
676 | 676 |
/* TODO: Raise early RX interrupt? */ |
677 | 677 |
s->int_level |= INT_RCV; |
678 | 678 |
smc91c111_update(s); |
679 |
|
|
680 |
return size; |
|
679 | 681 |
} |
680 | 682 |
|
681 | 683 |
static CPUReadMemoryFunc *smc91c111_readfn[] = { |
Also available in: Unified diff