]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
wifi: iwlwifi: mvm: handle the new missed beacons notification
authorEmmanuel Grumbach <emmanuel.grumbach@intel.com>
Thu, 8 Aug 2024 20:22:40 +0000 (23:22 +0300)
committerJohannes Berg <johannes.berg@intel.com>
Tue, 27 Aug 2024 08:28:54 +0000 (10:28 +0200)
Use the same handler for both types and just convert the old version to
the new. Drop the unused fields from the old one and fake the new
fields.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20240808232017.a64ffc998569.I7d181052b1a69c331d07263f20c1e00cbc0bc891@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
drivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c
drivers/net/wireless/intel/iwlwifi/mvm/mvm.h
drivers/net/wireless/intel/iwlwifi/mvm/ops.c

index 9209814b465c7644d2eb3cda5adb72d6c54237a2..4a8f50f8bb79befe53efbb4bf77d30c431c0b36a 100644 (file)
@@ -1586,11 +1586,11 @@ void iwl_mvm_rx_beacon_notif(struct iwl_mvm *mvm,
        }
 }
 
-void iwl_mvm_rx_missed_beacons_notif(struct iwl_mvm *mvm,
-                                    struct iwl_rx_cmd_buffer *rxb)
+static void
+iwl_mvm_handle_missed_beacons_notif(struct iwl_mvm *mvm,
+                                   const struct iwl_missed_beacons_notif *mb,
+                                   struct iwl_rx_packet *pkt)
 {
-       struct iwl_rx_packet *pkt = rxb_addr(rxb);
-       struct iwl_missed_beacons_notif_v4 *mb = (void *)pkt->data;
        struct iwl_fw_dbg_trigger_missed_bcon *bcon_trig;
        struct iwl_fw_dbg_trigger_tlv *trigger;
        u32 stop_trig_missed_bcon, stop_trig_missed_bcon_since_rx;
@@ -1604,6 +1604,16 @@ void iwl_mvm_rx_missed_beacons_notif(struct iwl_mvm *mvm,
        u8 notif_ver = iwl_fw_lookup_notif_ver(mvm->fw, LEGACY_GROUP,
                                               MISSED_BEACONS_NOTIFICATION,
                                               0);
+       u8 new_notif_ver = iwl_fw_lookup_notif_ver(mvm->fw, MAC_CONF_GROUP,
+                                                  MISSED_BEACONS_NOTIF, 0);
+
+       /* If the firmware uses the new notification (from MAC_CONF_GROUP),
+        * refer to that notification's version.
+        * Note that the new notification from MAC_CONF_GROUP starts from
+        * version 5.
+        */
+       if (new_notif_ver)
+               notif_ver = new_notif_ver;
 
        /* before version four the ID in the notification refers to mac ID */
        if (notif_ver < 4) {
@@ -1620,13 +1630,11 @@ void iwl_mvm_rx_missed_beacons_notif(struct iwl_mvm *mvm,
        }
 
        IWL_DEBUG_INFO(mvm,
-                      "missed bcn %s_id=%u, consecutive=%u (%u, %u, %u)\n",
+                      "missed bcn %s_id=%u, consecutive=%u (%u)\n",
                       notif_ver < 4 ? "mac" : "link",
                       id,
                       le32_to_cpu(mb->consec_missed_beacons),
-                      le32_to_cpu(mb->consec_missed_beacons_since_last_rx),
-                      le32_to_cpu(mb->num_recvd_beacons),
-                      le32_to_cpu(mb->num_expected_beacons));
+                      le32_to_cpu(mb->consec_missed_beacons_since_last_rx));
 
        if (!vif)
                return;
@@ -1687,6 +1695,31 @@ void iwl_mvm_rx_missed_beacons_notif(struct iwl_mvm *mvm,
                iwl_fw_dbg_collect_trig(&mvm->fwrt, trigger, NULL);
 }
 
+void iwl_mvm_rx_missed_beacons_notif(struct iwl_mvm *mvm,
+                                    struct iwl_rx_cmd_buffer *rxb)
+{
+       struct iwl_rx_packet *pkt = rxb_addr(rxb);
+
+       iwl_mvm_handle_missed_beacons_notif(mvm, (const void *)pkt->data, pkt);
+}
+
+void iwl_mvm_rx_missed_beacons_notif_legacy(struct iwl_mvm *mvm,
+                                           struct iwl_rx_cmd_buffer *rxb)
+{
+       struct iwl_rx_packet *pkt = rxb_addr(rxb);
+       const struct iwl_missed_beacons_notif_v4 *mb_v4 =
+               (const void *)pkt->data;
+       struct iwl_missed_beacons_notif mb = {
+               .link_id = mb_v4->link_id,
+               .consec_missed_beacons = mb_v4->consec_missed_beacons,
+               .consec_missed_beacons_since_last_rx =
+                       mb_v4->consec_missed_beacons_since_last_rx,
+               .other_link_id = cpu_to_le32(IWL_MVM_FW_LINK_ID_INVALID),
+       };
+
+       iwl_mvm_handle_missed_beacons_notif(mvm, &mb, pkt);
+}
+
 void iwl_mvm_rx_stored_beacon_notif(struct iwl_mvm *mvm,
                                    struct iwl_rx_cmd_buffer *rxb)
 {
index 4cacaa7b398e90e3c296cd6607fabcc8fe4224a5..f9e676374daa59f811c1690fda150bfd684ca79a 100644 (file)
@@ -2073,6 +2073,8 @@ void iwl_mvm_rx_beacon_notif(struct iwl_mvm *mvm,
                             struct iwl_rx_cmd_buffer *rxb);
 void iwl_mvm_rx_missed_beacons_notif(struct iwl_mvm *mvm,
                                     struct iwl_rx_cmd_buffer *rxb);
+void iwl_mvm_rx_missed_beacons_notif_legacy(struct iwl_mvm *mvm,
+                                           struct iwl_rx_cmd_buffer *rxb);
 void iwl_mvm_rx_stored_beacon_notif(struct iwl_mvm *mvm,
                                    struct iwl_rx_cmd_buffer *rxb);
 void iwl_mvm_mu_mimo_grp_notif(struct iwl_mvm *mvm,
index dd2631ff452d3ca2bb387ccd0349d44e70f618a0..0b91877592a8ab4997b6172176c471cbf4112bcc 100644 (file)
@@ -394,10 +394,15 @@ static const struct iwl_rx_handlers iwl_mvm_rx_handlers[] = {
                   iwl_mvm_rx_umac_scan_iter_complete_notif, RX_HANDLER_SYNC,
                   struct iwl_umac_scan_iter_complete_notif),
 
-       RX_HANDLER(MISSED_BEACONS_NOTIFICATION, iwl_mvm_rx_missed_beacons_notif,
+       RX_HANDLER(MISSED_BEACONS_NOTIFICATION,
+                  iwl_mvm_rx_missed_beacons_notif_legacy,
                   RX_HANDLER_ASYNC_LOCKED_WIPHY,
                   struct iwl_missed_beacons_notif_v4),
 
+       RX_HANDLER_GRP(MAC_CONF_GROUP, MISSED_BEACONS_NOTIF,
+                      iwl_mvm_rx_missed_beacons_notif,
+                      RX_HANDLER_ASYNC_LOCKED_WIPHY,
+                      struct iwl_missed_beacons_notif),
        RX_HANDLER(REPLY_ERROR, iwl_mvm_rx_fw_error, RX_HANDLER_SYNC,
                   struct iwl_error_resp),
        RX_HANDLER(PSM_UAPSD_AP_MISBEHAVING_NOTIFICATION,