|
From: | address@hidden |
Subject: | Re: [lwip-users] tcp_write() errors on snd_queuelen |
Date: | Thu, 17 Mar 2011 18:10:56 +0100 |
User-agent: | Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; de; rv:1.9.2.15) Gecko/20110303 Thunderbird/3.1.9 |
Mullanix, Todd wrote:
Yeah, the NO_SYS=0 case looks, OK, I think: timers are handled automatically by tcpip_thread and tcpip_input() is used for input packets.For my port to SYS/BIOS, I have NO_SYS=0 and I'm making sure the netif->input is being called from a thread and not in the interrupt. So I think I'm adhering to the rules of the game in my case. Note: I'll make the change to use netif->input.
Well, if you see it that way, the port is OK. But it seems like Tim calls tcp_write from main(). I know this is a point in lwIP which is not as easy to understand and at least Tim (as a user of Stellarisware) got it wrong resulting in some days of bug-hunting :-( Also, having had a look at the code, I'm not sure at which point it would be safe to call tcp_write with NO_SYS=1: there seems to be no obvious way to call user code from the ethernet interrupt handler (which is obviously the "lwip execution context" in your port for NO_SYS=1).My understanding of the NO_SYS=1 case was the same as Tim's. So as long as nothing is done in main() or another interrupt, it should be fine since there are no threads.
Note that this is only a problem for asynchronous writes. Server-writes (like in the httpd) are either triggered by received packets or by lwIP timers, so their execution context is always correct.
Simon
[Prev in Thread] | Current Thread | [Next in Thread] |