|
5 | 5 | #include "mvm.h" |
6 | 6 | #include "time-event.h" |
7 | 7 |
|
| 8 | +#define HANDLE_ESR_REASONS(HOW) \ |
| 9 | + HOW(BLOCKED_PREVENTION) \ |
| 10 | + HOW(BLOCKED_WOWLAN) \ |
| 11 | + HOW(BLOCKED_TPT) \ |
| 12 | + HOW(BLOCKED_FW) \ |
| 13 | + HOW(BLOCKED_NON_BSS) \ |
| 14 | + HOW(EXIT_MISSED_BEACON) \ |
| 15 | + HOW(EXIT_LOW_RSSI) \ |
| 16 | + HOW(EXIT_COEX) \ |
| 17 | + HOW(EXIT_BANDWIDTH) \ |
| 18 | + HOW(EXIT_CSA) |
| 19 | + |
| 20 | +static const char *const iwl_mvm_esr_states_names[] = { |
| 21 | +#define NAME_ENTRY(x) [ilog2(IWL_MVM_ESR_##x)] = #x, |
| 22 | + HANDLE_ESR_REASONS(NAME_ENTRY) |
| 23 | +}; |
| 24 | + |
| 25 | +static const char *iwl_get_esr_state_string(enum iwl_mvm_esr_state state) |
| 26 | +{ |
| 27 | + int offs = ilog2(state); |
| 28 | + |
| 29 | + if (offs >= ARRAY_SIZE(iwl_mvm_esr_states_names) || |
| 30 | + !iwl_mvm_esr_states_names[offs]) |
| 31 | + return "UNKNOWN"; |
| 32 | + |
| 33 | + return iwl_mvm_esr_states_names[offs]; |
| 34 | +} |
| 35 | + |
8 | 36 | static u32 iwl_mvm_get_free_fw_link_id(struct iwl_mvm *mvm, |
9 | 37 | struct iwl_mvm_vif *mvm_vif) |
10 | 38 | { |
@@ -680,10 +708,16 @@ iwl_mvm_esr_disallowed_with_link(struct ieee80211_vif *vif, |
680 | 708 | if (conf->csa_active) |
681 | 709 | ret |= IWL_MVM_ESR_EXIT_CSA; |
682 | 710 |
|
| 711 | +#define NAME_FMT(x) "%s" |
| 712 | +#define NAME_PR(x) (ret & IWL_MVM_ESR_##x) ? "[" #x "]" : "", |
| 713 | + |
683 | 714 | if (ret) |
684 | 715 | IWL_DEBUG_INFO(mvm, |
685 | | - "Link %d is not allowed for esr. Reason: 0x%x\n", |
686 | | - link->link_id, ret); |
| 716 | + "Link %d is not allowed for esr. reason = " |
| 717 | + HANDLE_ESR_REASONS(NAME_FMT) " (0x%x)\n", |
| 718 | + link->link_id, |
| 719 | + HANDLE_ESR_REASONS(NAME_PR) |
| 720 | + ret); |
687 | 721 | return ret; |
688 | 722 | } |
689 | 723 |
|
@@ -903,8 +937,9 @@ static bool iwl_mvm_check_esr_prevention(struct iwl_mvm *mvm, |
903 | 937 | IWL_MVM_ESR_PREVENT_LONG; |
904 | 938 |
|
905 | 939 | IWL_DEBUG_INFO(mvm, |
906 | | - "Preventing EMLSR for %ld seconds due to %u exits with the reason 0x%x\n", |
907 | | - delay / HZ, mvmvif->exit_same_reason_count, reason); |
| 940 | + "Preventing EMLSR for %ld seconds due to %u exits with the reason = %s (0x%x)\n", |
| 941 | + delay / HZ, mvmvif->exit_same_reason_count, |
| 942 | + iwl_get_esr_state_string(reason), reason); |
908 | 943 |
|
909 | 944 | wiphy_delayed_work_queue(mvm->hw->wiphy, |
910 | 945 | &mvmvif->prevent_esr_done_wk, delay); |
@@ -936,8 +971,9 @@ void iwl_mvm_exit_esr(struct iwl_mvm *mvm, struct ieee80211_vif *vif, |
936 | 971 |
|
937 | 972 | new_active_links = BIT(link_to_keep); |
938 | 973 | IWL_DEBUG_INFO(mvm, |
939 | | - "Exiting EMLSR. Reason = 0x%x. Current active links=0x%x, new active links = 0x%x\n", |
940 | | - reason, vif->active_links, new_active_links); |
| 974 | + "Exiting EMLSR. reason = %s (0x%x). Current active links=0x%x, new active links = 0x%x\n", |
| 975 | + iwl_get_esr_state_string(reason), reason, |
| 976 | + vif->active_links, new_active_links); |
941 | 977 |
|
942 | 978 | ieee80211_set_active_links_async(vif, new_active_links); |
943 | 979 |
|
@@ -975,8 +1011,9 @@ void iwl_mvm_block_esr(struct iwl_mvm *mvm, struct ieee80211_vif *vif, |
975 | 1011 | return; |
976 | 1012 |
|
977 | 1013 | if (!(mvmvif->esr_disable_reason & reason)) |
978 | | - IWL_DEBUG_INFO(mvm, "Blocking EMLSR mode. reason = 0x%x\n", |
979 | | - reason); |
| 1014 | + IWL_DEBUG_INFO(mvm, |
| 1015 | + "Blocking EMLSR mode. reason = %s (0x%x)\n", |
| 1016 | + iwl_get_esr_state_string(reason), reason); |
980 | 1017 |
|
981 | 1018 | mvmvif->esr_disable_reason |= reason; |
982 | 1019 |
|
@@ -1061,7 +1098,9 @@ void iwl_mvm_unblock_esr(struct iwl_mvm *mvm, struct ieee80211_vif *vif, |
1061 | 1098 | if (!(mvmvif->esr_disable_reason & reason)) |
1062 | 1099 | return; |
1063 | 1100 |
|
1064 | | - IWL_DEBUG_INFO(mvm, "Unblocking EMLSR mode. reason = 0x%x\n", reason); |
| 1101 | + IWL_DEBUG_INFO(mvm, |
| 1102 | + "Unblocking EMLSR mode. reason = %s (0x%x)\n", |
| 1103 | + iwl_get_esr_state_string(reason), reason); |
1065 | 1104 |
|
1066 | 1105 | mvmvif->esr_disable_reason &= ~reason; |
1067 | 1106 |
|
|
0 commit comments