diff mbox series

[v3,13/21] wifi: rtl8xxxu: support multiple interfaces in watchdog_callback()

Message ID 20231222101442.626837-14-martin.kaistra@linutronix.de (mailing list archive)
State Accepted
Commit 3f9baa99f8429ea6f56e7cc8d881c027518e9573
Delegated to: Kalle Valo
Headers show
Series wifi: rtl8xxxu: Add concurrent mode for 8188f | expand

Commit Message

Martin Kaistra Dec. 22, 2023, 10:14 a.m. UTC
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: Martin Kaistra <martin.kaistra@linutronix.de>
---
 .../wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 19 +++++++++++--------
 1 file changed, 11 insertions(+), 8 deletions(-)

Comments

Ping-Ke Shih Dec. 25, 2023, 5:22 a.m. UTC | #1
On Fri, Dec 22, 2023 at 6:16 PM Martin Kaistra
<martin.kaistra@linutronix.de> wrote:
>
> 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: Martin Kaistra <martin.kaistra@linutronix.de>

Reviewed-by: Ping-Ke Shih <pkshih@realtek.com>

Logically, this patch is fine to me, but I would like to know if you have
tested two STATION interfaces connect two different AP? Especially, one AP
is 802.11g mode and the other is 802.11n mode, so we can clearly know this
patch is expected. 

Ping-Ke
Martin Kaistra Jan. 8, 2024, 9:42 a.m. UTC | #2
Am 25.12.23 um 06:22 schrieb Ping-Ke Shih:
> 
> On Fri, Dec 22, 2023 at 6:16 PM Martin Kaistra
> <martin.kaistra@linutronix.de> wrote:
>>
>> 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: Martin Kaistra <martin.kaistra@linutronix.de>
> 
> Reviewed-by: Ping-Ke Shih <pkshih@realtek.com>
> 
> Logically, this patch is fine to me, but I would like to know if you have
> tested two STATION interfaces connect two different AP? Especially, one AP
> is 802.11g mode and the other is 802.11n mode, so we can clearly know this
> patch is expected.

Yes, I did try to connect the two interfaces to two different AP (on the same 
channel) at the same time, and it seems to behave fine.
Ping-Ke Shih Jan. 9, 2024, 2:55 a.m. UTC | #3
> -----Original Message-----
> From: Martin Kaistra <martin.kaistra@linutronix.de>
> Sent: Monday, January 8, 2024 5:43 PM
> To: Ping-Ke Shih <pkshih@realtek.com>; linux-wireless@vger.kernel.org
> Cc: Jes Sorensen <Jes.Sorensen@gmail.com>; Kalle Valo <kvalo@kernel.org>; Bitterblue Smith
> <rtl8821cerfe2@gmail.com>; Sebastian Andrzej Siewior <bigeasy@linutronix.de>
> Subject: Re: [PATCH v3 13/21] wifi: rtl8xxxu: support multiple interfaces in watchdog_callback()
> 
> Yes, I did try to connect the two interfaces to two different AP (on the same
> channel) at the same time, and it seems to behave fine.

Nice! Thanks for your work. :-)

Ping-Ke
diff mbox series

Patch

diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
index c5b71892369c9..fd0108668bcda 100644
--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
@@ -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);
 }