Add a new function __ieee80211_tpt_led_trig_trx. It is exported and takes ieee80211_hw as argument so that softmac driver can use. This can be helpful when traffic runs in HW path and mac80211 is not aware of the traffic. Signed-off-by: Yi-Chia Hsieh <yi-chia.hsieh@xxxxxxxxxxxx> Signed-off-by: Money Wang <Money.Wang@xxxxxxxxxxxx> Signed-off-by: Evelyn Tsai <evelyn.tsai@xxxxxxxxxxxx> Signed-off-by: Ryder Lee <ryder.lee@xxxxxxxxxxxx> --- v2: split series --- v3: retitle, keep the original API and combine double-underscore functions --- include/net/mac80211.h | 2 ++ net/mac80211/led.c | 12 ++++++++++++ net/mac80211/led.h | 6 ++---- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/include/net/mac80211.h b/include/net/mac80211.h index 8d993f6ab919..c32f614acb3d 100644 --- a/include/net/mac80211.h +++ b/include/net/mac80211.h @@ -4733,6 +4733,8 @@ __ieee80211_create_tpt_led_trigger(struct ieee80211_hw *hw, unsigned int flags, const struct ieee80211_tpt_blink *blink_table, unsigned int blink_table_len); +void __ieee80211_tpt_led_trig_trx(struct ieee80211_hw *hw, + int tx_bytes, int rx_bytes); #endif /** * ieee80211_get_tx_led_name - get name of TX LED diff --git a/net/mac80211/led.c b/net/mac80211/led.c index 2dc732147e85..1c18ebcaac20 100644 --- a/net/mac80211/led.c +++ b/net/mac80211/led.c @@ -319,6 +319,18 @@ __ieee80211_create_tpt_led_trigger(struct ieee80211_hw *hw, } EXPORT_SYMBOL(__ieee80211_create_tpt_led_trigger); +void __ieee80211_tpt_led_trig_trx(struct ieee80211_hw *hw, + int tx_bytes, int rx_bytes) +{ + struct ieee80211_local *local = hw_to_local(hw); + + if (atomic_read(&local->tpt_led_active)) { + local->tpt_led_trigger->tx_bytes += tx_bytes; + local->tpt_led_trigger->rx_bytes += rx_bytes; + } +} +EXPORT_SYMBOL(__ieee80211_tpt_led_trig_trx); + static void ieee80211_start_tpt_led_trig(struct ieee80211_local *local) { struct tpt_led_trigger *tpt_trig = local->tpt_led_trigger; diff --git a/net/mac80211/led.h b/net/mac80211/led.h index d25f13346b82..6d3212443d35 100644 --- a/net/mac80211/led.h +++ b/net/mac80211/led.h @@ -71,8 +71,7 @@ static inline void ieee80211_tpt_led_trig_tx(struct ieee80211_local *local, int bytes) { #ifdef CONFIG_MAC80211_LEDS - if (atomic_read(&local->tpt_led_active)) - local->tpt_led_trigger->tx_bytes += bytes; + __ieee80211_tpt_led_trig_trx(&local->hw, bytes, 0); #endif } @@ -80,7 +79,6 @@ static inline void ieee80211_tpt_led_trig_rx(struct ieee80211_local *local, int bytes) { #ifdef CONFIG_MAC80211_LEDS - if (atomic_read(&local->tpt_led_active)) - local->tpt_led_trigger->rx_bytes += bytes; + __ieee80211_tpt_led_trig_trx(&local->hw, 0, bytes); #endif } -- 2.39.0