[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lwip-users] Re: [lwip] porting lwIP for CS8900A with UcosII
From: |
Eric Miniere |
Subject: |
[lwip-users] Re: [lwip] porting lwIP for CS8900A with UcosII |
Date: |
Wed, 08 Jan 2003 22:53:38 -0000 |
C'est un message de format MIME en plusieurs parties.
------=_NextPart_000_014A_01C15665.DA2A3790
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Hello Adam,
This is about some clarification about Timeout stuff.
You write :
>=20
> Time-outs are functions that are called after a specified amount of =
time. The=20
> time-out functions must not be executed concurrently with the thread =
which=20
> sets the time-out, not can they be called in an interrupt context. =
There are=20
> a couple of ways to implement time-outs and I know of two different=20
> approaches.
>=20
> In my lwIP ports (unix and RTXC), time-outs are processes in the=20
> sys_mbox_fetch() and sys_sem_wait() functions, since threads can be =
suspended=20
> in those functions. Internally, those functions wait either until the=20
> semaphore/mailbox allows the thread to unblock, or until the next =
time-out=20
> should happen. If the thread unblocks because a time-out is scheduled =
to=20
> occur, the corresponding time-out function is called.=20
If we add a new entry timeout (handled by most of OSes) in the =
sys_mbox_fetch() and sys_sem_wait() functions and the corresponding =
handler(eg : tcp_timer_coarse ) in case of Timeout event, does it works =
?
How do we know the handler to call ?
>=20
> If the thread was unblocked because of a message arriving on the =
mailbox, or=20
> because the semaphore was signalled, the time the thread was waiting =
is=20
> subtracted from the time to the next time-out.
Does it mean that if we wait for message arriving on the mailbox for 400 =
ms=20
and the timeout is defined for 500ms, next time we wait that mailbox, =
the timeout will be of 100ms ?
>=20
> Even though time-outs are measured in microseconds, in the current =
lwIP code=20
> it is not terribly important that they occur at the very right time.=20
> Currently, time-outs are used only by the TCP code.
>=20
> The other approach taken to the implementation of time-outs is the one =
taken=20
> by Hongsong Li in his lwIP port to uC/OS 1.09; instead of processing=20
> time-outs within the sys_mbox_fetch() and sys_sem_wait() functions, he =
has a=20
> separate thread that schedules the time-outs and at the right time =
send a=20
> message to the mailbox in the lwIP main loop in api/tcpip.c. When this =
> message is received, the time-out function is called within the TCP/IP =
thread.
>=20
This means that in this thread, the time-out function can be called if =
the mailbox is not received on time ?
If yes, which one tcp_timer_coarse or tcp_timer_fine ?
> For the 0.5 version of lwIP, the time-out scheduling (which is the =
most=20
> complex part of the OS emulation layer) will be moved out of the =
sys_arch=20
> file and into a generic implementation. The sys_sem_wait and =
sys_mbox_fetch=20
> functions will be redesigned so that they take an extra argument which =
is the=20
> maximum time to wait before unblocking and returning to the caller. =
This will=20
> map nicely onto many OSes and will make it easier to port lwIP to =
other=20
> platforms.
I am not that familiar with TCP/IP but I tried to understand this logic =
...
It seems easier to start reprogramming those 2 functions with Timeout =
functionality included but
I am not sure of the load of work, and the consequence on lwIP code ?
best regards,
Eric Miniere
------=_NextPart_000_014A_01C15665.DA2A3790
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 5.50.4134.600" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY>
<DIV>Hello Adam,</DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>This is about some clarification about =
Timeout=20
stuff.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV>You write :</DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV>> <BR>> Time-outs are functions that are called after a =
specified=20
amount of time. The <BR>> time-out functions must not be executed=20
concurrently with the thread which <BR>> sets the time-out, not can =
they be=20
called in an interrupt context. There are <BR>> a couple of ways to =
implement=20
time-outs and I know of two different <BR>> approaches.<BR>> =
<BR>> In=20
my lwIP ports (unix and RTXC), time-outs are processes in the <BR>>=20
sys_mbox_fetch() and sys_sem_wait() functions, since threads can be =
suspended=20
<BR>> in those functions. Internally, those functions wait either =
until the=20
<BR>> semaphore/mailbox allows the thread to unblock, or until the =
next=20
time-out <BR>> should happen. If the thread unblocks because a =
time-out is=20
scheduled to <BR>> occur, the corresponding time-out function is =
called.=20
</DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV>If we add a new entry timeout (handled by most of OSes) in the=20
sys_mbox_fetch() and sys_sem_wait() functions and the =
corresponding=20
handler(eg : tcp_timer_coarse ) in case of Timeout event, does it works =
?</DIV>
<DIV>How do we know the handler to call ?</DIV><FONT face=3DArial =
size=3D2></FONT>
<DIV><FONT face=3DArial size=3D2></FONT><FONT face=3DArial =
size=3D2></FONT><FONT=20
face=3DArial size=3D2></FONT><BR>> <BR>> If the thread was =
unblocked because=20
of a message arriving on the mailbox, or <BR>> because the semaphore =
was=20
signalled, the time the thread was waiting is <BR>> subtracted from =
the time=20
to the next time-out.</DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV>Does it mean that if we wait for message arriving on the mailbox =
for 400=20
ms </DIV>
<DIV>and the timeout is defined for 500ms, next time we wait that =
mailbox, the=20
timeout will be of 100ms ?</DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2></FONT><BR>> <BR>> Even though =
time-outs are=20
measured in microseconds, in the current lwIP code <BR>> it is not =
terribly=20
important that they occur at the very right time. <BR>> Currently, =
time-outs=20
are used only by the TCP code.<BR>> <BR>> The other approach taken =
to the=20
implementation of time-outs is the one taken <BR>> by Hongsong Li in =
his lwIP=20
port to uC/OS 1.09; instead of processing <BR>> time-outs within the=20
sys_mbox_fetch() and sys_sem_wait() functions, he has a <BR>> =
separate thread=20
that schedules the time-outs and at the right time send a <BR>> =
message to=20
the mailbox in the lwIP main loop in api/tcpip.c. When this <BR>> =
message is=20
received, the time-out function is called within the TCP/IP =
thread.<BR>>=20
</DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV>This means that in this thread, the time-out function can be called =
if the=20
mailbox is not received on time ?</DIV>
<DIV>If yes, which one tcp_timer_coarse or tcp_timer_fine ?</DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV><BR>> For the 0.5 version of lwIP, the time-out scheduling =
(which is the=20
most <BR>> complex part of the OS emulation layer) will be moved out =
of the=20
sys_arch <BR>> file and into a generic implementation. The =
sys_sem_wait and=20
sys_mbox_fetch <BR>> functions will be redesigned so that they take =
an extra=20
argument which is the <BR>> maximum time to wait before unblocking =
and=20
returning to the caller. This will <BR>> map nicely onto many OSes =
and will=20
make it easier to port lwIP to other <BR>> platforms.<BR></DIV>
<DIV>I am not that familiar with TCP/IP but I tried to understand this =
logic=20
...</DIV>
<DIV>It seems easier to start reprogramming those 2 functions with =
Timeout=20
functionality included but</DIV>
<DIV>I am not sure of the load of work, and the consequence on lwIP=20
code ?</DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV> </DIV>
<DIV>best regards,</DIV>
<DIV><BR>Eric Miniere<BR></DIV></BODY></HTML>
------=_NextPart_000_014A_01C15665.DA2A3790--
[This message was sent through the lwip discussion list.]
- [lwip-users] Re: [lwip] porting lwIP for CS8900A with UcosII, Adam Dunkels, 2003/01/08
- [lwip-users] Re: [lwip] porting lwIP for CS8900A with UcosII, AMARESH, 2003/01/08
- [lwip-users] Re: [lwip] porting lwIP for CS8900A with UcosII, AMARESH, 2003/01/08
- [lwip-users] Re: [lwip] porting lwIP for CS8900A with UcosII, Adam Dunkels, 2003/01/08
- [lwip-users] Re: [lwip] porting lwIP for CS8900A with UcosII, Wolfgang Mües, 2003/01/08
- [lwip-users] Re: [lwip] porting lwIP for CS8900A with UcosII, Adam Dunkels, 2003/01/08
- [lwip-users] Re: [lwip] porting lwIP for CS8900A with UcosII,
Eric Miniere <=
- [lwip-users] Re: [lwip] porting lwIP for CS8900A with UcosII, Wing Kent Kwan, 2003/01/08
- [lwip-users] Re: [lwip] porting lwIP for CS8900A with UcosII, AMARESH, 2003/01/08
- [lwip-users] Re: [lwip] porting lwIP for CS8900A with UcosII, Wing Kent Kwan, 2003/01/09
- [lwip-users] Re: [lwip] porting lwIP for CS8900A with UcosII, Adam Dunkels, 2003/01/09