Author Topic: IPCONFIG default zero ?  (Read 8010 times)

Offline aaronlawrence

  • Jr. Member
  • **
  • Posts: 66
    • View Profile
IPCONFIG default zero ?
« on: February 17, 2010, 09:01:54 AM »
In Config.h there is:

Code: [Select]
#define USE_DHCP                                             // enable DHCP  - needs UDP - IPCONFIG default zero. Needs 1k Ethernet RX Buffers!! (set random number also)
What does "IPCONFIG default zero" mean??

Offline mark

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3234
    • View Profile
    • uTasker
Re: IPCONFIG default zero ?
« Reply #1 on: February 17, 2010, 04:08:09 PM »
Hi Aaron

IPCONFIG default zero. Needs 1k Ethernet RX Buffers!! (set random number also)

1) IPCONFIG default zero This comment informs that the local IP address is usually set to 0.0.0.0 when working with DHCP.
The truth is that by doing this the DHCP process will usually be faster since the DHCP client will immediately request a new address. If instead the local IP address is not set to 0.0.0.0 the DHCP client will first try to request the use of this address. Usually this will however be rejected (unless it happened to be allocated earlier by the same DHCP server and was then set as default) and result in failure, after which the standard request for a new address (rather than a request for the reuse of existing one) is started, resulting in a longer procedure.
When the DHCP operation is initiated there is however the option of forcing the request for a new address by calling it with the option:

fnStartDHCP((UTASK_TASK)(FORCE_INIT | OWN_TASK));

The FORCE_INIT flag allows the local IP address to be set to non-zero but immediately jump to the request phase. This doesn't exactly respect the DHCP specification since it requires that any existing local IP address be used if possible, but practically it allows the user to jump the first phase since it is known that it will probably fail anyway and results in longer initialisation times. This is discussed more here: http://www.utasker.com/forum/index.php?topic=514.msg3155#msg3155


2) Needs 1k Ethernet Rx Buffer is not of interest in today's projects but was important in the first uTasker package for the Freescale MC9S12NE64 where it was quite common to work with Ethernet buffers in the size range of 256 or 512 bytes (it has 8k SRAM which needs to be shared by the processor and the Ethernet controller and so in may cases small Ethernet buffers made useful space for application use). Since the DHCP UDP frames can be up to 1k in size DHCP could theoretically fail if buffers smaller that 1k were configured since the particular (theoretical) large frame would have to be rejected. Full size Ethernet buffers (as used as standard in pretty much all projects in the larger chips) can ignore this.

3) The comment about random numbers is to allow the DHCP module to fully respect the randomized back-off delays when sending particular requests - it also works without this but usually the random number generator support is active as standard.

Regards

Mark

Offline aaronlawrence

  • Jr. Member
  • **
  • Posts: 66
    • View Profile
Re: IPCONFIG default zero ?
« Reply #2 on: February 19, 2010, 01:27:08 PM »
OK, all clear, thanks. I thought that 0.0.0.0 was the implication, but just the way the comment is written isn't too clear.

I already read that other thread. I still haev yet to settle on a MAC address programming scheme...