* [PATCH] bonding: ratelimit failed speed/duplex update warning
@ 2017-08-11 10:04 Andreas Born
2017-08-11 10:59 ` Joe Perches
0 siblings, 1 reply; 2+ messages in thread
From: Andreas Born @ 2017-08-11 10:04 UTC (permalink / raw)
To: netdev; +Cc: Andreas Born
bond_miimon_commit() handles the UP transition for each slave of a bond
in the case of MII. It is triggered 10 times per second for the default
MII Polling interval of 100ms. For device drivers that do not implement
__ethtool_get_link_ksettings() the call to bond_update_speed_duplex()
fails persistently while the MII status could remain UP. That is, in this and
other cases where the speed/duplex update keeps failing over a longer
period of time while the MII state is UP, a warning is printed every MII
polling interval.
To address these excessive warnings pr_warn_ratelimited() should be used
instead. pr_warn_once() would not be sufficient since the call to
bond_update_speed_duplex() could recover to meanwhile succeed and fail
again later.
Fixes: b5bf0f5b16b9c (bonding: correctly update link status during mii-commit phase)
Signed-off-by: Andreas Born <futur.andy@googlemail.com>
---
drivers/net/bonding/bond_main.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 85bb272d2a34..7b8bbee531d7 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -2144,9 +2144,9 @@ static void bond_miimon_commit(struct bonding *bond)
if (bond_update_speed_duplex(slave) &&
bond_needs_speed_duplex(bond)) {
slave->link = BOND_LINK_DOWN;
- netdev_warn(bond->dev,
- "failed to get link speed/duplex for %s\n",
- slave->dev->name);
+ pr_warn_ratelimited("%s: failed to get link speed/duplex for %s\n",
+ bond->dev->name,
+ slave->dev->name);
continue;
}
bond_set_slave_link_state(slave, BOND_LINK_UP,
--
2.14.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] bonding: ratelimit failed speed/duplex update warning
2017-08-11 10:04 [PATCH] bonding: ratelimit failed speed/duplex update warning Andreas Born
@ 2017-08-11 10:59 ` Joe Perches
0 siblings, 0 replies; 2+ messages in thread
From: Joe Perches @ 2017-08-11 10:59 UTC (permalink / raw)
To: Andreas Born, netdev
On Fri, 2017-08-11 at 12:04 +0200, Andreas Born wrote:
> bond_miimon_commit() handles the UP transition for each slave of a bond
> in the case of MII. It is triggered 10 times per second for the default
> MII Polling interval of 100ms. For device drivers that do not implement
> __ethtool_get_link_ksettings() the call to bond_update_speed_duplex()
> fails persistently while the MII status could remain UP. That is, in this and
> other cases where the speed/duplex update keeps failing over a longer
> period of time while the MII state is UP, a warning is printed every MII
> polling interval.
>
> To address these excessive warnings pr_warn_ratelimited() should be used
> instead. pr_warn_once() would not be sufficient since the call to
> bond_update_speed_duplex() could recover to meanwhile succeed and fail
> again later.
[]
> diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
[]
> @@ -2144,9 +2144,9 @@ static void bond_miimon_commit(struct bonding *bond)
> if (bond_update_speed_duplex(slave) &&
> bond_needs_speed_duplex(bond)) {
> slave->link = BOND_LINK_DOWN;
> - netdev_warn(bond->dev,
> - "failed to get link speed/duplex for %s\n",
> - slave->dev->name);
> + pr_warn_ratelimited("%s: failed to get link speed/duplex for %s\n",
> + bond->dev->name,
> + slave->dev->name);
This is more commonly done using
if (net_ratelimit())
netdev_warn(etc...)
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-08-11 10:59 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-08-11 10:04 [PATCH] bonding: ratelimit failed speed/duplex update warning Andreas Born
2017-08-11 10:59 ` Joe Perches
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).