]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
wifi: iwlwifi: handle reasons recommended by FW for leaving EMLSR
authorSomashekhar Puttagangaiah <somashekhar.puttagangaiah@intel.com>
Sat, 3 May 2025 19:44:26 +0000 (22:44 +0300)
committerMiri Korenblit <miriam.rachel.korenblit@intel.com>
Wed, 7 May 2025 03:08:00 +0000 (06:08 +0300)
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
drivers/net/wireless/intel/iwlwifi/fw/api/datapath.h
drivers/net/wireless/intel/iwlwifi/fw/api/mac-cfg.h
drivers/net/wireless/intel/iwlwifi/mld/mlo.c
drivers/net/wireless/intel/iwlwifi/mld/notif.c

index c139b965980d562bd6f860b82d1cbba29059fd84..9c88bb280609c323118fbf1bd069e6e4ad90147c 100644 (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,
 
index b511e3aa6bb2f441edab3b2899ae188d549963d4..35a370918251639f67274b3e1cb4ba6ea8b5ff91 100644 (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,14 +697,45 @@ 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 {
+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;
+       __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
  *  ( MISSED_BEACONS_NOTIF = 0xF6 )
index 824a328da28ef2250d6c4c0ea7ba666716217eee..189946d5b2cbef7ead5cf4a82f5af255aa984fb4 100644 (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);
        }
 }
 
index 76b1a21135a88dd5e6e9b139a74d1c076751c397..61e00b13f2ce70dbf61930bb6e40f74d3cad0e83 100644 (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,