mac80211: make LED triggering depend on activation

When LED triggers are compiled in, but not used, mac80211 will still
call them to update the status. This isn't really a problem for the
assoc and radio ones, but the TX/RX (and to a certain extend TPT)
ones can be called very frequently (for every packet.)

In order to avoid that when they're not used, track their activation
and call the corresponding trigger (and in the TPT case, account for
throughput) only when the trigger is actually used by an LED.

Additionally, make those trigger functions inlines since theyre only
used once in the remaining code.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
This commit is contained in:
Johannes Berg
2015-04-23 12:19:22 +02:00
parent f5c4ae0799
commit 8d5c258568
4 changed files with 194 additions and 100 deletions

View File

@@ -1260,10 +1260,11 @@ struct ieee80211_local {
struct mutex chanctx_mtx;
#ifdef CONFIG_MAC80211_LEDS
struct led_trigger *tx_led, *rx_led, *assoc_led, *radio_led;
struct led_trigger tx_led, rx_led, assoc_led, radio_led;
struct led_trigger tpt_led;
atomic_t tx_led_active, rx_led_active, assoc_led_active;
atomic_t radio_led_active, tpt_led_active;
struct tpt_led_trigger *tpt_led_trigger;
char tx_led_name[32], rx_led_name[32],
assoc_led_name[32], radio_led_name[32];
#endif
#ifdef CONFIG_MAC80211_DEBUG_COUNTERS