Skip to content

Commit 2bed996

Browse files
committed
Revert "net: Only process 1 packet per ethernet RX interrupt"
This reverts commit acb3578. 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.
1 parent de8161f commit 2bed996

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

libraries/net/eth/lwip-eth/arch/lpc17_emac.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -812,8 +812,9 @@ static void packet_rx(void* pvParameters) {
812812
/* Wait for receive task to wakeup */
813813
sys_arch_sem_wait(&lpc_enetif->RxSem, 0);
814814

815-
/* Process packet for this semaphore signal */
816-
lpc_enetif_input(lpc_enetif->netif);
815+
/* Process packets until all empty */
816+
while (LPC_EMAC->RxConsumeIndex != LPC_EMAC->RxProduceIndex)
817+
lpc_enetif_input(lpc_enetif->netif);
817818
}
818819
}
819820

0 commit comments

Comments
 (0)