Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

b43: Add optional verbose runtime statistics

This adds support for verbose runtime statistics.
It defaults to off and must be enabled in debugfs, if desired.
The first measurement may be incorrect, because statistics are not cleared
after they got enabled through debugfs.

Signed-off-by: Michael Buesch <mb@bu3sch.de>
Signed-off-by: John W. Linville <linville@tuxdriver.com>

authored by

Michael Buesch and committed by
John W. Linville
990b86f4 176e9f6a

+43
+4
drivers/net/wireless/b43/b43.h
··· 817 817 /* Debugging stuff follows. */ 818 818 #ifdef CONFIG_B43_DEBUG 819 819 struct b43_dfsentry *dfsentry; 820 + unsigned int irq_count; 821 + unsigned int irq_bit_count[32]; 822 + unsigned int tx_count; 823 + unsigned int rx_count; 820 824 #endif 821 825 }; 822 826
+1
drivers/net/wireless/b43/debugfs.c
··· 689 689 add_dyn_dbg("debug_lo", B43_DBG_LO, 0); 690 690 add_dyn_dbg("debug_firmware", B43_DBG_FIRMWARE, 0); 691 691 add_dyn_dbg("debug_keys", B43_DBG_KEYS, 0); 692 + add_dyn_dbg("debug_verbose_stats", B43_DBG_VERBOSESTATS, 0); 692 693 693 694 #undef add_dyn_dbg 694 695 }
+1
drivers/net/wireless/b43/debugfs.h
··· 13 13 B43_DBG_LO, 14 14 B43_DBG_FIRMWARE, 15 15 B43_DBG_KEYS, 16 + B43_DBG_VERBOSESTATS, 16 17 __B43_NR_DYNDBG, 17 18 }; 18 19
+34
drivers/net/wireless/b43/main.c
··· 1830 1830 1831 1831 /* Re-enable interrupts on the device by restoring the current interrupt mask. */ 1832 1832 b43_write32(dev, B43_MMIO_GEN_IRQ_MASK, dev->irq_mask); 1833 + 1834 + #if B43_DEBUG 1835 + if (b43_debug(dev, B43_DBG_VERBOSESTATS)) { 1836 + dev->irq_count++; 1837 + for (i = 0; i < ARRAY_SIZE(dev->irq_bit_count); i++) { 1838 + if (reason & (1 << i)) 1839 + dev->irq_bit_count[i]++; 1840 + } 1841 + } 1842 + #endif 1833 1843 } 1834 1844 1835 1845 /* Interrupt thread handler. Handles device interrupts in thread context. */ ··· 2903 2893 2904 2894 atomic_set(&phy->txerr_cnt, B43_PHY_TX_BADNESS_LIMIT); 2905 2895 wmb(); 2896 + 2897 + #if B43_DEBUG 2898 + if (b43_debug(dev, B43_DBG_VERBOSESTATS)) { 2899 + unsigned int i; 2900 + 2901 + b43dbg(dev->wl, "Stats: %7u IRQs/sec, %7u TX/sec, %7u RX/sec\n", 2902 + dev->irq_count / 15, 2903 + dev->tx_count / 15, 2904 + dev->rx_count / 15); 2905 + dev->irq_count = 0; 2906 + dev->tx_count = 0; 2907 + dev->rx_count = 0; 2908 + for (i = 0; i < ARRAY_SIZE(dev->irq_bit_count); i++) { 2909 + if (dev->irq_bit_count[i]) { 2910 + b43dbg(dev->wl, "Stats: %7u IRQ-%02u/sec (0x%08X)\n", 2911 + dev->irq_bit_count[i] / 15, i, (1 << i)); 2912 + dev->irq_bit_count[i] = 0; 2913 + } 2914 + } 2915 + } 2916 + #endif 2906 2917 } 2907 2918 2908 2919 static void do_periodic_work(struct b43_wldev *dev) ··· 3123 3092 dev_kfree_skb(skb); /* Drop it */ 3124 3093 } 3125 3094 3095 + #if B43_DEBUG 3096 + dev->tx_count++; 3097 + #endif 3126 3098 mutex_unlock(&wl->mutex); 3127 3099 } 3128 3100
+3
drivers/net/wireless/b43/xmit.c
··· 692 692 memcpy(IEEE80211_SKB_RXCB(skb), &status, sizeof(status)); 693 693 ieee80211_rx(dev->wl->hw, skb); 694 694 695 + #if B43_DEBUG 696 + dev->rx_count++; 697 + #endif 695 698 return; 696 699 drop: 697 700 b43dbg(dev->wl, "RX: Packet dropped\n");