mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH 3/3] net/eth: fix link handling
Date: Wed, 26 Sep 2012 15:08:54 +0200	[thread overview]
Message-ID: <20120926130853.GP1322@pengutronix.de> (raw)
In-Reply-To: <20120926130353.GQ26553@game.jcrosoft.org>

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();
	}
}

eth_rx(void)
{
	check_link_status();
}

Sascha

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

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  reply	other threads:[~2012-09-26 13:08 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-24  9:31 [PATCH 0/1 v7] net: introduce phylib Jean-Christophe PLAGNIOL-VILLARD
2012-09-24  9:36 ` [PATCH 1/1] " Jean-Christophe PLAGNIOL-VILLARD
2012-09-24 19:20 ` [PATCH 0/1 v7] " Sascha Hauer
2012-09-24 20:14   ` Jean-Christophe PLAGNIOL-VILLARD
2012-09-25 17:26 ` Jan Lübbe
2012-09-25 18:19   ` Jean-Christophe PLAGNIOL-VILLARD
2012-09-26 11:02 ` Sascha Hauer
2012-09-26 11:20   ` Jean-Christophe PLAGNIOL-VILLARD
2012-09-26 11:31     ` Sascha Hauer
2012-09-26 11:36       ` Jean-Christophe PLAGNIOL-VILLARD
2012-09-26 11:37   ` [PATCH 1/2] calao: at91 qil/tny/usb auto detect the phy addr Jean-Christophe PLAGNIOL-VILLARD
2012-09-26 11:37     ` [PATCH 2/2] net/eth: fix missing check on eth active Jean-Christophe PLAGNIOL-VILLARD
2012-09-26 11:53     ` [PATCH 3/3] net/eth: fix link handling Jean-Christophe PLAGNIOL-VILLARD
2012-09-26 12:43       ` Sascha Hauer
2012-09-26 12:50         ` Jan Lübbe
2012-09-26 13:03           ` Jean-Christophe PLAGNIOL-VILLARD
2012-09-26 13:08             ` Sascha Hauer [this message]
2012-09-26 13:43               ` Jean-Christophe PLAGNIOL-VILLARD
2012-09-26 13:05         ` Jean-Christophe PLAGNIOL-VILLARD
2012-09-26 13:59 ` [PATCH 1/1] " Jean-Christophe PLAGNIOL-VILLARD
2012-09-26 15:17   ` Sascha Hauer
2012-09-26 15:51     ` Jean-Christophe PLAGNIOL-VILLARD
2012-10-02 14:44 ` [PATCH 0/1 v7] net: introduce phylib Renaud Barbier
2012-10-02 16:04   ` Jean-Christophe PLAGNIOL-VILLARD
2012-10-02 16:58     ` Sascha Hauer
2012-10-02 18:32       ` Jean-Christophe PLAGNIOL-VILLARD

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120926130853.GP1322@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=plagnioj@jcrosoft.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox