From nobody Sun Sep 27 04:21:45 2026 Received: from mail-wm1-f51.google.com (mail-wm1-f51.google.com [209.85.128.51]) (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 3E47751A721 for ; Fri, 4 Sep 2026 18:53:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788547994; cv=none; b=hBJyhLPDP26rPyLEiNaqy0RNSZjsMl9WXKGdQ0F0gKT5P1DEt8S9jb9oVM15yG3/PqkfXvlwqfu9CNVfVOJjV2+vnsOny4PjOFgdDW8NC/aQ9J0gsvyRqLVC/ZwSHhhNaEy1UytUr7lCKi2G6AzI2GmF1hwzq+I0tsXt3A5WI+k= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788547994; c=relaxed/simple; bh=5x4dulZK0+121XejeF6S/bpx9DVjzeNeXGD4og3vsyA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=fC1P4GNYAQA0xDNFG3T1nRz3NETQrcYGVOWWSXFmCAyv0/seaC2IN2KSYYfh0NIXThFQVv1T7HIdWpAnfO6GeoUI9EWR31sxVMk5ViBIaNX6C5vQjV+iZou0eYp4hup/QVs023KN8kVwZI6MpQR2ajnpbaQUE3EKKG+Y9vo1fcQ= 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=ZJd98wSa; arc=none smtp.client-ip=209.85.128.51 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="ZJd98wSa" Received: by mail-wm1-f51.google.com with SMTP id 5b1f17b1804b1-4980fe6b3beso18362975e9.0 for ; Fri, 04 Sep 2026 11:53:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1788547990; x=1789152790; 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=LN+PUjIhc1QRgwWnqFTrNClD/WVs9AN63AUQ/okw4kc=; b=ZJd98wSaGXr9l8ELnHJl2uBnBZL0JeQUFeKdxfiCs+ZIHJvC8bCUEYjwMkkFisOG5Y qIOqncdGdBa9hJ3BWPwZose6mKBoERQDyllJsSHPCFhE+G27IsKmTh+oUO/vIU73paKm 9XtZTB+8pU6aTAK7NDCGKP0d1svcVWJHAe3GcZOAOwjj1RR3KyNuC3dWTC746V5em3Pd 1HCBBFBrsbjz1dqJFpUkSry1nI+oxF/PSBT+BQjry+BYylNhFHzS3J714O0qAPKkfakY AVlsCpQMzqt8mBwm7itxT7+fgg1bHssnEEjbRWArbfiW6W4D7ikc+TFVDmsgn2OcT+8j j9sg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1788547990; x=1789152790; 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=LN+PUjIhc1QRgwWnqFTrNClD/WVs9AN63AUQ/okw4kc=; b=tD3nIQ1Ovo2gCivAprhXHB1H/4jZI5Ll4lqkMnhh+Y4O9oaUWQUrzA3EsI0CMvxQb1 N5ts1OblETzs8TKyMqiB6TZrlLuigWkfJGYMyRzkfPA8p7kq+2GMRYF1qy1G1bp4mstI 6cjMDAa0jpzeGnRuUVVFFaHILKW0S0rUk8CV+uF+eLHncout9m5oWj2bIL6TOsfKKYYp mQUUrQANHLj8l8xNNAVf/iM2Ij7w9calmE8YOYakQn/pqqOOoP9kD/FoFzm9wBv7ihJH Ns0m3W6OgQGn5r3PJMDE7vtFJAdX1TcOy2LfTwJt5cFIVzyeXzScyhaBtPlEzWui5B3Z NggA== X-Gm-Message-State: AFuF++l4ZCr8cfrpTcKn1rLm0ktgjdt7pDlS2ugVfAo4AIEhvB0MusUF pw3O9RGGornEa9S9iRmYpKCMKxk1UvZ5/iDISxuVUg3PceUr44lt41y5yiC0 X-Gm-Gg: AYBFou1si34hbjGtZcmHro5jsZyOc+Pihc8toJ64tQZ50rwQQ6DZFATnux9DPWD2/Qh l2pbE420nzhaeKMw7uWfsG951gygbPaxfW6uTfrX7uoCTHcU3NJVqBiohkRhNJTe6Gk743DCTjD dGFGvW7/fNxx8ACnux+7l2WoHMLN1tq9porVb6FQzpKc2AvO5XTHANBc9TVjp2YUcvCLtG+wWLf yaJfTmJ9r00EifGN857XrP07DeStAwc3aS1XoUyNhOYJHgGp+4gzH+7hPjpowMN4KDbJqm9BtLy RVxk+RvOLuh3VpoPmUajun5AjpTpDk0NH1Pc4rseqdhUVzGP0JiOy1K0ORk2DlEdTS1s0PDtBUJ CcTu71kmKOW0ILaFFvF6o6V9Zbb8hQzIBa5blr8PCgELUp8ojNIpPXSmxfkeJvxykAmBM/k6qiM tbcmjftauTiSTuwzhLYrsYwHERD61XsLZnoHjT1aetTKOAvFnmzZ7o4OAlAnUTI1ED0iV/Jzk9s h1MuI3uUMZN8639BUW72sQQ4hlw+FkqnyBRQZp8fylZJO1TZAt1rzZ5VMijPF2QOY5ZqVDSZGTi iiLG X-Received: by 2002:a05:600c:5397:b0:49c:e37e:4389 with SMTP id 5b1f17b1804b1-49cf82cba17mr68895295e9.4.1788547990271; Fri, 04 Sep 2026 11:53:10 -0700 (PDT) Received: from nn ([2001:1ab8:1003:0:5454:f357:ba89:4e22]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-49cfbe5b252sm58607715e9.3.2026.09.04.11.53.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Sep 2026 11:53:09 -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 v3 1/5] wifi: ath9k_htc: report a failed multi-read as all ones Date: Fri, 4 Sep 2026 21:52:49 +0300 Message-ID: <20260904185253.809209-2-nerijus.bendziunas@gmail.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260904185253.809209-1-nerijus.bendziunas@gmail.com> References: <20260904185253.809209-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 When the WMI command fails or times out, ath9k_multi_regread() logs the failure and still copies its result buffer to the caller, so the caller receives uninitialised stack data for every register it asked for. ath9k_hw_update_mibstats(), ath9k_hw_usb_gen_fill_eeprom() and ath9k_hw_read_array() all read through this path. 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. ath9k_hw_first_txpending(), added later in this series, relies on this: a timed-out tx queue status read must count as frames pending. Fixes: 09a525d33870 ("ath9k_htc: Add multiple register read API") Cc: stable@vger.kernel.org Assisted-by: Claude:claude-fable-5-1 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 6de78ae85726..f5844e9bdd2d 100644 --- a/drivers/net/wireless/ath/ath9k/htc_drv_init.c +++ b/drivers/net/wireless/ath/ath9k/htc_drv_init.c @@ -273,6 +273,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 Sun Sep 27 04:21:45 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 53A11521200 for ; Fri, 4 Sep 2026 18:53:14 +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=1788547996; cv=none; b=cmJJuzIHgt5pteYN8nwINFZno0SfY4sGPpxVMKZrkDxm4+u3DQJ9+oQKJViK5p/UWFhdze+URhpP5voW1N8/8QCBoJNKbAIpDXdoKTMGQwQ7C4l0GmAJ4N27Vom8m4wIbRN6Faj38aNDifxpNE4Db/T6JbfPI6qdIP4fwI82adg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788547996; c=relaxed/simple; bh=17rdg2ScjqmUoZ6yaWeSJKrB9uYV4e5mZ++WUCStIms=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=LOeDwzpfOyE9SU2246HFYTNQOH/H+xhZCk6c1sm3isaEqGd9o3pnzHzdPCM1wALqtIgRCbIlSzvDY7Q4gUz+JiMcZOsLRR9hX9PRnKpVfpxviosy1OhraUnrgW396dpZkElQVK5umriRMMwI8eynl9jztWSmqfVFDhWtN6/6gIo= 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=Z4503FNX; 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="Z4503FNX" Received: by mail-wm1-f44.google.com with SMTP id 5b1f17b1804b1-49b8eeb3ff2so12746485e9.2 for ; Fri, 04 Sep 2026 11:53:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1788547992; x=1789152792; 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=LnQaP9fPO2THdkTrCSNb+dwWcnrhsGIaZubrRTYDQ/0=; b=Z4503FNXkuPuzcJ9dclOhnJu9k9r0TLSOAn1wWgHuENAYpV23BekzBCnAc2Cdy7Zy/ AtDRa2MetG8DxB1PPTORDCqD2M5TirvowFAVuxbJ8Yvs5mKfToLnzf2G6666c07zonsl blccJKJzUkw2SNKo3in22TcSzCoqXUkLddgPL8Xv6Xjuo8xp/R56gZPkR/zIG6/c7/on brH9Joi/0hZUN8bJXuqSaWxsQKpk7qqSETSEBxeJZCsIIXn8ZeoBTihEqx7rWWtC+1sF R8sRUklojEb2O+oHy/xj+/D+hesH+buFg9TR9NsTXMauYcUMw932wJRQW+aVuR/mb08P 1oWg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1788547992; x=1789152792; 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=LnQaP9fPO2THdkTrCSNb+dwWcnrhsGIaZubrRTYDQ/0=; b=Q9S19wCwAcdp4OXkcB53NURpM34q3kA9ljTO8rpCi63eDzkERCFW1WCJaFwI3CdZhr iFprCcuw9y1zL9JiA45Vo7ZqcwTYK+tesulhDH0BQH26Nx77GXcq0VmjApmL65TxuXYS F2UAegJhg4/lHbUGZ4miYMgzQER5XlrZmr66Ck+O4GGAq58mKZw4myd66uo6cz2YbdIr PI8wUhaOqBFJ4XM6Jfup+/8HfcEjEvShdy38rF4ueMJoLJQR7QZksgMGXheEfHO0r7RT e1VcfbtzLhTOiSLbJ3X3mQQaW1h7LTCD5pLTkCtJKb4p0jDU6cFk4zoVYF9oCc2g9zUG iPdw== X-Gm-Message-State: AFuF++n1plsnLU7RSJD29uVgVlyt3AY7FRTIi+XUEqyz/oCXKh4aNKN/ dob3eHBD8oXpcmLtAzBnQOIMthHXlqGVFXKnSw2V+JBZy3lSqS3L3eI= X-Gm-Gg: AYBFou3nLxDmU5iZquFOZ44qDictKq3MCmCzFmNwBnmH8ZLiTSY7yn+h1OxzM+nBFGU WeRTgu4OnYmF7dGng+YYMZ8OMbk4InZzTpevqHcuOY+XTfZEYk9GZ+JeuXALzA6OiNnmnUgeZyu Erg9UcqS/gYKHEukDRgyG2OIAIn4kDEulboFc18v1h0E+jxJgxMG+pL4HNDvSwRWWk2YrITHUaq DEQ6n8OTyNLjrGRT/JjqNkD8KQyfwnKdQ1jZCerGaDYkioZxs9Xtq4quX4dzR42Z6kgW1IBE2+8 Do8fKj70lAv9OTc1EhYO7/jZbsb34zCj7A9zCoEgCajuffrpF1wEftzeBKwemR3iGgJZHSfl0cI ay0K8CiEzs5VGgVh5tzU8qqQICMah3TC4wxLMoylv1FEJbK7PR2vFgXnTIMmq7MLS8IXoy3Od1J RTjv6Nzon5byqIHUS8nHBySP1m4wGF4GPgLVdFTctm9ZWgQM8Qz+gYU6mqQK1fpH0tNrZzqSMl4 Ne56qUh2hwUSdpyxiw7id6F44e8bPosuGP72MNe2tJZ9vG16FmeC2g/Uh+frY/FXwepg3es9mhd 4yIp X-Received: by 2002:a05:600c:540f:b0:49c:d293:70c8 with SMTP id 5b1f17b1804b1-49cf81fb1e3mr75634765e9.3.1788547992181; Fri, 04 Sep 2026 11:53:12 -0700 (PDT) Received: from nn ([2001:1ab8:1003:0:5454:f357:ba89:4e22]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-49cfbe5b252sm58607715e9.3.2026.09.04.11.53.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Sep 2026 11:53:10 -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 v3 2/5] wifi: ath9k: name the register multi-read limit Date: Fri, 4 Sep 2026 21:52:50 +0300 Message-ID: <20260904185253.809209-3-nerijus.bendziunas@gmail.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260904185253.809209-1-nerijus.bendziunas@gmail.com> References: <20260904185253.809209-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 8-entry arrays and does not check the count it is given, so every REG_READ_MULTI() caller has to stay at 8 or below, which nothing states. Two callers ask for exactly 8: ar9271_hw_pa_cal() through REG_READ_ARRAY() and ath9k_hw_usb_gen_fill_eeprom(). Define ATH9K_MULTI_READ_MAX next to REG_READ_MULTI() and size the arrays with it. A larger count warns once and is reported as a failed read, all ones, instead of writing past the arrays. Assisted-by: Claude:claude-fable-5-1 Signed-off-by: Nerijus Bend=C5=BEi=C5=ABnas --- drivers/net/wireless/ath/ath9k/htc_drv_init.c | 9 +++++++-- drivers/net/wireless/ath/ath9k/hw.h | 7 +++++++ 2 files changed, 14 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 f5844e9bdd2d..3d4c6f9f6e95 100644 --- a/drivers/net/wireless/ath/ath9k/htc_drv_init.c +++ b/drivers/net/wireless/ath/ath9k/htc_drv_init.c @@ -258,10 +258,15 @@ 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)) { + memset(val, 0xff, sizeof(*val) * count); + 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..211d42c92796 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 +/* + * Maximum number of registers one REG_READ_MULTI() may ask for. The ath9k= _htc + * implementation converts the addresses and the results through fixed arr= ays + * of this size; 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 Sun Sep 27 04:21:45 2026 Received: from mail-wm1-f45.google.com (mail-wm1-f45.google.com [209.85.128.45]) (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 5B26852120F for ; Fri, 4 Sep 2026 18:53:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.45 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788547997; cv=none; b=Kw+x7oMeAaI8E3PdEMMz+ibizKc0f6EpjBCwF6N/MX3yQu9q/uci7vR9fPkCiz3aYXQfh0mLoJOZ5852CN6779kvMlZMj953FptM2i4egPnMZcIeXlD0VWydejjEfgBrQ91enaYqyroS3uR2iOO6tTFdOKmXZs0uuHITZSAfZJo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788547997; c=relaxed/simple; bh=q0jBlW76LvL4fU60HQWKpNaPKvxyoQqAS/s/hZ+Rji0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=QPr/I6SbGm/dFMFgjo2YJC2UVpTd2aH1qp927XOCpG129gUwZ9/WcxRUQoZ++UtsY19Tjlqrk4Sna//z24mFfYIW5q3XB1VGc1uZhlmeHDwgqnpT3RiTAsQTl1UpwSVwJUN/vUQXIz8M6dJcyGrrXNdTwBH8BZ789G3xWh2sDGc= 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=TbxFVEUG; arc=none smtp.client-ip=209.85.128.45 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="TbxFVEUG" Received: by mail-wm1-f45.google.com with SMTP id 5b1f17b1804b1-49ccfae359fso11287875e9.3 for ; Fri, 04 Sep 2026 11:53:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1788547993; x=1789152793; 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=d85C0WGMaBUKYmEMA486RpdKAWHT2Sz0LL4lVc+yQdE=; b=TbxFVEUGpEXmEx/mHYEwVc+DGkPBK/u9epodKRApuXuRSFS46JEmqSTMCbFB0lFHRa 7BNLkruNxYdkRMTmFY23ZH1q45In9g4mcIgKGgP4Nq2iM6kUjGX+XiuwplnaVqsJSiU6 rejbo4OqSmzCS4rTEmB9xK1bw8MLuKK3goIzJ+kr7RsqcPOLqJ38CPiSv/0YgNT3/MGQ rjQ2WsTga2cxvmE7cDXwdnwiGsN/F5FUiUU/KADWLwjQRjQpmnflfW4Iut8skyrGfAU+ puIKGTW1XC7v/VKefWzFHWbXCwbqZYzi7bB4fUuoNp/mzklSRSFM2AX9r/ffEBGSQok+ Sdxw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1788547993; x=1789152793; 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=d85C0WGMaBUKYmEMA486RpdKAWHT2Sz0LL4lVc+yQdE=; b=WkeRnOO00iIk/7i7PEeUPY89LTXP1lT8Jhbf3A8TQPbdQPJsKEUBBYGTlK89oL4/5/ o89cDD2dTcQnjayrQjrgL2NfLrUo5X20i5zj31ZVB0h5ncWYTGyAm3jYr1tFA+p6nF4D yW+TDcGJ4AlBW66mm8rPObHeswdSHBPo5/S/nxhjYe5BD7JSfyekEqAecjdLHsN9LXMS /ThQ4tG0l68SdY79U2/CSBCfg3s7m7+G9JE/7+mkzkZ5pMMSCAVQhebisPi4Td1I/yC5 AkK0WtgIDrTrvO+AO+zl7WsI8fXlDPtOwwp5c1EbMYINIEyWBw0SN92ZLb3HQRfVrWOK 7kfw== X-Gm-Message-State: AFuF++nRjebOnn2oHVmEtE7Iq8xbjAcAjQV4m3qqXltmbQHHgZ6szCC9 jRsaM9SAZ6qhT+Wi4g15TtL4m2QAAxdrDom/8iCNFha30ToQq30kf3oYP2gG X-Gm-Gg: AYBFou1PQKNVl9na9SDH1J6dt1bCLUKiBwDEhizkSLtwyCPb2PN0QQUGri6g9VyPG4F MjGykCx2ecDchcZ3Ne+p4bIAzI/EJ37O4EKKG/qarN1rVlomcgr6ZRHRo8qNoEH9kAAf45ddvfe wS3/bECbdbuBX2lrgXIkZckarGmG2p/0h++Ls8aeh6Y5odApOjbh0PwdrKdGxjfnGMpo3QyhyWL DBX5KqgVrVNXh6vn0VxJ+O7BN2H1LJ0gECfp5qc6R7g1eghe4QowHXVI9+UM9gLAwIBEDgHB+eu rs3xgqbKhbER5R/j7myYtdk4fL9n4HyvkCCd4jIeCjZYwk82aPoM/nbuztrQYvgSHg1xkSnNwXF F5UnrERCy3oXu25+FIOVrydynWnH4s00pXQHXbK1/8k5wGhE9tqnnHc8U6Pe41jTc1KyV/HbQa0 UqxHNdEMPKgLSVnqwRRzxuJgEZ38c9deHHHHpW0JWYF1DLtQU957VxY5pB6LvRoV+cST3JDmC2w Jv8e9jAtjYFi8gcARZsjDLnDR5hY4RrLP4GZGgnx9gE3wPChXQPa2B2KzEf5YmUgzHlwapfZslb 2DpuO0zyNh9+sYGM X-Received: by 2002:a05:600c:3495:b0:499:726b:7375 with SMTP id 5b1f17b1804b1-49cf8279f41mr82218115e9.14.1788547993229; Fri, 04 Sep 2026 11:53:13 -0700 (PDT) Received: from nn ([2001:1ab8:1003:0:5454:f357:ba89:4e22]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-49cfbe5b252sm58607715e9.3.2026.09.04.11.53.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Sep 2026 11:53:12 -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 v3 3/5] wifi: ath9k: check all tx queues with one multi-read Date: Fri, 4 Sep 2026 21:52:51 +0300 Message-ID: <20260904185253.809209-4-nerijus.bendziunas@gmail.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260904185253.809209-1-nerijus.bendziunas@gmail.com> References: <20260904185253.809209-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() calls ath9k_hw_numtxpending() for each of the 10 queues. Each call reads AR_QSTS and then AR_Q_TXE, so confirming that the radio has drained takes up to 20 register reads. On the USB devices each read is a synchronous WMI round trip, paid on every channel change before tuning starts. Add ath9k_hw_first_txpending(), which collects the 10 queue status registers and AR_Q_TXE with REG_READ_MULTI() and applies the same pending test. Use it in ath9k_hw_channel_change(). On PCI the multi-read is a loop of single reads, so the register traffic there is unchanged. A multi-read that fails over USB returns all ones, which counts as pending, so a lost read still fails the fast channel change and the caller falls back to a full reset. Assisted-by: Claude:claude-fable-5-1 Signed-off-by: Nerijus Bend=C5=BEi=C5=ABnas --- drivers/net/wireless/ath/ath9k/hw.c | 13 +++++---- drivers/net/wireless/ath/ath9k/mac.c | 40 ++++++++++++++++++++++++++++ drivers/net/wireless/ath/ath9k/mac.h | 1 + 3 files changed, 47 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..27926b67d628 100644 --- a/drivers/net/wireless/ath/ath9k/mac.c +++ b/drivers/net/wireless/ath/ath9k/mac.c @@ -77,6 +77,46 @@ u32 ath9k_hw_numtxpending(struct ath_hw *ah, u32 q) } EXPORT_SYMBOL(ath9k_hw_numtxpending); =20 +/** + * ath9k_hw_first_txpending - find a tx queue that still has frames pending + * @ah: hardware + * + * 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 of ATH9K_MULTI_READ_MAX. 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. + * + * Return: the first queue with frames pending, or -1 if all are 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 Sun Sep 27 04:21:45 2026 Received: from mail-wm1-f49.google.com (mail-wm1-f49.google.com [209.85.128.49]) (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 7C4AF51FCD9 for ; Fri, 4 Sep 2026 18:53:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.49 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788547998; cv=none; b=VO2z6Hc5wBUQC5kI13xGg1SW6KDBImLVSieQxorZ3z1Mvh59G0w0DYV5iC/ujKtIU7Wmg3y9rXGZvz30M8S4EqruPFGKZ9ZTE4ctyBxVaoDvSSaEPm+MkfZvbN/NVGxovOIdlIeGo+MSCy6QoELLJrgP5f7S0Ts8iAcHcsSbf8M= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788547998; c=relaxed/simple; bh=EZdaHNjU+TIXVe4GCjTzp2mJ0V1U6rUpYJ8v6fB/t8E=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=XHhzx17ow1jVrgPbeH86yomZQAEau/diDE6wUf4Y+IxukCdriGD5Fghy+KDk1/GbIvfil0C1SLaKsc5OV1RR4diNST+UEFJUTsm7CLcPYIdDEav0tmTHvqq7UuVuSevkE73rXzU2EvT5kDz8lzFa+DTbYd5tRsSw+KTNybR10G8= 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=aOdXFWcu; arc=none smtp.client-ip=209.85.128.49 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="aOdXFWcu" Received: by mail-wm1-f49.google.com with SMTP id 5b1f17b1804b1-4995b0343c1so17631575e9.3 for ; Fri, 04 Sep 2026 11:53:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1788547994; x=1789152794; 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=K8YmC3OILkqrRt2yACBkxysDZXA8U3Xzaub87X9aEHc=; b=aOdXFWcu1MQKzgnUQmcUQ/Ft1eQzast+KzSNf3hA8X0VGH/tVODP7J0t2bK1OGhYo1 a22pNeqhE3/NNDSTLwcnMYMp+Va9TNE9Yi4YUgTkmIrnEeT3FN4vCsTgvvCnnO8tgh1l nFsV3VlY2+b0iQSo7BFn2Mc6z4bX2txV0z7I0nsr9+Lhppmbe84zseZ0JZePHOvvVdCm XhEA34U2gIKfOKRcujSGwoinSCW6y8QjnKJbnM4W13AKEmSQWVz+Cau0DVCvTwcaNy1l 5S9NnRHhH4CXXMid1hZHq9QYkJTuu3V/OTQK7vNvCTcHzcMacaHDr9yVu6z0ZIVJqip1 8jJw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1788547994; x=1789152794; 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=K8YmC3OILkqrRt2yACBkxysDZXA8U3Xzaub87X9aEHc=; b=V93gQ52B+/CLzTdX1a/5edXFF8xGrYVvyxMGTKBckNhpMakr48KdpKa9/rO3dgoZcg RuOEUde3dR7nTiDgiOiGC2KuPkdXnF6fHY/wCnfTdYXf+tuWeD6JfxuotbUWGmVMJO5D veF54rR45VNlttdgP1E1I0AKy0MHrZKRKfPr04TuA1vSZmw/+oJ22jq9GVYt5jxgVGna YenFhRSX4MUaHI4RCW322y0qHq2v3fdyN3D7zLFw4tac25Bv9Vbq4SAHm1c2SrasKr+B LV7ldUsEetGERfFQCluhPbpaSztlSMv/dhsOQ04pZUc2n1660e4/MrU2O+kAO6P28gy9 /fhw== X-Gm-Message-State: AFuF++nyeddVHbPhssO3p4+3bNuGn5MCP8rzhRsTnhK3xn/MYvkw4w64 HzDkI/OEKMat5QIxURSIoPSdgVbjRWaJKxBT7zF0rVTEtF2wmYpVlYY= X-Gm-Gg: AYBFou20V5rWnpB5L/yJWicvaN2G+bl4eHzLM6vlaU/knCNjk4oP/0Vw8p3lOKMGzF7 2Ck/DqSF+yo7DoffVB3WK4A7lOpH4NgG3tbXg+izytqDWMLV2VyQuYaWjB8MyhfA98cZ384WFve z+9dIA5R+MZjiUED6DpJW4q2GNyxeiw81l7eXEuSpLWkYhGNGNyhTrOzXwWs4GEhTAP0p88FNpd EsGWNtYSucn4gOLys/rM6laB6PpTfTvKK7iHSrV7lrGw0IXH9l2eSltZKcd4RZ3nwYQUSCxT4bA KcN/DXcVi647lO7laCX14cQfNguUYxOSNGJf4dXGjBHoWTab3RohfnOVcnbX257ZNVVA3rKvxTy 4Va66Ms3gxzFo3cLbXjRoMwd+4XLEjqzVSEavkgfQRKTaMBomDRPPjp+K11GtQyZTYK1MJV43tu 0v6BTBHrqswkcdeYAqJAczub6hsKbYY617C/w3vBr2vYP5Is3repV3NnaMSSS1dANT0JItJUtA3 5QjJh5+72U2l+xoKtAHTurh70NCC3QZDaXCIhvGeUHTQc234lZC0PdUQbaaYIcVSy54xcKqX1tz 820C X-Received: by 2002:a05:600c:4e4c:b0:499:621a:2ec2 with SMTP id 5b1f17b1804b1-49cf8206e4dmr84668845e9.3.1788547994177; Fri, 04 Sep 2026 11:53:14 -0700 (PDT) Received: from nn ([2001:1ab8:1003:0:5454:f357:ba89:4e22]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-49cfbe5b252sm58607715e9.3.2026.09.04.11.53.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Sep 2026 11:53:13 -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 v3 4/5] wifi: ath9k: batch the read-modify-writes of a channel change Date: Fri, 4 Sep 2026 21:52:52 +0300 Message-ID: <20260904185253.809209-5-nerijus.bendziunas@gmail.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260904185253.809209-1-nerijus.bendziunas@gmail.com> References: <20260904185253.809209-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() each issue a run of read-modify-writes with no register read in between. Both run on every channel change, and on the USB devices each REG_RMW is a separate WMI command. Wrap both runs in ENABLE_REG_RMW_BUFFER() and REG_RMW_BUFFER_FLUSH() so the USB transport sends each run as one command. PCI does not install the buffer callbacks, so the macros do nothing there and the writes are issued as before. The same holds for USB devices with firmware older than 1.4, which have no WMI_REG_RMW_CMDID. ar5008_hw_set_delta_slope() is the AR5008 and AR9002 callback; AR9003 has its own and is not touched. Assisted-by: Claude:claude-fable-5-1 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 Sun Sep 27 04:21:45 2026 Received: from mail-wm1-f45.google.com (mail-wm1-f45.google.com [209.85.128.45]) (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 7BF6552123C for ; Fri, 4 Sep 2026 18:53:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.45 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788547999; cv=none; b=H3Sogqk1OyhiRE8vXgXXsP1OqLLrS9MYMHhHGLq+05L0mEfAQlelVWH2xR8DyQhy2eY7nR+Dxmzw/L5na+4Kd8JXuieW3OoKKVlVaTZ8kvCCK7RZiD8fKNhKd98iITNmTxXO2GIH+FS03aeK3/23wDRlmM73cD7pn1cpR7srVao= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788547999; c=relaxed/simple; bh=shczN+Wd1phO1G5nIqYAq6HteSzRw5Np9oURkf5Lq7Q=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=T/YYQddASVsnEpW+fsivU9EguRUh1vCKL2EypBwfxMGZYiLFoph8GPGVdIVqdBDy/NeJuGUdFpeKoIG1WVIA4MmjxFpmrnyHIcaWusOu4uVopzkTptC1VAYvkm8xv3ya6aXSHhCdSCRyanyyp2WQU7lEPRD2T5HKpJhTnoukyRY= 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=Cw07MPRg; arc=none smtp.client-ip=209.85.128.45 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="Cw07MPRg" Received: by mail-wm1-f45.google.com with SMTP id 5b1f17b1804b1-4921eed3fa2so16951315e9.0 for ; Fri, 04 Sep 2026 11:53:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1788547995; x=1789152795; 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=kR2H4mZOF5MD1bZlVKgICjhHENz8kmhN8v0njF7dUVc=; b=Cw07MPRgqf+qAUA2jhZhGpD8omhkAS0e9GPV+J0oGudKnshqc+TKw1n+02r5nwjVmT 46sfJIJIqhOTXKbFgFnYblzCsjSEp0Smc43jMQ6IDyREVrYgOzsYlx3v0rZt3Rs6tt0f dbl3/b2KqkyMxP9Je2crjAS0hehnIupyMVplahJ5IbasOZ5helhVp7XFDGBxeZZwWIMg aLHLrdhJ+SxCXvLN1PLxG09NTyq8QTkiQZ48qaWcMTmNPUkPWKFBtJ6KZ2bE3DX3U+Cc 9jCY1Z3M4yj9a0ce0mHfpxXsviADz7DIdM896hZOWgNgEB/bkL7YV/g13EG4OOaXdtH6 fSjA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1788547995; x=1789152795; 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=kR2H4mZOF5MD1bZlVKgICjhHENz8kmhN8v0njF7dUVc=; b=GkAwpmKeEo/R3BIAhbOLh4Jgx5pFRFkzOAmz3zjnoBKUyGOl8o79SNZChzFIZiZaXP +iBth/CvJDf9goJZG2kjKg69wYnZWe3wBjCqK9FY3LXkdJb9IHm+68QiJ3zNlrLSqvnL EnzyGFoQdRKbw/44tV3jh1daB/nMxzRoq5mFPwUdmnTJHLGC4isl7V3PFKJ6RLSzRXb+ ZRpWZEEA9v+gBTMWoWNWpWW8TJIxFsbk43uZGJ4FzUCsTDtHpbq1RllDMBAxSuWe2PpR btkjHpRfLDR74YqF45Fxs4zDx6NL04FxfTdlDSPuH7y4umBgpZkP7al4JI9S7rL95PCh /1Ag== X-Gm-Message-State: AFuF++kT3ZgPRLp2hFqKQFCnGjPLc18mzV9tg3v1xQg/toAKVRQ6dxqq 6V2w7LEF7DIeECSFxRBheV59bIZBkxFP80JkjbennykiPjLNMy76vDM= X-Gm-Gg: AYBFou3maD1KS5NZ7QraJGm04keOT9sD/QfxAq/n0ggwRRPAYUo7UIc8qomTC5pRxdk em4P3AwlNHb/XUTm6VjkcXlLFIIXeg3K4h30Plmt7TjhWVux1lxnoMtc2h9wWcFTOeWEE/0QMD3 //S545e/EVdz62dEUU8K9scvgXMv8aU8odtwK0NYIJaG5tg/v9dJKlnadjSA5AOycgQqW9y8V+6 Fp0JWsFJfbYnKC+iqUP1ELdBOAosnMyQ5FPUrlDYFVRfDrxi5eYBC7ie0BF+ie/OYRVUuSm+2dL oa68m3JdRZVyrw2d2i6WzD+LxHOAN78lHmChbEYDVZXX7cEkwYRdNGhpGRTVQfyGjwl0594V8uy uE+ZvI8tubSBNbKn6ob6IxzqbBRKhrdQ/54ZOZURhuAVAFN1QEki6mwI1hdfutUkZEkSEL/gPK2 EaItg40YU7z6aNi22bQOfjnmY4WbnwZZl6SnswV0y6kqkYZ8xijEs6kRgc3efH5pQ4WcFI0gbGF otfy5cy9y1QZmlnzPwTaSO09IZYjAe5e0tSAradwRGNorXEiAYsg4CYF0wEU2pnwQmBMXj0oy9f xqhk X-Received: by 2002:a05:600c:3e0a:b0:495:6e68:5df2 with SMTP id 5b1f17b1804b1-49cf8267a36mr95296185e9.12.1788547995236; Fri, 04 Sep 2026 11:53:15 -0700 (PDT) Received: from nn ([2001:1ab8:1003:0:5454:f357:ba89:4e22]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-49cfbe5b252sm58607715e9.3.2026.09.04.11.53.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Sep 2026 11:53:14 -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 v3 5/5] wifi: ath9k: skip the old channel's noise floor on USB fast changes Date: Fri, 4 Sep 2026 21:52:53 +0300 Message-ID: <20260904185253.809209-6-nerijus.bendziunas@gmail.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260904185253.809209-1-nerijus.bendziunas@gmail.com> References: <20260904185253.809209-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 to keep that channel's calibration history current. On a single-chain AR9271 that is three register reads, and on the USB devices each one is a synchronous WMI round trip paid on every channel change. Skip the readout on a fast channel change over USB. The arriving channel's noise floor is loaded as before, and periodic calibration updates the history while a channel is in use. Only a channel that is left and revisited without a calibration in between sees an older history entry. Assisted-by: Claude:claude-fable-5-1 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