developer | e0cba19 | 2023-07-28 07:08:38 +0800 | [diff] [blame] | 1 | From 758c358967c017318904a48f82857b75c16e4973 Mon Sep 17 00:00:00 2001 |
developer | f2cf4ce | 2023-07-13 08:38:02 +0800 | [diff] [blame] | 2 | From: Yi-Chia Hsieh <yi-chia.hsieh@mediatek.com> |
| 3 | Date: Thu, 13 Jul 2023 08:27:37 +0800 |
developer | e0cba19 | 2023-07-28 07:08:38 +0800 | [diff] [blame] | 4 | Subject: [PATCH 19/19] mac80211: mtk: export ieee80211_tpt_led_trig_tx/rx for |
| 5 | driver |
developer | f2cf4ce | 2023-07-13 08:38:02 +0800 | [diff] [blame] | 6 | |
| 7 | Whenever the H/W path is enabled and traffic is in the binding state, |
| 8 | mac80211 is not aware of the traffic. Consequently, the LED does not |
| 9 | blink for that reason. |
| 10 | |
| 11 | The ieee80211_tpt_led_trig_tx/rx functions are exported for the driver |
| 12 | so that we can report the tx and rx bytes from the driver when |
| 13 | the H/W path is being used. |
| 14 | |
| 15 | Signed-off-by: Yi-Chia Hsieh <yi-chia.hsieh@mediatek.com> |
| 16 | --- |
| 17 | include/net/mac80211.h | 17 +++++++++++++++++ |
| 18 | net/mac80211/led.c | 16 ++++++++++++++++ |
| 19 | net/mac80211/led.h | 17 ----------------- |
| 20 | net/mac80211/rx.c | 2 +- |
| 21 | net/mac80211/tx.c | 4 ++-- |
| 22 | 5 files changed, 36 insertions(+), 20 deletions(-) |
| 23 | |
| 24 | diff --git a/include/net/mac80211.h b/include/net/mac80211.h |
developer | e0cba19 | 2023-07-28 07:08:38 +0800 | [diff] [blame] | 25 | index 3e50a72..91affd5 100644 |
developer | f2cf4ce | 2023-07-13 08:38:02 +0800 | [diff] [blame] | 26 | --- a/include/net/mac80211.h |
| 27 | +++ b/include/net/mac80211.h |
| 28 | @@ -4404,6 +4404,8 @@ __ieee80211_create_tpt_led_trigger(struct ieee80211_hw *hw, |
| 29 | unsigned int flags, |
| 30 | const struct ieee80211_tpt_blink *blink_table, |
| 31 | unsigned int blink_table_len); |
| 32 | +void __ieee80211_tpt_led_trig_tx(struct ieee80211_hw *hw, int bytes); |
| 33 | +void __ieee80211_tpt_led_trig_rx(struct ieee80211_hw *hw, int bytes); |
| 34 | #endif |
| 35 | /** |
| 36 | * ieee80211_get_tx_led_name - get name of TX LED |
| 37 | @@ -4514,6 +4516,21 @@ ieee80211_create_tpt_led_trigger(struct ieee80211_hw *hw, unsigned int flags, |
| 38 | #endif |
| 39 | } |
| 40 | |
| 41 | +static inline void |
| 42 | +ieee80211_tpt_led_trig_tx(struct ieee80211_hw *hw, int bytes) |
| 43 | +{ |
| 44 | +#ifdef CPTCFG_MAC80211_LEDS |
| 45 | + __ieee80211_tpt_led_trig_tx(hw, bytes); |
| 46 | +#endif |
| 47 | +} |
| 48 | + |
| 49 | +static inline void |
| 50 | +ieee80211_tpt_led_trig_rx(struct ieee80211_hw *hw, int bytes) |
| 51 | +{ |
| 52 | +#ifdef CPTCFG_MAC80211_LEDS |
| 53 | + __ieee80211_tpt_led_trig_rx(hw, bytes); |
| 54 | +#endif |
| 55 | +} |
| 56 | /** |
| 57 | * ieee80211_unregister_hw - Unregister a hardware device |
| 58 | * |
| 59 | diff --git a/net/mac80211/led.c b/net/mac80211/led.c |
| 60 | index a28ba6d..219bde6 100644 |
| 61 | --- a/net/mac80211/led.c |
| 62 | +++ b/net/mac80211/led.c |
| 63 | @@ -364,6 +364,22 @@ __ieee80211_create_tpt_led_trigger(struct ieee80211_hw *hw, |
| 64 | } |
| 65 | EXPORT_SYMBOL(__ieee80211_create_tpt_led_trigger); |
| 66 | |
| 67 | +void __ieee80211_tpt_led_trig_tx(struct ieee80211_hw *hw, int bytes) |
| 68 | +{ |
| 69 | + struct ieee80211_local *local = hw_to_local(hw); |
| 70 | + if (atomic_read(&local->tpt_led_active)) |
| 71 | + local->tpt_led_trigger->tx_bytes += bytes; |
| 72 | +} |
| 73 | +EXPORT_SYMBOL(__ieee80211_tpt_led_trig_tx); |
| 74 | + |
| 75 | +void __ieee80211_tpt_led_trig_rx(struct ieee80211_hw *hw, int bytes) |
| 76 | +{ |
| 77 | + struct ieee80211_local *local = hw_to_local(hw); |
| 78 | + if (atomic_read(&local->tpt_led_active)) |
| 79 | + local->tpt_led_trigger->rx_bytes += bytes; |
| 80 | +} |
| 81 | +EXPORT_SYMBOL(__ieee80211_tpt_led_trig_rx); |
| 82 | + |
| 83 | static void ieee80211_start_tpt_led_trig(struct ieee80211_local *local) |
| 84 | { |
| 85 | struct tpt_led_trigger *tpt_trig = local->tpt_led_trigger; |
| 86 | diff --git a/net/mac80211/led.h b/net/mac80211/led.h |
| 87 | index 2abb1d0..b18ae9d 100644 |
| 88 | --- a/net/mac80211/led.h |
| 89 | +++ b/net/mac80211/led.h |
| 90 | @@ -69,22 +69,5 @@ static inline void ieee80211_mod_tpt_led_trig(struct ieee80211_local *local, |
| 91 | unsigned int types_off) |
| 92 | { |
| 93 | } |
| 94 | -#endif |
| 95 | |
| 96 | -static inline void |
| 97 | -ieee80211_tpt_led_trig_tx(struct ieee80211_local *local, int bytes) |
| 98 | -{ |
| 99 | -#ifdef CPTCFG_MAC80211_LEDS |
| 100 | - if (atomic_read(&local->tpt_led_active)) |
| 101 | - local->tpt_led_trigger->tx_bytes += bytes; |
| 102 | #endif |
| 103 | -} |
| 104 | - |
| 105 | -static inline void |
| 106 | -ieee80211_tpt_led_trig_rx(struct ieee80211_local *local, int bytes) |
| 107 | -{ |
| 108 | -#ifdef CPTCFG_MAC80211_LEDS |
| 109 | - if (atomic_read(&local->tpt_led_active)) |
| 110 | - local->tpt_led_trigger->rx_bytes += bytes; |
| 111 | -#endif |
| 112 | -} |
| 113 | diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c |
developer | e0cba19 | 2023-07-28 07:08:38 +0800 | [diff] [blame] | 114 | index 6d8ce15..a9fcc7a 100644 |
developer | f2cf4ce | 2023-07-13 08:38:02 +0800 | [diff] [blame] | 115 | --- a/net/mac80211/rx.c |
| 116 | +++ b/net/mac80211/rx.c |
developer | e0cba19 | 2023-07-28 07:08:38 +0800 | [diff] [blame] | 117 | @@ -5048,7 +5048,7 @@ void ieee80211_rx_list(struct ieee80211_hw *hw, struct ieee80211_sta *pubsta, |
developer | f2cf4ce | 2023-07-13 08:38:02 +0800 | [diff] [blame] | 118 | if (skb) { |
| 119 | if ((status->flag & RX_FLAG_8023) || |
| 120 | ieee80211_is_data_present(hdr->frame_control)) |
| 121 | - ieee80211_tpt_led_trig_rx(local, skb->len); |
| 122 | + ieee80211_tpt_led_trig_rx(&local->hw, skb->len); |
| 123 | |
| 124 | if (status->flag & RX_FLAG_8023) |
| 125 | __ieee80211_rx_handle_8023(hw, pubsta, skb, list); |
| 126 | diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c |
| 127 | index 9b66cc0..50ba10c 100644 |
| 128 | --- a/net/mac80211/tx.c |
| 129 | +++ b/net/mac80211/tx.c |
| 130 | @@ -4229,7 +4229,7 @@ void __ieee80211_subif_start_xmit(struct sk_buff *skb, |
| 131 | len = 0; |
| 132 | out: |
| 133 | if (len) |
| 134 | - ieee80211_tpt_led_trig_tx(local, len); |
| 135 | + ieee80211_tpt_led_trig_tx(&local->hw, len); |
| 136 | rcu_read_unlock(); |
| 137 | } |
| 138 | |
| 139 | @@ -4501,7 +4501,7 @@ static void ieee80211_8023_xmit(struct ieee80211_sub_if_data *sdata, |
| 140 | sta->tx_stats.packets[queue] += skbs; |
| 141 | sta->tx_stats.bytes[queue] += len; |
| 142 | |
| 143 | - ieee80211_tpt_led_trig_tx(local, len); |
| 144 | + ieee80211_tpt_led_trig_tx(&local->hw, len); |
| 145 | |
| 146 | ieee80211_tx_8023(sdata, skb, sta, false); |
| 147 | |
| 148 | -- |
developer | e0cba19 | 2023-07-28 07:08:38 +0800 | [diff] [blame] | 149 | 2.18.0 |
developer | f2cf4ce | 2023-07-13 08:38:02 +0800 | [diff] [blame] | 150 | |