@@ -181,6 +181,22 @@ static struct ieee80211_rate __wl_rates[] = {
181181 .max_power = 30, \
182182}
183183
184+ #define CHAN6G (_channel ) { \
185+ .band = NL80211_BAND_6GHZ, \
186+ .center_freq = 5950 + (5 * (_channel)), \
187+ .hw_value = (_channel), \
188+ .max_antenna_gain = 0, \
189+ .max_power = 30, \
190+ }
191+
192+ #define CHAN6G_CHAN2 () { \
193+ .band = NL80211_BAND_6GHZ, \
194+ .center_freq = 5935, \
195+ .hw_value = 0x5002, \
196+ .max_antenna_gain = 0, \
197+ .max_power = 30, \
198+ }
199+
184200static struct ieee80211_channel __wl_2ghz_channels [] = {
185201 CHAN2G (1 , 2412 ), CHAN2G (2 , 2417 ), CHAN2G (3 , 2422 ), CHAN2G (4 , 2427 ),
186202 CHAN2G (5 , 2432 ), CHAN2G (6 , 2437 ), CHAN2G (7 , 2442 ), CHAN2G (8 , 2447 ),
@@ -197,6 +213,21 @@ static struct ieee80211_channel __wl_5ghz_channels[] = {
197213 CHAN5G (153 ), CHAN5G (157 ), CHAN5G (161 ), CHAN5G (165 )
198214};
199215
216+ static struct ieee80211_channel __wl_6ghz_channels [] = {
217+ CHAN6G_CHAN2 (), CHAN6G (1 ), CHAN6G (5 ), CHAN6G (9 ), CHAN6G (13 ),
218+ CHAN6G (17 ), CHAN6G (21 ), CHAN6G (25 ), CHAN6G (29 ), CHAN6G (33 ),
219+ CHAN6G (37 ), CHAN6G (41 ), CHAN6G (45 ), CHAN6G (49 ), CHAN6G (53 ),
220+ CHAN6G (57 ), CHAN6G (61 ), CHAN6G (65 ), CHAN6G (69 ), CHAN6G (73 ),
221+ CHAN6G (77 ), CHAN6G (81 ), CHAN6G (85 ), CHAN6G (89 ), CHAN6G (93 ),
222+ CHAN6G (97 ), CHAN6G (101 ), CHAN6G (105 ), CHAN6G (109 ), CHAN6G (113 ),
223+ CHAN6G (117 ), CHAN6G (121 ), CHAN6G (125 ), CHAN6G (129 ), CHAN6G (133 ),
224+ CHAN6G (137 ), CHAN6G (141 ), CHAN6G (145 ), CHAN6G (149 ), CHAN6G (153 ),
225+ CHAN6G (157 ), CHAN6G (161 ), CHAN6G (165 ), CHAN6G (169 ), CHAN6G (173 ),
226+ CHAN6G (177 ), CHAN6G (181 ), CHAN6G (185 ), CHAN6G (189 ), CHAN6G (193 ),
227+ CHAN6G (197 ), CHAN6G (201 ), CHAN6G (205 ), CHAN6G (209 ), CHAN6G (213 ),
228+ CHAN6G (217 ), CHAN6G (221 ), CHAN6G (225 ), CHAN6G (229 ), CHAN6G (233 ),
229+ };
230+
200231/* Band templates duplicated per wiphy. The channel info
201232 * above is added to the band during setup.
202233 */
@@ -212,6 +243,12 @@ static const struct ieee80211_supported_band __wl_band_5ghz = {
212243 .n_bitrates = wl_a_rates_size ,
213244};
214245
246+ static const struct ieee80211_supported_band __wl_band_6ghz = {
247+ .band = NL80211_BAND_6GHZ ,
248+ .bitrates = wl_a_rates ,
249+ .n_bitrates = wl_a_rates_size ,
250+ };
251+
215252/* This is to override regulatory domains defined in cfg80211 module (reg.c)
216253 * By default world regulatory domain defined in reg.c puts the flags
217254 * NL80211_RRF_NO_IR for 5GHz channels (for * 36..48 and 149..165).
@@ -319,6 +356,8 @@ static u8 nl80211_band_to_fwil(enum nl80211_band band)
319356 return WLC_BAND_2G ;
320357 case NL80211_BAND_5GHZ :
321358 return WLC_BAND_5G ;
359+ case NL80211_BAND_6GHZ :
360+ return WLC_BAND_6G ;
322361 default :
323362 WARN_ON (1 );
324363 break ;
@@ -392,6 +431,9 @@ static u16 chandef_to_chanspec(struct brcmu_d11inf *d11inf,
392431 case NL80211_BAND_5GHZ :
393432 ch_inf .band = BRCMU_CHAN_BAND_5G ;
394433 break ;
434+ case NL80211_BAND_6GHZ :
435+ ch_inf .band = BRCMU_CHAN_BAND_6G ;
436+ break ;
395437 case NL80211_BAND_60GHZ :
396438 default :
397439 WARN_ON_ONCE (1 );
@@ -3405,12 +3447,27 @@ static s32 brcmf_inform_single_bss(struct brcmf_cfg80211_info *cfg,
34053447 }
34063448 channel = bi -> ctl_ch ;
34073449
3408- if (channel <= CH_MAX_2G_CHANNEL )
3409- band = NL80211_BAND_2GHZ ;
3410- else
3450+ if (CHSPEC_IS6G ( bi -> chanspec ) )
3451+ band = NL80211_BAND_6GHZ ;
3452+ else if ( CHSPEC_IS5G ( bi -> chanspec ))
34113453 band = NL80211_BAND_5GHZ ;
3454+ else
3455+ band = NL80211_BAND_2GHZ ;
34123456
34133457 freq = ieee80211_channel_to_frequency (channel , band );
3458+ if (!freq ) {
3459+ brcmf_err (
3460+ "Invalid frequency %d returned for channel %d, band %d. chanspec was %04x\n" ,
3461+ freq , channel , band , bi -> chanspec );
3462+
3463+ /* We ignore this BSS ID rather than try to continue on.
3464+ Otherwise we will cause an OOPs because our frequency is 0.
3465+ The main case this occurs is some new frequency band
3466+ we have not seen before, and if we return an error,
3467+ we will cause the scan to fail. It seems better to
3468+ report the error, skip this BSS, and move on.*/
3469+ return 0 ;
3470+ }
34143471 bss_data .chan = ieee80211_get_channel (wiphy , freq );
34153472 bss_data .scan_width = NL80211_BSS_CHAN_WIDTH_20 ;
34163473 bss_data .boottime_ns = ktime_to_ns (ktime_get_boottime ());
@@ -3520,8 +3577,10 @@ static s32 brcmf_inform_ibss(struct brcmf_cfg80211_info *cfg,
35203577
35213578 if (ch .band == BRCMU_CHAN_BAND_2G )
35223579 band = wiphy -> bands [NL80211_BAND_2GHZ ];
3523- else
3580+ else if ( ch . band == BRCMU_CHAN_BAND_5G )
35243581 band = wiphy -> bands [NL80211_BAND_5GHZ ];
3582+ else
3583+ band = wiphy -> bands [NL80211_BAND_6GHZ ];
35253584
35263585 freq = ieee80211_channel_to_frequency (ch .control_ch_num , band -> band );
35273586 cfg -> channel = freq ;
@@ -4105,6 +4164,7 @@ brcmf_wowl_nd_results(struct brcmf_if *ifp, const struct brcmf_event_msg *e,
41054164 memcpy (cfg -> wowl .nd -> ssid .ssid , netinfo -> SSID , netinfo -> SSID_len );
41064165 cfg -> wowl .nd -> ssid .ssid_len = netinfo -> SSID_len ;
41074166 cfg -> wowl .nd -> n_channels = 1 ;
4167+ /* TODO - need to store band so we can handle 6G */
41084168 cfg -> wowl .nd -> channels [0 ] =
41094169 ieee80211_channel_to_frequency (netinfo -> channel ,
41104170 netinfo -> channel <= CH_MAX_2G_CHANNEL ?
@@ -5754,6 +5814,9 @@ static int brcmf_cfg80211_get_channel(struct wiphy *wiphy,
57545814 case BRCMU_CHAN_BAND_5G :
57555815 band = NL80211_BAND_5GHZ ;
57565816 break ;
5817+ case BRCMU_CHAN_BAND_6G :
5818+ band = NL80211_BAND_6GHZ ;
5819+ break ;
57575820 }
57585821
57595822 switch (ch .bw ) {
@@ -6433,8 +6496,10 @@ brcmf_bss_roaming_done(struct brcmf_cfg80211_info *cfg,
64336496
64346497 if (ch .band == BRCMU_CHAN_BAND_2G )
64356498 band = wiphy -> bands [NL80211_BAND_2GHZ ];
6436- else
6499+ else if ( ch . band == BRCMU_CHAN_BAND_5G )
64376500 band = wiphy -> bands [NL80211_BAND_5GHZ ];
6501+ else
6502+ band = wiphy -> bands [NL80211_BAND_6GHZ ];
64386503
64396504 freq = ieee80211_channel_to_frequency (ch .control_ch_num , band -> band );
64406505 notify_channel = ieee80211_get_channel (wiphy , freq );
@@ -7012,6 +7077,10 @@ static int brcmf_construct_chaninfo(struct brcmf_cfg80211_info *cfg,
70127077 for (i = 0 ; i < band -> n_channels ; i ++ )
70137078 band -> channels [i ].flags = IEEE80211_CHAN_DISABLED ;
70147079 band = wiphy -> bands [NL80211_BAND_5GHZ ];
7080+ if (band )
7081+ for (i = 0 ; i < band -> n_channels ; i ++ )
7082+ band -> channels [i ].flags = IEEE80211_CHAN_DISABLED ;
7083+ band = wiphy -> bands [NL80211_BAND_6GHZ ];
70157084 if (band )
70167085 for (i = 0 ; i < band -> n_channels ; i ++ )
70177086 band -> channels [i ].flags = IEEE80211_CHAN_DISABLED ;
@@ -7032,6 +7101,8 @@ static int brcmf_construct_chaninfo(struct brcmf_cfg80211_info *cfg,
70327101 band = wiphy -> bands [NL80211_BAND_2GHZ ];
70337102 } else if (ch .band == BRCMU_CHAN_BAND_5G ) {
70347103 band = wiphy -> bands [NL80211_BAND_5GHZ ];
7104+ } else if (ch .band == BRCMU_CHAN_BAND_6G ) {
7105+ band = wiphy -> bands [NL80211_BAND_6GHZ ];
70357106 } else {
70367107 bphy_err (drvr , "Invalid channel Spec. 0x%x.\n" ,
70377108 ch .chspec );
@@ -7746,6 +7817,23 @@ static int brcmf_setup_wiphy(struct wiphy *wiphy, struct brcmf_if *ifp)
77467817 wiphy -> bands [NL80211_BAND_5GHZ ] = band ;
77477818 }
77487819 }
7820+ if (bandlist [i ] == cpu_to_le32 (WLC_BAND_6G )) {
7821+ band = kmemdup (& __wl_band_6ghz , sizeof (__wl_band_6ghz ),
7822+ GFP_KERNEL );
7823+ if (!band )
7824+ return - ENOMEM ;
7825+
7826+ band -> channels = kmemdup (& __wl_6ghz_channels ,
7827+ sizeof (__wl_6ghz_channels ),
7828+ GFP_KERNEL );
7829+ if (!band -> channels ) {
7830+ kfree (band );
7831+ return - ENOMEM ;
7832+ }
7833+
7834+ band -> n_channels = ARRAY_SIZE (__wl_6ghz_channels );
7835+ wiphy -> bands [NL80211_BAND_6GHZ ] = band ;
7836+ }
77497837
77507838 if (wiphy -> bands [NL80211_BAND_5GHZ ] &&
77517839 brcmf_feat_is_enabled (ifp , BRCMF_FEAT_DOT11H ))
@@ -8287,6 +8375,10 @@ static void brcmf_free_wiphy(struct wiphy *wiphy)
82878375 kfree (wiphy -> bands [NL80211_BAND_5GHZ ]-> channels );
82888376 kfree (wiphy -> bands [NL80211_BAND_5GHZ ]);
82898377 }
8378+ if (wiphy -> bands [NL80211_BAND_6GHZ ]) {
8379+ kfree (wiphy -> bands [NL80211_BAND_6GHZ ]-> channels );
8380+ kfree (wiphy -> bands [NL80211_BAND_6GHZ ]);
8381+ }
82908382#if IS_ENABLED (CONFIG_PM )
82918383 if (wiphy -> wowlan != & brcmf_wowlan_support )
82928384 kfree (wiphy -> wowlan );
0 commit comments