Commit | Line | Data |
---|---|---|
f0706e82 JB |
1 | /* |
2 | * Copyright 2006, Johannes Berg <johannes@sipsolutions.net> | |
3 | * | |
4 | * This program is free software; you can redistribute it and/or modify | |
5 | * it under the terms of the GNU General Public License version 2 as | |
6 | * published by the Free Software Foundation. | |
7 | */ | |
8 | ||
9 | #include <linux/list.h> | |
10 | #include <linux/spinlock.h> | |
11 | #include <linux/leds.h> | |
12 | #include "ieee80211_i.h" | |
13 | ||
8d5c2585 JB |
14 | #define MAC80211_BLINK_DELAY 50 /* ms */ |
15 | ||
16 | static inline void ieee80211_led_rx(struct ieee80211_local *local) | |
17 | { | |
18 | #ifdef CONFIG_MAC80211_LEDS | |
19 | unsigned long led_delay = MAC80211_BLINK_DELAY; | |
20 | ||
21 | if (!atomic_read(&local->rx_led_active)) | |
22 | return; | |
23 | led_trigger_blink_oneshot(&local->rx_led, &led_delay, &led_delay, 0); | |
24 | #endif | |
25 | } | |
26 | ||
27 | static inline void ieee80211_led_tx(struct ieee80211_local *local) | |
28 | { | |
29 | #ifdef CONFIG_MAC80211_LEDS | |
30 | unsigned long led_delay = MAC80211_BLINK_DELAY; | |
31 | ||
32 | if (!atomic_read(&local->tx_led_active)) | |
33 | return; | |
34 | led_trigger_blink_oneshot(&local->tx_led, &led_delay, &led_delay, 0); | |
35 | #endif | |
36 | } | |
37 | ||
f0706e82 | 38 | #ifdef CONFIG_MAC80211_LEDS |
e1e54068 JB |
39 | void ieee80211_led_assoc(struct ieee80211_local *local, |
40 | bool associated); | |
41 | void ieee80211_led_radio(struct ieee80211_local *local, | |
42 | bool enabled); | |
8d5c2585 JB |
43 | void ieee80211_alloc_led_names(struct ieee80211_local *local); |
44 | void ieee80211_free_led_names(struct ieee80211_local *local); | |
e1e54068 JB |
45 | void ieee80211_led_init(struct ieee80211_local *local); |
46 | void ieee80211_led_exit(struct ieee80211_local *local); | |
67408c8c JB |
47 | void ieee80211_mod_tpt_led_trig(struct ieee80211_local *local, |
48 | unsigned int types_on, unsigned int types_off); | |
f0706e82 | 49 | #else |
47f0c502 MB |
50 | static inline void ieee80211_led_assoc(struct ieee80211_local *local, |
51 | bool associated) | |
52 | { | |
53 | } | |
cdcb006f ID |
54 | static inline void ieee80211_led_radio(struct ieee80211_local *local, |
55 | bool enabled) | |
56 | { | |
57 | } | |
8d5c2585 JB |
58 | static inline void ieee80211_alloc_led_names(struct ieee80211_local *local) |
59 | { | |
60 | } | |
61 | static inline void ieee80211_free_led_names(struct ieee80211_local *local) | |
fe67c913 JB |
62 | { |
63 | } | |
f0706e82 JB |
64 | static inline void ieee80211_led_init(struct ieee80211_local *local) |
65 | { | |
66 | } | |
67 | static inline void ieee80211_led_exit(struct ieee80211_local *local) | |
68 | { | |
69 | } | |
67408c8c JB |
70 | static inline void ieee80211_mod_tpt_led_trig(struct ieee80211_local *local, |
71 | unsigned int types_on, | |
72 | unsigned int types_off) | |
e1e54068 JB |
73 | { |
74 | } | |
75 | #endif | |
76 | ||
77 | static inline void | |
78 | ieee80211_tpt_led_trig_tx(struct ieee80211_local *local, __le16 fc, int bytes) | |
79 | { | |
80 | #ifdef CONFIG_MAC80211_LEDS | |
8d5c2585 | 81 | if (ieee80211_is_data(fc) && atomic_read(&local->tpt_led_active)) |
e1e54068 | 82 | local->tpt_led_trigger->tx_bytes += bytes; |
f0706e82 | 83 | #endif |
e1e54068 JB |
84 | } |
85 | ||
86 | static inline void | |
87 | ieee80211_tpt_led_trig_rx(struct ieee80211_local *local, __le16 fc, int bytes) | |
88 | { | |
89 | #ifdef CONFIG_MAC80211_LEDS | |
8d5c2585 | 90 | if (ieee80211_is_data(fc) && atomic_read(&local->tpt_led_active)) |
e1e54068 JB |
91 | local->tpt_led_trigger->rx_bytes += bytes; |
92 | #endif | |
93 | } |