lwip-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lwip-devel] PPP single threaded


From: address@hidden
Subject: Re: [lwip-devel] PPP single threaded
Date: Thu, 11 Dec 2008 18:31:18 +0100
User-agent: Thunderbird 2.0.0.18 (Macintosh/20081105)

Simon Kallweit wrote:
is jiffies used only in PPP? Usualy you will get it from the RTOS, so I would suggest that a more generic function be used.

sys_jiffies() is defined in sys.h, but only used in the PPP code. It might be a good idea to have some standard interface to retrieve the system time, but it the current implementation lacks a lot, as there is no definition of what a jiffy is (in PPP it's assumed to be 10ms). We would need something like sys_get_time() which returns ms or something. Or we can get rid of it completely and have the application call a global timer function with delta time passed.


Sys_jiffies is supposed to be the number of ticks since system startup, wrapping around (so effectively only useful for a delta). In task #7235 (I guess it was), we had the idea to use this and a define of how much tick per ms (or ms per ticks, depending on tick speed) to calculate ms since system startup.

If you implement this for PPP, we could use it for standard sys_timeouts with NO_SYS=1 in lwIP.

what usualy works just fine is to put all your code into a single thread. Simple, easy and portable. Once the connection is established, the thread could just close.

Yes that's true, but then we would have to have the serial input and the timeout handling to be running in the same thread, which will be impossible if the serial input is blocking.


As someone who doesn't use PPP (even running it on win32 or unix, I'm lacking a counterpart), I still have one proposal: I think from the lwIP architechture point of view, it would be nice if PPP would be running in the main lwIP thread - like all the other protocols. This would of course only work if it were implemented statemachine-like, not blocking as it is now.

The benefit would be that it would run with and without threading: the only difference would be the application (e.g. sockets run in an own thread vs. raw API running as callbacks) and the I/O, which can be blocking in a seperate thread or non-blocking in the lwIP thread.

Would that be the way you want to go?
I haven't dug into the PPP code enough to see through. But it seems to be a bit messy in parts ...

Hehe, that's what I thought ;-)
Anyway, I appreciate PPP coming forward a little! Thanks!


Simon (G.)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]