[patch 22/49] r8169: fix RxMissed register access

From: Greg KH
Date: Tue Nov 11 2008 - 19:34:35 EST


2.6.27-stable review patch. If anyone has any objections, please let us know.

------------------

From: Francois Romieu <romieu@xxxxxxxxxxxxx>

Upstream as 523a609496dbc3897e530db2a2f27650d125ea00

- the register is defined for the 8169 chipset only and there is
no 8169 beyond RTL_GIGA_MAC_VER_06.
- only the lower 3 bytes of the register are valid

Fixes:
1. http://bugzilla.kernel.org/show_bug.cgi?id=10180
2. http://bugzilla.kernel.org/show_bug.cgi?id=11062 (bits of)

Tested by Hermann Gausterer and Adam Huffman.

Signed-off-by: Francois Romieu <romieu@xxxxxxxxxxxxx>
Cc: Edward Hsu <edward_hsu@xxxxxxxxxxxxxx>
Signed-off-by: Jeff Garzik <jgarzik@xxxxxxxxxx>
Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxx>

---
drivers/net/r8169.c | 25 ++++++++++++++-----------
1 file changed, 14 insertions(+), 11 deletions(-)

--- a/drivers/net/r8169.c
+++ b/drivers/net/r8169.c
@@ -2092,8 +2092,6 @@ static void rtl_hw_start_8168(struct net

RTL_R8(IntrMask);

- RTL_W32(RxMissed, 0);
-
rtl_set_rx_mode(dev);

RTL_W8(ChipCmd, CmdTxEnb | CmdRxEnb);
@@ -2136,8 +2134,6 @@ static void rtl_hw_start_8101(struct net

RTL_R8(IntrMask);

- RTL_W32(RxMissed, 0);
-
rtl_set_rx_mode(dev);

RTL_W8(ChipCmd, CmdTxEnb | CmdRxEnb);
@@ -2915,6 +2911,17 @@ static int rtl8169_poll(struct napi_stru
return work_done;
}

+static void rtl8169_rx_missed(struct net_device *dev, void __iomem *ioaddr)
+{
+ struct rtl8169_private *tp = netdev_priv(dev);
+
+ if (tp->mac_version > RTL_GIGA_MAC_VER_06)
+ return;
+
+ dev->stats.rx_missed_errors += (RTL_R32(RxMissed) & 0xffffff);
+ RTL_W32(RxMissed, 0);
+}
+
static void rtl8169_down(struct net_device *dev)
{
struct rtl8169_private *tp = netdev_priv(dev);
@@ -2932,9 +2939,7 @@ core_down:

rtl8169_asic_down(ioaddr);

- /* Update the error counts. */
- dev->stats.rx_missed_errors += RTL_R32(RxMissed);
- RTL_W32(RxMissed, 0);
+ rtl8169_rx_missed(dev, ioaddr);

spin_unlock_irq(&tp->lock);

@@ -3056,8 +3061,7 @@ static struct net_device_stats *rtl8169_

if (netif_running(dev)) {
spin_lock_irqsave(&tp->lock, flags);
- dev->stats.rx_missed_errors += RTL_R32(RxMissed);
- RTL_W32(RxMissed, 0);
+ rtl8169_rx_missed(dev, ioaddr);
spin_unlock_irqrestore(&tp->lock, flags);
}

@@ -3082,8 +3086,7 @@ static int rtl8169_suspend(struct pci_de

rtl8169_asic_down(ioaddr);

- dev->stats.rx_missed_errors += RTL_R32(RxMissed);
- RTL_W32(RxMissed, 0);
+ rtl8169_rx_missed(dev, ioaddr);

spin_unlock_irq(&tp->lock);


--
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/