Hi Punit.
I discussed the issue with our experts and there are their points:
- lwIP with raw API must be used in single thread mode. Either everything in an interrupt or everything in a main. Make sure that your app follows a simple main loop design as shown below.
- It looks like the lwIP bare-metal architecture is not designed for interrupts.
It can work in interrupt but the code may not be mixed with lwIP usage in main application.
It simply must be one-threaded. Main application and hooks running in interrupts creating preemption.
All the code using lwIP must be in interrupt (cause of lwIP hooks), so using it in user application is forbidden.
A simple main loop for a single-threaded system (lwIP 1.4.0+) might look like this:
while(1) {
/* poll the driver, get any outstanding frames, alloc memory for them, and
call netif->input, which is actually ip_input() */
poll_driver(netif);
sys_check_timeouts(); /* Handle all system timeouts for all core protocols */
}
there are no interrupts.
“To enable the lwIP stack, the user application has to perform two functions calls from the main program loop:
• ethernetif_input() to treat incoming packets (function defined in the network interface GMAC driver)
• timers_update() to refresh and trigger the lwIP timers (defined in the user application, typically under the
network folder)”
It mean that the lwIP in bare-metal is polled – not interrupt driven.
To your question about snd_queuelen please see the explanation here on the thread lwip-users - tcp_write() errors on snd_queuelen
Anyway, all these experts are on lwip community, please for lwIP-related questions, the user may ask on “Mailing list for lwIP users”: https://lists.nongnu.org/mailman/listinfo/lwip-users
I hope this helps you.
Best Regards,
Iva