@@ -580,7 +580,7 @@ static void iwl_init_vht_hw_capab(struct iwl_trans *trans,
580
580
cpu_to_le16 (IEEE80211_VHT_EXT_NSS_BW_CAPABLE );
581
581
}
582
582
583
- static struct ieee80211_sband_iftype_data iwl_he_capa [] = {
583
+ static const struct ieee80211_sband_iftype_data iwl_he_capa [] = {
584
584
{
585
585
.types_mask = BIT (NL80211_IFTYPE_STATION ),
586
586
.he_cap = {
@@ -748,19 +748,42 @@ static void iwl_init_he_hw_capab(struct iwl_trans *trans,
748
748
struct ieee80211_supported_band * sband ,
749
749
u8 tx_chains , u8 rx_chains )
750
750
{
751
- sband -> iftype_data = iwl_he_capa ;
751
+ struct ieee80211_sband_iftype_data * iftype_data ;
752
+
753
+ /* should only initialize once */
754
+ if (WARN_ON (sband -> iftype_data ))
755
+ return ;
756
+
757
+ BUILD_BUG_ON (sizeof (data -> iftd .low ) != sizeof (iwl_he_capa ));
758
+ BUILD_BUG_ON (sizeof (data -> iftd .high ) != sizeof (iwl_he_capa ));
759
+
760
+ switch (sband -> band ) {
761
+ case NL80211_BAND_2GHZ :
762
+ iftype_data = data -> iftd .low ;
763
+ break ;
764
+ case NL80211_BAND_5GHZ :
765
+ iftype_data = data -> iftd .high ;
766
+ break ;
767
+ default :
768
+ WARN_ON (1 );
769
+ return ;
770
+ }
771
+
772
+ memcpy (iftype_data , iwl_he_capa , sizeof (iwl_he_capa ));
773
+
774
+ sband -> iftype_data = iftype_data ;
752
775
sband -> n_iftype_data = ARRAY_SIZE (iwl_he_capa );
753
776
754
777
/* If not 2x2, we need to indicate 1x1 in the Midamble RX Max NSTS */
755
778
if ((tx_chains & rx_chains ) != ANT_AB ) {
756
779
int i ;
757
780
758
781
for (i = 0 ; i < sband -> n_iftype_data ; i ++ ) {
759
- iwl_he_capa [i ].he_cap .he_cap_elem .phy_cap_info [1 ] &=
782
+ iftype_data [i ].he_cap .he_cap_elem .phy_cap_info [1 ] &=
760
783
~IEEE80211_HE_PHY_CAP1_MIDAMBLE_RX_TX_MAX_NSTS ;
761
- iwl_he_capa [i ].he_cap .he_cap_elem .phy_cap_info [2 ] &=
784
+ iftype_data [i ].he_cap .he_cap_elem .phy_cap_info [2 ] &=
762
785
~IEEE80211_HE_PHY_CAP2_MIDAMBLE_RX_TX_MAX_NSTS ;
763
- iwl_he_capa [i ].he_cap .he_cap_elem .phy_cap_info [7 ] &=
786
+ iftype_data [i ].he_cap .he_cap_elem .phy_cap_info [7 ] &=
764
787
~IEEE80211_HE_PHY_CAP7_MAX_NC_MASK ;
765
788
}
766
789
}
0 commit comments