From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web12.219.1589321024745775306 for ; Tue, 12 May 2020 15:03:44 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: arm.com, ip: 217.140.110.172, mailfrom: ard.biesheuvel@arm.com) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 473F11FB; Tue, 12 May 2020 15:03:44 -0700 (PDT) Received: from [192.168.1.81] (unknown [10.37.8.255]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 92C233F68F; Tue, 12 May 2020 15:03:41 -0700 (PDT) Subject: Re: [edk2-devel] [edk2-platforms][PATCH 1/1] BcmGenetDxe: fix reliability issues To: Samer El-Haj-Mahmoud , "devel@edk2.groups.io" , "andrey.warkentin@gmail.com" Cc: "leif@nuviainc.com" , "pete@akeo.ie" , "philmd@redhat.com" References: <20200512215257.51748-1-andrey.warkentin@gmail.com> From: "Ard Biesheuvel" Message-ID: <85d15d48-68a9-a817-9398-d1783c288f07@arm.com> Date: Wed, 13 May 2020 00:03:37 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit On 5/12/20 11:57 PM, Samer El-Haj-Mahmoud wrote: > Tested-by: Samer El-Haj-Mahmoud > Pushed as 8977ff44a573..3698b912301b Thanks guys >> -----Original Message----- >> From: 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 ; 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 >> --- >> 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 >> >> >> >