aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorshemminger@linux-foundation.org <shemminger@linux-foundation.org>2007-01-26 14:38:39 -0500
committerJeff Garzik <jeff@garzik.org>2007-02-05 16:58:49 -0500
commit2bf56fe25cef2a7652f7b2ab37ac14a336c76c75 (patch)
tree0ee2f6c750bf4434e502881863b7f2cd2929daf7 /drivers/net
parent285e6ddd013bafa6278a0e4b76a25a075be74e14 (diff)
sky2: software rx/tx stats
Maintain packet statistics in software rather than hardware. This is slightly slower, but allows easier debugging of problems where packets are still being received by PHY but not being handled by hardware. Signed-off-by: Stephen Hemminger <shemminger@linux-foundation.org> Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/sky2.c21
1 files changed, 5 insertions, 16 deletions
diff --git a/drivers/net/sky2.c b/drivers/net/sky2.c
index 2a288070d566..947439167493 100644
--- a/drivers/net/sky2.c
+++ b/drivers/net/sky2.c
@@ -1443,6 +1443,9 @@ static void sky2_tx_complete(struct sky2_port *sky2, u16 done)
1443 if (unlikely(netif_msg_tx_done(sky2))) 1443 if (unlikely(netif_msg_tx_done(sky2)))
1444 printk(KERN_DEBUG "%s: tx done %u\n", 1444 printk(KERN_DEBUG "%s: tx done %u\n",
1445 dev->name, idx); 1445 dev->name, idx);
1446 sky2->net_stats.tx_packets++;
1447 sky2->net_stats.tx_bytes += re->skb->len;
1448
1446 dev_kfree_skb_any(re->skb); 1449 dev_kfree_skb_any(re->skb);
1447 } 1450 }
1448 1451
@@ -2065,6 +2068,8 @@ static int sky2_status_intr(struct sky2_hw *hw, int to_do)
2065 goto force_update; 2068 goto force_update;
2066 2069
2067 skb->protocol = eth_type_trans(skb, dev); 2070 skb->protocol = eth_type_trans(skb, dev);
2071 sky2->net_stats.rx_packets++;
2072 sky2->net_stats.rx_bytes += skb->len;
2068 dev->last_rx = jiffies; 2073 dev->last_rx = jiffies;
2069 2074
2070#ifdef SKY2_VLAN_TAG_USED 2075#ifdef SKY2_VLAN_TAG_USED
@@ -2790,25 +2795,9 @@ static void sky2_get_strings(struct net_device *dev, u32 stringset, u8 * data)
2790 } 2795 }
2791} 2796}
2792 2797
2793/* Use hardware MIB variables for critical path statistics and
2794 * transmit feedback not reported at interrupt.
2795 * Other errors are accounted for in interrupt handler.
2796 */
2797static struct net_device_stats *sky2_get_stats(struct net_device *dev) 2798static struct net_device_stats *sky2_get_stats(struct net_device *dev)
2798{ 2799{
2799 struct sky2_port *sky2 = netdev_priv(dev); 2800 struct sky2_port *sky2 = netdev_priv(dev);
2800 u64 data[13];
2801
2802 sky2_phy_stats(sky2, data, ARRAY_SIZE(data));
2803
2804 sky2->net_stats.tx_bytes = data[0];
2805 sky2->net_stats.rx_bytes = data[1];
2806 sky2->net_stats.tx_packets = data[2] + data[4] + data[6];
2807 sky2->net_stats.rx_packets = data[3] + data[5] + data[7];
2808 sky2->net_stats.multicast = data[3] + data[5];
2809 sky2->net_stats.collisions = data[10];
2810 sky2->net_stats.tx_aborted_errors = data[12];
2811
2812 return &sky2->net_stats; 2801 return &sky2->net_stats;
2813} 2802}
2814 2803