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

Harald Kipp harald.kipp at egnite.de
Mon Sep 15 10:04:58 CEST 2008


Hi Ole,

Ole Reinhardt wrote:
> My questions:
> 
> - is it necessary to wait until autonegotiation is complete to do the
>   nic reset?

It is not required to wait for a link.


> - Is there any way to check the current link state? AFAIK right now no
>   one of the network drivers support checking the link state, right?

You are right. Re-linking is done by the MAC automatically after 
attaching the cable again.


> - What should correctly happen if a link loss is detected? From my
>   understanding, this should be communicated up to the socket layer to
>   abort the currently opened sockets and set the socket error
>   appropriate, right?

Not really. It's an essential feature of TCP/IP to keep the connection 
established even during link loss. An optional "keepalive" extension can 
be used to detect this situation. But this is optional and not yet 
implemented in our stack.

There are different views on this topic, because the initial intention 
of TCP/IP is sometimes not practicable in real world applications.


> - On the other hand this should perhaps influence the dhcp thread to
>   request a new ip address after link establishment, right?

Similar to the above. At least a gratuitous ARP packet should be sent 
and further action taken in case of duplicate address detection.


> - Any further ideas / requirements?

I assume, that most problems can be solved by registering a callback. 
Then the application can decide about further actions, like shutting 
down the interface (in which case the socket layer _must_ be notified).


> These functions are realy missing in NutOS, so I'd like to start a
> discussion how to _correctly_ implement these features.

Fully agree. I started on this some time ago without any final result. 
IMHO, the following should be done first:

1. Implement functions for starting or shut down an interface.

2. Implementing an _ioctl() function in Ethernet drivers to control shut 
down or start interface, query or set MAC address, registering a link 
callback etc.

Harald





More information about the En-Nut-Discussion mailing list