@@ -371,6 +371,7 @@ ieee80211_ibss_add_sta(struct ieee80211_sub_if_data *sdata, const u8 *bssid,
371371 struct sta_info * sta ;
372372 struct ieee80211_chanctx_conf * chanctx_conf ;
373373 struct ieee80211_supported_band * sband ;
374+ enum nl80211_bss_scan_width scan_width ;
374375 int band ;
375376
376377 /*
@@ -399,6 +400,7 @@ ieee80211_ibss_add_sta(struct ieee80211_sub_if_data *sdata, const u8 *bssid,
399400 if (WARN_ON_ONCE (!chanctx_conf ))
400401 return NULL ;
401402 band = chanctx_conf -> def .chan -> band ;
403+ scan_width = cfg80211_chandef_to_scan_width (& chanctx_conf -> def );
402404 rcu_read_unlock ();
403405
404406 sta = sta_info_alloc (sdata , addr , GFP_KERNEL );
@@ -412,7 +414,7 @@ ieee80211_ibss_add_sta(struct ieee80211_sub_if_data *sdata, const u8 *bssid,
412414 /* make sure mandatory rates are always added */
413415 sband = local -> hw .wiphy -> bands [band ];
414416 sta -> sta .supp_rates [band ] = supp_rates |
415- ieee80211_mandatory_rates (sband );
417+ ieee80211_mandatory_rates (sband , scan_width );
416418
417419 return ieee80211_ibss_finish_sta (sta );
418420}
@@ -476,6 +478,7 @@ static void ieee80211_rx_bss_info(struct ieee80211_sub_if_data *sdata,
476478 u64 beacon_timestamp , rx_timestamp ;
477479 u32 supp_rates = 0 ;
478480 enum ieee80211_band band = rx_status -> band ;
481+ enum nl80211_bss_scan_width scan_width ;
479482 struct ieee80211_supported_band * sband = local -> hw .wiphy -> bands [band ];
480483 bool rates_updated = false;
481484
@@ -504,9 +507,15 @@ static void ieee80211_rx_bss_info(struct ieee80211_sub_if_data *sdata,
504507
505508 prev_rates = sta -> sta .supp_rates [band ];
506509 /* make sure mandatory rates are always added */
507- sta -> sta .supp_rates [band ] = supp_rates |
508- ieee80211_mandatory_rates (sband );
510+ scan_width = NL80211_BSS_CHAN_WIDTH_20 ;
511+ if (rx_status -> flag & RX_FLAG_5MHZ )
512+ scan_width = NL80211_BSS_CHAN_WIDTH_5 ;
513+ if (rx_status -> flag & RX_FLAG_10MHZ )
514+ scan_width = NL80211_BSS_CHAN_WIDTH_10 ;
509515
516+ sta -> sta .supp_rates [band ] = supp_rates |
517+ ieee80211_mandatory_rates (sband ,
518+ scan_width );
510519 if (sta -> sta .supp_rates [band ] != prev_rates ) {
511520 ibss_dbg (sdata ,
512521 "updated supp_rates set for %pM based on beacon/probe_resp (0x%x -> 0x%x)\n" ,
@@ -640,6 +649,7 @@ void ieee80211_ibss_rx_no_sta(struct ieee80211_sub_if_data *sdata,
640649 struct sta_info * sta ;
641650 struct ieee80211_chanctx_conf * chanctx_conf ;
642651 struct ieee80211_supported_band * sband ;
652+ enum nl80211_bss_scan_width scan_width ;
643653 int band ;
644654
645655 /*
@@ -665,6 +675,7 @@ void ieee80211_ibss_rx_no_sta(struct ieee80211_sub_if_data *sdata,
665675 return ;
666676 }
667677 band = chanctx_conf -> def .chan -> band ;
678+ scan_width = cfg80211_chandef_to_scan_width (& chanctx_conf -> def );
668679 rcu_read_unlock ();
669680
670681 sta = sta_info_alloc (sdata , addr , GFP_ATOMIC );
@@ -676,7 +687,7 @@ void ieee80211_ibss_rx_no_sta(struct ieee80211_sub_if_data *sdata,
676687 /* make sure mandatory rates are always added */
677688 sband = local -> hw .wiphy -> bands [band ];
678689 sta -> sta .supp_rates [band ] = supp_rates |
679- ieee80211_mandatory_rates (sband );
690+ ieee80211_mandatory_rates (sband , scan_width );
680691
681692 spin_lock (& ifibss -> incomplete_lock );
682693 list_add (& sta -> list , & ifibss -> incomplete_stations );
0 commit comments