@@ -951,12 +951,19 @@ iwl_mvm_stat_iterator_all_links(struct iwl_mvm *mvm,
951
951
}
952
952
}
953
953
954
+ #define SEC_LINK_MIN_PERC 10
955
+ #define SEC_LINK_MIN_TX 3000
956
+ #define SEC_LINK_MIN_RX 400
957
+
954
958
static void iwl_mvm_update_esr_mode_tpt (struct iwl_mvm * mvm )
955
959
{
956
960
struct ieee80211_vif * bss_vif = iwl_mvm_get_bss_vif (mvm );
957
961
struct iwl_mvm_vif * mvmvif ;
958
962
struct iwl_mvm_sta * mvmsta ;
959
963
unsigned long total_tx = 0 , total_rx = 0 ;
964
+ unsigned long sec_link_tx = 0 , sec_link_rx = 0 ;
965
+ u8 sec_link_tx_perc , sec_link_rx_perc ;
966
+ u8 sec_link ;
960
967
961
968
lockdep_assert_held (& mvm -> mutex );
962
969
@@ -973,6 +980,13 @@ static void iwl_mvm_update_esr_mode_tpt(struct iwl_mvm *mvm)
973
980
if (!mvmsta -> mpdu_counters )
974
981
return ;
975
982
983
+ /* Get the FW ID of the secondary link */
984
+ sec_link = iwl_mvm_get_other_link (bss_vif ,
985
+ iwl_mvm_get_primary_link (bss_vif ));
986
+ if (WARN_ON (!mvmvif -> link [sec_link ]))
987
+ return ;
988
+ sec_link = mvmvif -> link [sec_link ]-> fw_link_id ;
989
+
976
990
/* Sum up RX and TX MPDUs from the different queues/links */
977
991
for (int q = 0 ; q < mvm -> trans -> num_rx_queues ; q ++ ) {
978
992
spin_lock_bh (& mvmsta -> mpdu_counters [q ].lock );
@@ -982,6 +996,10 @@ static void iwl_mvm_update_esr_mode_tpt(struct iwl_mvm *mvm)
982
996
total_tx += mvmsta -> mpdu_counters [q ].per_link [link ].tx ;
983
997
total_rx += mvmsta -> mpdu_counters [q ].per_link [link ].rx ;
984
998
}
999
+
1000
+ sec_link_tx += mvmsta -> mpdu_counters [q ].per_link [sec_link ].tx ;
1001
+ sec_link_rx += mvmsta -> mpdu_counters [q ].per_link [sec_link ].rx ;
1002
+
985
1003
/*
986
1004
* In EMLSR we have statistics every 5 seconds, so we can reset
987
1005
* the counters upon every statistics notification.
@@ -994,9 +1012,26 @@ static void iwl_mvm_update_esr_mode_tpt(struct iwl_mvm *mvm)
994
1012
995
1013
/* If we don't have enough MPDUs - exit EMLSR */
996
1014
if (total_tx < IWL_MVM_ENTER_ESR_TPT_THRESH &&
997
- total_rx < IWL_MVM_ENTER_ESR_TPT_THRESH )
1015
+ total_rx < IWL_MVM_ENTER_ESR_TPT_THRESH ) {
998
1016
iwl_mvm_block_esr (mvm , bss_vif , IWL_MVM_ESR_BLOCKED_TPT ,
999
1017
iwl_mvm_get_primary_link (bss_vif ));
1018
+ return ;
1019
+ }
1020
+
1021
+ /* Calculate the percentage of the secondary link TX/RX */
1022
+ sec_link_tx_perc = total_tx ? sec_link_tx * 100 / total_tx : 0 ;
1023
+ sec_link_rx_perc = total_rx ? sec_link_rx * 100 / total_rx : 0 ;
1024
+
1025
+ /*
1026
+ * The TX/RX percentage is checked only if it exceeds the required
1027
+ * minimum. In addition, RX is checked only if the TX check failed.
1028
+ */
1029
+ if ((total_tx > SEC_LINK_MIN_TX &&
1030
+ sec_link_tx_perc < SEC_LINK_MIN_PERC ) ||
1031
+ (total_rx > SEC_LINK_MIN_RX &&
1032
+ sec_link_rx_perc < SEC_LINK_MIN_PERC ))
1033
+ iwl_mvm_exit_esr (mvm , bss_vif , IWL_MVM_ESR_EXIT_LINK_USAGE ,
1034
+ iwl_mvm_get_primary_link (bss_vif ));
1000
1035
}
1001
1036
1002
1037
void iwl_mvm_handle_rx_system_oper_stats (struct iwl_mvm * mvm ,
0 commit comments