[PATCH wireless-next v3 1/7] wifi: rt2x00: start the link tuner when an interface is added

From: Ho Jie Feng

Date: Thu Nov 12 2026 - 12:21:00 EST


rt2x00lib_start() enables the radio before mac80211 adds the first
interface, so rt2x00link_start_tuner(), called from
rt2x00lib_enable_radio(), finds no station or AP interface and returns.

Start the link tuner again when the first interface is added, and stop
it when the last interface is removed.

Fixes: d96324703ffa ("rt2x00: merge agc and vco works with link tuner")
Signed-off-by: Ho Jie Feng <hjf3108@xxxxxxxxx>
Acked-by: Stanislaw Gruszka <stf_xl@xxxxx>
---
drivers/net/wireless/ralink/rt2x00/rt2x00mac.c | 13 +++++++++++++
1 file changed, 13 insertions(+)

diff --git a/drivers/net/wireless/ralink/rt2x00/rt2x00mac.c b/drivers/net/wireless/ralink/rt2x00/rt2x00mac.c
index 3bc0c1c906..86547ce81c 100644
--- a/drivers/net/wireless/ralink/rt2x00/rt2x00mac.c
+++ b/drivers/net/wireless/ralink/rt2x00/rt2x00mac.c
@@ -264,6 +264,13 @@ int rt2x00mac_add_interface(struct ieee80211_hw *hw,
*/
rt2x00dev->packet_filter = 0;

+ /*
+ * Start the link tuner again if the radio is enabled before the
+ * first interface is added.
+ */
+ if (rt2x00dev->intf_ap_count + rt2x00dev->intf_sta_count == 1)
+ rt2x00link_start_tuner(rt2x00dev);
+
return 0;
}
EXPORT_SYMBOL_GPL(rt2x00mac_add_interface);
@@ -289,6 +296,12 @@ void rt2x00mac_remove_interface(struct ieee80211_hw *hw,
else
rt2x00dev->intf_sta_count--;

+ /*
+ * Stop the link tuner when the last interface is removed.
+ */
+ if (!rt2x00dev->intf_ap_count && !rt2x00dev->intf_sta_count)
+ rt2x00link_stop_tuner(rt2x00dev);
+
/*
* Release beacon entry so it is available for
* new interfaces again.
--
2.53.0