]> git.pld-linux.org Git - packages/kernel.git/blob - 2.6.0-t11-r8169-getstats.patch
- ported from linux-2.4.25-atmdd.patch
[packages/kernel.git] / 2.6.0-t11-r8169-getstats.patch
1 diff -Nur linux/drivers/net/r8169.c.orig linux/drivers/net/r8169.c
2 --- linux/drivers/net/r8169.c.orig      2003-12-02 20:36:07.000000000 -0200
3 +++ linux/drivers/net/r8169.c   2003-12-02 20:52:19.000000000 -0200
4 @@ -303,7 +303,7 @@
5  static int rtl8169_close(struct net_device *dev);
6  static void rtl8169_set_rx_mode(struct net_device *dev);
7  static void rtl8169_tx_timeout(struct net_device *dev);
8 -static struct net_device_stats *rtl8169_get_stats(struct net_device *netdev);
9 +static struct net_device_stats *rtl8169_get_stats(struct net_device *ethernet_device);
10  
11  static const u16 rtl8169_intr_mask =
12      SYSErr | PCSTimeout | RxUnderrun | RxOverflow | RxFIFOOver | TxErr | TxOK |
13 @@ -1113,11 +1113,26 @@
14         spin_unlock_irqrestore(&tp->lock, flags);
15  }
16  
17 +/**
18 + *  rtl8169_get_stats: - Get rtl8169 read/write statistics
19 + *  @ethernet_device: The Ethernet Device to get statistics for
20 + *
21 + *  Get TX/RX statistics for rtl8169
22 + */
23  struct net_device_stats *
24 -rtl8169_get_stats(struct net_device *dev)
25 +rtl8169_get_stats(struct net_device *ethernet_device)
26  {
27 -       struct rtl8169_private *tp = dev->priv;
28 +       struct rtl8169_private *tp = ethernet_device->priv;
29 +       void *ioaddr = tp->mmio_addr;
30 +       unsigned long flags;
31  
32 +        if (netif_running(ethernet_device)) {
33 +           spin_lock_irqsave (&tp->lock, flags);
34 +           tp->stats.rx_missed_errors += RTL_R32 (RxMissed);
35 +           RTL_W32 (RxMissed, 0);
36 +           spin_unlock_irqrestore (&tp->lock, flags);
37 +       }
38 +               
39         return &tp->stats;
40  }
41  
This page took 0.0342 seconds and 3 git commands to generate.