aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/b44.c
diff options
context:
space:
mode:
authorFrancois Romieu <romieu@fr.zoreil.com>2005-11-06 19:51:34 -0500
committerJeff Garzik <jgarzik@pobox.com>2005-11-07 03:37:05 -0500
commit3353930d9d026ca94747d0766f864b2a0a8c714b (patch)
tree6f76506a9ebe0be3a0fde5b214a01fd95000548a /drivers/net/b44.c
parent874a6214bc1477004a0dd6f881b078d0d6b1eae9 (diff)
[PATCH] b44: expose counters through ethtool
Signed-off-by: Francois Romieu <romieu@fr.zoreil.com> Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
Diffstat (limited to 'drivers/net/b44.c')
-rw-r--r--drivers/net/b44.c45
1 files changed, 44 insertions, 1 deletions
diff --git a/drivers/net/b44.c b/drivers/net/b44.c
index 3b6428f004f6..ac223fcf9864 100644
--- a/drivers/net/b44.c
+++ b/drivers/net/b44.c
@@ -106,6 +106,12 @@ static void b44_init_hw(struct b44 *);
106static int dma_desc_align_mask; 106static int dma_desc_align_mask;
107static int dma_desc_sync_size; 107static int dma_desc_sync_size;
108 108
109static const char b44_gstrings[][ETH_GSTRING_LEN] = {
110#define _B44(x...) # x,
111B44_STAT_REG_DECLARE
112#undef _B44
113};
114
109static inline void b44_sync_dma_desc_for_device(struct pci_dev *pdev, 115static inline void b44_sync_dma_desc_for_device(struct pci_dev *pdev,
110 dma_addr_t dma_base, 116 dma_addr_t dma_base,
111 unsigned long offset, 117 unsigned long offset,
@@ -498,7 +504,10 @@ static void b44_stats_update(struct b44 *bp)
498 for (reg = B44_TX_GOOD_O; reg <= B44_TX_PAUSE; reg += 4UL) { 504 for (reg = B44_TX_GOOD_O; reg <= B44_TX_PAUSE; reg += 4UL) {
499 *val++ += br32(bp, reg); 505 *val++ += br32(bp, reg);
500 } 506 }
501 val = &bp->hw_stats.rx_good_octets; 507
508 /* Pad */
509 reg += 8*4UL;
510
502 for (reg = B44_RX_GOOD_O; reg <= B44_RX_NPAUSE; reg += 4UL) { 511 for (reg = B44_RX_GOOD_O; reg <= B44_RX_NPAUSE; reg += 4UL) {
503 *val++ += br32(bp, reg); 512 *val++ += br32(bp, reg);
504 } 513 }
@@ -1772,6 +1781,37 @@ static int b44_set_pauseparam(struct net_device *dev,
1772 return 0; 1781 return 0;
1773} 1782}
1774 1783
1784static void b44_get_strings(struct net_device *dev, u32 stringset, u8 *data)
1785{
1786 switch(stringset) {
1787 case ETH_SS_STATS:
1788 memcpy(data, *b44_gstrings, sizeof(b44_gstrings));
1789 break;
1790 }
1791}
1792
1793static int b44_get_stats_count(struct net_device *dev)
1794{
1795 return ARRAY_SIZE(b44_gstrings);
1796}
1797
1798static void b44_get_ethtool_stats(struct net_device *dev,
1799 struct ethtool_stats *stats, u64 *data)
1800{
1801 struct b44 *bp = netdev_priv(dev);
1802 u32 *val = &bp->hw_stats.tx_good_octets;
1803 u32 i;
1804
1805 spin_lock_irq(&bp->lock);
1806
1807 b44_stats_update(bp);
1808
1809 for (i = 0; i < ARRAY_SIZE(b44_gstrings); i++)
1810 *data++ = *val++;
1811
1812 spin_unlock_irq(&bp->lock);
1813}
1814
1775static struct ethtool_ops b44_ethtool_ops = { 1815static struct ethtool_ops b44_ethtool_ops = {
1776 .get_drvinfo = b44_get_drvinfo, 1816 .get_drvinfo = b44_get_drvinfo,
1777 .get_settings = b44_get_settings, 1817 .get_settings = b44_get_settings,
@@ -1784,6 +1824,9 @@ static struct ethtool_ops b44_ethtool_ops = {
1784 .set_pauseparam = b44_set_pauseparam, 1824 .set_pauseparam = b44_set_pauseparam,
1785 .get_msglevel = b44_get_msglevel, 1825 .get_msglevel = b44_get_msglevel,
1786 .set_msglevel = b44_set_msglevel, 1826 .set_msglevel = b44_set_msglevel,
1827 .get_strings = b44_get_strings,
1828 .get_stats_count = b44_get_stats_count,
1829 .get_ethtool_stats = b44_get_ethtool_stats,
1787 .get_perm_addr = ethtool_op_get_perm_addr, 1830 .get_perm_addr = ethtool_op_get_perm_addr,
1788}; 1831};
1789 1832