public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [edk2-platforms][PATCH 1/1] BcmGenetDxe: fix reliability issues
@ 2020-05-12 21:52 Andrei Warkentin
  2020-05-12 21:57 ` [edk2-devel] " Samer El-Haj-Mahmoud
  0 siblings, 1 reply; 3+ messages in thread
From: Andrei Warkentin @ 2020-05-12 21:52 UTC (permalink / raw)
  To: devel; +Cc: ard.biesheuvel, leif, pete, philmd

- Failed TFTP boots
- Failed HTTP boots

The definite problem was that the incorrect PROD index was being written
TX ring. The PROD index should be the TxProdIndex (on the scale
of 0-0xffff), not the descriptor index (on the scale of 0-max descs).

The other small things were suspect (mod 0xffff is not the same as & 0xffff).

Signed-off-by: Andrei Warkentin <andrey.warkentin@gmail.com>
---
 Silicon/Broadcom/Drivers/Net/BcmGenetDxe/GenetUtil.c     | 4 ++--
 Silicon/Broadcom/Drivers/Net/BcmGenetDxe/SimpleNetwork.c | 3 +--
 2 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/Silicon/Broadcom/Drivers/Net/BcmGenetDxe/GenetUtil.c b/Silicon/Broadcom/Drivers/Net/BcmGenetDxe/GenetUtil.c
index 4b0995e3..1c4c8527 100644
--- a/Silicon/Broadcom/Drivers/Net/BcmGenetDxe/GenetUtil.c
+++ b/Silicon/Broadcom/Drivers/Net/BcmGenetDxe/GenetUtil.c
@@ -737,7 +737,7 @@ GenetDmaTriggerTx (
   GenetMmioWrite (Genet, GENET_TX_DESC_STATUS (DescIndex), DescStatus);
 
   GenetMmioWrite (Genet, GENET_TX_DMA_PROD_INDEX (GENET_DMA_DEFAULT_QUEUE),
-    (DescIndex + 1) & 0xFFFF);
+    Genet->TxProdIndex);
 }
 
 /**
@@ -764,7 +764,7 @@ GenetTxIntr (
     *TxBuf = Genet->TxBuffer[Genet->TxNext];
     Genet->TxQueued--;
     Genet->TxNext = (Genet->TxNext + 1) % GENET_DMA_DESC_COUNT;
-    Genet->TxConsIndex++;
+    Genet->TxConsIndex = (Genet->TxConsIndex + 1) & 0xFFFF;
   } else {
     *TxBuf = NULL;
   }
diff --git a/Silicon/Broadcom/Drivers/Net/BcmGenetDxe/SimpleNetwork.c b/Silicon/Broadcom/Drivers/Net/BcmGenetDxe/SimpleNetwork.c
index 74677927..371216ca 100644
--- a/Silicon/Broadcom/Drivers/Net/BcmGenetDxe/SimpleNetwork.c
+++ b/Silicon/Broadcom/Drivers/Net/BcmGenetDxe/SimpleNetwork.c
@@ -641,9 +641,8 @@ GenetSimpleNetworkTransmit (
     return Status;
   }
 
+  Genet->TxProdIndex = (Genet->TxProdIndex + 1) & 0xFFFF;
   GenetDmaTriggerTx (Genet, Desc, DmaDeviceAddress, DmaNumberOfBytes);
-
-  Genet->TxProdIndex = (Genet->TxProdIndex + 1) % 0xFFFF;
   Genet->TxQueued++;
 
   EfiReleaseLock (&Genet->Lock);
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [edk2-devel] [edk2-platforms][PATCH 1/1] BcmGenetDxe: fix reliability issues
  2020-05-12 21:52 [edk2-platforms][PATCH 1/1] BcmGenetDxe: fix reliability issues Andrei Warkentin
@ 2020-05-12 21:57 ` Samer El-Haj-Mahmoud
  2020-05-12 22:03   ` Ard Biesheuvel
  0 siblings, 1 reply; 3+ messages in thread
From: Samer El-Haj-Mahmoud @ 2020-05-12 21:57 UTC (permalink / raw)
  To: devel@edk2.groups.io, andrey.warkentin@gmail.com
  Cc: Ard Biesheuvel, leif@nuviainc.com, pete@akeo.ie,
	philmd@redhat.com

Tested-by: Samer El-Haj-Mahmoud <Samer.El-Haj-Mahmoud@arm.com>

> -----Original Message-----
> From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Andrei
> Warkentin via groups.io
> Sent: Tuesday, May 12, 2020 5:53 PM
> To: devel@edk2.groups.io
> Cc: Ard Biesheuvel <Ard.Biesheuvel@arm.com>; leif@nuviainc.com;
> pete@akeo.ie; philmd@redhat.com
> Subject: [edk2-devel] [edk2-platforms][PATCH 1/1] BcmGenetDxe: fix
> reliability issues
>
> - Failed TFTP boots
> - Failed HTTP boots
>
> The definite problem was that the incorrect PROD index was being written TX
> ring. The PROD index should be the TxProdIndex (on the scale of 0-0xffff),
> not the descriptor index (on the scale of 0-max descs).
>
> The other small things were suspect (mod 0xffff is not the same as & 0xffff).
>
> Signed-off-by: Andrei Warkentin <andrey.warkentin@gmail.com>
> ---
>  Silicon/Broadcom/Drivers/Net/BcmGenetDxe/GenetUtil.c     | 4 ++--
>  Silicon/Broadcom/Drivers/Net/BcmGenetDxe/SimpleNetwork.c | 3 +--
>  2 files changed, 3 insertions(+), 4 deletions(-)
>
> diff --git a/Silicon/Broadcom/Drivers/Net/BcmGenetDxe/GenetUtil.c
> b/Silicon/Broadcom/Drivers/Net/BcmGenetDxe/GenetUtil.c
> index 4b0995e3..1c4c8527 100644
> --- a/Silicon/Broadcom/Drivers/Net/BcmGenetDxe/GenetUtil.c
> +++ b/Silicon/Broadcom/Drivers/Net/BcmGenetDxe/GenetUtil.c
> @@ -737,7 +737,7 @@ GenetDmaTriggerTx (
>    GenetMmioWrite (Genet, GENET_TX_DESC_STATUS (DescIndex),
> DescStatus);
>
>    GenetMmioWrite (Genet, GENET_TX_DMA_PROD_INDEX
> (GENET_DMA_DEFAULT_QUEUE),
> -    (DescIndex + 1) & 0xFFFF);
> +    Genet->TxProdIndex);
>  }
>
>  /**
> @@ -764,7 +764,7 @@ GenetTxIntr (
>      *TxBuf = Genet->TxBuffer[Genet->TxNext];
>      Genet->TxQueued--;
>      Genet->TxNext = (Genet->TxNext + 1) % GENET_DMA_DESC_COUNT;
> -    Genet->TxConsIndex++;
> +    Genet->TxConsIndex = (Genet->TxConsIndex + 1) & 0xFFFF;
>    } else {
>      *TxBuf = NULL;
>    }
> diff --git a/Silicon/Broadcom/Drivers/Net/BcmGenetDxe/SimpleNetwork.c
> b/Silicon/Broadcom/Drivers/Net/BcmGenetDxe/SimpleNetwork.c
> index 74677927..371216ca 100644
> --- a/Silicon/Broadcom/Drivers/Net/BcmGenetDxe/SimpleNetwork.c
> +++ b/Silicon/Broadcom/Drivers/Net/BcmGenetDxe/SimpleNetwork.c
> @@ -641,9 +641,8 @@ GenetSimpleNetworkTransmit (
>      return Status;
>    }
>
> +  Genet->TxProdIndex = (Genet->TxProdIndex + 1) & 0xFFFF;
>    GenetDmaTriggerTx (Genet, Desc, DmaDeviceAddress,
> DmaNumberOfBytes);
> -
> -  Genet->TxProdIndex = (Genet->TxProdIndex + 1) % 0xFFFF;
>    Genet->TxQueued++;
>
>    EfiReleaseLock (&Genet->Lock);
> --
> 2.17.1
>
>
> 

IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [edk2-devel] [edk2-platforms][PATCH 1/1] BcmGenetDxe: fix reliability issues
  2020-05-12 21:57 ` [edk2-devel] " Samer El-Haj-Mahmoud
@ 2020-05-12 22:03   ` Ard Biesheuvel
  0 siblings, 0 replies; 3+ messages in thread
From: Ard Biesheuvel @ 2020-05-12 22:03 UTC (permalink / raw)
  To: Samer El-Haj-Mahmoud, devel@edk2.groups.io,
	andrey.warkentin@gmail.com
  Cc: leif@nuviainc.com, pete@akeo.ie, philmd@redhat.com

On 5/12/20 11:57 PM, Samer El-Haj-Mahmoud wrote:
> Tested-by: Samer El-Haj-Mahmoud <Samer.El-Haj-Mahmoud@arm.com>
> 

Pushed as 8977ff44a573..3698b912301b

Thanks guys

>> -----Original Message-----
>> From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Andrei
>> Warkentin via groups.io
>> Sent: Tuesday, May 12, 2020 5:53 PM
>> To: devel@edk2.groups.io
>> Cc: Ard Biesheuvel <Ard.Biesheuvel@arm.com>; leif@nuviainc.com;
>> pete@akeo.ie; philmd@redhat.com
>> Subject: [edk2-devel] [edk2-platforms][PATCH 1/1] BcmGenetDxe: fix
>> reliability issues
>>
>> - Failed TFTP boots
>> - Failed HTTP boots
>>
>> The definite problem was that the incorrect PROD index was being written TX
>> ring. The PROD index should be the TxProdIndex (on the scale of 0-0xffff),
>> not the descriptor index (on the scale of 0-max descs).
>>
>> The other small things were suspect (mod 0xffff is not the same as & 0xffff).
>>
>> Signed-off-by: Andrei Warkentin <andrey.warkentin@gmail.com>
>> ---
>>   Silicon/Broadcom/Drivers/Net/BcmGenetDxe/GenetUtil.c     | 4 ++--
>>   Silicon/Broadcom/Drivers/Net/BcmGenetDxe/SimpleNetwork.c | 3 +--
>>   2 files changed, 3 insertions(+), 4 deletions(-)
>>
>> diff --git a/Silicon/Broadcom/Drivers/Net/BcmGenetDxe/GenetUtil.c
>> b/Silicon/Broadcom/Drivers/Net/BcmGenetDxe/GenetUtil.c
>> index 4b0995e3..1c4c8527 100644
>> --- a/Silicon/Broadcom/Drivers/Net/BcmGenetDxe/GenetUtil.c
>> +++ b/Silicon/Broadcom/Drivers/Net/BcmGenetDxe/GenetUtil.c
>> @@ -737,7 +737,7 @@ GenetDmaTriggerTx (
>>     GenetMmioWrite (Genet, GENET_TX_DESC_STATUS (DescIndex),
>> DescStatus);
>>
>>     GenetMmioWrite (Genet, GENET_TX_DMA_PROD_INDEX
>> (GENET_DMA_DEFAULT_QUEUE),
>> -    (DescIndex + 1) & 0xFFFF);
>> +    Genet->TxProdIndex);
>>   }
>>
>>   /**
>> @@ -764,7 +764,7 @@ GenetTxIntr (
>>       *TxBuf = Genet->TxBuffer[Genet->TxNext];
>>       Genet->TxQueued--;
>>       Genet->TxNext = (Genet->TxNext + 1) % GENET_DMA_DESC_COUNT;
>> -    Genet->TxConsIndex++;
>> +    Genet->TxConsIndex = (Genet->TxConsIndex + 1) & 0xFFFF;
>>     } else {
>>       *TxBuf = NULL;
>>     }
>> diff --git a/Silicon/Broadcom/Drivers/Net/BcmGenetDxe/SimpleNetwork.c
>> b/Silicon/Broadcom/Drivers/Net/BcmGenetDxe/SimpleNetwork.c
>> index 74677927..371216ca 100644
>> --- a/Silicon/Broadcom/Drivers/Net/BcmGenetDxe/SimpleNetwork.c
>> +++ b/Silicon/Broadcom/Drivers/Net/BcmGenetDxe/SimpleNetwork.c
>> @@ -641,9 +641,8 @@ GenetSimpleNetworkTransmit (
>>       return Status;
>>     }
>>
>> +  Genet->TxProdIndex = (Genet->TxProdIndex + 1) & 0xFFFF;
>>     GenetDmaTriggerTx (Genet, Desc, DmaDeviceAddress,
>> DmaNumberOfBytes);
>> -
>> -  Genet->TxProdIndex = (Genet->TxProdIndex + 1) % 0xFFFF;
>>     Genet->TxQueued++;
>>
>>     EfiReleaseLock (&Genet->Lock);
>> --
>> 2.17.1
>>
>>
>> 
> 


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-05-12 22:03 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-05-12 21:52 [edk2-platforms][PATCH 1/1] BcmGenetDxe: fix reliability issues Andrei Warkentin
2020-05-12 21:57 ` [edk2-devel] " Samer El-Haj-Mahmoud
2020-05-12 22:03   ` Ard Biesheuvel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox