Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-only */
0002 /*
0003  * Copyright 2006, Johannes Berg <johannes@sipsolutions.net>
0004  */
0005 
0006 #include <linux/list.h>
0007 #include <linux/spinlock.h>
0008 #include <linux/leds.h>
0009 #include "ieee80211_i.h"
0010 
0011 #define MAC80211_BLINK_DELAY 50 /* ms */
0012 
0013 static inline void ieee80211_led_rx(struct ieee80211_local *local)
0014 {
0015 #ifdef CONFIG_MAC80211_LEDS
0016     unsigned long led_delay = MAC80211_BLINK_DELAY;
0017 
0018     if (!atomic_read(&local->rx_led_active))
0019         return;
0020     led_trigger_blink_oneshot(&local->rx_led, &led_delay, &led_delay, 0);
0021 #endif
0022 }
0023 
0024 static inline void ieee80211_led_tx(struct ieee80211_local *local)
0025 {
0026 #ifdef CONFIG_MAC80211_LEDS
0027     unsigned long led_delay = MAC80211_BLINK_DELAY;
0028 
0029     if (!atomic_read(&local->tx_led_active))
0030         return;
0031     led_trigger_blink_oneshot(&local->tx_led, &led_delay, &led_delay, 0);
0032 #endif
0033 }
0034 
0035 #ifdef CONFIG_MAC80211_LEDS
0036 void ieee80211_led_assoc(struct ieee80211_local *local,
0037              bool associated);
0038 void ieee80211_led_radio(struct ieee80211_local *local,
0039              bool enabled);
0040 void ieee80211_alloc_led_names(struct ieee80211_local *local);
0041 void ieee80211_free_led_names(struct ieee80211_local *local);
0042 void ieee80211_led_init(struct ieee80211_local *local);
0043 void ieee80211_led_exit(struct ieee80211_local *local);
0044 void ieee80211_mod_tpt_led_trig(struct ieee80211_local *local,
0045                 unsigned int types_on, unsigned int types_off);
0046 #else
0047 static inline void ieee80211_led_assoc(struct ieee80211_local *local,
0048                        bool associated)
0049 {
0050 }
0051 static inline void ieee80211_led_radio(struct ieee80211_local *local,
0052                        bool enabled)
0053 {
0054 }
0055 static inline void ieee80211_alloc_led_names(struct ieee80211_local *local)
0056 {
0057 }
0058 static inline void ieee80211_free_led_names(struct ieee80211_local *local)
0059 {
0060 }
0061 static inline void ieee80211_led_init(struct ieee80211_local *local)
0062 {
0063 }
0064 static inline void ieee80211_led_exit(struct ieee80211_local *local)
0065 {
0066 }
0067 static inline void ieee80211_mod_tpt_led_trig(struct ieee80211_local *local,
0068                           unsigned int types_on,
0069                           unsigned int types_off)
0070 {
0071 }
0072 #endif
0073 
0074 static inline void
0075 ieee80211_tpt_led_trig_tx(struct ieee80211_local *local, int bytes)
0076 {
0077 #ifdef CONFIG_MAC80211_LEDS
0078     if (atomic_read(&local->tpt_led_active))
0079         local->tpt_led_trigger->tx_bytes += bytes;
0080 #endif
0081 }
0082 
0083 static inline void
0084 ieee80211_tpt_led_trig_rx(struct ieee80211_local *local, int bytes)
0085 {
0086 #ifdef CONFIG_MAC80211_LEDS
0087     if (atomic_read(&local->tpt_led_active))
0088         local->tpt_led_trigger->rx_bytes += bytes;
0089 #endif
0090 }