mbedmicro/mbed — pull request #44 by adamgreen (2013-08-25 21:22:52+00:00)
Title: Robustness fixes for netstack

I welcome feedback on all of the updates included in this request but I would really like to get opinions on one in particular. Commit 4813d58 contains a fix for an issue that I saw where the maximum token count was exceeded on the semaphore used to communicate between the ethernet ISR and the packet_rx() thread. My current fix is to have packet_rx() consume only one packet per semaphore signal event instead of multiple as it did before. I wonder if it would be better to keep the original loop to handle all received packets when the packet_rx() thread is awaken but to use a Signal instead of a Semaphore. Thoughts?

The other changes include:
* Fully disable LWIP_ASSERTs by defining LWIP_NOASSERT macro in lwipopts.h
* Reset pbuf length when re-queueing on error. Previously the re-queued buffer size would have been adjusted to the size of the previously received packet instead of the full allocated size of the pbuf object.
* Enable the SYS_LIGHTWEIGHT_PROT macro in lwipopts.h. This is also a very big change! It turns out that a lot of the global data structures in lwIP weren't being protected by synchronization objects and therefore were not thread safe.

Please refer to the commit descriptions for more details on each of these changes.

I have tested these networking changes with a few samples that I have building with gcc4mbed and also the NET_1 test built and tested with the Python scripts in the mbed tree itself. I would run more of the tests from the mbed build system but they don't seem to work with GCC_ARM due to what I believe is a _sbrk() issue.

Thanks for considering these changes!