| From 758c358967c017318904a48f82857b75c16e4973 Mon Sep 17 00:00:00 2001 |
| From: Yi-Chia Hsieh <yi-chia.hsieh@mediatek.com> |
| Date: Thu, 13 Jul 2023 08:27:37 +0800 |
| Subject: [PATCH 19/19] mac80211: mtk: export ieee80211_tpt_led_trig_tx/rx for |
| driver |
| |
| Whenever the H/W path is enabled and traffic is in the binding state, |
| mac80211 is not aware of the traffic. Consequently, the LED does not |
| blink for that reason. |
| |
| The ieee80211_tpt_led_trig_tx/rx functions are exported for the driver |
| so that we can report the tx and rx bytes from the driver when |
| the H/W path is being used. |
| |
| Signed-off-by: Yi-Chia Hsieh <yi-chia.hsieh@mediatek.com> |
| --- |
| include/net/mac80211.h | 17 +++++++++++++++++ |
| net/mac80211/led.c | 16 ++++++++++++++++ |
| net/mac80211/led.h | 17 ----------------- |
| net/mac80211/rx.c | 2 +- |
| net/mac80211/tx.c | 4 ++-- |
| 5 files changed, 36 insertions(+), 20 deletions(-) |
| |
| diff --git a/include/net/mac80211.h b/include/net/mac80211.h |
| index 3e50a72..91affd5 100644 |
| --- a/include/net/mac80211.h |
| +++ b/include/net/mac80211.h |
| @@ -4404,6 +4404,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_tx(struct ieee80211_hw *hw, int bytes); |
| +void __ieee80211_tpt_led_trig_rx(struct ieee80211_hw *hw, int bytes); |
| #endif |
| /** |
| * ieee80211_get_tx_led_name - get name of TX LED |
| @@ -4514,6 +4516,21 @@ ieee80211_create_tpt_led_trigger(struct ieee80211_hw *hw, unsigned int flags, |
| #endif |
| } |
| |
| +static inline void |
| +ieee80211_tpt_led_trig_tx(struct ieee80211_hw *hw, int bytes) |
| +{ |
| +#ifdef CPTCFG_MAC80211_LEDS |
| + __ieee80211_tpt_led_trig_tx(hw, bytes); |
| +#endif |
| +} |
| + |
| +static inline void |
| +ieee80211_tpt_led_trig_rx(struct ieee80211_hw *hw, int bytes) |
| +{ |
| +#ifdef CPTCFG_MAC80211_LEDS |
| + __ieee80211_tpt_led_trig_rx(hw, bytes); |
| +#endif |
| +} |
| /** |
| * ieee80211_unregister_hw - Unregister a hardware device |
| * |
| diff --git a/net/mac80211/led.c b/net/mac80211/led.c |
| index a28ba6d..219bde6 100644 |
| --- a/net/mac80211/led.c |
| +++ b/net/mac80211/led.c |
| @@ -364,6 +364,22 @@ __ieee80211_create_tpt_led_trigger(struct ieee80211_hw *hw, |
| } |
| EXPORT_SYMBOL(__ieee80211_create_tpt_led_trigger); |
| |
| +void __ieee80211_tpt_led_trig_tx(struct ieee80211_hw *hw, int bytes) |
| +{ |
| + struct ieee80211_local *local = hw_to_local(hw); |
| + if (atomic_read(&local->tpt_led_active)) |
| + local->tpt_led_trigger->tx_bytes += bytes; |
| +} |
| +EXPORT_SYMBOL(__ieee80211_tpt_led_trig_tx); |
| + |
| +void __ieee80211_tpt_led_trig_rx(struct ieee80211_hw *hw, int bytes) |
| +{ |
| + struct ieee80211_local *local = hw_to_local(hw); |
| + if (atomic_read(&local->tpt_led_active)) |
| + local->tpt_led_trigger->rx_bytes += bytes; |
| +} |
| +EXPORT_SYMBOL(__ieee80211_tpt_led_trig_rx); |
| + |
| 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 2abb1d0..b18ae9d 100644 |
| --- a/net/mac80211/led.h |
| +++ b/net/mac80211/led.h |
| @@ -69,22 +69,5 @@ static inline void ieee80211_mod_tpt_led_trig(struct ieee80211_local *local, |
| unsigned int types_off) |
| { |
| } |
| -#endif |
| |
| -static inline void |
| -ieee80211_tpt_led_trig_tx(struct ieee80211_local *local, int bytes) |
| -{ |
| -#ifdef CPTCFG_MAC80211_LEDS |
| - if (atomic_read(&local->tpt_led_active)) |
| - local->tpt_led_trigger->tx_bytes += bytes; |
| #endif |
| -} |
| - |
| -static inline void |
| -ieee80211_tpt_led_trig_rx(struct ieee80211_local *local, int bytes) |
| -{ |
| -#ifdef CPTCFG_MAC80211_LEDS |
| - if (atomic_read(&local->tpt_led_active)) |
| - local->tpt_led_trigger->rx_bytes += bytes; |
| -#endif |
| -} |
| diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c |
| index 6d8ce15..a9fcc7a 100644 |
| --- a/net/mac80211/rx.c |
| +++ b/net/mac80211/rx.c |
| @@ -5048,7 +5048,7 @@ void ieee80211_rx_list(struct ieee80211_hw *hw, struct ieee80211_sta *pubsta, |
| if (skb) { |
| if ((status->flag & RX_FLAG_8023) || |
| ieee80211_is_data_present(hdr->frame_control)) |
| - ieee80211_tpt_led_trig_rx(local, skb->len); |
| + ieee80211_tpt_led_trig_rx(&local->hw, skb->len); |
| |
| if (status->flag & RX_FLAG_8023) |
| __ieee80211_rx_handle_8023(hw, pubsta, skb, list); |
| diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c |
| index 9b66cc0..50ba10c 100644 |
| --- a/net/mac80211/tx.c |
| +++ b/net/mac80211/tx.c |
| @@ -4229,7 +4229,7 @@ void __ieee80211_subif_start_xmit(struct sk_buff *skb, |
| len = 0; |
| out: |
| if (len) |
| - ieee80211_tpt_led_trig_tx(local, len); |
| + ieee80211_tpt_led_trig_tx(&local->hw, len); |
| rcu_read_unlock(); |
| } |
| |
| @@ -4501,7 +4501,7 @@ static void ieee80211_8023_xmit(struct ieee80211_sub_if_data *sdata, |
| sta->tx_stats.packets[queue] += skbs; |
| sta->tx_stats.bytes[queue] += len; |
| |
| - ieee80211_tpt_led_trig_tx(local, len); |
| + ieee80211_tpt_led_trig_tx(&local->hw, len); |
| |
| ieee80211_tx_8023(sdata, skb, sta, false); |
| |
| -- |
| 2.18.0 |
| |