4bac10eefe719700b6edfe056f9bb233716ef7e0
[openwrt/staging/wigyori.git] / package / kernel / mac80211 / patches / subsys / 321-mac80211_hwsim-make-6-GHz-channels-usable.patch
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
4
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.
7
8 Fixes: 28881922abd7 ("mac80211_hwsim: add 6GHz channels")
9 Signed-off-by: Felix Fietkau <nbd@nbd.name>
10 ---
11
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
15 {
16 u16 n_iftype_data;
17
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);
22 sband->iftype_data =
23 (struct ieee80211_sband_iftype_data *)he_capa_2ghz;
24 - } else if (sband->band == NL80211_BAND_5GHZ) {
25 + break;
26 + case NL80211_BAND_5GHZ:
27 + case NL80211_BAND_6GHZ:
28 n_iftype_data = ARRAY_SIZE(he_capa_5ghz);
29 sband->iftype_data =
30 (struct ieee80211_sband_iftype_data *)he_capa_5ghz;
31 - } else {
32 + break;
33 + default:
34 return;
35 }
36
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;
40 break;
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;
46 + break;
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
51 continue;
52 }
53
54 + mac80211_hwsim_he_capab(sband);
55 +
56 + hw->wiphy->bands[band] = sband;
57 +
58 + if (band == NL80211_BAND_6GHZ)
59 + continue;
60 +
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;
68 -
69 - mac80211_hwsim_he_capab(sband);
70 -
71 - hw->wiphy->bands[band] = sband;
72 }
73
74 /* By default all radios belong to the first group */