1 /* SPDX-License-Identifier: GPL-2.0-only */ << 2 /* 1 /* 3 * Copyright 2006, Johannes Berg <johannes@sip 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. 4 */ 7 */ 5 8 6 #include <linux/list.h> 9 #include <linux/list.h> 7 #include <linux/spinlock.h> 10 #include <linux/spinlock.h> 8 #include <linux/leds.h> 11 #include <linux/leds.h> 9 #include "ieee80211_i.h" 12 #include "ieee80211_i.h" 10 13 11 #define MAC80211_BLINK_DELAY 50 /* ms */ 14 #define MAC80211_BLINK_DELAY 50 /* ms */ 12 15 13 static inline void ieee80211_led_rx(struct iee 16 static inline void ieee80211_led_rx(struct ieee80211_local *local) 14 { 17 { 15 #ifdef CONFIG_MAC80211_LEDS 18 #ifdef CONFIG_MAC80211_LEDS >> 19 unsigned long led_delay = MAC80211_BLINK_DELAY; >> 20 16 if (!atomic_read(&local->rx_led_active 21 if (!atomic_read(&local->rx_led_active)) 17 return; 22 return; 18 led_trigger_blink_oneshot(&local->rx_l !! 23 led_trigger_blink_oneshot(&local->rx_led, &led_delay, &led_delay, 0); 19 #endif 24 #endif 20 } 25 } 21 26 22 static inline void ieee80211_led_tx(struct iee 27 static inline void ieee80211_led_tx(struct ieee80211_local *local) 23 { 28 { 24 #ifdef CONFIG_MAC80211_LEDS 29 #ifdef CONFIG_MAC80211_LEDS >> 30 unsigned long led_delay = MAC80211_BLINK_DELAY; >> 31 25 if (!atomic_read(&local->tx_led_active 32 if (!atomic_read(&local->tx_led_active)) 26 return; 33 return; 27 led_trigger_blink_oneshot(&local->tx_l !! 34 led_trigger_blink_oneshot(&local->tx_led, &led_delay, &led_delay, 0); 28 #endif 35 #endif 29 } 36 } 30 37 31 #ifdef CONFIG_MAC80211_LEDS 38 #ifdef CONFIG_MAC80211_LEDS 32 void ieee80211_led_assoc(struct ieee80211_loca 39 void ieee80211_led_assoc(struct ieee80211_local *local, 33 bool associated); 40 bool associated); 34 void ieee80211_led_radio(struct ieee80211_loca 41 void ieee80211_led_radio(struct ieee80211_local *local, 35 bool enabled); 42 bool enabled); 36 void ieee80211_alloc_led_names(struct ieee8021 43 void ieee80211_alloc_led_names(struct ieee80211_local *local); 37 void ieee80211_free_led_names(struct ieee80211 44 void ieee80211_free_led_names(struct ieee80211_local *local); 38 void ieee80211_led_init(struct ieee80211_local 45 void ieee80211_led_init(struct ieee80211_local *local); 39 void ieee80211_led_exit(struct ieee80211_local 46 void ieee80211_led_exit(struct ieee80211_local *local); 40 void ieee80211_mod_tpt_led_trig(struct ieee802 47 void ieee80211_mod_tpt_led_trig(struct ieee80211_local *local, 41 unsigned int t 48 unsigned int types_on, unsigned int types_off); 42 #else 49 #else 43 static inline void ieee80211_led_assoc(struct 50 static inline void ieee80211_led_assoc(struct ieee80211_local *local, 44 bool as 51 bool associated) 45 { 52 { 46 } 53 } 47 static inline void ieee80211_led_radio(struct 54 static inline void ieee80211_led_radio(struct ieee80211_local *local, 48 bool en 55 bool enabled) 49 { 56 { 50 } 57 } 51 static inline void ieee80211_alloc_led_names(s 58 static inline void ieee80211_alloc_led_names(struct ieee80211_local *local) 52 { 59 { 53 } 60 } 54 static inline void ieee80211_free_led_names(st 61 static inline void ieee80211_free_led_names(struct ieee80211_local *local) 55 { 62 { 56 } 63 } 57 static inline void ieee80211_led_init(struct i 64 static inline void ieee80211_led_init(struct ieee80211_local *local) 58 { 65 { 59 } 66 } 60 static inline void ieee80211_led_exit(struct i 67 static inline void ieee80211_led_exit(struct ieee80211_local *local) 61 { 68 { 62 } 69 } 63 static inline void ieee80211_mod_tpt_led_trig( 70 static inline void ieee80211_mod_tpt_led_trig(struct ieee80211_local *local, 64 71 unsigned int types_on, 65 72 unsigned int types_off) 66 { 73 { 67 } 74 } 68 #endif 75 #endif 69 76 70 static inline void 77 static inline void 71 ieee80211_tpt_led_trig_tx(struct ieee80211_loc !! 78 ieee80211_tpt_led_trig_tx(struct ieee80211_local *local, __le16 fc, int bytes) 72 { 79 { 73 #ifdef CONFIG_MAC80211_LEDS 80 #ifdef CONFIG_MAC80211_LEDS 74 if (atomic_read(&local->tpt_led_active !! 81 if (ieee80211_is_data(fc) && atomic_read(&local->tpt_led_active)) 75 local->tpt_led_trigger->tx_byt 82 local->tpt_led_trigger->tx_bytes += bytes; 76 #endif 83 #endif 77 } 84 } 78 85 79 static inline void 86 static inline void 80 ieee80211_tpt_led_trig_rx(struct ieee80211_loc !! 87 ieee80211_tpt_led_trig_rx(struct ieee80211_local *local, __le16 fc, int bytes) 81 { 88 { 82 #ifdef CONFIG_MAC80211_LEDS 89 #ifdef CONFIG_MAC80211_LEDS 83 if (atomic_read(&local->tpt_led_active !! 90 if (ieee80211_is_data(fc) && atomic_read(&local->tpt_led_active)) 84 local->tpt_led_trigger->rx_byt 91 local->tpt_led_trigger->rx_bytes += bytes; 85 #endif 92 #endif 86 } 93 } 87 94
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.