[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [lwip-devel] PPP single threaded
From: |
Alain M. |
Subject: |
Re: [lwip-devel] PPP single threaded |
Date: |
Thu, 11 Dec 2008 13:43:17 -0200 |
User-agent: |
Thunderbird 2.0.0.17 (X11/20080914) |
Hi Simon,
I am new to lwip but I hope that I can help. I have been working with
PSilva, I did most of the protocol decoding to find the problem...
I've put some work into getting PPP working in a single-threaded
(NO_SYS = 1) environment.
My first suggestion is that you make it over a Linux port, it really
helps A LOT to debug. Peter's test is running, but with threads, it
should be relatively easy to remove the threads. Al least it will make
it easyer FOR ME to help :)
I've also put some time into refactoring the existing PPP code to
match more with the rest of lwIP, mostly renaming though. I've also
implemented a really simple 'chat' module, to setup a GPRS connection.
Now I wonder if the effort should be made to bring this all back into
lwIP. There is still a lot to do, but it would probably be worth it.
Please, do ...
Let me explain what I changed in the design:
* Added a simple timesys module to PPP, this is ticked by a call to
ppp_tmr() like the rest of lwIP. This timesys implements a jiffies
counter which PPP needs in some places.
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.
It also implements the timeout handlers, which are absent in lwIP for
the NO_SYS = 1 case, but still necessary in PPP. I think this puts PPP
more in line with the rest of the lwIP core.
* Added ppp_poll(pd) function, which needs to be called periodically
when in single-threaded mode.
Yes, ans yes...
This all seems to work fine so far. I wonder though, how to make this
working again in a multi-threaded environment, where we have a
separate thread to poll the serial for input.
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.
I guess the PPP input and output paths are not thread-safe, so they
would have to be synchronized in some way.
I am not familiar with lwip , but from my experience with other systems,
I can say this: PPP has parts:
1) making the connection, in this part noone should use the serial port
and the ppp can use sio_xxx without wory
2) once the connection is established, it is a "packet driver" just like
the ethernet one. And I believe that lwip already must have solved that
problem ;)
The current approach with calling tcpip_callback() all the time does
not look like the right way to me.
agreed, but only theoreticaly because of lack of knowledge of lwip.
Is anyone interested on collaborating on this?
I can help some... specially on a Linux port. Real hardware is with
PSilva, but I indend to get another one soon.
I have sent to the list a sio_read() that can be aborted, I can easely
conver it to a nonblocking timeouted one.
I've heard from quite a few guys now, who did their own hacks to get
PPP working in a single-threaded environment, and I think it's time to
get it right. Any input is welcome!
I hope that I can help, at least with chearing :)
Alain