Commit 3f9baa99 authored by Martin Kaistra's avatar Martin Kaistra Committed by Kalle Valo
Browse files

wifi: rtl8xxxu: support multiple interfaces in watchdog_callback()



Check first whether priv->vifs[0] exists and is of type STATION, then go
to priv->vifs[1]. Make sure to call refresh_rate_mask for both
interfaces.

Signed-off-by: default avatarMartin Kaistra <martin.kaistra@linutronix.de>
Reviewed-by: default avatarPing-Ke Shih <pkshih@realtek.com>
Signed-off-by: default avatarKalle Valo <kvalo@kernel.org>
Link: https://msgid.link/20231222101442.626837-14-martin.kaistra@linutronix.de
parent 6b766382
Loading
Loading
Loading
Loading
+11 −8
Original line number Diff line number Diff line
@@ -7200,11 +7200,15 @@ static void rtl8xxxu_watchdog_callback(struct work_struct *work)
{
	struct ieee80211_vif *vif;
	struct rtl8xxxu_priv *priv;
	int i;

	priv = container_of(work, struct rtl8xxxu_priv, ra_watchdog.work);
	vif = priv->vif;
	for (i = 0; i < ARRAY_SIZE(priv->vifs); i++) {
		vif = priv->vifs[i];

		if (!vif || vif->type != NL80211_IFTYPE_STATION)
			continue;

	if (vif && vif->type == NL80211_IFTYPE_STATION) {
		int signal;
		struct ieee80211_sta *sta;

@@ -7215,22 +7219,21 @@ static void rtl8xxxu_watchdog_callback(struct work_struct *work)

			dev_dbg(dev, "%s: no sta found\n", __func__);
			rcu_read_unlock();
			goto out;
			continue;
		}
		rcu_read_unlock();

		signal = ieee80211_ave_rssi(vif);

		priv->fops->report_rssi(priv, 0,
		priv->fops->report_rssi(priv, rtl8xxxu_get_macid(priv, sta),
					rtl8xxxu_signal_to_snr(signal));

		if (priv->fops->set_crystal_cap)
			rtl8xxxu_track_cfo(priv);

		rtl8xxxu_refresh_rate_mask(priv, signal, sta, false);
	}

out:
	if (priv->fops->set_crystal_cap)
		rtl8xxxu_track_cfo(priv);

	schedule_delayed_work(&priv->ra_watchdog, 2 * HZ);
}