From 2bed9964627c52b4ce54159fa724ed5e61623046 Mon Sep 17 00:00:00 2001 From: Adam Green Date: Tue, 27 Aug 2013 22:24:47 -0700 Subject: [PATCH] Revert "net: Only process 1 packet per ethernet RX interrupt" This reverts commit acb35785c90a721b0d815f91b38cc4fa9b8d157f. It turns out that this commit actually causes problems if an ethernet interrupt is dropped because a higher privilege task is running, such as LocalFileSystem accesses. If this happens, the semaphore count isn't incremented enough times and the packet_rx() thread will fall behind and end up running as though it had only one ethernet receive buffer. This causes even more lost packets. I plan to fix this by switching the semaphore to be a signal so that the syncronization object is more boolean. It simply indicates if an interrupt has arrived since the last time packet_rx() was awaken to process inbound packets. --- libraries/net/eth/lwip-eth/arch/lpc17_emac.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/libraries/net/eth/lwip-eth/arch/lpc17_emac.c b/libraries/net/eth/lwip-eth/arch/lpc17_emac.c index e082fd495f..9bace5f80b 100644 --- a/libraries/net/eth/lwip-eth/arch/lpc17_emac.c +++ b/libraries/net/eth/lwip-eth/arch/lpc17_emac.c @@ -812,8 +812,9 @@ static void packet_rx(void* pvParameters) { /* Wait for receive task to wakeup */ sys_arch_sem_wait(&lpc_enetif->RxSem, 0); - /* Process packet for this semaphore signal */ - lpc_enetif_input(lpc_enetif->netif); + /* Process packets until all empty */ + while (LPC_EMAC->RxConsumeIndex != LPC_EMAC->RxProduceIndex) + lpc_enetif_input(lpc_enetif->netif); } }