All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Lunn <andrew@lunn.ch>
To: Paul Burton <paul.burton@mips.com>
Cc: netdev@vger.kernel.org, "David S . Miller" <davem@davemloft.net>
Subject: Re: [PATCH v7 06/11] net: pch_gbe: Only enable MAC when PHY link is active
Date: Thu, 28 Jun 2018 09:36:28 +0200	[thread overview]
Message-ID: <20180628073628.GA15034@lunn.ch> (raw)
In-Reply-To: <20180627175428.qfmnxnreuuywplcl@pburton-laptop>

On Wed, Jun 27, 2018 at 10:54:28AM -0700, Paul Burton wrote:
> Hi Andrew,
> 
> On Wed, Jun 27, 2018 at 07:30:14PM +0200, Andrew Lunn wrote:
> > On Tue, Jun 26, 2018 at 05:06:07PM -0700, Paul Burton wrote:
> > > When using a PHY connected via RGMII, as the pch_gbe driver presumes is
> > > the case, the RX clock is provided by the PHY to the MAC. Various PHYs,
> > > including both the AR8031 used by the Minnowboard & the RTL8211E used by
> > > the MIPS Boston development board, will stop generating the RX clock
> > > when the ethernet link is down (eg. the ethernet cable is unplugged).
> > > 
> > > Various pieces of functionality in the EG20T MAC, ranging from basics
> > > like completing a MAC reset to programming MAC addresses, rely upon the
> > > RX clock being provided. When the clock is not provided these pieces of
> > > functionality simply never complete, and the busy bits that indicate
> > > they're in progress remain set indefinitely.
> > > 
> > > The pch_gbe driver currently requires that the RX clock is always
> > > provided, and attempts to enforce this by disabling the hibernation
> > > feature of the AR8031 PHY to keep it generating the RX clock. This patch
> > > moves us away from this model by only configuring the MAC when the PHY
> > > indicates that the ethernet link is up. When the link is up we should be
> > > able to safely expect that the RX clock is being provided, and therefore
> > > safely reset & configure the MAC.
> > 
> > Hi Paul
> > 
> > I like the concept, but the implementation is not clear. Maybe it just
> > needs more details in the commit message. What has the watchdog got to
> > do with link up?
> 
> pch_gbe_watchdog() polls for the link coming up or going down, so that's
> where we find out that the link is up.

I was thinking it would be something like that. So could you please
explain this in the commit message.

Does the watchdog later become the adjust_link callback for phylib?
Having a name based around adjust_link would make this clearer. That
is the norm. But i understand this is a preparation step, so the
rename might happen later?

> > And what happens on link down? Does the MAC need shutting down? I
> > don't see such code here.
> 
> Well, depending upon the PHY the RX clock might stop which will prevent
> parts of the MAC from functioning properly.

The datasheet for the Atheros PHY suggests the clock will stop after a
while. So again, commenting why you think nothing extra is needed
would be good.

Basically, there is a lot of non-obvious stuff going on here, and it
helps both reviewer and future debugger to have a fuller explanation.

Thanks
	Andrew

  reply	other threads:[~2018-06-28  7:36 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-27  0:06 [PATCH v7 00/11] net: pch_gbe: Fixes, conversion to phylib, enable for MIPS Paul Burton
2018-06-27  0:06 ` [PATCH v7 01/11] net: pch_gbe: Remove unused struct pch_gbe_adapter fields Paul Burton
2018-06-27  0:06 ` [PATCH v7 02/11] net: pch_gbe: Mask spare MAC addresses all at once Paul Burton
2018-06-27  0:06 ` [PATCH v7 03/11] net: pch_gbe: Probe PHY ID & initialize only once Paul Burton
2018-06-27 17:21   ` Andrew Lunn
2018-06-27 17:31     ` Paul Burton
2018-06-27 17:33       ` Andrew Lunn
2018-06-28  7:47   ` Andrew Lunn
2018-06-27  0:06 ` [PATCH v7 04/11] net: pch_gbe: Remove irq_sem Paul Burton
2018-06-27  0:06 ` [PATCH v7 05/11] net: pch_gbe: Move pch_gbe_watchdog lower in pch_gbe_main.c Paul Burton
2018-06-27 17:23   ` Andrew Lunn
2018-06-27  0:06 ` [PATCH v7 06/11] net: pch_gbe: Only enable MAC when PHY link is active Paul Burton
2018-06-27 17:30   ` Andrew Lunn
2018-06-27 17:54     ` Paul Burton
2018-06-28  7:36       ` Andrew Lunn [this message]
2018-06-27 17:54   ` Florian Fainelli
2018-06-27 18:15     ` Paul Burton
2018-06-27  0:06 ` [PATCH v7 07/11] net: pch_gbe: Remove AR8031 PHY hibernation disable Paul Burton
2018-06-27 17:30   ` Andrew Lunn
2018-06-27  0:06 ` [PATCH v7 08/11] net: pch_gbe: Clean up resets Paul Burton
2018-06-27  0:06 ` [PATCH v7 09/11] net: pch_gbe: Convert to mdiobus and phylib Paul Burton
2018-06-27 17:51   ` Andrew Lunn
2018-06-27 18:09     ` Paul Burton
2018-06-28  7:44       ` Andrew Lunn
2018-06-27  0:06 ` [PATCH v7 10/11] ptp: pch: Allow build on MIPS platforms Paul Burton
2018-06-27 17:53   ` Andrew Lunn
2018-06-27  0:06 ` [PATCH v7 11/11] net: pch_gbe: " Paul Burton
2018-06-27 17:54   ` Andrew Lunn

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=20180628073628.GA15034@lunn.ch \
    --to=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    --cc=paul.burton@mips.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.