Commit f09cf4b7 authored by Chun-Hao Lin's avatar Chun-Hao Lin Committed by David S. Miller

r8169:fix "rtl_counters_cond == 1 (loop: 1000, delay: 10)" log spam.

There will be a log spam when there is no cable plugged. Please refer to
following links. https://bugzilla.kernel.org/show_bug.cgi?id=104351
https://bugzilla.kernel.org/show_bug.cgi?id=107421

This issue is caused by runtime power management. When there is no cable
plugged, the driver will be suspend (runtime suspend) by OS and NIC will be
put into the D3 state. During this time, if OS call rtl8169_get_stats64()
to dump tally counter, because NIC is in D3 state, the register value read
by driver will return all 0xff. This will let driver think tally counter
flag is not toggled and then sends the warning message "rtl_counters_cond
== 1 (loop: 1000, delay: 10)" to kernel log.

For fixing this issue, 1.add checking driver's pm runtime status in
rtl8169_get_stats64(). 2.dump tally counter before going runtime suspend
for counter accuracy in runtime suspend.
Signed-off-by: default avatarChunhao Lin <hau@realtek.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 9b368814
...@@ -7730,10 +7730,13 @@ rtl8169_get_stats64(struct net_device *dev, struct rtnl_link_stats64 *stats) ...@@ -7730,10 +7730,13 @@ rtl8169_get_stats64(struct net_device *dev, struct rtnl_link_stats64 *stats)
{ {
struct rtl8169_private *tp = netdev_priv(dev); struct rtl8169_private *tp = netdev_priv(dev);
void __iomem *ioaddr = tp->mmio_addr; void __iomem *ioaddr = tp->mmio_addr;
struct pci_dev *pdev = tp->pci_dev;
struct rtl8169_counters *counters = tp->counters; struct rtl8169_counters *counters = tp->counters;
unsigned int start; unsigned int start;
if (netif_running(dev)) pm_runtime_get_noresume(&pdev->dev);
if (netif_running(dev) && pm_runtime_active(&pdev->dev))
rtl8169_rx_missed(dev, ioaddr); rtl8169_rx_missed(dev, ioaddr);
do { do {
...@@ -7761,6 +7764,7 @@ rtl8169_get_stats64(struct net_device *dev, struct rtnl_link_stats64 *stats) ...@@ -7761,6 +7764,7 @@ rtl8169_get_stats64(struct net_device *dev, struct rtnl_link_stats64 *stats)
* Fetch additonal counter values missing in stats collected by driver * Fetch additonal counter values missing in stats collected by driver
* from tally counters. * from tally counters.
*/ */
if (pm_runtime_active(&pdev->dev))
rtl8169_update_counters(dev); rtl8169_update_counters(dev);
/* /*
...@@ -7774,6 +7778,8 @@ rtl8169_get_stats64(struct net_device *dev, struct rtnl_link_stats64 *stats) ...@@ -7774,6 +7778,8 @@ rtl8169_get_stats64(struct net_device *dev, struct rtnl_link_stats64 *stats)
stats->tx_aborted_errors = le16_to_cpu(counters->tx_aborted) - stats->tx_aborted_errors = le16_to_cpu(counters->tx_aborted) -
le16_to_cpu(tp->tc_offset.tx_aborted); le16_to_cpu(tp->tc_offset.tx_aborted);
pm_runtime_put_noidle(&pdev->dev);
return stats; return stats;
} }
...@@ -7853,6 +7859,10 @@ static int rtl8169_runtime_suspend(struct device *device) ...@@ -7853,6 +7859,10 @@ static int rtl8169_runtime_suspend(struct device *device)
rtl8169_net_suspend(dev); rtl8169_net_suspend(dev);
/* Update counters before going runtime suspend */
rtl8169_rx_missed(dev, tp->mmio_addr);
rtl8169_update_counters(dev);
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment