wifi: iwlwifi: handle reasons recommended by FW for leaving EMLSR

FW sends new notification version 2 indicating whether activating EMLSR
mode is recommended or not. If recommendation is to leave EMLSR or force
leave then FW sends the reason. Add debug log for the reason sent by FW.

Signed-off-by: Somashekhar Puttagangaiah <somashekhar.puttagangaiah@intel.com>
Reviewed-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20250503224231.0582726248a4.I9d1d00eb98d10a3a742cb3e06665ce10e5ec93f0@changeid
This commit is contained in:
Somashekhar Puttagangaiah
2025-05-03 22:44:26 +03:00
committed by Miri Korenblit
parent 7aeec8c8d6
commit 9babfb5f1f
4 changed files with 66 additions and 13 deletions

View File

@@ -98,7 +98,7 @@ enum iwl_data_path_subcmd_ids {
/**
* @ESR_MODE_NOTIF: notification to recommend/force a wanted esr mode,
* uses &struct iwl_esr_mode_notif
* uses &struct iwl_esr_mode_notif or &struct iwl_esr_mode_notif_v1
*/
ESR_MODE_NOTIF = 0xF3,

View File

@@ -686,9 +686,9 @@ struct iwl_mvm_sta_disable_tx_cmd {
/**
* enum iwl_mvm_fw_esr_recommendation - FW recommendation code
* @ESR_RECOMMEND_LEAVE: recommendation to leave esr
* @ESR_FORCE_LEAVE: force exiting esr
* @ESR_RECOMMEND_ENTER: recommendation to enter esr
* @ESR_RECOMMEND_LEAVE: recommendation to leave EMLSR
* @ESR_FORCE_LEAVE: force exiting EMLSR
* @ESR_RECOMMEND_ENTER: recommendation to enter EMLSR
*/
enum iwl_mvm_fw_esr_recommendation {
ESR_RECOMMEND_LEAVE,
@@ -697,13 +697,44 @@ enum iwl_mvm_fw_esr_recommendation {
}; /* ESR_MODE_RECOMMENDATION_CODE_API_E_VER_1 */
/**
* struct iwl_esr_mode_notif - FWs recommendation/force for esr mode
* struct iwl_esr_mode_notif_v1 - FW recommendation/force for EMLSR mode
*
* @action: the action to apply on esr state. See &iwl_mvm_fw_esr_recommendation
* @action: the action to apply on EMLSR state.
* See &iwl_mvm_fw_esr_recommendation
*/
struct iwl_esr_mode_notif_v1 {
__le32 action;
} __packed; /* ESR_MODE_RECOMMENDATION_NTFY_API_S_VER_1 */
/**
* enum iwl_esr_leave_reason - reasons for leaving EMLSR mode
*
* @ESR_LEAVE_REASON_OMI_MU_UL_DISALLOWED: OMI MU UL disallowed
* @ESR_LEAVE_REASON_NO_TRIG_FOR_ESR_STA: No trigger for EMLSR station
* @ESR_LEAVE_REASON_NO_ESR_STA_IN_MU_DL: No EMLSR station in MU DL
* @ESR_LEAVE_REASON_BAD_ACTIV_FRAME_TH: Bad activation frame threshold
* @ESR_LEAVE_REASON_RTS_IN_DUAL_LISTEN: RTS in dual listen
*/
enum iwl_esr_leave_reason {
ESR_LEAVE_REASON_OMI_MU_UL_DISALLOWED = BIT(0),
ESR_LEAVE_REASON_NO_TRIG_FOR_ESR_STA = BIT(1),
ESR_LEAVE_REASON_NO_ESR_STA_IN_MU_DL = BIT(2),
ESR_LEAVE_REASON_BAD_ACTIV_FRAME_TH = BIT(3),
ESR_LEAVE_REASON_RTS_IN_DUAL_LISTEN = BIT(4),
};
/**
* struct iwl_esr_mode_notif - FW recommendation/force for EMLSR mode
*
* @action: the action to apply on EMLSR state.
* See &iwl_mvm_fw_esr_recommendation
* @leave_reason_mask: mask for various reasons to leave EMLSR mode.
* See &iwl_esr_leave_reason
*/
struct iwl_esr_mode_notif {
__le32 action;
} __packed; /* ESR_MODE_RECOMMENDATION_NTFY_API_S_VER_1 */
__le32 leave_reason_mask;
} __packed; /* ESR_MODE_RECOMMENDATION_NTFY_API_S_VER_2 */
/**
* struct iwl_missed_beacons_notif - sent when by the firmware upon beacon loss

View File

@@ -326,23 +326,44 @@ static void
iwl_mld_vif_iter_emlsr_mode_notif(void *data, u8 *mac,
struct ieee80211_vif *vif)
{
struct iwl_mld_vif *mld_vif = iwl_mld_vif_from_mac80211(vif);
struct iwl_esr_mode_notif *notif = (void *)data;
const struct iwl_mld_vif *mld_vif = iwl_mld_vif_from_mac80211(vif);
enum iwl_mvm_fw_esr_recommendation action;
const struct iwl_esr_mode_notif *notif = NULL;
if (iwl_fw_lookup_notif_ver(mld_vif->mld->fw, DATA_PATH_GROUP,
ESR_MODE_NOTIF, 0) > 1) {
notif = (void *)data;
action = le32_to_cpu(notif->action);
} else {
const struct iwl_esr_mode_notif_v1 *notif_v1 = (void *)data;
action = le32_to_cpu(notif_v1->action);
}
if (!iwl_mld_vif_has_emlsr_cap(vif))
return;
switch (le32_to_cpu(notif->action)) {
switch (action) {
case ESR_RECOMMEND_LEAVE:
if (notif)
IWL_DEBUG_INFO(mld_vif->mld,
"FW recommend leave reason = 0x%x\n",
le32_to_cpu(notif->leave_reason_mask));
iwl_mld_exit_emlsr(mld_vif->mld, vif,
IWL_MLD_EMLSR_EXIT_FW_REQUEST,
iwl_mld_get_primary_link(vif));
break;
case ESR_RECOMMEND_ENTER:
case ESR_FORCE_LEAVE:
if (notif)
IWL_DEBUG_INFO(mld_vif->mld,
"FW force leave reason = 0x%x\n",
le32_to_cpu(notif->leave_reason_mask));
fallthrough;
case ESR_RECOMMEND_ENTER:
default:
IWL_WARN(mld_vif->mld, "Unexpected EMLSR notification: %d\n",
le32_to_cpu(notif->action));
action);
}
}

View File

@@ -336,7 +336,8 @@ CMD_VERSIONS(bt_coex_notif,
CMD_VERSIONS(beacon_notification,
CMD_VER_ENTRY(6, iwl_extended_beacon_notif))
CMD_VERSIONS(emlsr_mode_notif,
CMD_VER_ENTRY(1, iwl_esr_mode_notif))
CMD_VER_ENTRY(1, iwl_esr_mode_notif_v1)
CMD_VER_ENTRY(2, iwl_esr_mode_notif))
CMD_VERSIONS(emlsr_trans_fail_notif,
CMD_VER_ENTRY(1, iwl_esr_trans_fail_notif))
CMD_VERSIONS(uapsd_misbehaving_ap_notif,