1 From: Felix Fietkau <nbd@nbd.name>
2 Date: Mon, 24 May 2021 11:46:09 +0200
3 Subject: [PATCH] mac80211_hwsim: make 6 GHz channels usable
5 The previous commit that claimed to add 6 GHz channels didn't actually make
6 them usable, since the 6 GHz band was not registered with mac80211.
8 Fixes: 28881922abd7 ("mac80211_hwsim: add 6GHz channels")
9 Signed-off-by: Felix Fietkau <nbd@nbd.name>
12 --- a/drivers/net/wireless/mac80211_hwsim.c
13 +++ b/drivers/net/wireless/mac80211_hwsim.c
14 @@ -2968,15 +2968,19 @@ static void mac80211_hwsim_he_capab(stru
18 - if (sband->band == NL80211_BAND_2GHZ) {
19 + switch (sband->band) {
20 + case NL80211_BAND_2GHZ:
21 n_iftype_data = ARRAY_SIZE(he_capa_2ghz);
23 (struct ieee80211_sband_iftype_data *)he_capa_2ghz;
24 - } else if (sband->band == NL80211_BAND_5GHZ) {
26 + case NL80211_BAND_5GHZ:
27 + case NL80211_BAND_6GHZ:
28 n_iftype_data = ARRAY_SIZE(he_capa_5ghz);
30 (struct ieee80211_sband_iftype_data *)he_capa_5ghz;
37 @@ -3265,6 +3269,12 @@ static int mac80211_hwsim_new_radio(stru
38 sband->vht_cap.vht_mcs.tx_mcs_map =
39 sband->vht_cap.vht_mcs.rx_mcs_map;
41 + case NL80211_BAND_6GHZ:
42 + sband->channels = data->channels_6ghz;
43 + sband->n_channels = ARRAY_SIZE(hwsim_channels_6ghz);
44 + sband->bitrates = data->rates + 4;
45 + sband->n_bitrates = ARRAY_SIZE(hwsim_rates) - 4;
47 case NL80211_BAND_S1GHZ:
48 memcpy(&sband->s1g_cap, &hwsim_s1g_cap,
49 sizeof(sband->s1g_cap));
50 @@ -3275,6 +3285,13 @@ static int mac80211_hwsim_new_radio(stru
54 + mac80211_hwsim_he_capab(sband);
56 + hw->wiphy->bands[band] = sband;
58 + if (band == NL80211_BAND_6GHZ)
61 sband->ht_cap.ht_supported = true;
62 sband->ht_cap.cap = IEEE80211_HT_CAP_SUP_WIDTH_20_40 |
63 IEEE80211_HT_CAP_GRN_FLD |
64 @@ -3288,10 +3305,6 @@ static int mac80211_hwsim_new_radio(stru
65 sband->ht_cap.mcs.rx_mask[0] = 0xff;
66 sband->ht_cap.mcs.rx_mask[1] = 0xff;
67 sband->ht_cap.mcs.tx_params = IEEE80211_HT_MCS_TX_DEFINED;
69 - mac80211_hwsim_he_capab(sband);
71 - hw->wiphy->bands[band] = sband;
74 /* By default all radios belong to the first group */