diff options
-rw-r--r-- | drivers/net/b44.c | 45 | ||||
-rw-r--r-- | drivers/net/b44.h | 74 |
2 files changed, 98 insertions, 21 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 *); | |||
106 | static int dma_desc_align_mask; | 106 | static int dma_desc_align_mask; |
107 | static int dma_desc_sync_size; | 107 | static int dma_desc_sync_size; |
108 | 108 | ||
109 | static const char b44_gstrings[][ETH_GSTRING_LEN] = { | ||
110 | #define _B44(x...) # x, | ||
111 | B44_STAT_REG_DECLARE | ||
112 | #undef _B44 | ||
113 | }; | ||
114 | |||
109 | static inline void b44_sync_dma_desc_for_device(struct pci_dev *pdev, | 115 | static 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 | ||
1784 | static 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 | |||
1793 | static int b44_get_stats_count(struct net_device *dev) | ||
1794 | { | ||
1795 | return ARRAY_SIZE(b44_gstrings); | ||
1796 | } | ||
1797 | |||
1798 | static 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 | |||
1775 | static struct ethtool_ops b44_ethtool_ops = { | 1815 | static 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 | ||
diff --git a/drivers/net/b44.h b/drivers/net/b44.h index 593cb0ad4100..7afeaf608232 100644 --- a/drivers/net/b44.h +++ b/drivers/net/b44.h | |||
@@ -346,29 +346,63 @@ struct ring_info { | |||
346 | 346 | ||
347 | #define B44_MCAST_TABLE_SIZE 32 | 347 | #define B44_MCAST_TABLE_SIZE 32 |
348 | 348 | ||
349 | #define B44_STAT_REG_DECLARE \ | ||
350 | _B44(tx_good_octets) \ | ||
351 | _B44(tx_good_pkts) \ | ||
352 | _B44(tx_octets) \ | ||
353 | _B44(tx_pkts) \ | ||
354 | _B44(tx_broadcast_pkts) \ | ||
355 | _B44(tx_multicast_pkts) \ | ||
356 | _B44(tx_len_64) \ | ||
357 | _B44(tx_len_65_to_127) \ | ||
358 | _B44(tx_len_128_to_255) \ | ||
359 | _B44(tx_len_256_to_511) \ | ||
360 | _B44(tx_len_512_to_1023) \ | ||
361 | _B44(tx_len_1024_to_max) \ | ||
362 | _B44(tx_jabber_pkts) \ | ||
363 | _B44(tx_oversize_pkts) \ | ||
364 | _B44(tx_fragment_pkts) \ | ||
365 | _B44(tx_underruns) \ | ||
366 | _B44(tx_total_cols) \ | ||
367 | _B44(tx_single_cols) \ | ||
368 | _B44(tx_multiple_cols) \ | ||
369 | _B44(tx_excessive_cols) \ | ||
370 | _B44(tx_late_cols) \ | ||
371 | _B44(tx_defered) \ | ||
372 | _B44(tx_carrier_lost) \ | ||
373 | _B44(tx_pause_pkts) \ | ||
374 | _B44(rx_good_octets) \ | ||
375 | _B44(rx_good_pkts) \ | ||
376 | _B44(rx_octets) \ | ||
377 | _B44(rx_pkts) \ | ||
378 | _B44(rx_broadcast_pkts) \ | ||
379 | _B44(rx_multicast_pkts) \ | ||
380 | _B44(rx_len_64) \ | ||
381 | _B44(rx_len_65_to_127) \ | ||
382 | _B44(rx_len_128_to_255) \ | ||
383 | _B44(rx_len_256_to_511) \ | ||
384 | _B44(rx_len_512_to_1023) \ | ||
385 | _B44(rx_len_1024_to_max) \ | ||
386 | _B44(rx_jabber_pkts) \ | ||
387 | _B44(rx_oversize_pkts) \ | ||
388 | _B44(rx_fragment_pkts) \ | ||
389 | _B44(rx_missed_pkts) \ | ||
390 | _B44(rx_crc_align_errs) \ | ||
391 | _B44(rx_undersize) \ | ||
392 | _B44(rx_crc_errs) \ | ||
393 | _B44(rx_align_errs) \ | ||
394 | _B44(rx_symbol_errs) \ | ||
395 | _B44(rx_pause_pkts) \ | ||
396 | _B44(rx_nonpause_pkts) | ||
397 | |||
349 | /* SW copy of device statistics, kept up to date by periodic timer | 398 | /* SW copy of device statistics, kept up to date by periodic timer |
350 | * which probes HW values. Must have same relative layout as HW | 399 | * which probes HW values. Check b44_stats_update if you mess with |
351 | * register above, because b44_stats_update depends upon this. | 400 | * the layout |
352 | */ | 401 | */ |
353 | struct b44_hw_stats { | 402 | struct b44_hw_stats { |
354 | u32 tx_good_octets, tx_good_pkts, tx_octets; | 403 | #define _B44(x) u32 x; |
355 | u32 tx_pkts, tx_broadcast_pkts, tx_multicast_pkts; | 404 | B44_STAT_REG_DECLARE |
356 | u32 tx_len_64, tx_len_65_to_127, tx_len_128_to_255; | 405 | #undef _B44 |
357 | u32 tx_len_256_to_511, tx_len_512_to_1023, tx_len_1024_to_max; | ||
358 | u32 tx_jabber_pkts, tx_oversize_pkts, tx_fragment_pkts; | ||
359 | u32 tx_underruns, tx_total_cols, tx_single_cols; | ||
360 | u32 tx_multiple_cols, tx_excessive_cols, tx_late_cols; | ||
361 | u32 tx_defered, tx_carrier_lost, tx_pause_pkts; | ||
362 | u32 __pad1[8]; | ||
363 | |||
364 | u32 rx_good_octets, rx_good_pkts, rx_octets; | ||
365 | u32 rx_pkts, rx_broadcast_pkts, rx_multicast_pkts; | ||
366 | u32 rx_len_64, rx_len_65_to_127, rx_len_128_to_255; | ||
367 | u32 rx_len_256_to_511, rx_len_512_to_1023, rx_len_1024_to_max; | ||
368 | u32 rx_jabber_pkts, rx_oversize_pkts, rx_fragment_pkts; | ||
369 | u32 rx_missed_pkts, rx_crc_align_errs, rx_undersize; | ||
370 | u32 rx_crc_errs, rx_align_errs, rx_symbol_errs; | ||
371 | u32 rx_pause_pkts, rx_nonpause_pkts; | ||
372 | }; | 406 | }; |
373 | 407 | ||
374 | struct b44 { | 408 | struct b44 { |