From: Josef Schlehofer <pepe.schlehofer@gmail.com>
To: Jeff Johnson <jjohnson@kernel.org>
Cc: linux-wireless@vger.kernel.org
Subject: [PATCH ath-next 4/9] wifi: ath6kl: use per-device band and channel copies
Date: Mon, 30 Nov 2026 10:50:37 +0100 [thread overview]
Message-ID: <20261130095042.41330-5-pepe.schlehofer@gmail.com> (raw)
In-Reply-To: <20261130095042.41330-1-pepe.schlehofer@gmail.com>
ath6kl registers the same static band and channel structures for
every device. ath6kl_cfg80211_init() already changes the HT
capabilities of these shared structures to match the firmware of the
device being probed, so a second device inherits them. A per-board
channel limit from the device tree would have the same problem.
Copy the band and channel templates into struct ath6kl and register
the copies. The HT adjustments and the one reader of the 2.4 GHz HT
support now use the copies. The bitrate tables stay shared.
Signed-off-by: Josef Schlehofer <pepe.schlehofer@gmail.com>
---
This touches every ath6kl chip. Only an AR6006 hw1.1 on USB was
available for testing. It ran there with the rest of the series, but
two ath6kl devices side by side did not run.
drivers/net/wireless/ath/ath6kl/cfg80211.c | 50 ++++++++++++++--------
drivers/net/wireless/ath/ath6kl/core.h | 9 ++++
2 files changed, 40 insertions(+), 19 deletions(-)
diff --git a/drivers/net/wireless/ath/ath6kl/cfg80211.c b/drivers/net/wireless/ath/ath6kl/cfg80211.c
index c91560d55..6b03627e2 100644
--- a/drivers/net/wireless/ath/ath6kl/cfg80211.c
+++ b/drivers/net/wireless/ath/ath6kl/cfg80211.c
@@ -85,7 +85,7 @@ static struct ieee80211_rate ath6kl_rates[] = {
IEEE80211_HT_CAP_SGI_20 | \
IEEE80211_HT_CAP_SGI_40)
-static struct ieee80211_channel ath6kl_2ghz_channels[] = {
+static const struct ieee80211_channel ath6kl_2ghz_channels[] = {
CHAN2G(1, 2412, 0),
CHAN2G(2, 2417, 0),
CHAN2G(3, 2422, 0),
@@ -102,7 +102,7 @@ static struct ieee80211_channel ath6kl_2ghz_channels[] = {
CHAN2G(14, 2484, 0),
};
-static struct ieee80211_channel ath6kl_5ghz_a_channels[] = {
+static const struct ieee80211_channel ath6kl_5ghz_a_channels[] = {
CHAN5G(36, 0), CHAN5G(40, 0),
CHAN5G(44, 0), CHAN5G(48, 0),
CHAN5G(52, 0), CHAN5G(56, 0),
@@ -122,18 +122,16 @@ static struct ieee80211_channel ath6kl_5ghz_a_channels[] = {
CHAN5G(216, 0),
};
-static struct ieee80211_supported_band ath6kl_band_2ghz = {
+static const struct ieee80211_supported_band ath6kl_band_2ghz = {
.n_channels = ARRAY_SIZE(ath6kl_2ghz_channels),
- .channels = ath6kl_2ghz_channels,
.n_bitrates = ath6kl_g_rates_size,
.bitrates = ath6kl_g_rates,
.ht_cap.cap = ath6kl_g_htcap,
.ht_cap.ht_supported = true,
};
-static struct ieee80211_supported_band ath6kl_band_5ghz = {
+static const struct ieee80211_supported_band ath6kl_band_5ghz = {
.n_channels = ARRAY_SIZE(ath6kl_5ghz_a_channels),
- .channels = ath6kl_5ghz_a_channels,
.n_bitrates = ath6kl_a_rates_size,
.bitrates = ath6kl_a_rates,
.ht_cap.cap = ath6kl_a_htcap,
@@ -1121,7 +1119,7 @@ void ath6kl_cfg80211_ch_switch_notify(struct ath6kl_vif *vif, int freq,
cfg80211_chandef_create(&chandef,
ieee80211_get_channel(vif->ar->wiphy, freq),
(mode == WMI_11G_HT20 &&
- ath6kl_band_2ghz.ht_cap.ht_supported) ?
+ vif->ar->band_2ghz.ht_cap.ht_supported) ?
NL80211_CHAN_HT20 : NL80211_CHAN_NO_HT);
wiphy_lock(vif->ar->wiphy);
@@ -3931,6 +3929,20 @@ int ath6kl_cfg80211_init(struct ath6kl *ar)
return -EINVAL;
}
+ BUILD_BUG_ON(ARRAY_SIZE(ath6kl_2ghz_channels) !=
+ ATH6KL_NUM_2GHZ_CHANNELS);
+ BUILD_BUG_ON(ARRAY_SIZE(ath6kl_5ghz_a_channels) !=
+ ATH6KL_NUM_5GHZ_CHANNELS);
+
+ memcpy(ar->channels_2ghz, ath6kl_2ghz_channels,
+ sizeof(ar->channels_2ghz));
+ memcpy(ar->channels_5ghz, ath6kl_5ghz_a_channels,
+ sizeof(ar->channels_5ghz));
+ ar->band_2ghz = ath6kl_band_2ghz;
+ ar->band_2ghz.channels = ar->channels_2ghz;
+ ar->band_5ghz = ath6kl_band_5ghz;
+ ar->band_5ghz.channels = ar->channels_5ghz;
+
/*
* Even if the fw has HT support, advertise HT cap only when
* the firmware has support to override RSN capability, otherwise
@@ -3939,10 +3951,10 @@ int ath6kl_cfg80211_init(struct ath6kl *ar)
if (!(ht &&
test_bit(ATH6KL_FW_CAPABILITY_RSN_CAP_OVERRIDE,
ar->fw_capabilities))) {
- ath6kl_band_2ghz.ht_cap.cap = 0;
- ath6kl_band_2ghz.ht_cap.ht_supported = false;
- ath6kl_band_5ghz.ht_cap.cap = 0;
- ath6kl_band_5ghz.ht_cap.ht_supported = false;
+ ar->band_2ghz.ht_cap.cap = 0;
+ ar->band_2ghz.ht_cap.ht_supported = false;
+ ar->band_5ghz.ht_cap.cap = 0;
+ ar->band_5ghz.ht_cap.ht_supported = false;
if (ht)
ath6kl_err("Firmware lacks RSN-CAP-OVERRIDE, so HT (802.11n) is disabled.");
@@ -3950,15 +3962,15 @@ int ath6kl_cfg80211_init(struct ath6kl *ar)
if (test_bit(ATH6KL_FW_CAPABILITY_64BIT_RATES,
ar->fw_capabilities)) {
- ath6kl_band_2ghz.ht_cap.mcs.rx_mask[0] = 0xff;
- ath6kl_band_5ghz.ht_cap.mcs.rx_mask[0] = 0xff;
- ath6kl_band_2ghz.ht_cap.mcs.rx_mask[1] = 0xff;
- ath6kl_band_5ghz.ht_cap.mcs.rx_mask[1] = 0xff;
+ ar->band_2ghz.ht_cap.mcs.rx_mask[0] = 0xff;
+ ar->band_5ghz.ht_cap.mcs.rx_mask[0] = 0xff;
+ ar->band_2ghz.ht_cap.mcs.rx_mask[1] = 0xff;
+ ar->band_5ghz.ht_cap.mcs.rx_mask[1] = 0xff;
ar->hw.tx_ant = 0x3; /* mask, 2 antenna */
ar->hw.rx_ant = 0x3;
} else {
- ath6kl_band_2ghz.ht_cap.mcs.rx_mask[0] = 0xff;
- ath6kl_band_5ghz.ht_cap.mcs.rx_mask[0] = 0xff;
+ ar->band_2ghz.ht_cap.mcs.rx_mask[0] = 0xff;
+ ar->band_5ghz.ht_cap.mcs.rx_mask[0] = 0xff;
ar->hw.tx_ant = 1;
ar->hw.rx_ant = 1;
}
@@ -3967,9 +3979,9 @@ int ath6kl_cfg80211_init(struct ath6kl *ar)
wiphy->available_antennas_rx = ar->hw.rx_ant;
if (band_2gig)
- wiphy->bands[NL80211_BAND_2GHZ] = &ath6kl_band_2ghz;
+ wiphy->bands[NL80211_BAND_2GHZ] = &ar->band_2ghz;
if (band_5gig)
- wiphy->bands[NL80211_BAND_5GHZ] = &ath6kl_band_5ghz;
+ wiphy->bands[NL80211_BAND_5GHZ] = &ar->band_5ghz;
wiphy->signal_type = CFG80211_SIGNAL_TYPE_MBM;
diff --git a/drivers/net/wireless/ath/ath6kl/core.h b/drivers/net/wireless/ath/ath6kl/core.h
index 31cd88d83..da85c8dfb 100644
--- a/drivers/net/wireless/ath/ath6kl/core.h
+++ b/drivers/net/wireless/ath/ath6kl/core.h
@@ -703,10 +703,19 @@ enum ath6kl_fw_err {
ATH6KL_FW_EP_FULL,
};
+#define ATH6KL_NUM_2GHZ_CHANNELS 14
+#define ATH6KL_NUM_5GHZ_CHANNELS 33
+
struct ath6kl {
struct device *dev;
struct wiphy *wiphy;
+ /* per device copies, a board may disable channels or change HT caps */
+ struct ieee80211_supported_band band_2ghz;
+ struct ieee80211_supported_band band_5ghz;
+ struct ieee80211_channel channels_2ghz[ATH6KL_NUM_2GHZ_CHANNELS];
+ struct ieee80211_channel channels_5ghz[ATH6KL_NUM_5GHZ_CHANNELS];
+
enum ath6kl_state state;
unsigned int testmode;
--
2.54.0 (Apple Git-157)
next prev parent reply other threads:[~2026-11-30 9:50 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-30 9:50 [PATCH ath-next 0/9] wifi: ath6kl: add AR6006 hw1.1 (QCA6006) support Josef Schlehofer
2026-11-30 9:50 ` [PATCH ath-next 1/9] wifi: ath6kl: add AR6006 hw1.1 support Josef Schlehofer
2026-11-30 9:50 ` [PATCH ath-next 2/9] wifi: ath6kl: handle the AR6006 WMI layout Josef Schlehofer
2026-11-30 9:50 ` [PATCH ath-next 3/9] wifi: ath6kl: ignore AR6006 regulatory domain events Josef Schlehofer
2026-11-30 9:50 ` Josef Schlehofer [this message]
2026-11-30 9:50 ` [PATCH ath-next 5/9] dt-bindings: net: wireless: add QCA6006 binding Josef Schlehofer
2026-11-30 9:50 ` [PATCH ath-next 6/9] wifi: ath6kl: take the AR6006 MAC address from DT Josef Schlehofer
2026-11-30 9:50 ` [PATCH ath-next 7/9] wifi: ath6kl: handle unsupported connection frequencies Josef Schlehofer
2026-11-30 9:50 ` [PATCH ath-next 8/9] wifi: ath6kl: honour ieee80211-freq-limit from DT Josef Schlehofer
2026-11-30 9:50 ` [PATCH ath-next 9/9] wifi: ath6kl: add QCA6006 USB ID Josef Schlehofer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261130095042.41330-5-pepe.schlehofer@gmail.com \
--to=pepe.schlehofer@gmail.com \
--cc=jjohnson@kernel.org \
--cc=linux-wireless@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox