From nobody Sat Sep 26 07:15:21 2026 Received: from mail-wm1-f42.google.com (mail-wm1-f42.google.com [209.85.128.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B754E332628 for ; Thu, 3 Sep 2026 15:36:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.42 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788449797; cv=none; b=QPIcPRf+C+h2Os5vXQzKQ0yOOlZUe8HUkAwt5inKp7vv6A2shENM6wj5lxIznyNj9di6E1aSG9+k3Q7Jf3QohyM0EnSQcZME1g3VElMr07Dqfxz9Vf7JPj+zrzHqoq6UaNNYAzkt7ETY7wAbHkyQMuR4M4C8TSz51sdkgfYhQHk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788449797; c=relaxed/simple; bh=Sx82Mbp5lO5DjoKy80dsNlSHsxmeRD7u8l6pGGCMoDw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=YT+phmfxBbR9CDJ6LMODgzFqCJ8F5HEnPHudqfLSr9bZMU67tmSsju8a82PMB3kO1R9T4mHXq1q4d2nzCvGb4V6DYwUGcEK9g31MSg/u3PFoaZS7Ml7NmJwGEOzrU0zRZSeJrCRrJx4+Qd2xuP9I95k2h8XlCKAcpWTPuLXNAb8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=ADrn3gjh; arc=none smtp.client-ip=209.85.128.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="ADrn3gjh" Received: by mail-wm1-f42.google.com with SMTP id 5b1f17b1804b1-49954b88fffso255305e9.0 for ; Thu, 03 Sep 2026 08:36:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1788449794; x=1789054594; darn=vger.kernel.org; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:sender:from:to:cc :subject:date:message-id:reply-to:content-type; bh=mKYBlq5Au3+HGNkg1vfOBKHH7P2alX9eeNg+UdnZVyg=; b=ADrn3gjhi5wv5vwR25msD2CWjArgICNkDeFwl7Syi0TpNKNigyIWRYRGm9WyzL/Vaa Qq12xKNthoBC1kGUgYinYA8CtJaTlabUUbsNgkm4tZZwLB7pihJCascnebpUbbhsP6MQ Nav/98pj6BfgHMJJgFnp85blaYLITZluPm1rXaQbmHH7XUb9y9+LjZcJ+5l1io0Sbg/Q 7WqDVphYkW9fpu3ws4GqpwQJqjyMjUcPy95AkJiQIgVx4jWPsjzrXtm1oSd22Yf3CMa6 AmWdEIxsZai+ofRBWX44mSns2esbQqnEVn0j1LHrkT4nID7CCg7MoeIA1ABu+ecU1u0f n/ng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1788449794; x=1789054594; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:sender:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=mKYBlq5Au3+HGNkg1vfOBKHH7P2alX9eeNg+UdnZVyg=; b=cwiLgbJIS49SImcMujerSmDYQd6bqJxR+hPoOm5FCqMFSF/XkGj4vFKtgoYeSjh6V7 3NpaBLC59ddUzDWeOURU6B2jlbRzIzNNdv8pRNs4AOKMXzFoeghSVqKTz6fQv4ssb81G mCARyaZ/r3eHpEWGD8QaN89PY1ye2PnQweYV3c76sfZhprveVH/vNErvmwIH1hi3W9d5 ADuztQRY6BFeO9sL59LDHcINt7CI5OzpP8jtIW/E2uan8TM2BAfM9DqL06emeBlHGSgN 6I1QvFNgXi4iPmFjIz949Nq+t54tPzJIgi3pWNjsB2/oY+Cq4FBnzUwk55GCk0EC/lOq 331g== X-Gm-Message-State: AFuF++meFH4XPr7GHCoaaALVhPRF0UpUBQYx8seiqnHnyZnMie1pkqpp n7C5yAMXimAQxb4558HiO4wRQp/9lSlRtYJlL+DGXhePYARxKWNMRFQ= X-Gm-Gg: AYBFou1UjmCxm92lF1Z33l4GseXlj2qE271JYsVGG1oC0VF4FmHCNUg7bcfZjKsdl2v RCiRWzXSAGPyvXe9lgN621du1BrJr9l1ei9HXLdakbIUB8dGQ8ur8IDSPmCPbBShLFgiED8zWfq YQMaE5vWLIL2tT+PAKd9vDPxEqH373iRZ9OEAISV0QPmCs82LLTXvMLMjTGupFFTofB1MR24FEJ 58wDe4Gz8GdFNr9GsqqcqiUuuvbfLg3U73bEK/TxqsBaykznzYatBmOBGD7WKlUPOMoAddTFYzH cxI7xiR9gTu2gIteQQYscnPdyr2naLGJfuCxSNacY9+UDt+nwTWFvaQCyT9WO1isn8xTcYKMP06 fDTs1EJ+YpPlJ6y1RKzkglJObPsArylQPl/DO26Ha+qrqj7DiHV5+rw4xtWqN/XQX2ZceMI0OK/ /MiNNFDcrPkm/YB7pLduKHhBPx0x4n1YEbiBMGjUtNbeP7wnYI44uSozV4Fcq9EgPw5yybP5jxC 8yiRuyzFF/2QaI0tYiB8ZnQotGLXz0VnDvCqsbLG6dB+ebHHkSftfZunciztOajmxuw23UIDauR RfNzDFo/YSfF5UQ= X-Received: by 2002:a05:600c:6992:b0:49a:a101:4157 with SMTP id 5b1f17b1804b1-49ce58034admr264450575e9.7.1788449793861; Thu, 03 Sep 2026 08:36:33 -0700 (PDT) Received: from nn ([2001:1ab8:1003:0:5454:f357:ba89:4e22]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-49ce831af89sm75568425e9.1.2026.09.03.08.36.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Sep 2026 08:36:33 -0700 (PDT) Sender: N B From: =?UTF-8?q?Nerijus=20Bend=C5=BEi=C5=ABnas?= To: =?UTF-8?q?Toke=20H=C3=B8iland-J=C3=B8rgensen?= , linux-wireless@vger.kernel.org Cc: linux-kernel@vger.kernel.org Subject: [PATCH v2 1/5] wifi: ath9k: name the register multi-read limit Date: Thu, 3 Sep 2026 18:36:13 +0300 Message-ID: <20260903153617.990995-2-nerijus.bendziunas@gmail.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260903153617.990995-1-nerijus.bendziunas@gmail.com> References: <20260903153617.990995-1-nerijus.bendziunas@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable ath9k_multi_regread() converts the addresses and the results through fixed eight-entry arrays without checking the count it was given, so every REG_READ_MULTI() caller has to stay at or below eight to be safe over USB. Nothing says so. The only caller that exists today, ar9271_hw_pa_cal(), happens to ask for exactly eight. Give the limit a name next to REG_READ_MULTI(), size the arrays with it, and warn rather than write past them. Signed-off-by: Nerijus Bend=C5=BEi=C5=ABnas --- drivers/net/wireless/ath/ath9k/htc_drv_init.c | 7 +++++-- drivers/net/wireless/ath/ath9k/hw.h | 7 +++++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_init.c b/drivers/net/wi= reless/ath/ath9k/htc_drv_init.c index 6de78ae85726..7fdec25c76ef 100644 --- a/drivers/net/wireless/ath/ath9k/htc_drv_init.c +++ b/drivers/net/wireless/ath/ath9k/htc_drv_init.c @@ -258,10 +258,13 @@ static void ath9k_multi_regread(void *hw_priv, u32 *a= ddr, struct ath_hw *ah =3D hw_priv; struct ath_common *common =3D ath9k_hw_common(ah); struct ath9k_htc_priv *priv =3D common->priv; - __be32 tmpaddr[8]; - __be32 tmpval[8]; + __be32 tmpaddr[ATH9K_MULTI_READ_MAX]; + __be32 tmpval[ATH9K_MULTI_READ_MAX]; int i, ret; =20 + if (WARN_ON_ONCE(count > ATH9K_MULTI_READ_MAX)) + return; + for (i =3D 0; i < count; i++) { tmpaddr[i] =3D cpu_to_be32(addr[i]); } diff --git a/drivers/net/wireless/ath/ath9k/hw.h b/drivers/net/wireless/ath= /ath9k/hw.h index b942b8303d8f..946c4d307b91 100644 --- a/drivers/net/wireless/ath/ath9k/hw.h +++ b/drivers/net/wireless/ath/ath9k/hw.h @@ -83,6 +83,13 @@ #define REG_READ(_ah, _reg) \ (_ah)->reg_ops.read((_ah), (_reg)) =20 +/* + * Registers a single REG_READ_MULTI() may ask for. The USB transport carr= ies + * the addresses and the results in one WMI command each, so its buffers p= ut a + * hard cap on the count; callers must split larger reads themselves. + */ +#define ATH9K_MULTI_READ_MAX 8 + #define REG_READ_MULTI(_ah, _addr, _val, _cnt) \ (_ah)->reg_ops.multi_read((_ah), (_addr), (_val), (_cnt)) =20 --=20 2.55.0 From nobody Sat Sep 26 07:15:21 2026 Received: from mail-wm1-f50.google.com (mail-wm1-f50.google.com [209.85.128.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B59984E236D for ; Thu, 3 Sep 2026 15:36:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.50 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788449800; cv=none; b=sd0H9AEDde2JCHz+2J9QYVOq0DBeWE1ObF/NSiPNTp6c/IenefczReeW+NDMbqTtgeciB5/NaEGOhP7TotCl7dUlpd17y5IukdRZKydHPYxyLJIiM25BJLWjc1ZMO9fRCcyufq0Na5CtYwj54l/v3jdZ8e67MLHDbD7Zx8zRD8Y= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788449800; c=relaxed/simple; bh=SM0mRtUxaHoxR6ZHIxi0dRk/J3NkAPKmE+EazTtEt88=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=HEPg6NvQUHcEREmdhcfMn2ztFdqwFZskSIwENo4R8XYZuC8AMsyGW633d/agnABF4LuTyKLY+dh0vEpBd4GSGWu5IIj0gqCl36XkD2NdnqjBRF/hWtaqXwO896RLcFmr3hN6ONqjedWTqXqHWhRXnX2vTUryEwEIAlTAL0rCN4c= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=nfIYQpDU; arc=none smtp.client-ip=209.85.128.50 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="nfIYQpDU" Received: by mail-wm1-f50.google.com with SMTP id 5b1f17b1804b1-499b2981a7bso26784515e9.3 for ; Thu, 03 Sep 2026 08:36:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1788449797; x=1789054597; darn=vger.kernel.org; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:sender:from:to:cc :subject:date:message-id:reply-to:content-type; bh=TcouK0eCsqKz/evCB2s76zDGRnZRiqQtBAWxyElcQTY=; b=nfIYQpDUdPN9+QqD5muayaGfO+WUMkhGizlhLwjC6a5jjnHXEW0UlkfVeuuM02YAd/ SwaG6brUpB3wSi3wcNvJBrzSKsjr6UcAVTs47fpGR2BNS3FEQVR13CQ91TQ2DjI9EMGL OowL7GH+8R4QNAMzC5cmbO1RzVht0tSbVfdI17cp8xO08Agm/AUwO7qncyApXtCXUul4 XF0Hn9Sw5BzTvJ+/PPeZg2azF9LxRlJoQzRozy9IbpZaD42/zcc5VjxcjQd97Yzo2v3U GYVLrmCZNQCQZbVpZ/6mn2RSOTkP79rUT6KZB7mff2f22WuasLEAviJqlJKXGlEAjihl /r3Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1788449797; x=1789054597; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:sender:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=TcouK0eCsqKz/evCB2s76zDGRnZRiqQtBAWxyElcQTY=; b=Ik7/+Zjli1qw0Blt7SIQUhAkiLE9jF618YqQ8ItZ/xk2ctmNaaW84j5gzjP1bVxyID 53CfnqNzDX9xLT2/6Pan3rE3lQFOPaHmGTaSyRqEUlZfemW6XJ7qcaYmB7vmXPnWifhj IiXxNFgYOX12bc8BQ1aF6MKQ0ga2TIZEC3OA1p2PA2pngs+BIBezTAZ4z+m305v6oAta 72jNUY0RG3a9hHtwo3bjbzT7o7rzpo2HZVn3LSKDnkg8H35ihD6dkNTi5bW4iZmD0dev AprWOaL9ql9OO/PSQOE8N+6X+YEDbsUQRDlmT++jY4LWVI9/+GPsyocJslxZCqURBPaH FdRQ== X-Gm-Message-State: AFuF++kUsUMfPNJs/zM4G8toqRA+OVYKP7tkwN2LlgUZcpEwpoDUnkrw xLoZREccXRoAsCyPmJsBVR6hrqvxwhnvynv0wnrRkG1bDRxNJV1Hm5w= X-Gm-Gg: AYBFou3QiSlt3lZbj0k9AaadiWn6726sCUm4XKA+ttVLXZbE6sKnZ7HNZxzgwtAL3/n O8WW1j/B2TC8vvb3yMmWw5mvfgE8loS9QLoF/yj9dh9ZzFMkWZscC/Tpv6O+yAMJ9x5Xcw/cenh trNoTzYjZkGHORdQF78dergehMJz8EjIEtjHbqPSphOsthebDwojLpy0VNPax3RB2SsD/Isua/U FkyYMbfDpRE4Rvb1t7/hmlxChSrD54jYM93yXERHJ/IaClGW8FeFF4IAWHVM9vK02udY7lRZQ5X HvA9O3E5uyT1jL/p78KkhdOugiUpMR+5Fl2ofs+c2DcORoCVaY6vsdh3GbsFAZvR3gUxetQaXr2 nhlxD1V6T5Kce4P50PXIz8WIRIhS8NMNEBJN0f9a5Ax+xkAuTWKmoOiLHXpDrmw1ri11ssbPpVh Frz6TBD1hGSb7QX6IhXU3egn+EYOsj7Pjio2+WcfiaLKWrl3NJP+jmOHK8eeVy2NKBqCIl0WC8F 1EGjq7LkOWGdBPMlWB73zhsfME5k075sm9DTjZizXCw1olnKATDZ8ieO6V972Pj8U7MIah5KaKR 2UCv X-Received: by 2002:a05:600c:5306:b0:49c:c9ac:a4f3 with SMTP id 5b1f17b1804b1-49ce5810b6amr270638835e9.1.1788449796652; Thu, 03 Sep 2026 08:36:36 -0700 (PDT) Received: from nn ([2001:1ab8:1003:0:5454:f357:ba89:4e22]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-49ce831af89sm75568425e9.1.2026.09.03.08.36.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Sep 2026 08:36:35 -0700 (PDT) Sender: N B From: =?UTF-8?q?Nerijus=20Bend=C5=BEi=C5=ABnas?= To: =?UTF-8?q?Toke=20H=C3=B8iland-J=C3=B8rgensen?= , linux-wireless@vger.kernel.org Cc: linux-kernel@vger.kernel.org Subject: [PATCH v2 2/5] wifi: ath9k_htc: report a failed multi-read as all ones Date: Thu, 3 Sep 2026 18:36:14 +0300 Message-ID: <20260903153617.990995-3-nerijus.bendziunas@gmail.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260903153617.990995-1-nerijus.bendziunas@gmail.com> References: <20260903153617.990995-1-nerijus.bendziunas@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable ath9k_multi_regread() logs a WMI timeout and then copies its result buffer out regardless, so the caller receives whatever the stack held for every register it asked for: the ANI MIB counters grow by random amounts, an EEPROM block read at probe turns into noise, and ath9k_hw_read_array() hands back values that never came from the device. ath9k_regread() reports the same failure as -1. Fill the caller's buffer with all ones instead, so a failed multi-read looks like a failed single read and a register value that means "busy" or "pending" is what a timeout produces. The next patch relies on that for the tx queue status. Fixes: 09a525d33870 ("ath9k_htc: Add multiple register read API") Signed-off-by: Nerijus Bend=C5=BEi=C5=ABnas --- drivers/net/wireless/ath/ath9k/htc_drv_init.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_init.c b/drivers/net/wi= reless/ath/ath9k/htc_drv_init.c index 7fdec25c76ef..bfde58c5965b 100644 --- a/drivers/net/wireless/ath/ath9k/htc_drv_init.c +++ b/drivers/net/wireless/ath/ath9k/htc_drv_init.c @@ -276,6 +276,9 @@ static void ath9k_multi_regread(void *hw_priv, u32 *add= r, if (unlikely(ret)) { ath_dbg(common, WMI, "Multiple REGISTER READ FAILED (count: %d)\n", count); + /* Callers expect what a failed single read returns. */ + memset(val, 0xff, sizeof(*val) * count); + return; } =20 for (i =3D 0; i < count; i++) { --=20 2.55.0 From nobody Sat Sep 26 07:15:21 2026 Received: from mail-wm1-f52.google.com (mail-wm1-f52.google.com [209.85.128.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8181C4E2349 for ; Thu, 3 Sep 2026 15:36:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.52 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788449802; cv=none; b=na/J7uXKOFC8QtUyIycqvaPJIMTTFelvB0q2MNZFwseTNmssbIjh0AA48rpXRKEz5CQQAl1wOJMS/27Z7vO3AYW7GJ4Z+4tlCDgfXZa1FlDYYmiWh1pmehDoh1tCj1hbk/Nuly2O0pqzW1BiPAOvsdrlaOqa50BRzFKmc0JMimM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788449802; c=relaxed/simple; bh=tT3Q8k3SBGvhCW+ypFai1zo8VCC9N3bTDH1szrukFBo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Y7eNAJNO2v9P/dwNxkwIGxS8OMI5mYW9XnPT7O3W9Na79z+lVl/PDeEML1FqF399vSzF9XIhRNGEQc+M3WVdj9uUbYD39AU5iwYsC7CVTGOGULU5kGbTYNdQLbkFvxyXHkhyst1Ti5cyZlany6D1E9KTjnGutqPwKy9WFnYoasw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=R2KEiPET; arc=none smtp.client-ip=209.85.128.52 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="R2KEiPET" Received: by mail-wm1-f52.google.com with SMTP id 5b1f17b1804b1-49cd9add88aso16348165e9.3 for ; Thu, 03 Sep 2026 08:36:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1788449798; x=1789054598; darn=vger.kernel.org; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:sender:from:to:cc :subject:date:message-id:reply-to:content-type; bh=XFFCN85pDa3U+auxuvcaHapqvCSCEcU+9fOdA+AcD88=; b=R2KEiPETiX6HOLiotv02anrRukY6a5PRjBYiLxZ2rg/H8S2BmMnA3UBm4W/RIch02K tV+KsnCKIYLWtW/CN2bDOdVOh+NvVwcJL5yEtR4Vi+NFeRrI34dzfT58Mfaem9XP4vJD qr0INPJ1quJjgFpO2RgJUnNnXG1jzVV4pSCsBxYlMLgc5lq39jfwSxKbBTxpECKO6JRn MbXXlLMs6wUz1V1dD7ROq2D2CnBVU30T/HfGEUESCD0rRGuE/3ssYI5QcUUfQO6GNZZw IEt/tH/lDb7JF5ETY2Dp/j4ITn/PNk2+P+udM9liPwwYUsfdB9e8U5Q1NqEofcylgGMa dRRw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1788449798; x=1789054598; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:sender:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=XFFCN85pDa3U+auxuvcaHapqvCSCEcU+9fOdA+AcD88=; b=ggvJ1cuPOEEPp9F2lCNNQ0Ls9Si/UZw0vVjmM90U0wTwK28w8BrcakqeHtBvOokUaV Tbu4T8bisEyaDBzyirVizf5spz/XerHBET+xbm+nafg2ef78PZN/OcbGoDkKtJL1KmqE ErdHKCHjZr63aPbTzoiMm4PVu8Gt1d+V6RHld+vK1WwWSbqNRXW0c+CeMBN6zkH3ey3P /zTego8NsdeA/SZRPKrUIkmcW1nf1FmW9lPndufzsTNgyBqP2muCd4iTNbEgov1Vjw78 WA+KLzOgo2AlaYgO5nzEauy+zJjQx2F85IJhyk/p6ATWDmAGO2IG2ph9cM/dI1u30Dvb wNCQ== X-Gm-Message-State: AFuF++lE5f0Hd4+VDralv/MQ555D4QXasUkf23vNxc/1ueMumkeHb91u vCnr5UHstbgeuJ5+RRGBA7SdjVnp3/0iYc87LFL+uLIZyd34VcLzqxo= X-Gm-Gg: AYBFou0KjtJy64sbX+hNbdCRbYyJxtlAcX3kzNLkY3RFkYRoksm5lBtKFwB0GUrEhXK nDahKFEWr2zSpvQU7zMMwOfZInnNqQj/PoUDdk3U6F8UqurhsdTIjDE0bs1PaSjqtI6bessip7U M66OnELgHw7BsnoK/PpiJeyXfaaIQD02bohWUdWiMT7s8NIkNWNXq7Q198QOea5UY5BNmaEZcYb IGnZlrU3SBi/qiFg2VcleQSWLWG57qxQfLoSLOdnf57AvPCvM8WpYIynT+xiwWT2rqfiFtf7FcV OhVqqUKCeDkJOt0PPjGHaGeHa266l9venmON4CF9P9usoa8zPVNwVlPUATdFh+FQun3Si04DuwG ycd4D/sW5ktvNmC5buGGbG/ctEUNnbdZNdAunG4Fm5h3PtJLKgpOLQlLizP8iKSfyxeZVKCUJCn pXhFb1ZpmN7teadkHiblXbyk9Y5/Q8Dg9Ge1il3zj4//0g8ypCuHA48RA6gTJO0fSKSiLXuhKL4 x05D0bA6c1TYWwZvh4YmZNnqM8piPkrZaa5F1/rgDkV5WgzwcQFXgm+TSRmC5O6fLp4BSZ42wc0 cGI/PDVho4YZtjmO X-Received: by 2002:a05:600c:1394:b0:499:db27:7b1 with SMTP id 5b1f17b1804b1-49cf5bafa7bmr13645245e9.15.1788449797712; Thu, 03 Sep 2026 08:36:37 -0700 (PDT) Received: from nn ([2001:1ab8:1003:0:5454:f357:ba89:4e22]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-49ce831af89sm75568425e9.1.2026.09.03.08.36.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Sep 2026 08:36:37 -0700 (PDT) Sender: N B From: =?UTF-8?q?Nerijus=20Bend=C5=BEi=C5=ABnas?= To: =?UTF-8?q?Toke=20H=C3=B8iland-J=C3=B8rgensen?= , linux-wireless@vger.kernel.org Cc: linux-kernel@vger.kernel.org Subject: [PATCH v2 3/5] wifi: ath9k: check all tx queues with one multi-read Date: Thu, 3 Sep 2026 18:36:15 +0300 Message-ID: <20260903153617.990995-4-nerijus.bendziunas@gmail.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260903153617.990995-1-nerijus.bendziunas@gmail.com> References: <20260903153617.990995-1-nerijus.bendziunas@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Before a channel change ath9k_hw_channel_change() asks ath9k_hw_numtxpending() about each of the ten queues in turn, and each call reads AR_QSTS and then AR_Q_TXE, so confirming a drained radio takes up to twenty register reads. On the USB devices those are twenty synchronous WMI round trips, paid on every hop before any tuning starts. Collect the ten queue status registers and AR_Q_TXE through REG_READ_MULTI() instead, split into chunks the transport can carry, and apply the same pending test to the results. PCI implements the multi-read as a loop of ordinary reads, so it sees no change beyond the loop moving. Signed-off-by: Nerijus Bend=C5=BEi=C5=ABnas --- drivers/net/wireless/ath/ath9k/hw.c | 13 +++++----- drivers/net/wireless/ath/ath9k/mac.c | 38 ++++++++++++++++++++++++++++ drivers/net/wireless/ath/ath9k/mac.h | 1 + 3 files changed, 45 insertions(+), 7 deletions(-) diff --git a/drivers/net/wireless/ath/ath9k/hw.c b/drivers/net/wireless/ath= /ath9k/hw.c index e08ab73fcacb..d204cdf3fa8f 100644 --- a/drivers/net/wireless/ath/ath9k/hw.c +++ b/drivers/net/wireless/ath/ath9k/hw.c @@ -1547,7 +1547,7 @@ static bool ath9k_hw_channel_change(struct ath_hw *ah, struct ath9k_hw_capabilities *pCap =3D &ah->caps; bool band_switch =3D false, mode_diff =3D false; u8 ini_reloaded =3D 0; - u32 qnum; + int qnum; int r; =20 if (pCap->hw_caps & ATH9K_HW_CAP_FCC_BAND_SWITCH) { @@ -1556,12 +1556,11 @@ static bool ath9k_hw_channel_change(struct ath_hw *= ah, mode_diff =3D !!(flags_diff & ~CHANNEL_HT); } =20 - for (qnum =3D 0; qnum < AR_NUM_QCU; qnum++) { - if (ath9k_hw_numtxpending(ah, qnum)) { - ath_dbg(common, QUEUE, - "Transmit frames pending on queue %d\n", qnum); - return false; - } + qnum =3D ath9k_hw_first_txpending(ah); + if (qnum >=3D 0) { + ath_dbg(common, QUEUE, + "Transmit frames pending on queue %d\n", qnum); + return false; } =20 if (!ath9k_hw_rfbus_req(ah)) { diff --git a/drivers/net/wireless/ath/ath9k/mac.c b/drivers/net/wireless/at= h/ath9k/mac.c index b070403e083f..49f59ce92133 100644 --- a/drivers/net/wireless/ath/ath9k/mac.c +++ b/drivers/net/wireless/ath/ath9k/mac.c @@ -77,6 +77,44 @@ u32 ath9k_hw_numtxpending(struct ath_hw *ah, u32 q) } EXPORT_SYMBOL(ath9k_hw_numtxpending); =20 +/* + * Asking ath9k_hw_numtxpending() about each queue in turn costs up to two + * register reads per queue, and on the USB devices every one of those is a + * synchronous WMI round trip. Collect the queue status registers and AR_Q= _TXE + * with the multi-read op instead, in chunks the transport can carry. A + * multi-read that fails over USB reads as all ones, which counts as pendi= ng, + * so a WMI timeout still refuses the fast channel change. + * + * Returns the first queue that still has frames pending, or -1 if they are + * all drained. + */ +int ath9k_hw_first_txpending(struct ath_hw *ah) +{ + u32 addr[AR_NUM_QCU + 1]; + u32 val[AR_NUM_QCU + 1]; + u32 q, txe, done =3D 0; + + for (q =3D 0; q < AR_NUM_QCU; q++) + addr[q] =3D AR_QSTS(q); + addr[AR_NUM_QCU] =3D AR_Q_TXE; + + while (done < ARRAY_SIZE(addr)) { + u32 count =3D min_t(u32, ARRAY_SIZE(addr) - done, + ATH9K_MULTI_READ_MAX); + + REG_READ_MULTI(ah, addr + done, val + done, count); + done +=3D count; + } + + txe =3D val[AR_NUM_QCU]; + for (q =3D 0; q < AR_NUM_QCU; q++) { + if ((val[q] & AR_Q_STS_PEND_FR_CNT) || (txe & BIT(q))) + return q; + } + + return -1; +} + /** * ath9k_hw_updatetxtriglevel - adjusts the frame trigger level * diff --git a/drivers/net/wireless/ath/ath9k/mac.h b/drivers/net/wireless/at= h/ath9k/mac.h index 16203e7ecf29..5b94ce087be2 100644 --- a/drivers/net/wireless/ath/ath9k/mac.h +++ b/drivers/net/wireless/ath/ath9k/mac.h @@ -721,6 +721,7 @@ u32 ath9k_hw_gettxbuf(struct ath_hw *ah, u32 q); void ath9k_hw_puttxbuf(struct ath_hw *ah, u32 q, u32 txdp); void ath9k_hw_txstart(struct ath_hw *ah, u32 q); u32 ath9k_hw_numtxpending(struct ath_hw *ah, u32 q); +int ath9k_hw_first_txpending(struct ath_hw *ah); bool ath9k_hw_updatetxtriglevel(struct ath_hw *ah, bool bIncTrigLevel); bool ath9k_hw_stop_dma_queue(struct ath_hw *ah, u32 q); void ath9k_hw_abort_tx_dma(struct ath_hw *ah); --=20 2.55.0 From nobody Sat Sep 26 07:15:21 2026 Received: from mail-wm1-f44.google.com (mail-wm1-f44.google.com [209.85.128.44]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8B4CD4E3781 for ; Thu, 3 Sep 2026 15:36:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.44 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788449802; cv=none; b=KRYFz+AFtEZuW6ZtIUuUJvnCr+g9htpKPqIVZdnSoQP1mIINsCuvkXq68b6uSp12AcPODYA06y0BK2h8fpJgp8n0ulUHCzFttZI4PQmp2nVa/75NdfGEU5AhRHzIMlN7T/wvJHEr3ibs0yb8RtthFtes92c5qYVryqreRfzJ3Uk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788449802; c=relaxed/simple; bh=dxgTuRXIg9MafPzhR81UeFG4+538SkbvTi0siu7dZuQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=N8YoWL2Z1E4hZGxllGjYDtv/ZEeQbmnxPX4Mt7lS7vKr3ZO0fPkkvwOvF5grG7UsNuC5c+wv4FouUgzB5p4N7pIk1ySYaCB9/H/X7ik/wbyLOo+gK0ejKGBdz87ufHUs8hE0cO8Tn48gn4U9cgA4R220ss5YcxlKT2VAyAF3Q60= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=Zd9lmOhl; arc=none smtp.client-ip=209.85.128.44 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Zd9lmOhl" Received: by mail-wm1-f44.google.com with SMTP id 5b1f17b1804b1-49556f97a9dso21006215e9.1 for ; Thu, 03 Sep 2026 08:36:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1788449799; x=1789054599; darn=vger.kernel.org; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:sender:from:to:cc :subject:date:message-id:reply-to:content-type; bh=UMmi9ENN2WjM1s9qjAy3S5/7V0uR4HETS3+LJLK/gWM=; b=Zd9lmOhlC2s8Je3Q6i/+Gw62t0rA+xtQcux9KrIyYS53s+D1ikBI22WxMzoQbQn+9X WvjmYFrJ8D028QN85RJ3yX9+d1+LfV5LE19uQ4No0PENGehdANpl+azMnG3LqjYoHKSO rge5i1HFvrMRmUmf1c9Y2Mr4UkzC5DGd1juyNUzpr/+jEpOE2vgPChTSq6X2yc09ovy+ kS2YS7USNaUFeYd7ItH44EsV+J7b40AzWLnzd2Q/f5VmNl10sPcpa1IsK4VXWZoNhOYb xdFqSAqAC+OeYz3jz1KXikKepsk7MSS6A1oc1BXyT8ZfG9vqYKdJAB+3SOVLTZzYs87O ndfg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1788449799; x=1789054599; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:sender:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=UMmi9ENN2WjM1s9qjAy3S5/7V0uR4HETS3+LJLK/gWM=; b=KD2J9xa7xslq3YQCn/o2aX19qaeHNL9OL/TgOPbn2byA5JH7anFVsknYWPA6Rcn6VH AYMb0/AnC7gve1evprbfQS0HD0lD1ibq8t8eKweAVxdzzHwqyVkzIecEywy8kcUlVD1a kQvHtKiSXwg2acFhiQEK4r4yi8KqfpaD6JPyT9EE2Epo7Zwd93EdpzI73TbNGtexoic5 HtiExAOPUF5/3SR8nMAXWMdiQnjmtyIe8i2dt5vuC88K87XfWDUTLVeGO8eb1CTCtTn3 VpvjW5WNZZuFi1yM3CJp/awvKof9ArkDTdOtDo5S2t43NZQIiiwKWjmucfaaEtOI883p RYwA== X-Gm-Message-State: AFuF++k6WjD28sG/xSe0PnY2xvzwo1PN36MUYzVqUexo743TX2dObq+0 vYPPeEI2sqNcMijRfk8F5vEs/2AktlNYU2KxlZy86cHeiAtwkAQuqgIBpqTW X-Gm-Gg: AYBFou3EzmP2rZFs2eb+za9F9K4MRVny/BBEeHiehB3Y4VUv7u3g6FnGX5f0Xj7J1d+ HoQlFGvVHX1BdKjNFfVN94M8+KMeI+4hWrocelVw2FGuS0FYq+HSaK7rt7is4Ou2AlZuOe4WqHT F/HQ4NwGMmZ3TPm6Ou9sigAzI0h2XGlIVAeEGNNQo54O9IAXYilm5XjmK6bfRcMerY+S9eIUEU3 GgrpXe2wuMBqFt/dPL8dBo3ZrqNA3he0Hz6CTllgcZO/ieucRqe/e04Dqt4/8qsnq25DULACSyV OtC/KCNxps+tVHW/8zqATGRPx6E+yM9g8EXQNLwVE5udztSgWElEbo+8A4HRpxqXyBUjmTKVdbg PECbZzWZFr2x/5IH/iyjGvZORGfnIpEn/WLNkBePjRUUSKjrHEyE75vDUclWb9DzceZJvh53/EM fpOCa3IB/rakpYeDk7SbtaoL/q2C0Zizxq7hv5+kh8fyvbIENVYDXkKSsSpTON8WjbEQjPpRERA psewGeVLMfcTWhD/x8uou1vqsljkN1xCrl/bAuRkddGZllV4RIQ5c4egXYtIgXwnA/NLThc/QFV zF5y X-Received: by 2002:a05:600c:4e8f:b0:499:bf0e:95c8 with SMTP id 5b1f17b1804b1-49ce57f5647mr199297695e9.1.1788449798654; Thu, 03 Sep 2026 08:36:38 -0700 (PDT) Received: from nn ([2001:1ab8:1003:0:5454:f357:ba89:4e22]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-49ce831af89sm75568425e9.1.2026.09.03.08.36.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Sep 2026 08:36:38 -0700 (PDT) Sender: N B From: =?UTF-8?q?Nerijus=20Bend=C5=BEi=C5=ABnas?= To: =?UTF-8?q?Toke=20H=C3=B8iland-J=C3=B8rgensen?= , linux-wireless@vger.kernel.org Cc: linux-kernel@vger.kernel.org Subject: [PATCH v2 4/5] wifi: ath9k: batch the read-modify-writes of a channel change Date: Thu, 3 Sep 2026 18:36:16 +0300 Message-ID: <20260903153617.990995-5-nerijus.bendziunas@gmail.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260903153617.990995-1-nerijus.bendziunas@gmail.com> References: <20260903153617.990995-1-nerijus.bendziunas@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable ar5008_hw_set_delta_slope() and ath9k_hw_start_nfcal() both issue a run of read-modify-writes with nothing between them that reads a register back. Both run on every channel change, and on the USB devices each REG_RMW is its own WMI command. Wrap the two runs in the RMW buffer so the transport sends each as a single command. PCI does not install the buffer callbacks, so ENABLE_REG_RMW_BUFFER() and REG_RMW_BUFFER_FLUSH() are empty there and the writes are issued exactly as before. Signed-off-by: Nerijus Bend=C5=BEi=C5=ABnas --- drivers/net/wireless/ath/ath9k/ar5008_phy.c | 2 ++ drivers/net/wireless/ath/ath9k/calib.c | 2 ++ 2 files changed, 4 insertions(+) diff --git a/drivers/net/wireless/ath/ath9k/ar5008_phy.c b/drivers/net/wire= less/ath/ath9k/ar5008_phy.c index 7a45f5f62826..af05dcf95a61 100644 --- a/drivers/net/wireless/ath/ath9k/ar5008_phy.c +++ b/drivers/net/wireless/ath/ath9k/ar5008_phy.c @@ -868,6 +868,7 @@ static void ar5008_hw_set_delta_slope(struct ath_hw *ah, ath9k_hw_get_delta_slope_vals(ah, coef_scaled, &ds_coef_man, &ds_coef_exp); =20 + ENABLE_REG_RMW_BUFFER(ah); REG_RMW_FIELD(ah, AR_PHY_TIMING3, AR_PHY_TIMING3_DSC_MAN, ds_coef_man); REG_RMW_FIELD(ah, AR_PHY_TIMING3, @@ -882,6 +883,7 @@ static void ar5008_hw_set_delta_slope(struct ath_hw *ah, AR_PHY_HALFGI_DSC_MAN, ds_coef_man); REG_RMW_FIELD(ah, AR_PHY_HALFGI, AR_PHY_HALFGI_DSC_EXP, ds_coef_exp); + REG_RMW_BUFFER_FLUSH(ah); } =20 static bool ar5008_hw_rfbus_req(struct ath_hw *ah) diff --git a/drivers/net/wireless/ath/ath9k/calib.c b/drivers/net/wireless/= ath/ath9k/calib.c index b4ab85bd7895..73c63ab32d53 100644 --- a/drivers/net/wireless/ath/ath9k/calib.c +++ b/drivers/net/wireless/ath/ath9k/calib.c @@ -224,6 +224,7 @@ void ath9k_hw_start_nfcal(struct ath_hw *ah, bool updat= e) if (ah->caldata) set_bit(NFCAL_PENDING, &ah->caldata->cal_flags); =20 + ENABLE_REG_RMW_BUFFER(ah); REG_SET_BIT(ah, AR_PHY_AGC_CONTROL(ah), AR_PHY_AGC_CONTROL_ENABLE_NF); =20 @@ -235,6 +236,7 @@ void ath9k_hw_start_nfcal(struct ath_hw *ah, bool updat= e) AR_PHY_AGC_CONTROL_NO_UPDATE_NF); =20 REG_SET_BIT(ah, AR_PHY_AGC_CONTROL(ah), AR_PHY_AGC_CONTROL_NF); + REG_RMW_BUFFER_FLUSH(ah); } =20 int ath9k_hw_loadnf(struct ath_hw *ah, struct ath9k_channel *chan) --=20 2.55.0 From nobody Sat Sep 26 07:15:21 2026 Received: from mail-wm1-f44.google.com (mail-wm1-f44.google.com [209.85.128.44]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D4ABC4E3EC4 for ; Thu, 3 Sep 2026 15:36:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.44 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788449805; cv=none; b=F4zRsfMpJ074ngtwc1IOkX4em5s2BHpry50LqMdY8P4z7Sg/igb7JQajD1nT+JkZ/s0bKP0M1VheKSlOQ/UQIAuMK6a4RSZOye/Z5CoFjRqcMXSokDLYnaoPT3GsjJQhfhIQJZQUyaESIt5+NH1DnF6iTMvXsOODQj6JpEW4i/0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788449805; c=relaxed/simple; bh=qsFwjBfu2NKtEcsDviKHxw63ntmppkT8r3P6UxlkbOc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=qokWk90z/BdyHizRdn/3qk/KZ9ZhxgQ8pmhN/mIdNb3Z4Q6Xj7xe+bthVMS1effKWSChxN6MGxONRy7iSDiGgMmK1vCdNeridOANTtXRvCHptPND1X1b/XkpxNO99AB+UkckjuosGwg51a3vnLslGhNbEdHQkLG1/Sn7ker59bw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=VvpVhIdC; arc=none smtp.client-ip=209.85.128.44 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="VvpVhIdC" Received: by mail-wm1-f44.google.com with SMTP id 5b1f17b1804b1-49b0d78a801so22435e9.2 for ; Thu, 03 Sep 2026 08:36:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1788449800; x=1789054600; darn=vger.kernel.org; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:sender:from:to:cc :subject:date:message-id:reply-to:content-type; bh=ShvhKa6MyfZ1jEWheQQ6SuhEnn7upG8Sh84fZvzR0n8=; b=VvpVhIdCDu+E+q9D3ZMVDm1AVd6kHCs8u0qRwDmqS02aZUnA7DlhlUPPj6QjbNNkC3 a+ImcYMOjILsuXRZ6hJUOFHTcyBnqhQH/TxOaYKBs0qhUuK3R04YL9oa7zp1HiT9Yzjq 5x9JkMwVTPgUcFbNdq8I9gUSH+rPfLEZgk+3scg/AQ3W/4tYr60jkTWurl6ozeAo2jzM khFaxl5svuz8sNmDY9yug7HyKgx4NpgsjkIXP0bYPrEJqA9h1uDlZ8lM/P/tBy4Ugt2n C/k6OGdKx54xCJZ6kePdrBgxzp5Kv0RzPQwr0erX1g+ClUEwZpbhbjQIxGVvl5HW7KRa 37yg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1788449800; x=1789054600; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:sender:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=ShvhKa6MyfZ1jEWheQQ6SuhEnn7upG8Sh84fZvzR0n8=; b=U0fa2E1ZE5l+VXh4VD8uJjFcLh1+kC4zxQK/6pihoXELpDu1at9kyR+gPdjYOQnCt5 sZBkE5AZxWgSdU3FIiAZ5dnD5CwSIRuAl/XCB6Pe+S1AYho6scKtTNn/LdivSEgJqOm4 58y35UFot9a3gNUV2dZ2+GdjUKClw9Lk+m7Vqmp4WeWhtHWy3kZorBxEEjjSymEo07B3 ffUF0x8gw7DFBAkMp47SsV8t4+Q2enMEGrlIh+4u9avO1cgViSYdQFBI2iFeXhELrdEC Krv4JxW6mMyZOJmNyUq8ym7E4+7Mqau7a8czx9vdrhEfO+WRNuaKZFgx88DD+SBug7hS w2Fw== X-Gm-Message-State: AFuF++miIVC7oTAlcLiFeSoB6UrdySXuB3TVnxDKCxwsl3nU6xI7GRdD qTTMgqKcRcwBxklIJXotCv/rIn4EAUNUDlDt/3/Lm92JNDUhQNELSIY= X-Gm-Gg: AYBFou3x3KMmoYIHOjasS2xkn9K+HGi4J/7OENNdwGYAiJapcZZcCkbxt+c8ag4e+k6 TdhW1+M8DBqN8ipTXknQQshpP3ZfliA6B3fagpl1KIcvgn+v8EWzVVUED6VNcnjz7EEbOQMOG8X Knok1HNCGr93MSg7bSexeNyKZiIvTvwnLVb8sRqXqyyU3fcRR+VEyT9S34H3XEJGjEmQP93OYdw F5gtB4DNw+YKPxjDAeWmwa3IMXdFsEAgMZVltjKRe2f3ZNoACDe9Kncw/SpbGI8adhzEldnVIvx PvK32wBvn6ZTu+LvJiNpiIjTkFBBGeJ7zpHcjYb7UEPEE4FIXWOVRZus6N3KxFLrSGFJ8UtZBUP cFoJ6A5I5YmVRUKksDh7NYIWrVEkeobxg/IGaunNDKG9MbwB06JKvrdqP3CyYn2e3AAJuako9/O XqgBk6f+O37h8TqF0bDagCuy+WQN19ovILJE3s0pYTMkpTNBGCQnUWGpk3sClk3lurwiJ/JIYoz 07Ud/TlijUmpZW/Lbzd7zGPzORxAtqUTdssZAiPSHVpgkDH2WxP2znr0xvimxr1m1VuaERlRVHf p9TlW+MBBlkvsCc= X-Received: by 2002:a05:600c:3495:b0:49c:ee36:10fc with SMTP id 5b1f17b1804b1-49cee361162mr166580795e9.8.1788449799511; Thu, 03 Sep 2026 08:36:39 -0700 (PDT) Received: from nn ([2001:1ab8:1003:0:5454:f357:ba89:4e22]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-49ce831af89sm75568425e9.1.2026.09.03.08.36.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Sep 2026 08:36:39 -0700 (PDT) Sender: N B From: =?UTF-8?q?Nerijus=20Bend=C5=BEi=C5=ABnas?= To: =?UTF-8?q?Toke=20H=C3=B8iland-J=C3=B8rgensen?= , linux-wireless@vger.kernel.org Cc: linux-kernel@vger.kernel.org Subject: [PATCH v2 5/5] wifi: ath9k: skip the departing channel's noise floor on USB fast changes Date: Thu, 3 Sep 2026 18:36:17 +0300 Message-ID: <20260903153617.990995-6-nerijus.bendziunas@gmail.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260903153617.990995-1-nerijus.bendziunas@gmail.com> References: <20260903153617.990995-1-nerijus.bendziunas@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable ath9k_hw_reset() reads the noise floor of the channel it is leaving so that channel's calibration history stays current. The readout is several register reads, which on the USB devices are as many synchronous WMI round trips, and a frequency-hopping monitor pays them on every hop for a value that only matters if the radio returns to that channel later. Leave the readout out when a fast channel change is asked for on a USB device. Periodic calibration refreshes the history while a channel is in use, and the arriving channel's noise floor is loaded either way, so only a channel that is left and revisited without calibrating in between sees an older history. Signed-off-by: Nerijus Bend=C5=BEi=C5=ABnas --- drivers/net/wireless/ath/ath9k/hw.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/ath/ath9k/hw.c b/drivers/net/wireless/ath= /ath9k/hw.c index d204cdf3fa8f..64fefbec46d5 100644 --- a/drivers/net/wireless/ath/ath9k/hw.c +++ b/drivers/net/wireless/ath/ath9k/hw.c @@ -1878,7 +1878,13 @@ int ath9k_hw_reset(struct ath_hw *ah, struct ath9k_c= hannel *chan, if (!ath9k_hw_setpower(ah, ATH9K_PM_AWAKE)) return -EIO; =20 - if (ah->curchan && !ah->chip_fullsleep) + /* + * Over USB the departing channel's noise-floor readout costs several + * round trips and only feeds its history; the fast path reloads the + * arriving channel's noise floor regardless. + */ + if (ah->curchan && !ah->chip_fullsleep && + !(fastcc && common->bus_ops->ath_bus_type =3D=3D ATH_USB)) ath9k_hw_getnf(ah, ah->curchan); =20 ah->caldata =3D caldata; --=20 2.55.0