lwip - Change k64f emac layer to drop frames on buffer exhaustion

Previously, exhausting hardware buffers would begin blocking the lwip
thread. This patch changes the emac layer to simply drop ethernet
frames, leaving recovery up to a higher level protocol.

This is consistent with the behaviour of the emac layer when unable
to allocate dynamic memory.
pull/3227/head
Christopher Haster 2016-10-28 15:22:08 -05:00 committed by Anna Bridge
parent 14f9518709
commit 5c97ea9254
1 changed files with 4 additions and 3 deletions

View File

@ -522,9 +522,10 @@ static err_t k64f_low_level_output(struct netif *netif, struct pbuf *p)
dst += q->len;
}
/* Wait until a descriptor is available for the transfer. */
/* THIS WILL BLOCK UNTIL THERE ARE A DESCRIPTOR AVAILABLE */
osSemaphoreWait(k64f_enet->xTXDCountSem.id, osWaitForever);
/* Check if a descriptor is available for the transfer. */
int32_t count = osSemaphoreWait(k64f_enet->xTXDCountSem.id, 0);
if (count < 1)
return ERR_BUF;
/* Get exclusive access */
sys_mutex_lock(&k64f_enet->TXLockMutex);