[En-Nut-Discussion] Network Link state on at91_emac and others

Harald Kipp harald.kipp at egnite.de
Mon Sep 15 18:27:37 CEST 2008


ennut at thezachariasgroup.com wrote:
> If the link is not available then the 
> initialization has failed and should be reflected in the return value.
> 
> If NutRegisterDevice always succeeded, how would 
> one detect if the link were down or the cable was not plugged in?

IMHO we should distinguish between a broken Ethernet controller and a 
broken link.

If the Ethernet controller (including the PHY) is not accessible, then 
NutRegisterDevice() should return an error.

If the link fails, it should not do so, but return 0 = OK. Instead the 
link status should be handled by NutNetIfConfig(), NutDhcpIfConfig() and 
similar.

In general, these routines had been a mess since the introduction of 
DHCP in Nut/Net. There had been an urgent request from a US customer and 
I hacked this code into the existing stuff many years ago in a rather 
bad way. As usual, bad code lives long and introduces more bad code. For 
example, DHCP links to DNS, which is really bad. Most apps use DHCP but 
never use DNS, but the big DNS stuff is always included.

Harald



More information about the En-Nut-Discussion mailing list