> -----Original Message-----
> From: Florian Fainelli [mailto:f.faine...@gmail.com]
> Sent: Saturday, August 15, 2015 1:02 AM
> To: shh....@gmail.com; netdev@vger.kernel.org; da...@davemloft.net
> Cc: Xie Shaohui-B21989
> Subject: Re: [PATCH] net: phy: fix PHY_RUNNING in phy_state_machine
> 
> Le 08/13/15 21:23, shh....@gmail.com a écrit :
> > From: Shaohui Xie <shaohui....@freescale.com>
> >
> > Currently, if phy state is PHY_RUNNING, we always register a CHANGE
> > when phy works in polling or interrupt ignored, this will make the
> > adjust_link being called even the phy link did Not changed.
> 
> Right, which is why most drivers do implement a caching scheme.
> 
> >
> > checking the phy link to make sure the link did changed before we
> > register a CHANGE, if link did not changed, we do nothing.
> 
> With your change we will end-up with virtually polling a PHY twice as fast as 
> we
> used to with the RUNNING -> CHANGELINK -> RUNNING transition (current state
> transitions), which is probably fine, but puts a bit more pressure on the 
> (slow)
> MDIO bus since we end-up with two additional reads to latch the link status
> register.
[S.H] How about put the link checking in state PHY_CHANGELINK, if the link did 
changed,
Continue to original handle, if the link did not changed, modify the state to 
PHY_RUNNING?

        case PHY_CHANGELINK:
+               old_link = phydev->link;
                err = phy_read_status(phydev);
                if (err)
                        break;
 
+               if (old_link == phydev->link) {
+                       phydev->state = PHY_RUNNING;
+                       break;
+               }
+

Thanks!
Shaohui
N�����r��y����b�X��ǧv�^�)޺{.n�+���z�^�)����w*jg��������ݢj/���z�ޖ��2�ޙ����&�)ߡ�a�����G���h��j:+v���w��٥

Reply via email to