@@ -7507,32 +7507,6 @@ static int ath11k_mac_stop_vdev_early(struct ieee80211_hw *hw,
75077507 return 0 ;
75087508}
75097509
7510- static u8 ath11k_mac_get_tpe_count (u8 txpwr_intrprt , u8 txpwr_cnt )
7511- {
7512- switch (txpwr_intrprt ) {
7513- /* Refer "Table 9-276-Meaning of Maximum Transmit Power Count subfield
7514- * if the Maximum Transmit Power Interpretation subfield is 0 or 2" of
7515- * "IEEE Std 802.11ax 2021".
7516- */
7517- case IEEE80211_TPE_LOCAL_EIRP :
7518- case IEEE80211_TPE_REG_CLIENT_EIRP :
7519- txpwr_cnt = txpwr_cnt <= 3 ? txpwr_cnt : 3 ;
7520- txpwr_cnt = txpwr_cnt + 1 ;
7521- break ;
7522- /* Refer "Table 9-277-Meaning of Maximum Transmit Power Count subfield
7523- * if Maximum Transmit Power Interpretation subfield is 1 or 3" of
7524- * "IEEE Std 802.11ax 2021".
7525- */
7526- case IEEE80211_TPE_LOCAL_EIRP_PSD :
7527- case IEEE80211_TPE_REG_CLIENT_EIRP_PSD :
7528- txpwr_cnt = txpwr_cnt <= 4 ? txpwr_cnt : 4 ;
7529- txpwr_cnt = txpwr_cnt ? (BIT (txpwr_cnt - 1 )) : 1 ;
7530- break ;
7531- }
7532-
7533- return txpwr_cnt ;
7534- }
7535-
75367510static u8 ath11k_mac_get_num_pwr_levels (struct cfg80211_chan_def * chan_def )
75377511{
75387512 if (chan_def -> chan -> flags & IEEE80211_CHAN_PSD ) {
@@ -7859,33 +7833,23 @@ static void ath11k_mac_parse_tx_pwr_env(struct ath11k *ar,
78597833 struct ath11k_base * ab = ar -> ab ;
78607834 struct ath11k_vif * arvif = ath11k_vif_to_arvif (vif );
78617835 struct ieee80211_bss_conf * bss_conf = & vif -> bss_conf ;
7862- struct ieee80211_tx_pwr_env * single_tpe ;
7836+ struct ieee80211_parsed_tpe_eirp * non_psd = NULL ;
7837+ struct ieee80211_parsed_tpe_psd * psd = NULL ;
78637838 enum wmi_reg_6ghz_client_type client_type ;
78647839 struct cur_regulatory_info * reg_info ;
7840+ u8 local_tpe_count , reg_tpe_count ;
7841+ bool use_local_tpe ;
78657842 int i ;
7866- u8 pwr_count , pwr_interpret , pwr_category ;
7867- u8 psd_index = 0 , non_psd_index = 0 , local_tpe_count = 0 , reg_tpe_count = 0 ;
7868- bool use_local_tpe , non_psd_set = false, psd_set = false;
78697843
78707844 reg_info = & ab -> reg_info_store [ar -> pdev_idx ];
78717845 client_type = reg_info -> client_type ;
78727846
7873- for (i = 0 ; i < bss_conf -> tx_pwr_env_num ; i ++ ) {
7874- single_tpe = & bss_conf -> tx_pwr_env [i ];
7875- pwr_category = u8_get_bits (single_tpe -> tx_power_info ,
7876- IEEE80211_TX_PWR_ENV_INFO_CATEGORY );
7877- pwr_interpret = u8_get_bits (single_tpe -> tx_power_info ,
7878- IEEE80211_TX_PWR_ENV_INFO_INTERPRET );
7879-
7880- if (pwr_category == client_type ) {
7881- if (pwr_interpret == IEEE80211_TPE_LOCAL_EIRP ||
7882- pwr_interpret == IEEE80211_TPE_LOCAL_EIRP_PSD )
7883- local_tpe_count ++ ;
7884- else if (pwr_interpret == IEEE80211_TPE_REG_CLIENT_EIRP ||
7885- pwr_interpret == IEEE80211_TPE_REG_CLIENT_EIRP_PSD )
7886- reg_tpe_count ++ ;
7887- }
7888- }
7847+ local_tpe_count =
7848+ bss_conf -> tpe .max_local [client_type ].valid +
7849+ bss_conf -> tpe .psd_local [client_type ].valid ;
7850+ reg_tpe_count =
7851+ bss_conf -> tpe .max_reg_client [client_type ].valid +
7852+ bss_conf -> tpe .psd_reg_client [client_type ].valid ;
78897853
78907854 if (!reg_tpe_count && !local_tpe_count ) {
78917855 ath11k_warn (ab ,
@@ -7898,83 +7862,44 @@ static void ath11k_mac_parse_tx_pwr_env(struct ath11k *ar,
78987862 use_local_tpe = false;
78997863 }
79007864
7901- for (i = 0 ; i < bss_conf -> tx_pwr_env_num ; i ++ ) {
7902- single_tpe = & bss_conf -> tx_pwr_env [i ];
7903- pwr_category = u8_get_bits (single_tpe -> tx_power_info ,
7904- IEEE80211_TX_PWR_ENV_INFO_CATEGORY );
7905- pwr_interpret = u8_get_bits (single_tpe -> tx_power_info ,
7906- IEEE80211_TX_PWR_ENV_INFO_INTERPRET );
7907-
7908- if (pwr_category != client_type )
7909- continue ;
7910-
7911- /* get local transmit power envelope */
7912- if (use_local_tpe ) {
7913- if (pwr_interpret == IEEE80211_TPE_LOCAL_EIRP ) {
7914- non_psd_index = i ;
7915- non_psd_set = true;
7916- } else if (pwr_interpret == IEEE80211_TPE_LOCAL_EIRP_PSD ) {
7917- psd_index = i ;
7918- psd_set = true;
7919- }
7920- /* get regulatory transmit power envelope */
7921- } else {
7922- if (pwr_interpret == IEEE80211_TPE_REG_CLIENT_EIRP ) {
7923- non_psd_index = i ;
7924- non_psd_set = true;
7925- } else if (pwr_interpret == IEEE80211_TPE_REG_CLIENT_EIRP_PSD ) {
7926- psd_index = i ;
7927- psd_set = true;
7928- }
7929- }
7865+ if (use_local_tpe ) {
7866+ psd = & bss_conf -> tpe .psd_local [client_type ];
7867+ if (!psd -> valid )
7868+ psd = NULL ;
7869+ non_psd = & bss_conf -> tpe .max_local [client_type ];
7870+ if (!non_psd -> valid )
7871+ non_psd = NULL ;
7872+ } else {
7873+ psd = & bss_conf -> tpe .psd_reg_client [client_type ];
7874+ if (!psd -> valid )
7875+ psd = NULL ;
7876+ non_psd = & bss_conf -> tpe .max_reg_client [client_type ];
7877+ if (!non_psd -> valid )
7878+ non_psd = NULL ;
79307879 }
79317880
7932- if (non_psd_set && !psd_set ) {
7933- single_tpe = & bss_conf -> tx_pwr_env [non_psd_index ];
7934- pwr_count = u8_get_bits (single_tpe -> tx_power_info ,
7935- IEEE80211_TX_PWR_ENV_INFO_COUNT );
7936- pwr_interpret = u8_get_bits (single_tpe -> tx_power_info ,
7937- IEEE80211_TX_PWR_ENV_INFO_INTERPRET );
7881+ if (non_psd && !psd ) {
79387882 arvif -> reg_tpc_info .is_psd_power = false;
79397883 arvif -> reg_tpc_info .eirp_power = 0 ;
79407884
7941- arvif -> reg_tpc_info .num_pwr_levels =
7942- ath11k_mac_get_tpe_count (pwr_interpret , pwr_count );
7885+ arvif -> reg_tpc_info .num_pwr_levels = non_psd -> count ;
79437886
79447887 for (i = 0 ; i < arvif -> reg_tpc_info .num_pwr_levels ; i ++ ) {
79457888 ath11k_dbg (ab , ATH11K_DBG_MAC ,
79467889 "non PSD power[%d] : %d\n" ,
7947- i , single_tpe -> tx_power [i ]);
7948- arvif -> reg_tpc_info .tpe [i ] = single_tpe -> tx_power [i ] / 2 ;
7890+ i , non_psd -> power [i ]);
7891+ arvif -> reg_tpc_info .tpe [i ] = non_psd -> power [i ] / 2 ;
79497892 }
79507893 }
79517894
7952- if (psd_set ) {
7953- single_tpe = & bss_conf -> tx_pwr_env [psd_index ];
7954- pwr_count = u8_get_bits (single_tpe -> tx_power_info ,
7955- IEEE80211_TX_PWR_ENV_INFO_COUNT );
7956- pwr_interpret = u8_get_bits (single_tpe -> tx_power_info ,
7957- IEEE80211_TX_PWR_ENV_INFO_INTERPRET );
7958- arvif -> reg_tpc_info .is_psd_power = true;
7895+ if (psd ) {
7896+ arvif -> reg_tpc_info .num_pwr_levels = psd -> count ;
79597897
7960- if ( pwr_count == 0 ) {
7898+ for ( i = 0 ; i < arvif -> reg_tpc_info . num_pwr_levels ; i ++ ) {
79617899 ath11k_dbg (ab , ATH11K_DBG_MAC ,
7962- "TPE PSD power : %d\n" , single_tpe -> tx_power [0 ]);
7963- arvif -> reg_tpc_info .num_pwr_levels =
7964- ath11k_mac_get_num_pwr_levels (& ctx -> def );
7965-
7966- for (i = 0 ; i < arvif -> reg_tpc_info .num_pwr_levels ; i ++ )
7967- arvif -> reg_tpc_info .tpe [i ] = single_tpe -> tx_power [0 ] / 2 ;
7968- } else {
7969- arvif -> reg_tpc_info .num_pwr_levels =
7970- ath11k_mac_get_tpe_count (pwr_interpret , pwr_count );
7971-
7972- for (i = 0 ; i < arvif -> reg_tpc_info .num_pwr_levels ; i ++ ) {
7973- ath11k_dbg (ab , ATH11K_DBG_MAC ,
7974- "TPE PSD power[%d] : %d\n" ,
7975- i , single_tpe -> tx_power [i ]);
7976- arvif -> reg_tpc_info .tpe [i ] = single_tpe -> tx_power [i ] / 2 ;
7977- }
7900+ "TPE PSD power[%d] : %d\n" ,
7901+ i , psd -> power [i ]);
7902+ arvif -> reg_tpc_info .tpe [i ] = psd -> power [i ] / 2 ;
79787903 }
79797904 }
79807905}
0 commit comments