From nobody Fri Sep 25 04:43:45 2026 Received: from mail-wr1-f41.google.com (mail-wr1-f41.google.com [209.85.221.41]) (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 D2D1A4D7D2A for ; Wed, 16 Sep 2026 17:34:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.41 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789580089; cv=none; b=huEJrHKyhZe3aNEPR4CsH2F/aTnMnhJxbU2GoIOVTHIldnhlSG/WhUyZou1uV4srvOY4yz0iBuAD651cP0lMlzjl1rq++O575LideNzazqqjnNxAUoCU76PxJ+0pyH/RtySarPEns9UHD/QkUMJImGMj9r6Q/eoIDnuVS07oAeU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789580089; c=relaxed/simple; bh=iwDKG6ahLu03ZTpVgkhI8rsprMAFlZ0EjKbSWmFEPGk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=eoRBBuX6+5JJertYjNZN08RpnbMThRWmeQzxFZAHWXSGcitSoNoqg9kr692cc12PDzdCJCXdAwa6j8fvlY0iKeaAu7174GHmBnOiG16a37ThQLGi48Ig5/wKmPPHmWmfHJtVE84Xhc7D62Idu1fCI4+E9rX7AQ4Qjy9Ot6GrSNc= 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=dkFhepWE; arc=none smtp.client-ip=209.85.221.41 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="dkFhepWE" Received: by mail-wr1-f41.google.com with SMTP id ffacd0b85a97d-48431648f33so999693f8f.0 for ; Wed, 16 Sep 2026 10:34:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1789580075; x=1790184875; 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=1iqGmORGiRLjddmmjFvHkR4msXAhMvLmPlXq2zOjXno=; b=dkFhepWEgwyU53DSz/jd8q7yWvo+jGTk37Cs9oDj3SUC+TLQ+UZ81z288AQoKpptqq 0k+2YfDA3wWmHVjwHo6vxI9tNqqIncWybVnNXveZYfZ/rERI0Zcl6dfJ0HszQGuzZ0Os xxu0UpC9zDZvovwLZfYLGdZjDciPDD5M0nSTyPdd1VfWpRQOcTOSzxzFrAHiV7ov6vPB gFFMCtQuNqHfUU0zQN+rV0+4klqrM65BalHxdD/iSTUZk0p2TrYWFRfgWh5Hv0+0pC84 ihr2AWq22EsK3mqvwD72vId9LDWsUhKn+hLsbhDDWpIaUTGZxeniZHTUA6ZKnprtckZK REfg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1789580075; x=1790184875; 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=1iqGmORGiRLjddmmjFvHkR4msXAhMvLmPlXq2zOjXno=; b=qamxTftakEiYS2CktFsKG/fAIH2RdWm2oRA7Sa+h4iuvudzzA916AzdKGRD0MFf2VF f6MttJSnEDwSO1VMF2FwSIQWdkHEn24lUDUzmkIZDCdUheMhm0/fW/SZsai/g5Ctb2lc Afu7IMAHsBMQLm9DFiCrTLEgSWVs7HC8m/l2tSEO5ISumJvvPr3Pa4wv0NTnILCbyJfH +iOji9yNzQ2aNQO4iDUvYb0pDmmH7LynR6AO+DN1SCGuxsgqD0Exh/Y1LaAUMANSkujT TmwbxHA5Eh79Qe6IqSUXJlN82HGAi1V+aRKdObZObOvlRW22OJrZNqeqNP7X6x4xOimF QKWQ== X-Forwarded-Encrypted: i=1; AKwUvBw1/K/B7mGxxeFUbpUVmiNC6G87PB5vEhL2xztLP1zFijoDs8vbPminPLFKxuymsca9+1wle8oLLNk/I7E=@vger.kernel.org X-Gm-Message-State: AFuF++l9D2HF5UU/9L8NTVcJiK4wq19nNbpxHEZgQ0IUXFT6+qNj2pxP YSpK+p/Th7HV20f8HJYVymYl9Iusm7n8tzRRBhcE5ckeK03O2Zl/R00= X-Gm-Gg: AYBFou0xFYQhwJvObEaO+dlNmGGcPiYkmK6JunvH813TK/Jeiq0wa9yNNDs+buOhQMB 31p/j/xsTQl/pgJRY45sPyH6kUv44GUKuuJOYByA89OqHMI12ci3BQEBQq+Dva03xuJFGkJE5Rq uj3EIJqv0JI5PcHDXXCGT+o13AC0O3qs7FDM4zoy1HJArUBvfvjvf0/eaAkqYtUN8iZOMZwUWb1 jqUbSjN5YNF0/5UVRB6UWR4FC78MJef6BTeL2XHGP9CC3cNTk5nWQsYXf6mx4nCHAJlfvkbkirj 227NfOqQmxaYFGy31gcJWQCJrO6b9oYMlvgs98F3ji3mBMHJuS9cfw3kLXoN/qiZQP29P3PVqgJ bPcAwXDMQMezt2DgxnzEP2J6Yih092ZBtNjQQadSoHNpNmZzvt2Hz3o/sD3BmYnqeLNrQTkxB9S gEqOezhxjggih++oqwlAmiQIbwVGWK0NN/5F2MRHAFaE0FGtKfLtf+bAkJznKjRvvaDkHr2gmG+ 2Pz0RhgQ6k4+AD9MYnPdfFQE22iDu2Es05lhRiwP17HoTq/tIe5HipL1VrVMThyYiSxAqsMsXnO 6X2pLAmRVrmfX6o= X-Received: by 2002:a05:600c:81c5:b0:49d:28fc:d6a0 with SMTP id 5b1f17b1804b1-49fbd200256mr6225295e9.18.1789580075031; Wed, 16 Sep 2026 10:34:35 -0700 (PDT) Received: from nn ([2001:1ab8:1003:0:f23c:f0c3:c09d:d6d6]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-4870bf27ce2sm8987544f8f.20.2026.09.16.10.34.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Sep 2026 10:34:34 -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?= Cc: linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org, "John W . Linville" , Simon Wunderlich , Oleksij Rempel , Kalle Valo , Jeff Johnson , stable@vger.kernel.org Subject: [PATCH ath-next v4 1/8] wifi: ath9k: return an error from a failed multi-register read Date: Wed, 16 Sep 2026 20:34:22 +0300 Message-ID: <20260916173429.403889-2-nerijus.bendziunas@gmail.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260916173429.403889-1-nerijus.bendziunas@gmail.com> References: <20260916173429.403889-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 failed or timed-out WMI read and still copies its result buffer to the caller, so the caller gets uninitialised stack data for every register it asked for. The MIB counters in ath9k_hw_update_mibstats() then take arbitrary jumps, and an EEPROM read at probe fails on the checksum rather than on the read. Give the multi_read op a return value, return the WMI error from ath9k_multi_regread(), and check it: skip the counter update and fail the EEPROM fill when the read did not happen. Fixes: 09a525d33870 ("ath9k_htc: Add multiple register read API") Assisted-by: LLM Signed-off-by: Nerijus Bend=C5=BEi=C5=ABnas --- drivers/net/wireless/ath/ath.h | 2 +- drivers/net/wireless/ath/ath9k/ani.c | 4 +++- drivers/net/wireless/ath/ath9k/eeprom.c | 10 +++++++--- drivers/net/wireless/ath/ath9k/eeprom.h | 2 +- drivers/net/wireless/ath/ath9k/eeprom_4k.c | 4 +--- drivers/net/wireless/ath/ath9k/eeprom_9287.c | 7 +++---- drivers/net/wireless/ath/ath9k/eeprom_def.c | 5 ++--- drivers/net/wireless/ath/ath9k/htc_drv_init.c | 7 +++++-- drivers/net/wireless/ath/ath9k/init.c | 6 ++++-- 9 files changed, 27 insertions(+), 20 deletions(-) diff --git a/drivers/net/wireless/ath/ath.h b/drivers/net/wireless/ath/ath.h index 34654f710d8a..d1af0b81768a 100644 --- a/drivers/net/wireless/ath/ath.h +++ b/drivers/net/wireless/ath/ath.h @@ -126,7 +126,7 @@ enum ath_cipher { */ struct ath_ops { unsigned int (*read)(void *, u32 reg_offset); - void (*multi_read)(void *, u32 *addr, u32 *val, u16 count); + int (*multi_read)(void *hw_priv, u32 *addr, u32 *val, u16 count); void (*write)(void *, u32 val, u32 reg_offset); void (*enable_write_buffer)(void *); void (*write_flush) (void *); diff --git a/drivers/net/wireless/ath/ath9k/ani.c b/drivers/net/wireless/at= h/ath9k/ani.c index 41d192709e8e..6d9f0ee26237 100644 --- a/drivers/net/wireless/ath/ath9k/ani.c +++ b/drivers/net/wireless/ath/ath9k/ani.c @@ -111,7 +111,9 @@ static void ath9k_hw_update_mibstats(struct ath_hw *ah, AR_FCS_FAIL, AR_BEACON_CNT}; u32 data[5]; =20 - REG_READ_MULTI(ah, &addr[0], &data[0], 5); + if (REG_READ_MULTI(ah, &addr[0], &data[0], 5)) + return; + /* AR_RTS_OK */ stats->rts_good +=3D data[0]; /* AR_RTS_FAIL */ diff --git a/drivers/net/wireless/ath/ath9k/eeprom.c b/drivers/net/wireless= /ath/ath9k/eeprom.c index df58dc02e104..6bf86d017c13 100644 --- a/drivers/net/wireless/ath/ath9k/eeprom.c +++ b/drivers/net/wireless/ath/ath9k/eeprom.c @@ -76,7 +76,7 @@ bool ath9k_hw_get_lower_upper_index(u8 target, u8 *pList,= u16 listSize, return false; } =20 -void ath9k_hw_usb_gen_fill_eeprom(struct ath_hw *ah, u16 *eep_data, +bool ath9k_hw_usb_gen_fill_eeprom(struct ath_hw *ah, u16 *eep_data, int eep_start_loc, int size) { int i =3D 0, j, addr; @@ -88,7 +88,8 @@ void ath9k_hw_usb_gen_fill_eeprom(struct ath_hw *ah, u16 = *eep_data, ((addr + eep_start_loc) << AR5416_EEPROM_S); i++; if (i =3D=3D 8) { - REG_READ_MULTI(ah, addrdata, data, i); + if (REG_READ_MULTI(ah, addrdata, data, i)) + return false; =20 for (j =3D 0; j < i; j++) { *eep_data =3D data[j]; @@ -99,13 +100,16 @@ void ath9k_hw_usb_gen_fill_eeprom(struct ath_hw *ah, u= 16 *eep_data, } =20 if (i !=3D 0) { - REG_READ_MULTI(ah, addrdata, data, i); + if (REG_READ_MULTI(ah, addrdata, data, i)) + return false; =20 for (j =3D 0; j < i; j++) { *eep_data =3D data[j]; eep_data++; } } + + return true; } =20 static bool ath9k_hw_nvram_read_array(u16 *blob, size_t blob_size, diff --git a/drivers/net/wireless/ath/ath9k/eeprom.h b/drivers/net/wireless= /ath/ath9k/eeprom.h index f1cde43fcb55..dc5ad4a3e752 100644 --- a/drivers/net/wireless/ath/ath9k/eeprom.h +++ b/drivers/net/wireless/ath/ath9k/eeprom.h @@ -680,7 +680,7 @@ bool ath9k_hw_nvram_read(struct ath_hw *ah, u32 off, u1= 6 *data); int ath9k_hw_nvram_swap_data(struct ath_hw *ah, bool *swap_needed, int siz= e); bool ath9k_hw_nvram_validate_checksum(struct ath_hw *ah, int size); bool ath9k_hw_nvram_check_version(struct ath_hw *ah, int version, int minr= ev); -void ath9k_hw_usb_gen_fill_eeprom(struct ath_hw *ah, u16 *eep_data, +bool ath9k_hw_usb_gen_fill_eeprom(struct ath_hw *ah, u16 *eep_data, int eep_start_loc, int size); void ath9k_hw_fill_vpd_table(u8 pwrMin, u8 pwrMax, u8 *pPwrList, u8 *pVpdList, u16 numIntercepts, diff --git a/drivers/net/wireless/ath/ath9k/eeprom_4k.c b/drivers/net/wirel= ess/ath/ath9k/eeprom_4k.c index 3e16cfe059f3..d5a8275ceb03 100644 --- a/drivers/net/wireless/ath/ath9k/eeprom_4k.c +++ b/drivers/net/wireless/ath/ath9k/eeprom_4k.c @@ -53,9 +53,7 @@ static bool __ath9k_hw_usb_4k_fill_eeprom(struct ath_hw *= ah) { u16 *eep_data =3D (u16 *)&ah->eeprom.map4k; =20 - ath9k_hw_usb_gen_fill_eeprom(ah, eep_data, 64, SIZE_EEPROM_4K); - - return true; + return ath9k_hw_usb_gen_fill_eeprom(ah, eep_data, 64, SIZE_EEPROM_4K); } =20 static bool ath9k_hw_4k_fill_eeprom(struct ath_hw *ah) diff --git a/drivers/net/wireless/ath/ath9k/eeprom_9287.c b/drivers/net/wir= eless/ath/ath9k/eeprom_9287.c index c139ac49ccf6..73213416fc8c 100644 --- a/drivers/net/wireless/ath/ath9k/eeprom_9287.c +++ b/drivers/net/wireless/ath/ath9k/eeprom_9287.c @@ -55,10 +55,9 @@ static bool __ath9k_hw_usb_ar9287_fill_eeprom(struct ath= _hw *ah) { u16 *eep_data =3D (u16 *)&ah->eeprom.map9287; =20 - ath9k_hw_usb_gen_fill_eeprom(ah, eep_data, - AR9287_HTC_EEP_START_LOC, - SIZE_EEPROM_AR9287); - return true; + return ath9k_hw_usb_gen_fill_eeprom(ah, eep_data, + AR9287_HTC_EEP_START_LOC, + SIZE_EEPROM_AR9287); } =20 static bool ath9k_hw_ar9287_fill_eeprom(struct ath_hw *ah) diff --git a/drivers/net/wireless/ath/ath9k/eeprom_def.c b/drivers/net/wire= less/ath/ath9k/eeprom_def.c index 5ba467cb7425..085e544f7c4b 100644 --- a/drivers/net/wireless/ath/ath9k/eeprom_def.c +++ b/drivers/net/wireless/ath/ath9k/eeprom_def.c @@ -112,9 +112,8 @@ static bool __ath9k_hw_usb_def_fill_eeprom(struct ath_h= w *ah) { u16 *eep_data =3D (u16 *)&ah->eeprom.def; =20 - ath9k_hw_usb_gen_fill_eeprom(ah, eep_data, - 0x100, SIZE_EEPROM_DEF); - return true; + return ath9k_hw_usb_gen_fill_eeprom(ah, eep_data, + 0x100, SIZE_EEPROM_DEF); } =20 static bool ath9k_hw_def_fill_eeprom(struct ath_hw *ah) 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..3798d3375158 100644 --- a/drivers/net/wireless/ath/ath9k/htc_drv_init.c +++ b/drivers/net/wireless/ath/ath9k/htc_drv_init.c @@ -252,8 +252,8 @@ static unsigned int ath9k_regread(void *hw_priv, u32 re= g_offset) return be32_to_cpu(val); } =20 -static void ath9k_multi_regread(void *hw_priv, u32 *addr, - u32 *val, u16 count) +static int ath9k_multi_regread(void *hw_priv, u32 *addr, + u32 *val, u16 count) { struct ath_hw *ah =3D hw_priv; struct ath_common *common =3D ath9k_hw_common(ah); @@ -273,11 +273,14 @@ static void ath9k_multi_regread(void *hw_priv, u32 *a= ddr, if (unlikely(ret)) { ath_dbg(common, WMI, "Multiple REGISTER READ FAILED (count: %d)\n", count); + return ret; } =20 for (i =3D 0; i < count; i++) { val[i] =3D be32_to_cpu(tmpval[i]); } + + return 0; } =20 static void ath9k_regwrite_multi(struct ath_common *common) diff --git a/drivers/net/wireless/ath/ath9k/init.c b/drivers/net/wireless/a= th/ath9k/init.c index 2f0c4ef86b7e..e425d355bf94 100644 --- a/drivers/net/wireless/ath/ath9k/init.c +++ b/drivers/net/wireless/ath/ath9k/init.c @@ -201,13 +201,15 @@ static unsigned int ath9k_ioread32(void *hw_priv, u32= reg_offset) return val; } =20 -static void ath9k_multi_ioread32(void *hw_priv, u32 *addr, - u32 *val, u16 count) +static int ath9k_multi_ioread32(void *hw_priv, u32 *addr, + u32 *val, u16 count) { int i; =20 for (i =3D 0; i < count; i++) val[i] =3D ath9k_ioread32(hw_priv, addr[i]); + + return 0; } =20 =20 --=20 2.55.0 From nobody Fri Sep 25 04:43:45 2026 Received: from mail-wm2-f13.google.com (mail-wm2-f13.google.com [74.125.225.141]) (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 E436E4D7D53 for ; Wed, 16 Sep 2026 17:34:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.225.141 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789580091; cv=none; b=D5ajhA8MJslY3oqnfaAw6NKmfQTZDJo1rW5HuzgnYnAfhlFiYuXX8Em0M5l3ST7ODFS+1IAm4UuGYPYMNNuc+zMwTrUbY/N2RE9b4JqI1HYyksR9qeTLMm+FqIYNV9gx9n2MQ4SDSUYZvBWERF4qePFfk2MdYqwS8/oKv6CAJhg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789580091; c=relaxed/simple; bh=O4fQFptbwIWGrP3i51so22Moy8UsJAxa2WB25LmlnH0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=FODodj/6Z9cRsz5VQRhZlW4WWou6u8pzT8oZqYriT/YHa/uMUiYBFI9hztwhpP9vyWvAnyaXmuIyd+CQszOkBCKx8Lf/5VmTQcRo/Kzi9zfELHb7bAtPYs3ClMXf+CG8gRQXBHq1UDrqqg3wNw2f95v7qWT9OOyGm1+jTtlc7v8= 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=WjakcTaJ; arc=none smtp.client-ip=74.125.225.141 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="WjakcTaJ" Received: by mail-wm2-f13.google.com with SMTP id 5b1f17b1804b1-49e79a408deso6408995e9.2 for ; Wed, 16 Sep 2026 10:34:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1789580076; x=1790184876; 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=b//GgrHPthUrwrYixVrlFYT/x+uXt+xKgBiSW3+vKf4=; b=WjakcTaJvDEo/tboaKFdS/cl9UWHlASfpBtfKZ2v/EmgDeCmOpisQSX48nh5ssgl/3 Sboh6dMEBy3CHONGqvXLqL3PW14/XuWDlc2KAXStseUXqrGTH69hESqvLU/fmJpZgQcl 0fH6GCGFr5pm/BNqEIuSykBmX/e7eQIwLXwpa5w2Wxp6tBRFOjKUBiSPggl3GNvLHfTm 77MiTYzQcJktCzMEL7dEDm21FrRIFTAbUmuo5r6xQ9h8OeBHhBtHFFVhnQZb5Sckkm4Q 5TIxsHur4ORMPxrzbfD8qHwkRYmuU4sqVsDE3eoRaDumeaArLtSCTub1d520DV+Z3WJb 1eVA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1789580076; x=1790184876; 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=b//GgrHPthUrwrYixVrlFYT/x+uXt+xKgBiSW3+vKf4=; b=wBvZWffeTNELXtPDm5NiKfA5Fz7wAjDmMycV4+5kS+Ubx0kdmWPBXlhskZuQFSPxMJ GKMrkvTyd9Uo9HsJtxTXgEU5+ks/G4Chk69VINbiXG8bI581OmzPsra4hxeuIMGae24H U5SbeccjVPpTNquZBLotk34DoFttNMMTcn5GXkfzK98101vgKcytGPSljvJ0SC0gU4gz iEiE+Q7DUH4myBnwmFjj8YQqdjjlFliZPGuNYYxSr7xxqDmYeF3quvmDWTTWFUnXvK11 x9AS5LA22nYtLz3qmicS1Gt5+5TMDu46yllrtnOFlrDh8pAy6t1rbPCnU8KQ7gioqnbF I0tA== X-Forwarded-Encrypted: i=1; AKwUvBwHZCs87tAcLUFYGLUiUem2bKmhbg7bUGizxojGVszwKdlRa3hBQTfhyxOttSqBcTGdytJE+/PV6w4d1gg=@vger.kernel.org X-Gm-Message-State: AFuF++kBs/jSBhq0R2z5AzvWr+SDbzCyYnNYt4FvcgUrHXQEipsyELop PF/XvbtX43yv9lIxSjPq1ptKb+a1FZSu2NKj+96J0dueP7RfM5wB3/0= X-Gm-Gg: AYBFou3vQ7IV0kbwoBOclwq0ahg7/aw0+h03xbW3/TWb3+zq+wNtSc30ifaer+JU/nE zqFFC2Vsb1rQtColrLvnLMeOVxs+gb68krGG3ByaG8zxIR6UdvlHTA6a1831g27jHWHUDTwZT7O Tg+4ZRvOI77nYi1n0Il5s30BON+v6tz7qlR6zBkb8KtnNW0v7S7nY1zw2a8nCOeCSuSdbyLEuxy egO/kFtKh9po/UYKgm7YMc/rGuzACI8hEbrDonYhTkRC6jz6FDxymUvPa0PhlKP6IAZ7y5EDmQV F1nVysBCFqZd6nCBnC9rG80ewKVQ9x7X1IDVOThRTbsDPEMxvI3vwwOIYL/ilGNkqJaNDxuFg1G ABX/fC11oDJiau3StXxwfFKFLBoFJ7qeU57U8tmFynOqaeLrOetJoPuW9ilG77+Jt4Ld2MZT3hj XNof8aNamTDOnfNxUiChLvUVsUXwFkNW8vluNgHyJpt7nktv5FYq6ke84+//JTdm0vWLx/IkVC4 U7q38g4bL+0F0+qbkkykrQxBnOXw/9Adzw0GZyNxQSlbIyxcC5m3KNnH9cMS1B/gTj7dK8AGHb/ ESFnpue7B5LMhdg= X-Received: by 2002:a05:600c:1909:b0:49e:715e:ec1f with SMTP id 5b1f17b1804b1-49eb7339c99mr38436865e9.30.1789580076159; Wed, 16 Sep 2026 10:34:36 -0700 (PDT) Received: from nn ([2001:1ab8:1003:0:f23c:f0c3:c09d:d6d6]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-4870bf27ce2sm8987544f8f.20.2026.09.16.10.34.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Sep 2026 10:34: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?= Cc: linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org, "John W . Linville" , Simon Wunderlich , Oleksij Rempel , Kalle Valo , Jeff Johnson , stable@vger.kernel.org Subject: [PATCH ath-next v4 2/8] wifi: ath9k_htc: fix the byte count of a full RMW buffer flush Date: Wed, 16 Sep 2026 20:34:23 +0300 Message-ID: <20260916173429.403889-3-nerijus.bendziunas@gmail.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260916173429.403889-1-nerijus.bendziunas@gmail.com> References: <20260916173429.403889-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_reg_rmw_buffer() sizes a full-buffer flush with sizeof(struct register_write), 8 bytes, instead of sizeof(struct register_rmw), 12 bytes. ar9271_hw_pa_cal() queues exactly 15 read-modify-writes, so the AR9271 PA calibration has been losing its last five writes since the buffer was added. The corrected command is 192 bytes, three full 64-byte USB packets, and the firmware ends a command only on a short packet, so the device stops answering WMI on the first interface open. Send the whole buffer on a full flush and cap it at 14 entries; 15 is the only count within the buffer's reach that fills whole packets. Fixes: 8badb50cfab6 ("ath9k_htc: add new WMI_REG_RMW_CMDID command") Cc: stable@vger.kernel.org Assisted-by: LLM Signed-off-by: Nerijus Bend=C5=BEi=C5=ABnas --- drivers/net/wireless/ath/ath9k/htc_drv_init.c | 2 +- drivers/net/wireless/ath/ath9k/wmi.h | 2 +- 2 files changed, 2 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 3798d3375158..2d9c14006972 100644 --- a/drivers/net/wireless/ath/ath9k/htc_drv_init.c +++ b/drivers/net/wireless/ath/ath9k/htc_drv_init.c @@ -408,7 +408,7 @@ static void ath9k_reg_rmw_buffer(void *hw_priv, if (priv->wmi->multi_rmw_idx =3D=3D MAX_RMW_CMD_NUMBER) { r =3D ath9k_wmi_cmd(priv->wmi, WMI_REG_RMW_CMDID, (u8 *) &priv->wmi->multi_rmw, - sizeof(struct register_write) * priv->wmi->multi_rmw_idx, + sizeof(priv->wmi->multi_rmw), (u8 *) &rsp_status, sizeof(rsp_status), 100); if (unlikely(r)) { diff --git a/drivers/net/wireless/ath/ath9k/wmi.h b/drivers/net/wireless/at= h/ath9k/wmi.h index 5c3b710b8f31..f9c0fe54a884 100644 --- a/drivers/net/wireless/ath/ath9k/wmi.h +++ b/drivers/net/wireless/ath/ath9k/wmi.h @@ -126,7 +126,7 @@ enum wmi_event_id { }; =20 #define MAX_CMD_NUMBER 62 -#define MAX_RMW_CMD_NUMBER 15 +#define MAX_RMW_CMD_NUMBER 14 =20 struct register_write { __be32 reg; --=20 2.55.0 From nobody Fri Sep 25 04:43:45 2026 Received: from mail-wr2-f12.google.com (mail-wr2-f12.google.com [74.125.225.76]) (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 304254D9554 for ; Wed, 16 Sep 2026 17:34:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.225.76 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789580100; cv=none; b=kkipDiOF3f7cLFbttUWTcPxe683OUNnesXalNPgBtw1RVogspH9nuoL+VbNCGpKwJMjA3xUTsLYU3AUvbaaYZLJgWlxKndLBZPSADjpWjfL6W2g9BJvrXBHWCiKH2Anz1UQ1M+NJsY8KwUHPE7ZfXoixJAXqRN/F/kTNkLmhESM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789580100; c=relaxed/simple; bh=pbWiPxiQInKuj5bTFtORq9m72QKi4BBFkW3huAQwTGs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=ZXWA+ptBd98mcWqm7BBti2gRDHwF9OicE/KNABSoHJHvVUVSTr9BrodHqJm13gOF/yMTJPBaPL98qUfrFh8QcB/VuVHyM5BeAfotcIueEQdMXFk5m3mzoCm2gFu9ZjzCxGMNbLJhltqOSMFc1XVYpqERjR6aHlgZvp5R8O90TKw= 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=X+jigOvX; arc=none smtp.client-ip=74.125.225.76 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="X+jigOvX" Received: by mail-wr2-f12.google.com with SMTP id ffacd0b85a97d-4843378fb37so513478f8f.3 for ; Wed, 16 Sep 2026 10:34:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1789580077; x=1790184877; 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=TP9Q4QkeKPg/kRB9zan/QUnpnRo0dK+31LaOT3R+N7Y=; b=X+jigOvXb844rOIp9scXQCgpo2sYfoGdYGKyoBITcAaSxkqNBmIhgbKckmNFeldTRf uH8IvjsqxgxJ4kHelFL9HDOqZT7xFGpLlEFLnJodlCTd6Yy33Wa5OD+DqyV59VxD+FzA 0HtyRpkNHrQdvKE4y17u7K9iMIH6ChwWpYaYkPG0wiiHQCHiMiFyBO86RdoxDWNFoM2L MIPLH3JeJrFqU9fR6pVBUbbluYHIPq2rMBzveycCCxjryRQHUyf9e+G1ZLuYilzceDF2 WwAwVfDDFlfeC0s2su0eehePEi/XzLYhZwpM1u1iG3n8UBzD5Nv4n/beVTwtGM/vByj3 osnQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1789580077; x=1790184877; 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=TP9Q4QkeKPg/kRB9zan/QUnpnRo0dK+31LaOT3R+N7Y=; b=FRRmYphpQh1DspBJTeJ4VXonEBccroeSG6l+l89fS/bh+reCjtb6CZgRas6EQLK2GY kUGUI5h3SWtLxPvtlTftbDciFcoUe97sJ8SfgMtjUIuaj4wLWBCItPepW08garUeCsRx MaxknXFOXawVshPhkli6AaDH8gw3jPf/rERXM+tr+jV4sxBNyATXRxZldx2qWY6PqU1P DPWdHlBzV1i6ruddVjlYxOAGGFwDcHSSBlEG4DwPp0wEgMeLPiMZqjd3CkrYM3ulkmC2 zwY6matFC1Px3HorUKUwWCOaD3ObVrwoAtRMQB2Dgdea7idbKDRUiM2CxwWqO/fJ8m0S V5lg== X-Forwarded-Encrypted: i=1; AKwUvByH/spYYXgpC3BgcXiWrsHZqlD4mDDA9PxhGIPf5Y6/E59x31m4sjnM0L+0EWrsr0TrK11g7D/72IwkYdY=@vger.kernel.org X-Gm-Message-State: AFuF++mCjWr/6zbSKhSU6jOnL4EKXqqOV7OK6KA6r/z4pD9e558cqkFA NcdyHZNYTTi014uH9K0V3sxyll5hQ3rsUf2uTMyzCvIFO2sg5p0FCmI= X-Gm-Gg: AYBFou3tSMZ2pWR5BTzetugjpe1jZcBwke2UoisZ5GPz70qv5CcKB83Wo+cZJ9w3ZNT hgaAKIf7XbyEDmwOGoFWtpJXJ/kz6B2scasNCq7/6AFTXgIfQk4qw8mq5j9Prqw6uKIqFmAoSDJ rizp5POrRf5t1UCh5Ty3HyFpnQb6k+tnoc77tAEwHJJSbC11Eo1FVrhG0hnLMOlfUGN3gefgSS1 9SzsMbIzFSoeJiUmpIH1h81V+cPp9phiHxGtcFkheMtARooK/ksUoo0MOosFq5BqtYzib/E2EFz KnDw2/1aPaOESrI4yTqxYYPdwOCg8mMdPAfEttr88Nvxn6pheXzJkguxY1rzxteDucH+RIhzpaM OhwtK0r3iYgaELNrBGUafqF4TdqDXQQSJF3WgKCE9I4A7nw20ThXCUvti54CvfQBs/F3fZIOSyH OIh/1u1feLR8Fpu4K4Jxe00E6v29MIyuIph9EasnT+zMol7bQ8X11vcOw1M1mPI/tDJ35wq/tX+ Z+u3sVueEPNP4SWygGA3KavZVPnphE5q3mZkkFB3YR48RBShsNWFcW2CRqhPRbL/N13gXRNiIYH P7GjoGLWqdZjSP8= X-Received: by 2002:a05:600c:3e0a:b0:49d:39:90ba with SMTP id 5b1f17b1804b1-49eac46392fmr43178425e9.3.1789580077291; Wed, 16 Sep 2026 10:34:37 -0700 (PDT) Received: from nn ([2001:1ab8:1003:0:f23c:f0c3:c09d:d6d6]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-4870bf27ce2sm8987544f8f.20.2026.09.16.10.34.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Sep 2026 10:34:36 -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?= Cc: linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org, "John W . Linville" , Simon Wunderlich , Oleksij Rempel , Kalle Valo , Jeff Johnson , stable@vger.kernel.org Subject: [PATCH ath-next v4 3/8] wifi: ath9k_htc: refuse a command that fills whole USB packets Date: Wed, 16 Sep 2026 20:34:24 +0300 Message-ID: <20260916173429.403889-4-nerijus.bendziunas@gmail.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260916173429.403889-1-nerijus.bendziunas@gmail.com> References: <20260916173429.403889-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 The firmware ends a command on the interrupt OUT endpoint only on a short packet, so a command whose length is a multiple of the packet size is never delivered and the device stops answering WMI. The previous patch removes the one such command; nothing prevents the next. Refuse such a command in hif_usb_send_regout(), where the packet size is known, with a warning. Assisted-by: LLM Signed-off-by: Nerijus Bend=C5=BEi=C5=ABnas --- drivers/net/wireless/ath/ath9k/hif_usb.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/net/wireless/ath/ath9k/hif_usb.c b/drivers/net/wireles= s/ath/ath9k/hif_usb.c index d3491ff08e6e..4b57cc2f3d6c 100644 --- a/drivers/net/wireless/ath/ath9k/hif_usb.c +++ b/drivers/net/wireless/ath/ath9k/hif_usb.c @@ -99,10 +99,17 @@ static void hif_usb_regout_cb(struct urb *urb) static int hif_usb_send_regout(struct hif_device_usb *hif_dev, struct sk_buff *skb) { + u16 maxpacket =3D usb_maxpacket(hif_dev->udev, + usb_sndintpipe(hif_dev->udev, + USB_REG_OUT_PIPE)); struct urb *urb; struct cmd_buf *cmd; int ret =3D 0; =20 + if (WARN_ONCE(maxpacket && skb->len % maxpacket =3D=3D 0, + "%u-byte command fills whole USB packets\n", skb->len)) + return -EMSGSIZE; + urb =3D usb_alloc_urb(0, GFP_KERNEL); if (urb =3D=3D NULL) return -ENOMEM; --=20 2.55.0 From nobody Fri Sep 25 04:43:45 2026 Received: from mail-wr2-f30.google.com (mail-wr2-f30.google.com [74.125.225.94]) (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 544954D6C5D for ; Wed, 16 Sep 2026 17:34:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.225.94 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789580089; cv=none; b=jq5ULMg+vke6Zdf1LiO0goOBaZ4kkJvRGm3UQyYzH1m3ylQraL9p6HRicuvnA5/8KHymq+xmmA05P8Ltqd3xoXgoxhkWy/2K+FeUKFBhlj+aYX6rHeiSrM3EhHJk23f+YPJbT0wyANd+unZJrbYuiN33/zMqWkcgQrdQ0adYP4E= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789580089; c=relaxed/simple; bh=DbTuwqjf85854fenTtyIPM+vsibM6VyN2XhXfAJ4Lkk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=pKfSgK1k1mGRMlOwmNdk+2mSgLOIVGaWpubHnD+Bntm+peMggfQ8hvmeQzklIGdEilLzbzhTT+RIXD6CE3NdRBu94hOLXH2OAivTFsJZBtAX8eVAVd/iCsPWIh7JRQ1bu8WQNrmANkLaxcHYDd+kRH5P9jfbvbSSLKhqLcNDWnc= 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=L4aWH/B5; arc=none smtp.client-ip=74.125.225.94 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="L4aWH/B5" Received: by mail-wr2-f30.google.com with SMTP id ffacd0b85a97d-48439feca17so858460f8f.1 for ; Wed, 16 Sep 2026 10:34:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1789580078; x=1790184878; 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=ROTRY7hKYrz3TsSfE8T23LGWXQ6PydcyjAIm+qUiZis=; b=L4aWH/B5/Ed1NWRE+Ijt3SKX0qX+rkQA5qMTLm3zhIaM+UtHEpSe5lZUzHghelX+p+ sJHEU7FC5jxkmn2p5fsLLDIi31RPKT1BS5nx42KMvT9eWxNOnCVJY9roeAHr0snr4yk1 8WnWsaRw6ITCIHTiPvwQr6+sdSi5e1/S3m24FOx6KjuNEoBNeCadAEefvHsRvfK8p6Ho 8NQLqjco0oWL8GwpKQwNvjzpSIwv9y4VHDSlzvj0jVOLH10AA5MuQOxQTREkkIxYB0W2 MTR47RUQBwNKPs+36nZ53HFDsLkRKJHbL28pTq/gu6TPI02rRaOXqQ/q9nYHYIZ7X5LB bXhw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1789580078; x=1790184878; 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=ROTRY7hKYrz3TsSfE8T23LGWXQ6PydcyjAIm+qUiZis=; b=zlVYxu+1wSPNmSt2RUDDNXjPScC2HombN7la0AbXeXVqa7r44Iiek192TavpglCcm6 VCvabZ//lbS7TwzS0FixA5RSAZddVfvsJxJV19N68eSTQsfqmddP4AHZpZjWy3Xf2Y9B atZUm3uYQCr8L/WRfiaPrzu/SnLiULEpz26sote6l9DM7yi+AQdjMnE6ZSXjNcSoYmOK gy+qRGbc7IHq1+G/8N8WsF7DiNlCP+Z2phZyI+s9xGNa/6A15TJKTeTgjv2nJBSIXSGz dpbELLZa6JIwetVXRxUFZVMZapOkTNBK7dx2srAyolx6HeWgl5fhtK+MPJXF8Yd/1T/7 VIDw== X-Forwarded-Encrypted: i=1; AKwUvBykknMf5ecEx9rnXaN3XgOre+v4u0IkImlGq/DMTOkOvzjZj+Cb6i1Y2vlDgid3EnobVCLwhpFropvXeDA=@vger.kernel.org X-Gm-Message-State: AFuF++mZg3HL2B72M3GShstA4xe+6SqBuGBZ/Y0iu42deQ9Gn003d4q3 A7YRjh2subJat0OHX6HkqROExoK86m+xp8J99w54oOnfB//ZCSjgJdY= X-Gm-Gg: AYBFou1xb94e49rIeubNxiQFSZsS4zHmfjm/iGAu/KhPmmlqB1Uzhvg3a/5y9Qjfj/a pN4sWgBL7OD5Wr3S1mvHpPp5YXJn7eqWndBuTNkZGyDeTYXrL2WP9eMKeNCZygAQLMwiuxiPB0x 26uNgvXuHZQQKOkkUPonpNpbvWwH4DV8Ct7xb8nIBrz07IuabfbBP+GAIymb9YfrnVHO7qC3vVF yIK2HpbckhtDzhceIdwcJMmKG+wsHYlpZgaM0mvqBJqJ7LJB+e+kqbhdq61foFzlOOaH0D+IvBt /4ayoY1qeYmfOmkMGXWu5NCxCZDgsdWVdQRXaAvWstrQENnGAYgQwlp8w4v9YXT5vdTDAuqafnJ Y9At+8pi2+whoK04BGr8NY1UxK+T2jdT2dHhymynUGmc1/bxgxYdnZ1fY82WaZNEi+iTLIwLiB7 R+GwsPHQuXedpnckyxiYjaNsKAqFtoehFZcRbsX2QCDWZds0Ztm56WUMVmIeTR8HDlaM1rV4k1S pZXHkJcvQFXVCXPE+vTfeVtwgB+yv6nTkG03Ct3/zggEc3PxDZWeHSLMAAC/Bv3eMZ8Vm+WEUNu t046/CtF/30faWYp X-Received: by 2002:a05:6000:41cd:b0:487:72f:fbe0 with SMTP id ffacd0b85a97d-4870d0666c3mr4743641f8f.35.1789580078373; Wed, 16 Sep 2026 10:34:38 -0700 (PDT) Received: from nn ([2001:1ab8:1003:0:f23c:f0c3:c09d:d6d6]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-4870bf27ce2sm8987544f8f.20.2026.09.16.10.34.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Sep 2026 10:34: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?= Cc: linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org, "John W . Linville" , Simon Wunderlich , Oleksij Rempel , Kalle Valo , Jeff Johnson , stable@vger.kernel.org Subject: [PATCH ath-next v4 4/8] wifi: ath9k: stop a failed register read from opening the RX filter Date: Wed, 16 Sep 2026 20:34:25 +0300 Message-ID: <20260916173429.403889-5-nerijus.bendziunas@gmail.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260916173429.403889-1-nerijus.bendziunas@gmail.com> References: <20260916173429.403889-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 On USB a register read is a WMI round trip and a timeout returns -1. The spectral trigger reads AR_RX_FILTER back, ORs in the PHY error bits and writes it, so a timed-out read stores 0xffffffff and the device forwards every frame and PHY error to the host. Add ath9k_hw_enable_rxfilter(), which sets the requested bits with REG_SET_BIT() instead of reading the register from the driver, and use it in the trigger. With firmware 1.4 and later the read-modify-write is done by the firmware; older firmware still reads from the host. Fixes: e93d083f42a1 ("ath9k: add spectral scan feature") Cc: stable@vger.kernel.org Assisted-by: LLM Signed-off-by: Nerijus Bend=C5=BEi=C5=ABnas --- .../net/wireless/ath/ath9k/common-spectral.c | 7 ++---- drivers/net/wireless/ath/ath9k/hw.c | 23 +++++++++++++++++++ drivers/net/wireless/ath/ath9k/hw.h | 1 + 3 files changed, 26 insertions(+), 5 deletions(-) diff --git a/drivers/net/wireless/ath/ath9k/common-spectral.c b/drivers/net= /wireless/ath/ath9k/common-spectral.c index ca01a07f6630..73c1eb4ebe0e 100644 --- a/drivers/net/wireless/ath/ath9k/common-spectral.c +++ b/drivers/net/wireless/ath/ath9k/common-spectral.c @@ -716,7 +716,6 @@ void ath9k_cmn_spectral_scan_trigger(struct ath_common = *common, struct ath_spec_scan_priv *spec_priv) { struct ath_hw *ah =3D spec_priv->ah; - u32 rxfilter; =20 if (IS_ENABLED(CONFIG_ATH9K_TX99)) return; @@ -730,10 +729,8 @@ void ath9k_cmn_spectral_scan_trigger(struct ath_common= *common, return; =20 ath_ps_ops(common)->wakeup(common); - rxfilter =3D ath9k_hw_getrxfilter(ah); - ath9k_hw_setrxfilter(ah, rxfilter | - ATH9K_RX_FILTER_PHYRADAR | - ATH9K_RX_FILTER_PHYERR); + ath9k_hw_enable_rxfilter(ah, ATH9K_RX_FILTER_PHYRADAR | + ATH9K_RX_FILTER_PHYERR); =20 /* TODO: usually this should not be necessary, but for some reason * (or in some mode?) the trigger must be called after the diff --git a/drivers/net/wireless/ath/ath9k/hw.c b/drivers/net/wireless/ath= /ath9k/hw.c index e08ab73fcacb..7cafd6c5870f 100644 --- a/drivers/net/wireless/ath/ath9k/hw.c +++ b/drivers/net/wireless/ath/ath9k/hw.c @@ -2905,6 +2905,29 @@ void ath9k_hw_setrxfilter(struct ath_hw *ah, u32 bit= s) } EXPORT_SYMBOL(ath9k_hw_setrxfilter); =20 +/** + * ath9k_hw_enable_rxfilter() - set RX filter bits without a driver-side r= ead + * @ah: the atheros hardware data structure + * @bits: ATH9K_RX_FILTER_* bits to set + */ +void ath9k_hw_enable_rxfilter(struct ath_hw *ah, u32 bits) +{ + u32 phybits =3D 0; + + if (bits & ATH9K_RX_FILTER_PHYRADAR) + phybits |=3D AR_PHY_ERR_RADAR; + if (bits & ATH9K_RX_FILTER_PHYERR) + phybits |=3D AR_PHY_ERR_OFDM_TIMING | AR_PHY_ERR_CCK_TIMING; + + REG_SET_BIT(ah, AR_RX_FILTER, bits); + + if (phybits) { + REG_SET_BIT(ah, AR_PHY_ERR, phybits); + REG_SET_BIT(ah, AR_RXCFG, AR_RXCFG_ZLFDMA); + } +} +EXPORT_SYMBOL(ath9k_hw_enable_rxfilter); + bool ath9k_hw_phy_disable(struct ath_hw *ah) { if (ath9k_hw_mci_is_enabled(ah)) diff --git a/drivers/net/wireless/ath/ath9k/hw.h b/drivers/net/wireless/ath= /ath9k/hw.h index b942b8303d8f..f102f73a0114 100644 --- a/drivers/net/wireless/ath/ath9k/hw.h +++ b/drivers/net/wireless/ath/ath9k/hw.h @@ -1055,6 +1055,7 @@ void ath9k_hw_get_channel_centers(struct ath_hw *ah, struct chan_centers *centers); u32 ath9k_hw_getrxfilter(struct ath_hw *ah); void ath9k_hw_setrxfilter(struct ath_hw *ah, u32 bits); +void ath9k_hw_enable_rxfilter(struct ath_hw *ah, u32 bits); bool ath9k_hw_phy_disable(struct ath_hw *ah); bool ath9k_hw_disable(struct ath_hw *ah); void ath9k_hw_set_txpowerlimit(struct ath_hw *ah, u32 limit, bool test); --=20 2.55.0 From nobody Fri Sep 25 04:43:45 2026 Received: from mail-wr2-f12.google.com (mail-wr2-f12.google.com [74.125.225.76]) (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 46DE04D9556 for ; Wed, 16 Sep 2026 17:34:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.225.76 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789580093; cv=none; b=c6hY4+TyJBzuGaYocM+j9dsUXJRwAouBW+DADTawlNE0nRobbDH0jv0yOShow+/5Atjp5kCWxvG9tu/3ZbSeIx0HT0h5iSpCka4PK30NZ+A1i4rGiHa77gmbqO6TgEG3UeFxG96vOzFxqv76OsFmznhYwTdyrJ0hpLXEkGmMSgc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789580093; c=relaxed/simple; bh=ghaLQhsjErRuw7z0EbmTWSMQtRPaLPRGjjmIhiMeksM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=f9uKK2LkAUSKcnD0Yq0qFboW5K46+UUEXwrdEgL3/YbEsUADlYzQ27nykG5w084eCyz/MRuHqFbPJZN1vCMUjcKTbCRgVbAlrsEQl1CHa6No2e91psTs7S5CT+l2Pf+ZOsBLomCPBGTWtcXXwWnZnmnQhs7+/im+OCOFSxGO6aQ= 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=YvGRz5r4; arc=none smtp.client-ip=74.125.225.76 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="YvGRz5r4" Received: by mail-wr2-f12.google.com with SMTP id ffacd0b85a97d-482f63546c3so883920f8f.1 for ; Wed, 16 Sep 2026 10:34:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1789580080; x=1790184880; 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=w65kxI0NVO+6JXj4YPaYmqJGny/IamxZxDoeb93T3ro=; b=YvGRz5r4skKFjGn+VPbLzIIJHKluXbJn8oeVovguT6l160/YI+S372+BL1ZWluNCsF Dl8Jn0Z/NQV/Fd7hMnuoGfy7rNi2ueoZWk67NTGajFxa/ZuPBzKysCuavDA6jANDdy9g YzfflkCnIKQ8FW0byjMQCHTRW/BoVXv8/7npmyEyeSxM1nidHa//ploxa3U2Y4hJmkno TCK+B1r9sxmFvhjvuQwtH3vGTQPDdyet0ClQlTZjEbMcli+XmRdy+rs1PVXRMl8/7MSl hkIo0saWuTfLWejxjAgWRV5PakFPQ10Im3CxPJSZ3/ILN/GkXFIjhnJzwP8telP6V4Ke 5HBQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1789580080; x=1790184880; 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=w65kxI0NVO+6JXj4YPaYmqJGny/IamxZxDoeb93T3ro=; b=1hcqCEcF9rOD3sacibIhrcisCPb8pDCJXfeqSYq25+R9+cWIviEhob1AxhL5hFiPk1 1gEyxNf+pXH+tI09yHFKYvN7n3aY7d9Lvt83H4JZRzGqqbJoAjiWPWDXMHNNv6p2UvnG eBJVrYwVd5yxlF6reZawSTwAfjazcr98XYbvHlZdwdZI2inzAu6PqilcTFX3lZRh+Yju cImzGErHtxHjddX+lKPzIC3yupBDoY6uRbdWrKrdCU4jpm3Yx2S1gQiR6VLCjyEDxxRN DNO0QyTZrZQPzD1x0XssFNSQQJ18hkiA7vuvJg1kSJsrMH2RIUjUrCBHbfGFIQLpBFQr LSrA== X-Forwarded-Encrypted: i=1; AKwUvByvS6pUiQmJ7HTuqjB6HmqSgNUQwoylBqN8EDil1uT6emRaYWrqnMRmm5qv7i6iqpCqHMMmfzMzW6CHO1A=@vger.kernel.org X-Gm-Message-State: AFuF++nZChttP9OVN09zFSpcovQdemN8RpBrV1dwEkA3snH5G0nIq7k0 FRULjL78MH6G98QwgMO39sTDX4s7P9Wf47BE+k5tEH23PtwOGMlrPGo= X-Gm-Gg: AYBFou1MMtSKYZfAQ6KWE2SoibwrDVlDP+u2BXYbVhB8vPd0BatgyqW2IYDd//xO4s4 9v9tUl27IbwNSSa5UnRpd3TxWa5ScxMpOHFYHv5/ElvDbJVoS9Df3ih5ud6f814sDsJPG/3LvCw n7rSJBYISUNteDnONBdK7gSnuA4C/oC7YNYGfGKiRHx7DZD5QDfjll43jXoCYkBU+OlsZthSPfK c7CYIgjdH917YcicVhL8RjBY4kb7SeWnrCV1rCKUZfK2w/A9cxe3wglqIdyFGNLWptUnoiP5lje siDGuuQ2UnuImxZqvQuxjRdikF5YhdZSGVR0mE51H+LfOHD7en/+Wntsica4YwdQfDPziLXmz59 8ghsJR/+FTK+wH/qUmBPG+LxJoXSdTko/OAbtfVS8fv7lBEefOnZutP054zcAyDIKHOcOlED9z/ Mbkt7PwmcnXDjmo19iDFr643RL0lu9435UR8vRoXhJDDUzjfmBQ7OUSyNrrtXbdMJFNjdhh8pPb QlHydWYDkWveCIB39U4BzAXe2S8Ut8DCcPM1gci1I4IjM1sCbF3WHpEdEawUuBa7Zm2u1iSf07W tZxbPbj89TKP4gmq X-Received: by 2002:a05:6000:4b1c:b0:487:c99:8bec with SMTP id ffacd0b85a97d-4870cf0a430mr4310836f8f.3.1789580079562; Wed, 16 Sep 2026 10:34:39 -0700 (PDT) Received: from nn ([2001:1ab8:1003:0:f23c:f0c3:c09d:d6d6]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-4870bf27ce2sm8987544f8f.20.2026.09.16.10.34.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Sep 2026 10:34: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?= Cc: linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org, "John W . Linville" , Simon Wunderlich , Oleksij Rempel , Kalle Valo , Jeff Johnson , stable@vger.kernel.org Subject: [PATCH ath-next v4 5/8] wifi: ath9k: clear the PHY error filter when a spectral scan is disabled Date: Wed, 16 Sep 2026 20:34:26 +0300 Message-ID: <20260916173429.403889-6-nerijus.bendziunas@gmail.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260916173429.403889-1-nerijus.bendziunas@gmail.com> References: <20260916173429.403889-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 Triggering a spectral scan sets the PHY error bits in AR_RX_FILTER and AR_PHY_ERR and sets AR_RXCFG_ZLFDMA; disabling it clears none of them. ath9k_htc carries the hardware bits into every later filter update, so an idle device keeps forwarding every PHY error as a zero-length frame. Clear all three when the scan is disabled, unless radar detection is enabled and needs the same bits. AR_RXCFG_ZLFDMA must go too, or the frames keep coming. Fixes: e93d083f42a1 ("ath9k: add spectral scan feature") Cc: stable@vger.kernel.org Assisted-by: LLM Signed-off-by: Nerijus Bend=C5=BEi=C5=ABnas --- .../net/wireless/ath/ath9k/common-spectral.c | 5 ++++ drivers/net/wireless/ath/ath9k/hw.c | 23 +++++++++++++++++++ drivers/net/wireless/ath/ath9k/hw.h | 1 + 3 files changed, 29 insertions(+) diff --git a/drivers/net/wireless/ath/ath9k/common-spectral.c b/drivers/net= /wireless/ath/ath9k/common-spectral.c index 73c1eb4ebe0e..24000d5b2a6f 100644 --- a/drivers/net/wireless/ath/ath9k/common-spectral.c +++ b/drivers/net/wireless/ath/ath9k/common-spectral.c @@ -776,6 +776,11 @@ int ath9k_cmn_spectral_scan_config(struct ath_common *= common, =20 ath_ps_ops(common)->wakeup(common); ath9k_hw_ops(ah)->spectral_scan_config(ah, &spec_priv->spec_config); + + if (spectral_mode =3D=3D SPECTRAL_DISABLED && + !common->hw->conf.radar_enabled) + ath9k_hw_disable_rxfilter(ah, ATH9K_RX_FILTER_PHYRADAR | + ATH9K_RX_FILTER_PHYERR); ath_ps_ops(common)->restore(common); =20 spec_priv->spectral_mode =3D spectral_mode; diff --git a/drivers/net/wireless/ath/ath9k/hw.c b/drivers/net/wireless/ath= /ath9k/hw.c index 7cafd6c5870f..b8f3a8afaeb3 100644 --- a/drivers/net/wireless/ath/ath9k/hw.c +++ b/drivers/net/wireless/ath/ath9k/hw.c @@ -2928,6 +2928,29 @@ void ath9k_hw_enable_rxfilter(struct ath_hw *ah, u32= bits) } EXPORT_SYMBOL(ath9k_hw_enable_rxfilter); =20 +/** + * ath9k_hw_disable_rxfilter() - clear RX filter bits without a driver-sid= e read + * @ah: the atheros hardware data structure + * @bits: ATH9K_RX_FILTER_* bits to clear + */ +void ath9k_hw_disable_rxfilter(struct ath_hw *ah, u32 bits) +{ + u32 phybits =3D 0; + + if (bits & ATH9K_RX_FILTER_PHYRADAR) + phybits |=3D AR_PHY_ERR_RADAR; + if (bits & ATH9K_RX_FILTER_PHYERR) + phybits |=3D AR_PHY_ERR_OFDM_TIMING | AR_PHY_ERR_CCK_TIMING; + + REG_CLR_BIT(ah, AR_RX_FILTER, bits); + + if (phybits) { + REG_CLR_BIT(ah, AR_PHY_ERR, phybits); + REG_CLR_BIT(ah, AR_RXCFG, AR_RXCFG_ZLFDMA); + } +} +EXPORT_SYMBOL(ath9k_hw_disable_rxfilter); + bool ath9k_hw_phy_disable(struct ath_hw *ah) { if (ath9k_hw_mci_is_enabled(ah)) diff --git a/drivers/net/wireless/ath/ath9k/hw.h b/drivers/net/wireless/ath= /ath9k/hw.h index f102f73a0114..983146208f26 100644 --- a/drivers/net/wireless/ath/ath9k/hw.h +++ b/drivers/net/wireless/ath/ath9k/hw.h @@ -1056,6 +1056,7 @@ void ath9k_hw_get_channel_centers(struct ath_hw *ah, u32 ath9k_hw_getrxfilter(struct ath_hw *ah); void ath9k_hw_setrxfilter(struct ath_hw *ah, u32 bits); void ath9k_hw_enable_rxfilter(struct ath_hw *ah, u32 bits); +void ath9k_hw_disable_rxfilter(struct ath_hw *ah, u32 bits); bool ath9k_hw_phy_disable(struct ath_hw *ah); bool ath9k_hw_disable(struct ath_hw *ah); void ath9k_hw_set_txpowerlimit(struct ath_hw *ah, u32 limit, bool test); --=20 2.55.0 From nobody Fri Sep 25 04:43:45 2026 Received: from mail-wr2-f12.google.com (mail-wr2-f12.google.com [74.125.225.76]) (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 810B637E5E2 for ; Wed, 16 Sep 2026 17:34:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.225.76 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789580095; cv=none; b=DGbsbIJTmLsmRTNrM71OQ+mFmZx7F0yi0sV/7vRsE1ARBZZiKKUt95k7uQYdTRTtIlnU5WoQr98DQ+0O7Nma1ln7SY87YBplbaEjtoR2qoLvfyEC3WFVQNddwBeZetN5ql0kIRC5tM/2E374pDhPf+KjpRU5BZqWKUNrmEe4gxA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789580095; c=relaxed/simple; bh=fSGL1mOOCyTsYa09zn/uR5Z/XbG5GF80+DVedQRCVh4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=LGGyxogVtfP9qIdZ0aMCaXl0g8K0dag2DEi5ZBB96qLTdo4rY8moX7EieGUZSxeVA0SgY9puXpCx06lhE+kwINkk3dNdEsls+hQClzGA0PjdnB/iFtw06sKT2BBEY8ZY1Ngzz3EB461gX2Rud9MsbqCO4wJHEFkYHE6E57vI36k= 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=mcFolMZ3; arc=none smtp.client-ip=74.125.225.76 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="mcFolMZ3" Received: by mail-wr2-f12.google.com with SMTP id ffacd0b85a97d-482f63546c3so883935f8f.1 for ; Wed, 16 Sep 2026 10:34:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1789580081; x=1790184881; 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=A8rQM1SCspNmiwKjpWc6vCGmypeC9LKlk/ALZbiEucg=; b=mcFolMZ3PNHbruBKUBnGOfYcwWvX2Ltd6zW7a9rfq+4Suq+C1WAai9XW4b4YC2yhwk VGz3j9l7MZDBBX8dLk6tlou4jr/nkrWvssL56dJW5F7J4KL2PN/DFuOjQnUK4zfX5Qe5 moij6/Sh0YXe3fK6aPdvb9kB7RlbPh9NgudpRKPyRDtaiDzz0S6yOU1DVvjUnxXyDqxE kjlaqXsHxpRpRQrBiFNW+NbDula84cnrdISQi1MJX4qeAhOeyq0eWHxoCv0vMTg69upb NfSkSWmovw90ppbIT9N7Cjjut3l1ZCsLtqc90mC0xkwQI6h69+AzOGL6lyaRDZXXr73i s9GA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1789580081; x=1790184881; 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=A8rQM1SCspNmiwKjpWc6vCGmypeC9LKlk/ALZbiEucg=; b=RrouesZmzoHgBlYDGHBhOIi+ETn9fi6UFr81rIN0dgNtv5fQr9dhXRz8CC85f5conm iR0B+1/aqqRsvjDp0S9ruUtyJpZjX34U5BloXYaJoWcd+hpyGsxgK0BwVqK4yQzBWY7m xDJKBUxBxTIquK1f/OqzKMk9BR65OvdOfIUQL6F3Lmq8ikgx/1pIyqSPM97706KMErfV jp/+gZsoOYBQxuRBnE6+LxLO9+0+7sEP49BbSGF/bEwA6IPJcbjuu7tsT9E3gzesT4eH tFyC9luJPaeZ1lTe7tXyEYl6aRMcIGeUDftRyAMA1TsGhjj5PJ/uSjqD0Zi1cnggrrlj l09Q== X-Forwarded-Encrypted: i=1; AKwUvBycZlQc6JDFr+9uRhEzYB1E9CX5bINspSEm/3Q7j/SkGM/Wkrya1COF1U9jWQQypX3o9ylV/1Im3g0rN78=@vger.kernel.org X-Gm-Message-State: AFuF++lJ9G/bdLQ515Hir4x5rd5LpFWcmkShZ/+HP04I+OCoA8kG5a7f I6Xe42MmjUI0yKFhQhLi0WPsKIpOu/R3FP/a/IfTxXfUKKkF9l3aRWo32BzN X-Gm-Gg: AYBFou0DmqOsnlZN1PxICA2Zqt22epipHT8MVnyoBH44U/GfhBbTD74P62k5TVnCLJY ZAQ7wJZ7q7j1IJ6iP/BgXtZUE26ynmdl6pCwYUno15EeJf0nHYZWz29CVZqTRQxg9L786XKI46M zyMkiI4Q/ttSVnd7XSBU3mTeZrmSrArbKZWf/+ghBocF9p8af4LD6QHdPDr+NocLUSOYwgl/efs CpPJf7960sk1ZdT91nG/DaM3nv0n88w2NxoWp7cArMEzVfhSIEF7nOxfyIBYgVIOG0Wi3Gc2paO /u5bO7gOAMQlkkkwivEe3zDUycZqrXPu0rQQ/MESUKfICC2v6Q0xi6bfR+BeBfB7ziwEie4I4sA ZCmydKjPApuuM1ZUEk5W3hJtf/gcTBX6Y4kBvqV+pLQEdCEEPrRcKvaUsDPQAwRpMcIYGF32qU3 75eYzAqMy7RXLi6ApJUxZNQQgf5AyJUrkVXarw9pPLfwZj79RB7FjmO8i9j7tSPtcbrOcJdQ6vR gNQaCEyzGTl6Gk8UiyiwfVB6PvxlmtmxhVz3j9/Ne6g1uu25b8q6r86x+HJ87+axNbdL6WUzO3w nq287+JKBwnXiCA= X-Received: by 2002:a05:6000:4b1c:b0:487:b44:a561 with SMTP id ffacd0b85a97d-4870cf0a3aamr4317108f8f.10.1789580080711; Wed, 16 Sep 2026 10:34:40 -0700 (PDT) Received: from nn ([2001:1ab8:1003:0:f23c:f0c3:c09d:d6d6]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-4870bf27ce2sm8987544f8f.20.2026.09.16.10.34.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Sep 2026 10:34:40 -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?= Cc: linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org, "John W . Linville" , Simon Wunderlich , Oleksij Rempel , Kalle Valo , Jeff Johnson , stable@vger.kernel.org Subject: [PATCH ath-next v4 6/8] wifi: ath9k: count spectral samples in the driver's own RX stats Date: Wed, 16 Sep 2026 20:34:27 +0300 Message-ID: <20260916173429.403889-7-nerijus.bendziunas@gmail.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260916173429.403889-1-nerijus.bendziunas@gmail.com> References: <20260916173429.403889-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 ath_cmn_process_fft() is shared by ath9k and ath9k_htc, but it casts common->priv to struct ath_softc to reach the rx_spectral_sample_good and rx_spectral_sample_err counters. On ath9k_htc common->priv is a struct ath9k_htc_priv, a much smaller structure, and with CONFIG_ATH9K_DEBUGFS the increment lands far past the end of that allocation, once per FFT sample. Store a pointer to the driver's struct ath_rx_stats in struct ath_spec_scan_priv and count through it. Both drivers pass their own stats to ath9k_cmn_spectral_init_debug(), and both print them in the shared recv debugfs file, so the two counters now also work on ath9k_htc. Without debugfs the pointer stays NULL and nothing is counted, as before. Fixes: 03224678c013 ("ath9k: add counters for good and errorneous FFT/spect= ral frames") Cc: stable@vger.kernel.org Assisted-by: LLM Signed-off-by: Nerijus Bend=C5=BEi=C5=ABnas --- .../net/wireless/ath/ath9k/common-spectral.c | 29 ++++++++++++------- .../net/wireless/ath/ath9k/common-spectral.h | 10 +++++-- drivers/net/wireless/ath/ath9k/debug.c | 3 +- .../net/wireless/ath/ath9k/htc_drv_debug.c | 3 +- 4 files changed, 31 insertions(+), 14 deletions(-) diff --git a/drivers/net/wireless/ath/ath9k/common-spectral.c b/drivers/net= /wireless/ath/ath9k/common-spectral.c index 24000d5b2a6f..44b5a5bbe74a 100644 --- a/drivers/net/wireless/ath/ath9k/common-spectral.c +++ b/drivers/net/wireless/ath/ath9k/common-spectral.c @@ -465,6 +465,20 @@ ath_cmn_is_fft_buf_full(struct ath_spec_scan_priv *spe= c_priv) return 0; } =20 +static void ath_cmn_count_fft_sample(struct ath_spec_scan_priv *spec_priv, + int ret) +{ + struct ath_rx_stats *rx_stats =3D spec_priv->rx_stats; + + if (!rx_stats) + return; + + if (ret =3D=3D 0) + rx_stats->rx_spectral_sample_good++; + else + rx_stats->rx_spectral_sample_err++; +} + /* returns 1 if this was a spectral frame, even if not handled. */ int ath_cmn_process_fft(struct ath_spec_scan_priv *spec_priv, struct ieee8= 0211_hdr *hdr, struct ath_rx_status *rs, u64 tsf) @@ -472,7 +486,6 @@ int ath_cmn_process_fft(struct ath_spec_scan_priv *spec= _priv, struct ieee80211_h u8 sample_buf[SPECTRAL_SAMPLE_MAX_LEN] =3D {0}; struct ath_hw *ah =3D spec_priv->ah; struct ath_common *common =3D ath9k_hw_common(spec_priv->ah); - struct ath_softc *sc =3D common->priv; u8 num_bins, *vdata =3D (u8 *)hdr; struct ath_radar_info *radar_info; int len =3D rs->rs_datalen; @@ -624,10 +637,7 @@ int ath_cmn_process_fft(struct ath_spec_scan_priv *spe= c_priv, struct ieee80211_h ret =3D fft_handler(rs, spec_priv, sample_buf, tsf, freq, chan_type); =20 - if (ret =3D=3D 0) - RX_STAT_INC(sc, rx_spectral_sample_good); - else - RX_STAT_INC(sc, rx_spectral_sample_err); + ath_cmn_count_fft_sample(spec_priv, ret); =20 /* Mix the received bins to the /dev/random * pool @@ -642,10 +652,7 @@ int ath_cmn_process_fft(struct ath_spec_scan_priv *spe= c_priv, struct ieee80211_h ret =3D fft_handler(rs, spec_priv, sample_start, tsf, freq, chan_type); =20 - if (ret =3D=3D 0) - RX_STAT_INC(sc, rx_spectral_sample_good); - else - RX_STAT_INC(sc, rx_spectral_sample_err); + ath_cmn_count_fft_sample(spec_priv, ret); =20 /* Mix the received bins to the /dev/random * pool @@ -1054,8 +1061,10 @@ void ath9k_cmn_spectral_deinit_debug(struct ath_spec= _scan_priv *spec_priv) EXPORT_SYMBOL(ath9k_cmn_spectral_deinit_debug); =20 void ath9k_cmn_spectral_init_debug(struct ath_spec_scan_priv *spec_priv, - struct dentry *debugfs_phy) + struct dentry *debugfs_phy, + struct ath_rx_stats *rx_stats) { + spec_priv->rx_stats =3D rx_stats; spec_priv->rfs_chan_spec_scan =3D relay_open("spectral_scan", debugfs_phy, 1024, 256, &rfs_spec_scan_cb, diff --git a/drivers/net/wireless/ath/ath9k/common-spectral.h b/drivers/net= /wireless/ath/ath9k/common-spectral.h index 011d8ab8b974..6c397b8726b9 100644 --- a/drivers/net/wireless/ath/ath9k/common-spectral.h +++ b/drivers/net/wireless/ath/ath9k/common-spectral.h @@ -94,12 +94,15 @@ struct ath_ht20_40_fft_packet { struct ath_radar_info radar_info; } __packed; =20 +struct ath_rx_stats; + struct ath_spec_scan_priv { struct ath_hw *ah; /* relay(fs) channel for spectral scan */ struct rchan *rfs_chan_spec_scan; enum spectral_mode spectral_mode; struct ath_spec_scan spec_config; + struct ath_rx_stats *rx_stats; }; =20 #define SPECTRAL_HT20_40_TOTAL_DATA_LEN (sizeof(struct ath_ht20_40_fft_pac= ket)) @@ -169,7 +172,9 @@ static inline u8 spectral_bitmap_weight(u8 *bins) } =20 #ifdef CONFIG_ATH9K_COMMON_SPECTRAL -void ath9k_cmn_spectral_init_debug(struct ath_spec_scan_priv *spec_priv, s= truct dentry *debugfs_phy); +void ath9k_cmn_spectral_init_debug(struct ath_spec_scan_priv *spec_priv, + struct dentry *debugfs_phy, + struct ath_rx_stats *rx_stats); void ath9k_cmn_spectral_deinit_debug(struct ath_spec_scan_priv *spec_priv); =20 void ath9k_cmn_spectral_scan_trigger(struct ath_common *common, @@ -181,7 +186,8 @@ int ath_cmn_process_fft(struct ath_spec_scan_priv *spec= _priv, struct ieee80211_h struct ath_rx_status *rs, u64 tsf); #else static inline void ath9k_cmn_spectral_init_debug(struct ath_spec_scan_priv= *spec_priv, - struct dentry *debugfs_phy) + struct dentry *debugfs_phy, + struct ath_rx_stats *rx_stats) { } =20 diff --git a/drivers/net/wireless/ath/ath9k/debug.c b/drivers/net/wireless/= ath/ath9k/debug.c index 74a0134075cf..042a4f542a94 100644 --- a/drivers/net/wireless/ath/ath9k/debug.c +++ b/drivers/net/wireless/ath/ath9k/debug.c @@ -1389,7 +1389,8 @@ int ath9k_init_debug(struct ath_hw *ah) =20 ath9k_dfs_init_debug(sc); ath9k_tx99_init_debug(sc); - ath9k_cmn_spectral_init_debug(&sc->spec_priv, sc->debug.debugfs_phy); + ath9k_cmn_spectral_init_debug(&sc->spec_priv, sc->debug.debugfs_phy, + &sc->debug.stats.rxstats); =20 debugfs_create_devm_seqfile(sc->dev, "dma", sc->debug.debugfs_phy, read_file_dma); diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_debug.c b/drivers/net/w= ireless/ath/ath9k/htc_drv_debug.c index 9437d69877cc..9d354b1d929c 100644 --- a/drivers/net/wireless/ath/ath9k/htc_drv_debug.c +++ b/drivers/net/wireless/ath/ath9k/htc_drv_debug.c @@ -487,7 +487,8 @@ int ath9k_htc_init_debug(struct ath_hw *ah) priv->debug.debugfs_phy =3D debugfs_create_dir(KBUILD_MODNAME, priv->hw->wiphy->debugfsdir); =20 - ath9k_cmn_spectral_init_debug(&priv->spec_priv, priv->debug.debugfs_phy); + ath9k_cmn_spectral_init_debug(&priv->spec_priv, priv->debug.debugfs_phy, + &priv->debug.rx_stats); =20 debugfs_create_file("tgt_int_stats", 0400, priv->debug.debugfs_phy, priv, &fops_tgt_int_stats); --=20 2.55.0 From nobody Fri Sep 25 04:43:45 2026 Received: from mail-wm2-f13.google.com (mail-wm2-f13.google.com [74.125.225.141]) (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 F3B1E4D9572 for ; Wed, 16 Sep 2026 17:34:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.225.141 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789580093; cv=none; b=JQ/U0gGuYd/7nhmX46l8WJJ2BHiH3o9kzowPE/jQ3D9t7bhda4AdCMMObQk19nriAjWfyfC2kwhM1+CJj4XeQwD2OdjdnU/7IOsaDGwgx2TnCzoJ2iDb/OcKWIBjhUFMxu/fkxxDa6CoY7XasOMuGuEbgXF2GBiJtne45cqLjAM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789580093; c=relaxed/simple; bh=vfPgszcrKMkOdEiihjECb4jnRWMn9BoIETfDExylycs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=hfw6Jqpcq1JPdJRkSLOpN+hHVpEQ2XQJgnljViWAgCAMZ7Mt2sDTqGQ/cx/puS/JQCdeThet8BgePag7kYn71j7/cg+fUWAup76f2NSGBQP9A7xX7DnLFgCtYWmQUODCYiqlqr3X9RcO0E7ij1qEOhH5ejc4qz2j8ZyWmsh7DWA= 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=FNAu4/xG; arc=none smtp.client-ip=74.125.225.141 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="FNAu4/xG" Received: by mail-wm2-f13.google.com with SMTP id 5b1f17b1804b1-49e721b5503so46365e9.0 for ; Wed, 16 Sep 2026 10:34:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1789580082; x=1790184882; 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=EXWmb7VjjlkNtn1q70BvaaY3UDnd0CfPKSfQaqn3n2k=; b=FNAu4/xGxulIBRs/0kFJf7a2BYLWyLH8Ui09Gy6NQYKQX/14DScyW77uLKWAVQoFIV AWwSBIlVmQvk0ac+q2HW4Ps98Wgk9thQXe64WXzkVTkRLhX/yFLx/C948BM/A7B7XZNE aTIxua+aHaERYrjHyereN+fnSN9VSSRwLrtc5Ml7NcCHBvOEmAb6AONolgw7fbBcDgAR aQB7O3kYFvZUTACTVeM7Um5OljEKpDLK2XAfPtOp394skWEN0femRjwxUx1XHGz5iZHc 6zU6I3HVVuglk3AGlcofyYtUEi3Ow5au+M3tt6GurXBLCnaTgLYA1wxyWCqmx/S4jF5h b9lQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1789580082; x=1790184882; 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=EXWmb7VjjlkNtn1q70BvaaY3UDnd0CfPKSfQaqn3n2k=; b=lNmUAbfvrcvlZimIhzKGi9MEONUyEKOIpn9EsxbzwV0b2XHxjb/c4dCDKJae+HBm+V fUuVvXo9aKUFwcb9ExOcEFR++NhThPIHZ+Nfn9/krpuI/trPbAzNErCodPnxKRoHzb1T 8LofltbuSu2ES8O9/yOMsYOzXHEJZ8AYntL2WXXr16uEOjXytk8YwRFYSIWY6q+BIYdb 3ZtoR76GbK2LlGfF2GYg2AtE2moLdYoFpug3y6MSoIChKy+BiLvmPqYrKOGpfhrJfOWC 7GjZKHLnpl1hXWLQkeJ+2tsupPEET/eXTPYHzhUNrtrKNT0mVvaFRd44+wwbYuaubL/t ZU+Q== X-Forwarded-Encrypted: i=1; AKwUvBw77c1wwMZkJjMvPgQVmbrZGpdvp+NfuU+lM77RziiB57zsoGa/tOn6f3DeeJPrakzkpy+Zw8K5vHIYX94=@vger.kernel.org X-Gm-Message-State: AFuF++kwtW29NAKeVN9haUi3sbx1TYLjzNLQF5m1Vy72zZacr+n2dhWh +bQ28NhxKZtusFKgo3gC6WVZtT462MCJ9rV38JVSo6dQ4wtjnoLq/yQNrPTj X-Gm-Gg: AYBFou1MA4Pz/73hs5IKGwux2hmo2H04o8v5SKNXhChC2pAjBxEPwg2vd3y/CaXZVD4 eu8v4E2V5NWQUvBr0zXl61uy1rB6AmZM7HX48XWeaMcDwcIcMtWpH41i3enhtfb22NsaoAxNqGA gakIS564FJbQAErH+BX2fRSOfvsLqEt9rkQ/PuwaKtUU42QSbxzktM0VZQEk8oOZTA+tn0fj6/5 A4Ge1t0e6tiDZc9Xd5LZTxzOdhNqsD47UcKU3aGrBHtfxjgDtcnu4irrK6Qcwx+eC/Eb8gIBq6B 3Ovwz4E8NV9KD1fhk+uysqaZ1U8N/nrDJj8c1qVtziSHyv45eAaObgGjGQCMSbswOlKZw8D/ocP C6x6QZ+9m4N4fHYWKk6191TYKt8CnRUh6QJeHFzpGhPW7HncWnb7HNRdtYqn1M/icxnJ7dXcAEW dIxQ9KhgAdRtfqAW6ZbEQsPL6u/i7aCa8BYyU/5t1cm9aR6tblQuvug3ZGsuEbeL63lU7laZic5 +4PIPOObrGYBbEfuA7j99QsmONFVKqzRGctb4DskoQ1rgvbuf2b3pTxfD3l2/R3/2ZXI8e/CPic 8DL3bqQVGMXDuPA= X-Received: by 2002:a05:600c:c8f:b0:49c:fc6c:be15 with SMTP id 5b1f17b1804b1-49eb733c62dmr44718705e9.27.1789580081884; Wed, 16 Sep 2026 10:34:41 -0700 (PDT) Received: from nn ([2001:1ab8:1003:0:f23c:f0c3:c09d:d6d6]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-4870bf27ce2sm8987544f8f.20.2026.09.16.10.34.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Sep 2026 10:34:41 -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?= Cc: linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org, "John W . Linville" , Simon Wunderlich , Oleksij Rempel , Kalle Valo , Jeff Johnson , stable@vger.kernel.org Subject: [PATCH ath-next v4 7/8] wifi: ath9k_htc: pass CRC-tagged spectral samples to the FFT parser Date: Wed, 16 Sep 2026 20:34:28 +0300 Message-ID: <20260916173429.403889-8-nerijus.bendziunas@gmail.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260916173429.403889-1-nerijus.bendziunas@gmail.com> References: <20260916173429.403889-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 The AR9271 firmware reports a frame that failed its CRC as a CRC error even when the PHY error bit is set too, so spectral samples received under interference reach the host as CRC errors, and the host passes only PHY errors to the FFT parser. ath9k reordered the same check in commit 3a325565c7fa ("ath9k: reorder error codes for spectral"); the firmware never followed. While a scan is active, also pass a CRC error frame of FFT report size to the parser, with the PHY error code it expects. The parser rejects a frame without the spectral bit in its trailer. A monitor interface with FIF_FCSFAIL no longer sees those frames. Fixes: 83fb287ecd8a ("ath9k_htc: process rx spectral packets") Assisted-by: LLM Signed-off-by: Nerijus Bend=C5=BEi=C5=ABnas --- drivers/net/wireless/ath/ath9k/htc_drv_txrx.c | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c b/drivers/net/wi= reless/ath/ath9k/htc_drv_txrx.c index bed7ea2425a0..23d1ef2407a4 100644 --- a/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c +++ b/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c @@ -969,6 +969,25 @@ static void rx_status_htc_to_ath(struct ath_rx_status = *rx_stats, convert_htc_flag(rx_stats, rxstatus); } =20 +static bool ath9k_htc_is_spectral_sample_len(struct ath9k_htc_priv *priv, + u16 len) +{ + enum nl80211_channel_type chan_type; + u16 fft_len; + + if (priv->spec_priv.spectral_mode =3D=3D SPECTRAL_DISABLED) + return false; + + chan_type =3D cfg80211_get_chandef_type(&priv->hw->conf.chandef); + if (chan_type =3D=3D NL80211_CHAN_HT40MINUS || + chan_type =3D=3D NL80211_CHAN_HT40PLUS) + fft_len =3D SPECTRAL_HT20_40_TOTAL_DATA_LEN; + else + fft_len =3D SPECTRAL_HT20_TOTAL_DATA_LEN; + + return len >=3D fft_len - 1 && len <=3D fft_len + 2; +} + static bool ath9k_rx_prepare(struct ath9k_htc_priv *priv, struct ath9k_htc_rxbuf *rxbuf, struct ieee80211_rx_status *rx_status) @@ -1052,6 +1071,16 @@ static bool ath9k_rx_prepare(struct ath9k_htc_priv *= priv, goto rx_next; } =20 + if (unlikely(rx_stats.rs_status & ATH9K_RXERR_CRC) && + ath9k_htc_is_spectral_sample_len(priv, rs_datalen)) { + struct ath_rx_status sample_rs =3D rx_stats; + + sample_rs.rs_phyerr =3D ATH9K_PHYERR_RADAR; + if (ath_cmn_process_fft(&priv->spec_priv, hdr, &sample_rs, + rx_status->mactime)) + goto rx_next; + } + if (!ath9k_cmn_rx_accept(common, hdr, rx_status, &rx_stats, &decrypt_error, priv->rxfilter)) goto rx_next; --=20 2.55.0 From nobody Fri Sep 25 04:43:45 2026 Received: from mail-wr2-f12.google.com (mail-wr2-f12.google.com [74.125.225.76]) (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 1BECD4D956F for ; Wed, 16 Sep 2026 17:34:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.225.76 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789580097; cv=none; b=ExmZQCBGRnTfpwMo+PofGRa/afbephtSB6b2xU4kMqo85hxS0OzeJ+BseZ+xhdsnIVJD9KEx4lnPX3bj/ZgTITfgjplKWprM+yF+aQiePYINk8mR2kEhs4WkBSHl6qBpZP4AHRSCqH36ZR0/caIu4ko/n8YZ2tKozckvVwL3ep8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789580097; c=relaxed/simple; bh=0eploKnMtQbqzOfeqyk5Y9GntqbhvzIpMJaqpsK1jfU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=cahvGcXhv2ErPCyR1jgymrMqk25XZwxU2+5ma9HhlSaif9liLMm8pKj6HoyZ6uBlkjU9W/GRogRVtAmV8O/LaCU/hyCv4QNSIwyDLfCyuYzKwvLpHaxMxbTtRDhsH3V5X2rShw62+GlTPTFlPNNnVuNbKJV9T9AGURzNqlORmGQ= 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=KpYaQiMx; arc=none smtp.client-ip=74.125.225.76 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="KpYaQiMx" Received: by mail-wr2-f12.google.com with SMTP id ffacd0b85a97d-482f6350f91so1602f8f.1 for ; Wed, 16 Sep 2026 10:34:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1789580083; x=1790184883; 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=gJUYHxCo3nb6bY06DouSUmL+wiO8MyUobMdBWXhYgS8=; b=KpYaQiMxfn66pN06z2rADzN00QHVnUdzmKq7KHl0b0Fk91NC2H5xhkxzAp0i2j2jUx MPwpYFc1CQFHMAKhTNQiA2Z538NneBRkMRIY2PZIj4iANRTISWD7WHcAgHQ+g/pNVoLX tIuWiZjhExOok9TVCjnxVQpNJiDapkK17aS7pcGrByv86ZqkLjzBV+3htWf7mdAIXYrs Y54Ex0J/sFyI6sFX2PaWC+CtDXq1BB0DzhU/gXM0T0iZ1Ne/YY648WgNg7OBMBt0oLUy InFI8aSwI4GXXydt6CLtLHAuR/y+j8k5XZbhgePUXDCn0qYqodHNrY6kyAnKl3S80Ohv WDYw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1789580083; x=1790184883; 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=gJUYHxCo3nb6bY06DouSUmL+wiO8MyUobMdBWXhYgS8=; b=n5nm1TPy6i9OvAH1ROdIT0q2Vzjc3BNLugj6w9D14YnHXbC1ktln2fcmf3Q2R1uKBg PqMTfdL1vBsEW/m8QaXLMieDLnfxv7P/lyqWC+q/V6VcxlvtYpCeIsycTNFvzuNw3YOT 1rUH82X2SAl9hokI+77wCGdV84WtbYWKhY1uqjwHRn5PYkNNCkQbgWdJY8vhdO03X9Eh E4hRl85BpVRKOcwtoSSbB/wqzujHi9VD6ET7l8verVMsLvTSEBOtuI36OjdBH6xBwJss GzoOoQwAmowCokVDQeCAXNmuzz1C6vEx37gQDDid68kecL6AIoTLfCPWTd00A9QJH92L pycQ== X-Forwarded-Encrypted: i=1; AKwUvByTb8lIgao/II75SUG4dZ//dre6seZHf7maHDQkGIAse7FE6Ekfx1nOlUXXr/yf2PnBNnw4sWqBJDKXkuw=@vger.kernel.org X-Gm-Message-State: AFuF++kGhsKks1+ceka5q4B3aqpJkAq8YYsL+QFm+GaDyRltywnupaeU sZ+KMpzYNOgQUIIblagZyzDyxset+lTuryqGbm4K5gfAF1NO0uWnvn4= X-Gm-Gg: AYBFou3tMtACjMf+0tU8CpnSGW56UQGvfRx3ZCRlsIuVfao0kFthBGi6X1+X5pYhoCC XIB8uR9wOemI3bGmvKmOD6Fd6a66AR2j5/K0pStkoWPisQIfeHQbJZBN8NJKIgSqwC0P5WWtkRE jCSEbDzgRrcPj5Rpyi6bTXiaCNNClm0RE3q70n6vPZxCxTRXY6Fzj4kU4viPOLtCmCYMINONEk9 VDiBX70VUISdDnLJwmhv6LYx3Z3ejdGVLSI0OXIyibGYv951ItZnZnfvyNaWyJ7DUv8bNnhZI4a fuKxFiIjWhBRcSTDQrPBuTs4NvmVwItEDIwMHEsrRSHdozA1HKlRBI7bCEKUtJectaIR5JAaWsO zjYjbU9IMjmpuUtIPmdMuT1wv8gGaG+4SzySqdxVqSuTqkO5hIw1sVSnpl8JJNIwmDw8xIfIFXG yfi6ugW72gQzQsU6mfnJGn2mUbIzgrlDcw7WtYo46XVPGneDfWt6sRnR6yz904USjFcCSDIYgJQ W4Nja8WjLMpNy9cayO0WWtnHj0BaN1JHXel+AXwTjYJc5raq6tu+qsYsQDvZrj84wpovaZcMvPJ NixrLdeBwXzz+083S7eo1aJrSw== X-Received: by 2002:a05:6000:230f:b0:486:f97b:6412 with SMTP id ffacd0b85a97d-4870d26c82bmr4826879f8f.46.1789580083139; Wed, 16 Sep 2026 10:34:43 -0700 (PDT) Received: from nn ([2001:1ab8:1003:0:f23c:f0c3:c09d:d6d6]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-4870bf27ce2sm8987544f8f.20.2026.09.16.10.34.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Sep 2026 10:34:42 -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?= Cc: linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org, "John W . Linville" , Simon Wunderlich , Oleksij Rempel , Kalle Valo , Jeff Johnson , stable@vger.kernel.org Subject: [PATCH ath-next v4 8/8] wifi: ath9k_htc: derive the PHY error filter bits from software state Date: Wed, 16 Sep 2026 20:34:29 +0300 Message-ID: <20260916173429.403889-9-nerijus.bendziunas@gmail.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260916173429.403889-1-nerijus.bendziunas@gmail.com> References: <20260916173429.403889-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_htc_calcrxfilter() reads the RX filter back from the device to preserve the PHY error bits a spectral scan may have set. When that WMI read times out it returns all ones, and the recalculated filter forwards every PHY error to the host with no scan running. Set the two bits from the spectral mode instead. A mode written to spectral_scan_ctl now sets them at the next filter update, not only at the trigger. Fixes: fb9987d0f748 ("ath9k_htc: Support for AR9271 chipset.") Assisted-by: LLM Signed-off-by: Nerijus Bend=C5=BEi=C5=ABnas --- drivers/net/wireless/ath/ath9k/htc_drv_txrx.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c b/drivers/net/wi= reless/ath/ath9k/htc_drv_txrx.c index 23d1ef2407a4..1a051d23cf2a 100644 --- a/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c +++ b/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c @@ -868,14 +868,14 @@ int ath9k_htc_cabq_setup(struct ath9k_htc_priv *priv) */ u32 ath9k_htc_calcrxfilter(struct ath9k_htc_priv *priv) { -#define RX_FILTER_PRESERVE (ATH9K_RX_FILTER_PHYERR | ATH9K_RX_FILTER_PHYRA= DAR) - struct ath_hw *ah =3D priv->ah; u32 rfilt; =20 - rfilt =3D (ath9k_hw_getrxfilter(ah) & RX_FILTER_PRESERVE) - | ATH9K_RX_FILTER_UCAST | ATH9K_RX_FILTER_BCAST - | ATH9K_RX_FILTER_MCAST; + rfilt =3D ATH9K_RX_FILTER_UCAST | ATH9K_RX_FILTER_BCAST | + ATH9K_RX_FILTER_MCAST; + + if (priv->spec_priv.spectral_mode !=3D SPECTRAL_DISABLED) + rfilt |=3D ATH9K_RX_FILTER_PHYRADAR | ATH9K_RX_FILTER_PHYERR; =20 if (priv->rxfilter & FIF_PROBE_REQ) rfilt |=3D ATH9K_RX_FILTER_PROBEREQ; @@ -906,8 +906,6 @@ u32 ath9k_htc_calcrxfilter(struct ath9k_htc_priv *priv) rfilt |=3D ATH9K_RX_FILTER_MCAST_BCAST_ALL; =20 return rfilt; - -#undef RX_FILTER_PRESERVE } =20 /* --=20 2.55.0