From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.221.45 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796032253; b=JG1AqHijvS0GU6rS6kfVx3r3cDjEN/ZNDSM5FCQj90xnlX8EOW19Di18IcSGPr5Q1SRl aoEiTtP375HiiD5yCE6dF2cUCw7U7jijD0qD+Kz8BTOJ7t4y54gHV2AwUWCjSzisowW4U jMg2gXkYdVDxqvti8xrkZ+AHcmuXenkQ7LtaM+Y6Raa22dPekVCe/DKLEA2093t8o/reT NSO9csTKXzgj3uhzMhZ9ecEsFXwM0qgpvMLd6i4F0D3LFfEgXs7qzRKUM0k9QcunVV/kp Zp7Tg+0FRIt2E0z60tHCGSGVMlnKLfYY6n/kRxwDS7+rUwTJfd9Yk24A4Mo6QSj+RiQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796032253; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Gm-Message-State:X-Gm-Gg:X-Received:Received:From:To:Cc:Subject: Date:Message-ID:X-Mailer:In-Reply-To:References:MIME-Version: Content-Transfer-Encoding; bh=sgYjbTsrXWmkPPI8Rg0P5CBZ/47CXS10wB1QBi+bG+0=; b=HaRkbnplf90xw2RVdPd/klHsRh7OT1+/9DFS5JnOwApL+sa5JSHq7L16Tuxo+mZvFnLW 0Lxxovhdgck0WacJ30wsBd22jY2dxtPRQezOjzAcMPXBPnPdhIV2M2wS9k4W5nTdBv2GH H9uIepJGas3+Rf71Od1RHRjblKy0eJaDLH332GaztFpoJmbNCmBg8V79OCJN8RpV77cQG /MhaHu0L56DOXlYEcGdXHnvNoIMphymwfv4HTfD2MCaPZlny0Geu+3Xd0MerlSGbfFs5K X0qdzRLov7hCHYd8Oj/h8uLgAGf4FlCTbFnD7yNGY5ScnhIZMTJfrbjCboADMar8qzA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=Jn9oav7X; arc=none smtp.remote-ip=209.85.221.45 Received: from mail-wr1-f45.google.com (mail-wr1-f45.google.com [209.85.221.45]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DB72F60A2612 for ; Mon, 30 Nov 2026 09:50:52 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org DB72F60A2612 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.a=rsa-sha256 header.s=20260707 header.b=Jn9oav7X Received: by mail-wr1-f45.google.com with SMTP id ffacd0b85a97d-498f5fa5103so6059539f8f.2 for ; Mon, 30 Nov 2026 01:50:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1796032251; x=1796637051; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=sgYjbTsrXWmkPPI8Rg0P5CBZ/47CXS10wB1QBi+bG+0=; b=Jn9oav7XzTpZrtpyRTijGek1NDS8iMjtAfr6bMWvkEE/qCO1m1iaNIVpRiqvX7W4PG rIwf9NQ6g3Slka31peMeBkpPzOcAoJebQ9J9fcikfym34i3n4W+iCyLhYBHdBE4a+sLB nYJrDBPj9uJl5vaQXLZRbxhItPCTFsrqVvcaSpU0JAchfw03BuNtTzvGh5irLFar2zgq 33qNk4EKoDiyZ7WVtOrqOzp+V7VnbNXYUngzhl0rArbY1Yng8mR9GnOfFu0ycb5IVyVf +rR+h5JPVOWByyfdDg2uu641IpJVh1TSYW7NKW2t/+NZ/AhwsfRw7SfGWxpEPpBjs2IM xXFA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796032251; x=1796637051; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=sgYjbTsrXWmkPPI8Rg0P5CBZ/47CXS10wB1QBi+bG+0=; b=qoXlv8yR+r/SRkGyoiu4+GzpI+WYHcpR/HdxjdMMeX7mxSl9oTUVk6wYM22nJckbqq DTr92K0MVIzt8WhhdrTYclpxXXAkAwAvhxHHSgo8Bndl5/r1bmqo5qZ0xNmLu88yCkLQ lCDH+77+M4Q66abaten++PJ1D7dsx6wRZ3jNs8AxVOCXCUkB4p+56SfyipD+0I/66LE2 d7xDZh41LZc9JKSRiFl+CbDg4hOQln6vzNcHPbOtzY1RBFZKchocZMB/8csUBqZTdbHs bkp/ICn0pGwL44Q5+UqN7tjWkFzpTMY3Ff+kKNPTLvurcPhB/E1aUXU+lchH4G4xHYlW fkRg== X-Gm-Message-State: APuU4Z88xCs8pQJgDsMHRfbSqIL2N/vwn6Vu0BXqjDghh4vFA1OL0VYX ps+FhZWG302NY2bB8Y3pOVAtKwXQ9F2/kPeZbDAGXPkbR9YzO6IzMMwiwKpBVMzz X-Gm-Gg: AZFdTZcC6/BOWvrTUvUshTf3wuJA8ClXo1Fzkq0rXptHEBBtw7C3aRsHHavQmyIocZQ AmVCMMLfjV51RSNBW3X/EO+elC4J25q5yOsIZ7m6ZyrGESTpuXb4zmtDowqSiwcGPn4hfAueM68 b/7DxFtT4HxaaR/T6ew5J5XZ+llQ4pBZCpcK/zT/Wu29xPacNsQKYvrrC8ea0uPlEpIwVsPXrrl oSHcEdYgRydbpKf/PxO6cjOu3G+nuH5s6eHLFA7p8KrFVlFUTm7Gn7PlEG6dhr1SkRn5zK2ah// itaNKmScN1WQD1yeJf1ytIQlwbnZYrA89+/NJEPjGRmXHcnHzXXdvOXk+eLVVgszUej6hhCI8xx 1qamNdpLYmlhF2QB6+GsrQ7/+rwxDiV1JGOUuh6p4QyjKJAJA267CPSuBq9Zbc/VD3Gs1bKi8St B8/EAeLIJgqSgrIpIqh3kZFpODwd89p95TEahzANJIv/QZkYtII9iChHNjf18V+ydegQpIc2IT2 0iKI40sPaNcsTi0O7phFpCxJ5bTObbg5Cn4cehVyiHGM7X+DmVc6bocSPFNa3kp5DdV4dqPwohi QRv87OzzcGTpHNKvthKdu4+9k7iuneAMJk3px+4SSGwan79OeYBK0GkKeXmdUUYdt9UUCRt7Psh HUMevBFQbRiJSwv25p2kfV3lMH487nzJEMmuZtQ5ICpTWp3ok0clop4JpagaVpHfsl+V91Cn1Oz GqSD92Z4erXPPGGGrJt7lsZRdR2acx+9V4c5U5O8Ke9Z2Rv/HFxs+x X-Received: by 2002:a05:6000:22ca:b0:487:1662:cf4c with SMTP id ffacd0b85a97d-4abacfea532mr68843614f8f.7.1796032251078; Mon, 30 Nov 2026 01:50:51 -0800 (PST) Received: from localhost.localdomain (dynamic-2a00-1028-8388-a84e-1080-8fd8-c252-0ba8.ipv6.o2.cz. [2a00:1028:8388:a84e:1080:8fd8:c252:ba8]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-4ab6b10b5f6sm59591566f8f.34.2026.11.30.01.50.50 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 30 Nov 2026 01:50:50 -0800 (PST) From: Josef Schlehofer To: Jeff Johnson Cc: linux-wireless@vger.kernel.org Subject: [PATCH ath-next 8/9] wifi: ath6kl: honour ieee80211-freq-limit from DT Date: Mon, 30 Nov 2026 10:50:41 +0100 Message-ID: <20261130095042.41330-9-pepe.schlehofer@gmail.com> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20261130095042.41330-1-pepe.schlehofer@gmail.com> References: <20261130095042.41330-1-pepe.schlehofer@gmail.com> X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit The AR6006 firmware in the Xiaomi AIoT AC2350 reports a dual band phy in its ready event, but the board only has a 2.4 GHz front end. A scan on that router saw no 5 GHz network at all, not even the router's own. Call wiphy_read_of_freq_limits() before the wiphy is registered, so a board can describe the limit with ieee80211-freq-limit on the node of the USB device. It works on the per-device channel copies, so other ath6kl devices are not affected. A band that has no enabled channel left is dropped from the wiphy, so user space does not see a band full of disabled channels. A limit that leaves no channel at all only gets a warning. The ath6kl loops over wiphy->bands already skip a missing band, and the previous patch handles a connection on a frequency that has no channel. ath6kl does not pass the limit to the firmware, which picks the network on its own. Reject a connection on a channel that the limit disabled, as the previous patch does for a frequency without a channel. The check uses orig_flags, as brcmfmac does, so a channel that only the regulatory domain disables is not affected. Signed-off-by: Josef Schlehofer --- On the router, ieee80211-freq-limit = <2400000 2483000> on the node of the USB port, added at runtime, left only the 2.4 GHz band in iw phy, and station and AP mode worked. With <2400000 2430000> only channels 1 and 2 stayed enabled, and connections the firmware made on channel 6 were rejected. drivers/net/wireless/ath/ath6kl/cfg80211.c | 41 ++++++++++++++++++++++ drivers/net/wireless/ath/ath6kl/main.c | 8 +++-- 2 files changed, 47 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/ath/ath6kl/cfg80211.c b/drivers/net/wireless/ath/ath6kl/cfg80211.c index 7f1ffe4b7..97107510b 100644 --- a/drivers/net/wireless/ath/ath6kl/cfg80211.c +++ b/drivers/net/wireless/ath/ath6kl/cfg80211.c @@ -3875,6 +3875,39 @@ static const struct wiphy_wowlan_support ath6kl_wowlan_support = { }; #endif +static bool +ath6kl_band_has_channel(const struct ieee80211_supported_band *sband) +{ + int i; + + for (i = 0; i < sband->n_channels; i++) + if (!(sband->channels[i].flags & IEEE80211_CHAN_DISABLED)) + return true; + + return false; +} + +/* drop bands without an enabled channel, unless no band would be left */ +static void ath6kl_drop_empty_bands(struct wiphy *wiphy) +{ + int band, left = 0; + + for (band = 0; band < NUM_NL80211_BANDS; band++) + if (wiphy->bands[band] && + ath6kl_band_has_channel(wiphy->bands[band])) + left++; + + if (!left) { + ath6kl_warn("ieee80211-freq-limit leaves no channel\n"); + return; + } + + for (band = 0; band < NUM_NL80211_BANDS; band++) + if (wiphy->bands[band] && + !ath6kl_band_has_channel(wiphy->bands[band])) + wiphy->bands[band] = NULL; +} + int ath6kl_cfg80211_init(struct ath6kl *ar) { struct wiphy *wiphy = ar->wiphy; @@ -3990,6 +4023,14 @@ int ath6kl_cfg80211_init(struct ath6kl *ar) if (band_5gig) wiphy->bands[NL80211_BAND_5GHZ] = &ar->band_5ghz; + /* + * Some boards only have a front end for one band although the + * firmware reports a dual band phy. Let the device tree limit the + * channels and drop a band that has none left. + */ + wiphy_read_of_freq_limits(wiphy); + ath6kl_drop_empty_bands(wiphy); + wiphy->signal_type = CFG80211_SIGNAL_TYPE_MBM; wiphy->cipher_suites = cipher_suites; diff --git a/drivers/net/wireless/ath/ath6kl/main.c b/drivers/net/wireless/ath/ath6kl/main.c index a062598ce..20fa471a9 100644 --- a/drivers/net/wireless/ath/ath6kl/main.c +++ b/drivers/net/wireless/ath/ath6kl/main.c @@ -632,12 +632,16 @@ void ath6kl_connect_event(struct ath6kl_vif *vif, u16 channel, u8 *bssid, u8 *assoc_info) { struct ath6kl *ar = vif->ar; + struct ieee80211_channel *chan; /* * cfg80211 needs a channel for the BSS. Reject a connection on a - * frequency that has no channel on this device. + * frequency without a channel here, or on a channel disabled before + * wiphy_register() (orig_flags), as ieee80211-freq-limit does. Later + * regulatory updates only change flags. */ - if (!ieee80211_get_channel(ar->wiphy, channel)) { + chan = ieee80211_get_channel(ar->wiphy, channel); + if (!chan || (chan->orig_flags & IEEE80211_CHAN_DISABLED)) { ath6kl_err("connected on unsupported frequency %u MHz\n", channel); ath6kl_wmi_disconnect_cmd(ar->wmi, vif->fw_vif_idx); ath6kl_disconnect_event(vif, DISCONNECT_CMD, bssid, 0, NULL, -- 2.54.0 (Apple Git-157)