[PATCH 3/3] net/eth: fix link handling

Jan Lübbe jlu at pengutronix.de
Wed Sep 26 08:50:49 EDT 2012


On Wed, 2012-09-26 at 14:43 +0200, Sascha Hauer wrote:
> The eth->active is for tracking whether a device is opened (thus we have
> to call eth->halt). With this patch eth->active == 0 could mean:
> 
> a) device not opened
> b) opened, but no link
> 
> This is asking for trouble. A bit only has two states, you should not
> encode three states in it.

Yes. We should not repeatedly open the device to check link status
again. A open (active==1) device with no link is perfectly valid, it
just can't be used for TX/RX.

So if we have an open device in TX/RX and
  link down: recheck link
  link up: recheck link if the last check is "too old"

This way we notice both link going down and up, while not wasting time
when we are waiting for link up.

Regards,
Jan
-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |




More information about the barebox mailing list