patchlwIP - A Lightweight TCP/IP stack - Patches: patch #5789, Integrate DHCP timer into...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

patch #5789: Integrate DHCP timer into tcpip_thread

Submitter:  Simon Goldschmidt <goldsimon>
Submitted:  Wed 07 Mar 2007 09:46:39 AM UTC
   
 
Category:  None Priority:  5 - Normal
Status:  Done Privacy:  Public
Assigned to:  goldsimon Open/Closed:  Closed
Planned Release:  None

Jump to the original submission

Thu 08 Mar 2007 10:37:54 AM UTC, comment #8: 

Checked in the patch.

Simon Goldschmidt <goldsimon>
Group administrator
Wed 07 Mar 2007 11:11:05 AM UTC, comment #7: 

Re: comment #5 - whoops, missed that.  Sounds like you're doing the right thing then.

Kieran Mansley <kieranm>
Group Member
Wed 07 Mar 2007 11:03:41 AM UTC, comment #6: 


>Exactly. But then you would set LWIP_DHCP to 0 wouldn't you? Since it's an embedded application, either you know that DHCP is needed or not, or (if it's configurable) your system has to be able to work fast enough with the timer on, anyway.


Yes, I'm in second case (it's configurable), but even if in each timer function, first task is to check each netif's dhcp field, it add a timout handler in the tcpip_thread. But I don't think this is an important overhead (but I will measure it).

Always about thread-safe, if you want to stop dhcp on an netif (change from dhcp config to static config), there is no way to call dhcp_stop inside tcpip_thread. A new apilib.c message will help to avoid a crash between these concurrent calls: dhcp_stop (application context), dhcp_coarse_tmr & dhcp_fine_tmr (tcpip_thread context). Same for dhcp_start.


Frédéric Bernon <fbernon>
Group Member
Wed 07 Mar 2007 10:44:47 AM UTC, comment #5: 

:to comment #4

>DHCP is definitely optional and so this code should also be so. Preferably using the same compile time switch as the DHCP code itself.


Uhm, I thought that's what I did. There's an #if LWIP_DHCP around the dhcp-timer-code in tcpip.c in my patch.

to comment 3#:

>I only initialize them if one netif have to be initialized by DHCP (and, of course, this is not always the case).


Exactly. But then you would set LWIP_DHCP to 0 wouldn't you? Since it's an embedded application, either you know that DHCP is needed or not, or (if it's configurable) your system has to be able to work fast enough with the timer on, anyway.

Simon Goldschmidt <goldsimon>
Group administrator
Wed 07 Mar 2007 10:33:20 AM UTC, comment #4: 

DHCP is definitely optional and so this code should also be so.  Preferably using the same compile time switch as the DHCP code itself.

Kieran Mansley <kieranm>
Group Member
Wed 07 Mar 2007 10:30:44 AM UTC, comment #3: 

Ok. But in this case, DHCP timers are always initialized. In my target, I only initialize them if one netif have to be initialized by DHCP (and, of course, this is not always the case).

Frédéric Bernon <fbernon>
Group Member
Wed 07 Mar 2007 09:56:52 AM UTC, comment #2: 

Agree with you... Most of timers using lwIP core MUST be in tcpip_thread a multithreading environment...

Simplify lwIP integration is also important... Perhaps, like there is a driver skeleton (ethernetif.c), it would be useful to have a "main.c" to have a clear initialization sequence, but not into ports (which are "old" and not always maintains).


Frédéric Bernon <fbernon>
Group Member
Wed 07 Mar 2007 09:52:45 AM UTC, comment #1: 

There it is (the patch!)

(file #12140)

Simon Goldschmidt <goldsimon>
Group administrator
Wed 07 Mar 2007 09:46:39 AM UTC, original submission:  

Like the ARP timer, DHCP timer must run in context of tcpip_thread in multithreading configurations.

To simplify porting lwIP, I think it would be good to include the timeout calls to dhcp_timer_coarse() and tcp_timer_fine() into tcpip.c

I'll submit my patch.

Simon Goldschmidt <goldsimon>
Group administrator

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attached Files
file #12140:  init_dhcp_timers_in_tcpip.c.patch added by goldsimon (1KiB - application/octet-stream)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by kieranm (Posted a comment)
  • -email is unavailable- added by fbernon (Posted a comment)
  • -email is unavailable- added by goldsimon (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

     

    Follow 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2007-03-08 goldsimon StatusNone Done
        Open/ClosedOpen Closed
    2007-03-07 goldsimon Attached File- Added init_dhcp_timers_in_tcpip.c.patch, #12140

    Back to the top

    Powered by Savane 3.13-02a9.
    Corresponding source code