mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-04 00:03:54 -06:00
net: add return value to packet receive handler
This allows us to handle queue full conditions rather than dropping the packet on the floor. Signed-off-by: Mark McLoughlin <markmc@redhat.com>
This commit is contained in:
parent
e3f5ec2b5e
commit
4f1c942b7f
18 changed files with 126 additions and 95 deletions
|
@ -1076,16 +1076,17 @@ static int pcnet_can_receive(VLANClientState *vc)
|
|||
|
||||
#define MIN_BUF_SIZE 60
|
||||
|
||||
static void pcnet_receive(VLANClientState *vc, const uint8_t *buf, size_t size)
|
||||
static ssize_t pcnet_receive(VLANClientState *vc, const uint8_t *buf, size_t size_)
|
||||
{
|
||||
PCNetState *s = vc->opaque;
|
||||
int is_padr = 0, is_bcast = 0, is_ladr = 0;
|
||||
uint8_t buf1[60];
|
||||
int remaining;
|
||||
int crc_err = 0;
|
||||
int size = size_;
|
||||
|
||||
if (CSR_DRX(s) || CSR_STOP(s) || CSR_SPND(s) || !size)
|
||||
return;
|
||||
return -1;
|
||||
|
||||
#ifdef PCNET_DEBUG
|
||||
printf("pcnet_receive size=%d\n", size);
|
||||
|
@ -1252,6 +1253,8 @@ static void pcnet_receive(VLANClientState *vc, const uint8_t *buf, size_t size)
|
|||
|
||||
pcnet_poll(s);
|
||||
pcnet_update_irq(s);
|
||||
|
||||
return size_;
|
||||
}
|
||||
|
||||
static void pcnet_transmit(PCNetState *s)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue