Skip to content

Commit 8761f51

Browse files
evpopovEmil Popovtony-josi-awsActoryOu
authored
SAME70 driver xTXDescriptorSemaphore issue (#1033)
* Fixes and issue with the SAME70 port where and error in gmac_dev_write() causes the counting xTXDescriptorSemaphore to not be returned and eventually exhausting it. * fix formatting * Allows release of the network buffer if gmac_dev_write() fails and the ero-copy driver is being used. Thanks @htibosch * Fix typo --------- Co-authored-by: Emil Popov <[email protected]> Co-authored-by: tony-josi-aws <[email protected]> Co-authored-by: ActoryOu <[email protected]>
1 parent 2131f01 commit 8761f51

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

source/portable/NetworkInterface/DriverSAM/NetworkInterface.c

+12-2
Original file line numberDiff line numberDiff line change
@@ -651,12 +651,22 @@ static BaseType_t prvSAM_NetworkInterfaceOutput( NetworkInterface_t * pxInterfac
651651
if( ulResult != GMAC_OK )
652652
{
653653
TX_STAT_INCREMENT( tx_write_fail );
654+
655+
/* On a successful write to GMAC, the ownership of the TX descriptor will eventually get returned back to the network
656+
* driver and prvEMACHandlerTask will give back the xTXDescriptorSemaphore counting semaphore. In this case however,
657+
* writing to the GMAC failed, so there will be no EMAC_IF_TX_EVENT sent to prvEMACHandlerTask and the counting
658+
* semaphore will not be given back. Give it back now. */
659+
xSemaphoreGive( xTXDescriptorSemaphore );
654660
}
655661

656662
#if ( ipconfigZERO_COPY_TX_DRIVER != 0 )
657663
{
658-
/* Confirm that the pxDescriptor may be kept by the driver. */
659-
bReleaseAfterSend = pdFALSE;
664+
if( ulResult == GMAC_OK )
665+
{
666+
/* The message was send in a zero-copy way.
667+
* It will be released after a successful transmission. */
668+
bReleaseAfterSend = pdFALSE;
669+
}
660670
}
661671
#endif /* ipconfigZERO_COPY_TX_DRIVER */
662672
/* Not interested in a call-back after TX. */

0 commit comments

Comments
 (0)