On 15:08 Wed 26 Sep , Sascha Hauer wrote: > On Wed, Sep 26, 2012 at 03:03:53PM +0200, Jean-Christophe PLAGNIOL-VILLARD wrote: > > On 14:50 Wed 26 Sep , Jan Lübbe wrote: > > > 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. > > except this can not work in barebox. In linux you can as you have a schedule > > work that check the phy status. In barebox we do not do so and I do not want > > it (slow down the boot). So we check it at the open only and only once. When > > the phy is up we do not check it again. > > > > Remember we are in a bootloader not in an os we need to do some concession. > > int check_link_status(void) > { > if (is_timeout(last_link_check, SECOND)) { > do_link_check(); > last_link_check = get_time_ns(); > } > } we can do this but every second is too much this will slow down nfs/tftp transfert every 30s or 10s will be better Best Regards, J. _______________________________________________ barebox mailing list barebox@xxxxxxxxxxxxxxxxxxx http://lists.infradead.org/mailman/listinfo/barebox