diff mbox

[1/2] rtl8139: Do not consume the packet during overflow in standard mode.

Message ID 1440194365-27610-2-git-send-email-vyasevic@redhat.com
State New
Headers show

Commit Message

Vlad Yasevich Aug. 21, 2015, 9:59 p.m. UTC
When operation in standard mode, we currently return the size
of packet during buffer overflow.  This consumes the overflow
packet.  Return 0 instead so we can re-process the overflow packet
when we have room.

This fixes issues with lost/dropped fragments of large messages.

Signed-off-by: Vladislav Yasevich <vyasevic@redhat.com>
---
 hw/net/rtl8139.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Stefan Hajnoczi Aug. 26, 2015, 12:18 p.m. UTC | #1
On Fri, Aug 21, 2015 at 02:59:24PM -0700, Vladislav Yasevich wrote:
> When operation in standard mode, we currently return the size
> of packet during buffer overflow.  This consumes the overflow
> packet.  Return 0 instead so we can re-process the overflow packet
> when we have room.
> 
> This fixes issues with lost/dropped fragments of large messages.
> 
> Signed-off-by: Vladislav Yasevich <vyasevic@redhat.com>
> ---
>  hw/net/rtl8139.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/hw/net/rtl8139.c b/hw/net/rtl8139.c
> index edbb61c..359e001 100644
> --- a/hw/net/rtl8139.c
> +++ b/hw/net/rtl8139.c
> @@ -1157,7 +1157,7 @@ static ssize_t rtl8139_do_receive(NetClientState *nc, const uint8_t *buf, size_t
>              s->IntrStatus |= RxOverflow;
>              ++s->RxMissed;
>              rtl8139_update_irq(s);
> -            return size_;
> +            return 0;

Every .receive() return 0 must be paired with a
qemu_flush_queued_packets() call.

Is rtl8139_RxBufPtr_write() guaranteed to be called when the guest
refills rx buffers?
Vlad Yasevich Aug. 26, 2015, 1:02 p.m. UTC | #2
On 08/26/2015 08:18 AM, Stefan Hajnoczi wrote:
> On Fri, Aug 21, 2015 at 02:59:24PM -0700, Vladislav Yasevich wrote:
>> When operation in standard mode, we currently return the size
>> of packet during buffer overflow.  This consumes the overflow
>> packet.  Return 0 instead so we can re-process the overflow packet
>> when we have room.
>>
>> This fixes issues with lost/dropped fragments of large messages.
>>
>> Signed-off-by: Vladislav Yasevich <vyasevic@redhat.com>
>> ---
>>  hw/net/rtl8139.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/hw/net/rtl8139.c b/hw/net/rtl8139.c
>> index edbb61c..359e001 100644
>> --- a/hw/net/rtl8139.c
>> +++ b/hw/net/rtl8139.c
>> @@ -1157,7 +1157,7 @@ static ssize_t rtl8139_do_receive(NetClientState *nc, const uint8_t *buf, size_t
>>              s->IntrStatus |= RxOverflow;
>>              ++s->RxMissed;
>>              rtl8139_update_irq(s);
>> -            return size_;
>> +            return 0;
> 
> Every .receive() return 0 must be paired with a
> qemu_flush_queued_packets() call.

Isn't that already there.  A few drivers already return 0 to trigger a requeue.  What's
missing?


> 
> Is rtl8139_RxBufPtr_write() guaranteed to be called when the guest
> refills rx buffers?
> 

It calls it on read, once it's consumed a packet, to advance to the next packet in the
buffer.

-vlad
diff mbox

Patch

diff --git a/hw/net/rtl8139.c b/hw/net/rtl8139.c
index edbb61c..359e001 100644
--- a/hw/net/rtl8139.c
+++ b/hw/net/rtl8139.c
@@ -1157,7 +1157,7 @@  static ssize_t rtl8139_do_receive(NetClientState *nc, const uint8_t *buf, size_t
             s->IntrStatus |= RxOverflow;
             ++s->RxMissed;
             rtl8139_update_irq(s);
-            return size_;
+            return 0;
         }
 
         packet_header |= RxStatusOK;