* [PATCH] gianfar: Reduce logging noise seen due to phy polling if link is down
@ 2015-03-02 20:03 Guenter Roeck
2015-03-03 14:42 ` claudiu.manoil
2015-03-03 19:37 ` David Miller
0 siblings, 2 replies; 3+ messages in thread
From: Guenter Roeck @ 2015-03-02 20:03 UTC (permalink / raw)
To: netdev; +Cc: David S. Miller, Guenter Roeck, Claudiu Manoil, linux-kernel
Commit 6ce29b0e2a04 ("gianfar: Avoid unnecessary reg accesses in adjust_link()")
eliminates unnecessary calls to adjust_link for phy devices which don't support
interrupts and need polling. As part of that work, the 'new_state' local flag,
which was used to reduce logging noise on the console, was eliminated.
Unfortunately, that means that a 'Link is Down' log message will now be
issued continuously if a link is configured as UP, the link state is down,
and the associated phy requires polling. This occurs because priv->oldduplex
is -1 in this case, which always differs from phydev->duplex. In addition,
phydev->speed may also differ from priv->oldspeed. gfar_update_link_state()
is therefore called each time a phy is polled, even if the link state did not
change.
Cc: Claudiu Manoil <claudiu.manoil@freescale.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
---
drivers/net/ethernet/freescale/gianfar.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/freescale/gianfar.c b/drivers/net/ethernet/freescale/gianfar.c
index 43df788..178e540 100644
--- a/drivers/net/ethernet/freescale/gianfar.c
+++ b/drivers/net/ethernet/freescale/gianfar.c
@@ -3162,8 +3162,8 @@ static void adjust_link(struct net_device *dev)
struct phy_device *phydev = priv->phydev;
if (unlikely(phydev->link != priv->oldlink ||
- phydev->duplex != priv->oldduplex ||
- phydev->speed != priv->oldspeed))
+ (phydev->link && (phydev->duplex != priv->oldduplex ||
+ phydev->speed != priv->oldspeed))))
gfar_update_link_state(priv);
}
--
2.1.0
^ permalink raw reply [flat|nested] 3+ messages in thread* RE: [PATCH] gianfar: Reduce logging noise seen due to phy polling if link is down
2015-03-02 20:03 [PATCH] gianfar: Reduce logging noise seen due to phy polling if link is down Guenter Roeck
@ 2015-03-03 14:42 ` claudiu.manoil
2015-03-03 19:37 ` David Miller
1 sibling, 0 replies; 3+ messages in thread
From: claudiu.manoil @ 2015-03-03 14:42 UTC (permalink / raw)
To: Guenter Roeck, netdev; +Cc: David S. Miller, linux-kernel
> -----Original Message-----
> From: Guenter Roeck [mailto:linux@roeck-us.net]
> Sent: Monday, March 02, 2015 10:03 PM
>
[...]
>
> Cc: Claudiu Manoil <claudiu.manoil@freescale.com>
> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
> ---
[...]
> if (unlikely(phydev->link != priv->oldlink ||
> - phydev->duplex != priv->oldduplex ||
> - phydev->speed != priv->oldspeed))
> + (phydev->link && (phydev->duplex != priv->oldduplex ||
> + phydev->speed != priv->oldspeed))))
> gfar_update_link_state(priv);
> }
I did a quick check and, indeed, phydev->duplex or phydev->speed
may change even if phydev->link is 0. I could reproduce the issue
with the following test for an eth with a polling mode phy:
1) initially link is up - autoneg on, speed 1000;
2) taking the link down - link down message printed only once;
3) turning autoneg to off for the same eth - link down message
is printed continuously;
So, given this, I agree that the driver needs this protection before
accessing the phydev->duplex/speed fields, namely to check first whether
phydev->link is 1. If link is 0, phydev->speed/duplex may be bogus.
Thanks for spotting this.
Reviewed-by: Claudiu Manoil <claudiu.manoil@freescale.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] gianfar: Reduce logging noise seen due to phy polling if link is down
2015-03-02 20:03 [PATCH] gianfar: Reduce logging noise seen due to phy polling if link is down Guenter Roeck
2015-03-03 14:42 ` claudiu.manoil
@ 2015-03-03 19:37 ` David Miller
1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2015-03-03 19:37 UTC (permalink / raw)
To: linux; +Cc: netdev, claudiu.manoil, linux-kernel
From: Guenter Roeck <linux@roeck-us.net>
Date: Mon, 2 Mar 2015 12:03:27 -0800
> Commit 6ce29b0e2a04 ("gianfar: Avoid unnecessary reg accesses in adjust_link()")
> eliminates unnecessary calls to adjust_link for phy devices which don't support
> interrupts and need polling. As part of that work, the 'new_state' local flag,
> which was used to reduce logging noise on the console, was eliminated.
>
> Unfortunately, that means that a 'Link is Down' log message will now be
> issued continuously if a link is configured as UP, the link state is down,
> and the associated phy requires polling. This occurs because priv->oldduplex
> is -1 in this case, which always differs from phydev->duplex. In addition,
> phydev->speed may also differ from priv->oldspeed. gfar_update_link_state()
> is therefore called each time a phy is polled, even if the link state did not
> change.
>
> Cc: Claudiu Manoil <claudiu.manoil@freescale.com>
> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Applied, thanks.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-03-03 19:37 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-02 20:03 [PATCH] gianfar: Reduce logging noise seen due to phy polling if link is down Guenter Roeck
2015-03-03 14:42 ` claudiu.manoil
2015-03-03 19:37 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®