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

Alain M. alainm at pobox.com
Mon Sep 15 18:55:57 CEST 2008


Harald Kipp escreveu:
> Ole Reinhardt wrote:
 >
>> - 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.

I agree, in general every effort should be taken to reestablish the 
connection. Sometimes not even a timeout is desirable. I have already 
implemented such behaviour in the past with success...

> 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.

Maybe a thread to take care of the connection is desirable. I have seen 
here in the list that some people have implemented it. If not standard 
in Nut, this could be facilitated and even an example could be available.

---From later messages on this thread:---
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.
In general, these routines had been a mess since the introduction of
DHCP in Nut/Net.

IMHO if all is done in background and a status is available somewhere, 
all could be much simpler as everything can go on in background.

---From later messages on this thread:---
Whatever you do, please keep in mind that some of us use multiple 
network interfaces on one board. Simply killing all sockets when the 
cable has been pulled is likely to cause
me problems.

I disagree the general Windows behaviour is to return -1 to socket 
functions if network is down. Normaly Win/Linux TCP does not detect that 
the cabe was removed, The TCP socket will first try to send it's packets 
and will eventualy timeout.

Alain




More information about the En-Nut-Discussion mailing list