openwrt/package/kernel/mac80211/patches/subsys/321-mac80211_hwsim-make-6-G...

75 lines
2.2 KiB
Diff

From: Felix Fietkau <nbd@nbd.name>
Date: Mon, 24 May 2021 11:46:09 +0200
Subject: [PATCH] mac80211_hwsim: make 6 GHz channels usable
The previous commit that claimed to add 6 GHz channels didn't actually make
them usable, since the 6 GHz band was not registered with mac80211.
Fixes: 28881922abd7 ("mac80211_hwsim: add 6GHz channels")
Signed-off-by: Felix Fietkau <nbd@nbd.name>
---
--- a/drivers/net/wireless/mac80211_hwsim.c
+++ b/drivers/net/wireless/mac80211_hwsim.c
@@ -2992,15 +2992,19 @@ static void mac80211_hwsim_he_capab(stru
{
u16 n_iftype_data;
- if (sband->band == NL80211_BAND_2GHZ) {
+ switch (sband->band) {
+ case NL80211_BAND_2GHZ:
n_iftype_data = ARRAY_SIZE(he_capa_2ghz);
sband->iftype_data =
(struct ieee80211_sband_iftype_data *)he_capa_2ghz;
- } else if (sband->band == NL80211_BAND_5GHZ) {
+ break;
+ case NL80211_BAND_5GHZ:
+ case NL80211_BAND_6GHZ:
n_iftype_data = ARRAY_SIZE(he_capa_5ghz);
sband->iftype_data =
(struct ieee80211_sband_iftype_data *)he_capa_5ghz;
- } else {
+ break;
+ default:
return;
}
@@ -3290,6 +3294,12 @@ static int mac80211_hwsim_new_radio(stru
sband->vht_cap.vht_mcs.tx_mcs_map =
sband->vht_cap.vht_mcs.rx_mcs_map;
break;
+ case NL80211_BAND_6GHZ:
+ sband->channels = data->channels_6ghz;
+ sband->n_channels = ARRAY_SIZE(hwsim_channels_6ghz);
+ sband->bitrates = data->rates + 4;
+ sband->n_bitrates = ARRAY_SIZE(hwsim_rates) - 4;
+ break;
case NL80211_BAND_S1GHZ:
memcpy(&sband->s1g_cap, &hwsim_s1g_cap,
sizeof(sband->s1g_cap));
@@ -3300,6 +3310,13 @@ static int mac80211_hwsim_new_radio(stru
continue;
}
+ mac80211_hwsim_he_capab(sband);
+
+ hw->wiphy->bands[band] = sband;
+
+ if (band == NL80211_BAND_6GHZ)
+ continue;
+
sband->ht_cap.ht_supported = true;
sband->ht_cap.cap = IEEE80211_HT_CAP_SUP_WIDTH_20_40 |
IEEE80211_HT_CAP_GRN_FLD |
@@ -3313,10 +3330,6 @@ static int mac80211_hwsim_new_radio(stru
sband->ht_cap.mcs.rx_mask[0] = 0xff;
sband->ht_cap.mcs.rx_mask[1] = 0xff;
sband->ht_cap.mcs.tx_params = IEEE80211_HT_MCS_TX_DEFINED;
-
- mac80211_hwsim_he_capab(sband);
-
- hw->wiphy->bands[band] = sband;
}
/* By default all radios belong to the first group */