Just an update: further input on LWIP_TCPIP_CORE_LOCKING suggests 0 (disabled) should not have any advantages in any circumstances compared with 1 (enabled).
I thought that testing showed better reliability under heavy load (multiple RTOS tasks all using netconn and sockets) with 0 but can't really replicate it, and it could be mixed up with PBUF buffer allocation dependencies.
1 uses a mutex at a high level - at the API level - so will lock out TCP tasks at that high level. This may not matter, but could result in "priority inversion" in that a low priority task using TCP will block a higher priority one, for the entire duration of the LWIP API call. I now possibly understand the bit here
https://www.nongnu.org/lwip/2_0_x/group__lwip__opts__lock.htmlYour system should provide mutexes supporting priority inversion to use this.I have no idea what such a mutex would be (a mutex is a mutex, and has to be used with care, no?) but whether this matters depends. It doesn't make sense for a task using TCP comms to have a very high priority anyway
And for sure the effect will depend on how much buffering you have allocated to the ETH PHY TX; I don't think LWIP has any
TX buffering configured anywhere. Helping this will be that most if not all packets disappear down the wire at 10mbytes/sec regardless, especially if Nagle is disabled which seems a good idea in embedded apps anyway.
Dare's multicast filtering function works wonderfully
The only possible issue is that if one day I want to implement discovery, then processing broadcasts will be necessary. Then I guess the function would be modified with accept broadcast packets with a specific payload.
Later edit in case somebody finds this in the future:
The question of whether LWIP is thread safe is nontrivial. Apparently it is even without LWIP_TCPIP_CORE_LOCKING=1, for the netconn and socket APIs but it is never thread-safe for the raw API. Anyway, originally the extra locking has been implemented as it is claimed to improve performance. More info:
https://www.nongnu.org/lwip/2_1_x/multithreading.htmlhttps://www.nongnu.org/lwip/2_1_x/pitfalls.htmlThe 2nd URL above says the RAW API is also thread-safe if core locking=1.
While the consensus is that LWIP_TCPIP_CORE_LOCKING=1 should be the default usage, it was experimentally found that the system is much more reliable with =0, so these two have been set to 1 as per the above docs.
#define LWIP_ALLOW_MEM_FREE_FROM_OTHER_CONTEXT 1
#define SYS_LIGHTWEIGHT_PROT 1
This is necessary especially as, in the commonly used ex-ST low_level_input and low_level_output code, other RTOS tasks are calling e.g. pbuf_free() in ethernetif.c.
Why the system is much more reliably with LWIP_TCPIP_CORE_LOCKING=0 I don't know. The difference is found only when I have around 5 RTOS tasks running, some HTTP, some HTTPS, and other stuff, some using netconn API and some using the socket API.