diff options
author | Francois Romieu <romieu@fr.zoreil.com> | 2008-09-10 16:28:56 -0400 |
---|---|---|
committer | Jeff Garzik <jgarzik@redhat.com> | 2008-09-24 18:48:54 -0400 |
commit | 523a609496dbc3897e530db2a2f27650d125ea00 (patch) | |
tree | cbc59ced67ab151337fcb3f9f23b489769dbdf46 /drivers/net/r8169.c | |
parent | e93dcb11dd6468000f2f018bd887e94b074ce931 (diff) |
r8169: fix RxMissed register access
- 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@fr.zoreil.com>
Cc: Edward Hsu <edward_hsu@realtek.com.tw>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
Diffstat (limited to 'drivers/net/r8169.c')
-rw-r--r-- | drivers/net/r8169.c | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c index 1822491f19cb..f28c2022f3b2 100644 --- a/drivers/net/r8169.c +++ b/drivers/net/r8169.c | |||
@@ -2286,8 +2286,6 @@ static void rtl_hw_start_8168(struct net_device *dev) | |||
2286 | 2286 | ||
2287 | RTL_R8(IntrMask); | 2287 | RTL_R8(IntrMask); |
2288 | 2288 | ||
2289 | RTL_W32(RxMissed, 0); | ||
2290 | |||
2291 | rtl_set_rx_mode(dev); | 2289 | rtl_set_rx_mode(dev); |
2292 | 2290 | ||
2293 | RTL_W8(ChipCmd, CmdTxEnb | CmdRxEnb); | 2291 | RTL_W8(ChipCmd, CmdTxEnb | CmdRxEnb); |
@@ -2412,8 +2410,6 @@ static void rtl_hw_start_8101(struct net_device *dev) | |||
2412 | 2410 | ||
2413 | RTL_R8(IntrMask); | 2411 | RTL_R8(IntrMask); |
2414 | 2412 | ||
2415 | RTL_W32(RxMissed, 0); | ||
2416 | |||
2417 | rtl_set_rx_mode(dev); | 2413 | rtl_set_rx_mode(dev); |
2418 | 2414 | ||
2419 | RTL_W8(ChipCmd, CmdTxEnb | CmdRxEnb); | 2415 | RTL_W8(ChipCmd, CmdTxEnb | CmdRxEnb); |
@@ -3191,6 +3187,17 @@ static int rtl8169_poll(struct napi_struct *napi, int budget) | |||
3191 | return work_done; | 3187 | return work_done; |
3192 | } | 3188 | } |
3193 | 3189 | ||
3190 | static void rtl8169_rx_missed(struct net_device *dev, void __iomem *ioaddr) | ||
3191 | { | ||
3192 | struct rtl8169_private *tp = netdev_priv(dev); | ||
3193 | |||
3194 | if (tp->mac_version > RTL_GIGA_MAC_VER_06) | ||
3195 | return; | ||
3196 | |||
3197 | dev->stats.rx_missed_errors += (RTL_R32(RxMissed) & 0xffffff); | ||
3198 | RTL_W32(RxMissed, 0); | ||
3199 | } | ||
3200 | |||
3194 | static void rtl8169_down(struct net_device *dev) | 3201 | static void rtl8169_down(struct net_device *dev) |
3195 | { | 3202 | { |
3196 | struct rtl8169_private *tp = netdev_priv(dev); | 3203 | struct rtl8169_private *tp = netdev_priv(dev); |
@@ -3208,9 +3215,7 @@ core_down: | |||
3208 | 3215 | ||
3209 | rtl8169_asic_down(ioaddr); | 3216 | rtl8169_asic_down(ioaddr); |
3210 | 3217 | ||
3211 | /* Update the error counts. */ | 3218 | rtl8169_rx_missed(dev, ioaddr); |
3212 | dev->stats.rx_missed_errors += RTL_R32(RxMissed); | ||
3213 | RTL_W32(RxMissed, 0); | ||
3214 | 3219 | ||
3215 | spin_unlock_irq(&tp->lock); | 3220 | spin_unlock_irq(&tp->lock); |
3216 | 3221 | ||
@@ -3332,8 +3337,7 @@ static struct net_device_stats *rtl8169_get_stats(struct net_device *dev) | |||
3332 | 3337 | ||
3333 | if (netif_running(dev)) { | 3338 | if (netif_running(dev)) { |
3334 | spin_lock_irqsave(&tp->lock, flags); | 3339 | spin_lock_irqsave(&tp->lock, flags); |
3335 | dev->stats.rx_missed_errors += RTL_R32(RxMissed); | 3340 | rtl8169_rx_missed(dev, ioaddr); |
3336 | RTL_W32(RxMissed, 0); | ||
3337 | spin_unlock_irqrestore(&tp->lock, flags); | 3341 | spin_unlock_irqrestore(&tp->lock, flags); |
3338 | } | 3342 | } |
3339 | 3343 | ||
@@ -3358,8 +3362,7 @@ static int rtl8169_suspend(struct pci_dev *pdev, pm_message_t state) | |||
3358 | 3362 | ||
3359 | rtl8169_asic_down(ioaddr); | 3363 | rtl8169_asic_down(ioaddr); |
3360 | 3364 | ||
3361 | dev->stats.rx_missed_errors += RTL_R32(RxMissed); | 3365 | rtl8169_rx_missed(dev, ioaddr); |
3362 | RTL_W32(RxMissed, 0); | ||
3363 | 3366 | ||
3364 | spin_unlock_irq(&tp->lock); | 3367 | spin_unlock_irq(&tp->lock); |
3365 | 3368 | ||