1 /* SPDX-License-Identifier: GPL-2.0-only */
3 * Copyright 2006, Johannes Berg <johannes@sipsolutions.net>
6 #include <linux/list.h>
7 #include <linux/spinlock.h>
8 #include <linux/leds.h>
9 #include "ieee80211_i.h"
11 #define MAC80211_BLINK_DELAY 50 /* ms */
13 static inline void ieee80211_led_rx(struct ieee80211_local *local)
15 #ifdef CONFIG_MAC80211_LEDS
16 unsigned long led_delay = MAC80211_BLINK_DELAY;
18 if (!atomic_read(&local->rx_led_active))
20 led_trigger_blink_oneshot(&local->rx_led, &led_delay, &led_delay, 0);
24 static inline void ieee80211_led_tx(struct ieee80211_local *local)
26 #ifdef CONFIG_MAC80211_LEDS
27 unsigned long led_delay = MAC80211_BLINK_DELAY;
29 if (!atomic_read(&local->tx_led_active))
31 led_trigger_blink_oneshot(&local->tx_led, &led_delay, &led_delay, 0);
35 #ifdef CONFIG_MAC80211_LEDS
36 void ieee80211_led_assoc(struct ieee80211_local *local,
38 void ieee80211_led_radio(struct ieee80211_local *local,
40 void ieee80211_alloc_led_names(struct ieee80211_local *local);
41 void ieee80211_free_led_names(struct ieee80211_local *local);
42 void ieee80211_led_init(struct ieee80211_local *local);
43 void ieee80211_led_exit(struct ieee80211_local *local);
44 void ieee80211_mod_tpt_led_trig(struct ieee80211_local *local,
45 unsigned int types_on, unsigned int types_off);
47 static inline void ieee80211_led_assoc(struct ieee80211_local *local,
51 static inline void ieee80211_led_radio(struct ieee80211_local *local,
55 static inline void ieee80211_alloc_led_names(struct ieee80211_local *local)
58 static inline void ieee80211_free_led_names(struct ieee80211_local *local)
61 static inline void ieee80211_led_init(struct ieee80211_local *local)
64 static inline void ieee80211_led_exit(struct ieee80211_local *local)
67 static inline void ieee80211_mod_tpt_led_trig(struct ieee80211_local *local,
68 unsigned int types_on,
69 unsigned int types_off)
75 ieee80211_tpt_led_trig_tx(struct ieee80211_local *local, int bytes)
77 #ifdef CONFIG_MAC80211_LEDS
78 if (atomic_read(&local->tpt_led_active))
79 local->tpt_led_trigger->tx_bytes += bytes;
84 ieee80211_tpt_led_trig_rx(struct ieee80211_local *local, int bytes)
86 #ifdef CONFIG_MAC80211_LEDS
87 if (atomic_read(&local->tpt_led_active))
88 local->tpt_led_trigger->rx_bytes += bytes;