Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp647414rdb; Fri, 22 Dec 2023 00:07:51 -0800 (PST) X-Google-Smtp-Source: AGHT+IHyl8yaSIGhGhdnk1WXRhHsrJrewl7xZdtIAk6I9MRUpc9sF4nPHySDSyR9LGxHmJlbfMBU X-Received: by 2002:a92:cda3:0:b0:35f:d8a1:1e6 with SMTP id g3-20020a92cda3000000b0035fd8a101e6mr1023241ild.4.1703232471133; Fri, 22 Dec 2023 00:07:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703232471; cv=none; d=google.com; s=arc-20160816; b=SwGdAo7etts7TQGhynGgKWmBY0i0sfWaMxbSzH412EFfrTcWYkPud/BwxjYJL4HKHw SPQymvtbVIoHAhgOvs47/9Wx//Jxeu/cjwISd9cKSP9nM53S5qUBzIVJB3CKCsQ5g0DK bkSfaNORaQxYKXyFsyc0UXocDph6BNc9s2srMkrxB78ZwyZu7ARzdCpML76JPS3QoJTD up99/qalkqYtjAif4BS33nSXfkeIOr+T2tGjwb3ICnWJexKwTCg09PArD01xlTUuhaKG ZniLtz6rXhlMJJjya/TDIq92Zfbqdr7wVVazmenYMIIYf3yE3jRqzXQRUdq9vFYuDy3o vV8Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:dkim-signature :dkim-signature:message-id; bh=ZiKt9d88/nBmI57K3KfVrU4teGGYJB73YbPgi6/viDE=; fh=B8o+z0BrKEPgpj9MKmYUFYnGwr+ws6ED0wqC2zV4cSs=; b=fDdZP5HU9Pe9dH/nheWipcsD4PvhttdS6S/E2YuypfYTGRcSgmpvd8YT+5UA58ayK4 5VizvRvMsdUviU4EedBDFBTpvBOzD/8IE/6v6fx0sj8O4dYCMuqRcR8zLFyDaKYaTd0h z/0Gym6sW6knS0Deb/tV2wB775/znS9sWGqmYT7VXWHto5H7nsYEzFL08uE0FbyflyLb JodF+zM4JCZS7o7SDEce4ROIlVwjIUeqLKvYuLImk/0zeFttOFV1T3TfJGCEQsl8agRl S3fgU7bx8soOlsI1NMmLelOiuMStGbLGfhRR5tSavfeTomzaRoFKfVI7bMkMzO9pwnP/ D+eA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=PtowrM2q; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; spf=pass (google.com: domain of linux-wireless+bounces-1206-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-wireless+bounces-1206-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id w23-20020a631617000000b005cd82e43aa3si609433pgl.321.2023.12.22.00.07.50 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Dec 2023 00:07:51 -0800 (PST) Received-SPF: pass (google.com: domain of linux-wireless+bounces-1206-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=PtowrM2q; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; spf=pass (google.com: domain of linux-wireless+bounces-1206-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-wireless+bounces-1206-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 82CD8B24B4E for ; Fri, 22 Dec 2023 08:05:19 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 72219FBE2; Fri, 22 Dec 2023 08:05:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="PtowrM2q"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="NELY9Qxk" X-Original-To: linux-wireless@vger.kernel.org Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 43BFAFBE8 for ; Fri, 22 Dec 2023 08:05:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Message-ID: DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1703232311; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ZiKt9d88/nBmI57K3KfVrU4teGGYJB73YbPgi6/viDE=; b=PtowrM2qvfydbyTnEp2taySTFhn3ga9h158yPrviskKdrQJB/HX9VE6jw+GrUzTpRddOqx D97NwvME5fBFPLnuWDSckGbjFljtbmQNP0yyuWHOu0+F91Nlag6o9AF2MV2SQDzqQ+bAP4 tl0Hfc9Ybtvz44Fi2Q24d5VA6Wz9uJncE/kuoqZPnRXoTs8qa5OKsXoEttWlgYtm3or8Qh Yxs1RiwWLljQyWikVwAkebrl86/yCxyaX9seo6uuAoq9wuKIuAcah5yrKYJj1ipl9s868z nr61yEN7bCEMGlTnTnrBX0Ckno4J5uCkOVCXCO12uNFdazpSv6DIWQn20m71Rg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1703232311; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ZiKt9d88/nBmI57K3KfVrU4teGGYJB73YbPgi6/viDE=; b=NELY9Qxk+Oq+a0ESaCjRw0UVmNZN6pi90/KPrGQXjdcwXc6INFq00Wa4+xcl3SaOLRIn3B iucKZo67Nwxe4sDw== Date: Fri, 22 Dec 2023 09:05:11 +0100 Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Subject: Re: [PATCH v2 13/21] wifi: rtl8xxxu: support multiple interfaces in watchdog_callback() Content-Language: de-DE To: Ping-Ke Shih , "linux-wireless@vger.kernel.org" Cc: Jes Sorensen , Kalle Valo , Bitterblue Smith , Sebastian Andrzej Siewior References: <20231221164353.603258-1-martin.kaistra@linutronix.de> <20231221164353.603258-14-martin.kaistra@linutronix.de> From: Martin Kaistra In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Am 22.12.23 um 02:45 schrieb Ping-Ke Shih: > > On Fri, Dec 22, 2023 at 12:45 AM Martin Kaistra > 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 >> --- >> .../wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 19 +++++++++++-------- >> 1 file changed, 11 insertions(+), 8 deletions(-) >> >> 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; > > Currently, this loop becomes to get RSSI and update rate mask, but only for > station mode. That means we don't update them for peer stations in AP mode. > Maybe, we need ieee80211_iterate_stations_atomic() for all stations, but > ieee80211_ave_rssi() is only for 'vif', so we need to add a driver level > RSSI for all stations (macid). Also, we need to extend priv->rssi_level for > all macid as well. > > I suppose _default_ value can work to stations in AP mode, so you can decide > if you will defer this support temporarily. > > (Sorry, I don't dig rtl8xxxu very deeply, so I'm not able to tell you all > things in one go.) It probably makes sense to fix this, however if it's ok for you, I would like to do it separatly from this series. > >> >> - 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); > > It seems like 'sta' isn't protected by RCU read lock. > (an existing bug, not introduced by this patch) I will add a patch which moves the rcu_read_unlock() to fix this. > > >> } >> >> -out: >> + if (priv->fops->set_crystal_cap) >> + rtl8xxxu_track_cfo(priv); >> + >> schedule_delayed_work(&priv->ra_watchdog, 2 * HZ); >> } >> >> -- >> 2.39.2 >> >>