mbed-os/features/FEATURE_LWIP/lwip-interface/lwip-eth/arch/TARGET_STM
Russ Butler 9620b0fc7f STM32 - fix bug were sockets stop receiving data
The function _eth_arch_low_level_input() is meant to pass data into
LWIP and to prepare the ethernet buffers to receive more data.
If the LWIP heap is empty and the call to pbuf_alloc() in
_eth_arch_low_level_input returns null, the ethernet receive buffers
are not updated to receive data. Because of this the ethernet RX
interrupt will not fire. Since the RX interrupt is the only thing that
triggers a call to _eth_arch_low_level_input(), the receive buffers
will never get cleared, and the device stops receiving data.

To prevent this from happening, this patch ensures that the function
_eth_arch_low_level_input() clears the receive buffers even if a new
pbuf for the data couldn't be allocated.

This issue can be reproduce by running the test
"features-feature_lwip-tests-mbedmicro-net-udp_echo_parallel"
and on the same machine running the below python script to flood the
device with UDP broadcast packets:

MY_IP = #ADD your local IP here
from socket import *
s = socket(AF_INET, SOCK_DGRAM)
s.bind((MY_IP, 1234))
s.setsockopt(SOL_SOCKET, SO_REUSEADDR, 1)
s.setsockopt(SOL_SOCKET, SO_BROADCAST, 1)
for _ in range(1000):
    s.sendto("test data", ('255.255.255.255', 1234))
print("Message sent")
2017-06-12 22:18:04 -05:00
..
TARGET_STM32F2 Disabled lwip ethernet ipv6 multicast filter for STM boards 2017-06-09 11:57:24 +03:00
TARGET_STM32F4 lwip: fix stm32f4 eth conf file 2017-06-10 15:20:30 +01:00
TARGET_STM32F7 Disabled lwip ethernet ipv6 multicast filter for STM boards 2017-06-09 11:57:24 +03:00
lwipopts_conf.h restructure - Restructured features/net directory 2016-09-30 19:18:09 -05:00
stm32xx_emac.c STM32 - fix bug were sockets stop receiving data 2017-06-12 22:18:04 -05:00