Skip to content

Commit 966a4d9

Browse files
gabaydjmberg-intel
authored andcommitted
wifi: iwlwifi: Print EMLSR states name
This is useful for debug instead of looking for the hex value. Signed-off-by: Daniel Gabay <daniel.gabay@intel.com> Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com> Link: https://msgid.link/20240505091420.f3509cf652f2.Ic086b6b2132ffe249b3c4bdd24c673ce7fd1b614@changeid Signed-off-by: Johannes Berg <johannes.berg@intel.com>
1 parent a1efeb8 commit 966a4d9

2 files changed

Lines changed: 50 additions & 9 deletions

File tree

drivers/net/wireless/intel/iwlwifi/mvm/link.c

Lines changed: 48 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,34 @@
55
#include "mvm.h"
66
#include "time-event.h"
77

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+
836
static u32 iwl_mvm_get_free_fw_link_id(struct iwl_mvm *mvm,
937
struct iwl_mvm_vif *mvm_vif)
1038
{
@@ -680,10 +708,16 @@ iwl_mvm_esr_disallowed_with_link(struct ieee80211_vif *vif,
680708
if (conf->csa_active)
681709
ret |= IWL_MVM_ESR_EXIT_CSA;
682710

711+
#define NAME_FMT(x) "%s"
712+
#define NAME_PR(x) (ret & IWL_MVM_ESR_##x) ? "[" #x "]" : "",
713+
683714
if (ret)
684715
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);
687721
return ret;
688722
}
689723

@@ -903,8 +937,9 @@ static bool iwl_mvm_check_esr_prevention(struct iwl_mvm *mvm,
903937
IWL_MVM_ESR_PREVENT_LONG;
904938

905939
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);
908943

909944
wiphy_delayed_work_queue(mvm->hw->wiphy,
910945
&mvmvif->prevent_esr_done_wk, delay);
@@ -936,8 +971,9 @@ void iwl_mvm_exit_esr(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
936971

937972
new_active_links = BIT(link_to_keep);
938973
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);
941977

942978
ieee80211_set_active_links_async(vif, new_active_links);
943979

@@ -975,8 +1011,9 @@ void iwl_mvm_block_esr(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
9751011
return;
9761012

9771013
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);
9801017

9811018
mvmvif->esr_disable_reason |= reason;
9821019

@@ -1061,7 +1098,9 @@ void iwl_mvm_unblock_esr(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
10611098
if (!(mvmvif->esr_disable_reason & reason))
10621099
return;
10631100

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);
10651104

10661105
mvmvif->esr_disable_reason &= ~reason;
10671106

drivers/net/wireless/intel/iwlwifi/mvm/mvm.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -353,6 +353,8 @@ struct iwl_mvm_vif_link_info {
353353
* For the blocking reasons - use iwl_mvm_(un)block_esr(), and for the exit
354354
* reasons - use iwl_mvm_exit_esr().
355355
*
356+
* Note: new reasons shall be added to HANDLE_ESR_REASONS as well (for logs)
357+
*
356358
* @IWL_MVM_ESR_BLOCKED_PREVENTION: Prevent EMLSR to avoid entering and exiting
357359
* in a loop.
358360
* @IWL_MVM_ESR_BLOCKED_WOWLAN: WOWLAN is preventing the enablement of EMLSR

0 commit comments

Comments
 (0)