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>
This commit is contained in:
parent
285e6ddd01
commit
2bf56fe25c
|
@ -1443,6 +1443,9 @@ static void sky2_tx_complete(struct sky2_port *sky2, u16 done)
|
||||||
if (unlikely(netif_msg_tx_done(sky2)))
|
if (unlikely(netif_msg_tx_done(sky2)))
|
||||||
printk(KERN_DEBUG "%s: tx done %u\n",
|
printk(KERN_DEBUG "%s: tx done %u\n",
|
||||||
dev->name, idx);
|
dev->name, idx);
|
||||||
|
sky2->net_stats.tx_packets++;
|
||||||
|
sky2->net_stats.tx_bytes += re->skb->len;
|
||||||
|
|
||||||
dev_kfree_skb_any(re->skb);
|
dev_kfree_skb_any(re->skb);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2065,6 +2068,8 @@ static int sky2_status_intr(struct sky2_hw *hw, int to_do)
|
||||||
goto force_update;
|
goto force_update;
|
||||||
|
|
||||||
skb->protocol = eth_type_trans(skb, dev);
|
skb->protocol = eth_type_trans(skb, dev);
|
||||||
|
sky2->net_stats.rx_packets++;
|
||||||
|
sky2->net_stats.rx_bytes += skb->len;
|
||||||
dev->last_rx = jiffies;
|
dev->last_rx = jiffies;
|
||||||
|
|
||||||
#ifdef SKY2_VLAN_TAG_USED
|
#ifdef SKY2_VLAN_TAG_USED
|
||||||
|
@ -2790,25 +2795,9 @@ static void sky2_get_strings(struct net_device *dev, u32 stringset, u8 * data)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Use hardware MIB variables for critical path statistics and
|
|
||||||
* transmit feedback not reported at interrupt.
|
|
||||||
* Other errors are accounted for in interrupt handler.
|
|
||||||
*/
|
|
||||||
static struct net_device_stats *sky2_get_stats(struct net_device *dev)
|
static struct net_device_stats *sky2_get_stats(struct net_device *dev)
|
||||||
{
|
{
|
||||||
struct sky2_port *sky2 = netdev_priv(dev);
|
struct sky2_port *sky2 = netdev_priv(dev);
|
||||||
u64 data[13];
|
|
||||||
|
|
||||||
sky2_phy_stats(sky2, data, ARRAY_SIZE(data));
|
|
||||||
|
|
||||||
sky2->net_stats.tx_bytes = data[0];
|
|
||||||
sky2->net_stats.rx_bytes = data[1];
|
|
||||||
sky2->net_stats.tx_packets = data[2] + data[4] + data[6];
|
|
||||||
sky2->net_stats.rx_packets = data[3] + data[5] + data[7];
|
|
||||||
sky2->net_stats.multicast = data[3] + data[5];
|
|
||||||
sky2->net_stats.collisions = data[10];
|
|
||||||
sky2->net_stats.tx_aborted_errors = data[12];
|
|
||||||
|
|
||||||
return &sky2->net_stats;
|
return &sky2->net_stats;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue