qemu-trivial
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-trivial] [Qemu-devel] [PATCH] net: cadence_gem: clear RX contr


From: Philippe Mathieu-Daudé
Subject: Re: [Qemu-trivial] [Qemu-devel] [PATCH] net: cadence_gem: clear RX control descriptor
Date: Tue, 16 Jul 2019 09:19:44 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.0

On 7/16/19 9:11 AM, Ramon Fried wrote:
> ping
> 
> On Sat, Jun 15, 2019 at 8:17 AM Ramon Fried <address@hidden> wrote:
>>
>> The RX ring descriptors control field is used for setting
>> SOF and EOF (start of frame and end of frame).
>> The SOF and EOF weren't cleared from the previous descriptors,
>> causing inconsistencies in ring buffer.
>> Fix that by clearing the control field of every descriptors we're
>> processing.
>>
>> Signed-off-by: Ramon Fried <address@hidden>
>> ---
>>  hw/net/cadence_gem.c | 7 +++++++
>>  1 file changed, 7 insertions(+)
>>
>> diff --git a/hw/net/cadence_gem.c b/hw/net/cadence_gem.c
>> index ecee22525c..d83a82bdb0 100644
>> --- a/hw/net/cadence_gem.c
>> +++ b/hw/net/cadence_gem.c
>> @@ -406,6 +406,11 @@ static inline void rx_desc_set_sof(uint32_t *desc)
>>      desc[1] |= DESC_1_RX_SOF;
>>  }
>>
>> +static inline void rx_desc_clear(uint32_t *desc)
>> +{
>> +    desc[1]  = 0;
>> +}
>> +
>>  static inline void rx_desc_set_eof(uint32_t *desc)
>>  {
>>      desc[1] |= DESC_1_RX_EOF;
>> @@ -994,6 +999,8 @@ static ssize_t gem_receive(NetClientState *nc, const 
>> uint8_t *buf, size_t size)
>>          bytes_to_copy -= MIN(bytes_to_copy, rxbufsize);
>>
>>          /* Update the descriptor.  */
>> +        rx_desc_clear(s->rx_desc[q]);

Maybe move the call before the comment, regardless:
Reviewed-by: Philippe Mathieu-Daudé <address@hidden>

>> +
>>          if (first_desc) {
>>              rx_desc_set_sof(s->rx_desc[q]);
>>              first_desc = false;
>> --
>> 2.21.0
>>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]