Skip to content

Commit 8b7c051

Browse files
committed
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.
1 parent 2fd15f4 commit 8b7c051

File tree

1 file changed

+4
-3
lines changed
  • features/FEATURE_LWIP/lwip-interface/lwip-eth/arch/TARGET_Freescale

1 file changed

+4
-3
lines changed

features/FEATURE_LWIP/lwip-interface/lwip-eth/arch/TARGET_Freescale/k64f_emac.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -522,9 +522,10 @@ static err_t k64f_low_level_output(struct netif *netif, struct pbuf *p)
522522
dst += q->len;
523523
}
524524

525-
/* Wait until a descriptor is available for the transfer. */
526-
/* THIS WILL BLOCK UNTIL THERE ARE A DESCRIPTOR AVAILABLE */
527-
osSemaphoreWait(k64f_enet->xTXDCountSem.id, osWaitForever);
525+
/* Check if a descriptor is available for the transfer. */
526+
int32_t count = osSemaphoreWait(k64f_enet->xTXDCountSem.id, 0);
527+
if (count < 1)
528+
return ERR_BUF;
528529

529530
/* Get exclusive access */
530531
sys_mutex_lock(&k64f_enet->TXLockMutex);

0 commit comments

Comments
 (0)