]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
wifi: iwlwifi: add CQM event support for per-link RSSI changes
authorAvinash Bhatt <avinash.bhatt@intel.com>
Fri, 20 Mar 2026 08:09:12 +0000 (10:09 +0200)
committerMiri Korenblit <miriam.rachel.korenblit@intel.com>
Wed, 25 Mar 2026 09:31:57 +0000 (11:31 +0200)
Implement CQM RSSI threshold handling by tracking the last reported RSSI
and issuing CQM low/high events when the RSSI crosses the configured
threshold with the required hysteresis. This provides proper CQM support
and enables userspace to receive per-link RSSI notifications.

Signed-off-by: Avinash Bhatt <avinash.bhatt@intel.com>
Reviewed-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Reviewed-by: Johannes Berg <johannes.berg@intel.com>
Reviewed-by: Pagadala Yesu Anjaneyulu <pagadala.yesu.anjaneyulu@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20260320100746.08697e34bf66.Ic1a68537ef0d37be62c73c138efe9c5cf09bd24c@changeid
drivers/net/wireless/intel/iwlwifi/mld/link.h
drivers/net/wireless/intel/iwlwifi/mld/stats.c

index 9e4da8e4de93d18e257f3295b554503b03b5807a..ca691259fc5e6283571e9f9eeee7e35c7b7c9e52 100644 (file)
@@ -40,6 +40,7 @@ struct iwl_probe_resp_data {
  * @bcast_sta: station used for broadcast packets. Used in AP, GO and IBSS.
  * @mcast_sta: station used for multicast packets. Used in AP, GO and IBSS.
  * @mon_sta: station used for TX injection in monitor interface.
+ * @last_cqm_rssi_event: rssi of the last cqm rssi event
  * @average_beacon_energy: average beacon energy for beacons received during
  *     client connections
  * @ap_early_keys: The firmware cannot install keys before bcast/mcast STAs,
@@ -66,6 +67,7 @@ struct iwl_mld_link {
        struct iwl_mld_int_sta bcast_sta;
        struct iwl_mld_int_sta mcast_sta;
        struct iwl_mld_int_sta mon_sta;
+       int last_cqm_rssi_event;
 
        /* we can only have 2 GTK + 2 IGTK + 2 BIGTK active at a time */
        struct ieee80211_key_conf *ap_early_keys[6];
index 7b8709716324ab4f53df54f9159fb562ae83309b..9b3149b9d2c22cca8602c7f3c5837782fb8f3dac 100644 (file)
@@ -369,15 +369,39 @@ out:
 static void iwl_mld_update_link_sig(struct ieee80211_vif *vif, int sig,
                                    struct ieee80211_bss_conf *bss_conf)
 {
+       struct iwl_mld_link *link = iwl_mld_link_from_mac80211(bss_conf);
        struct iwl_mld *mld = iwl_mld_vif_from_mac80211(vif)->mld;
        int exit_emlsr_thresh;
+       int last_event;
 
        if (sig == 0) {
                IWL_DEBUG_RX(mld, "RSSI is 0 - skip signal based decision\n");
                return;
        }
 
-       /* TODO: task=statistics handle CQM notifications */
+       if (WARN_ON(!link))
+               return;
+
+       /* CQM Notification */
+       if (vif->driver_flags & IEEE80211_VIF_SUPPORTS_CQM_RSSI) {
+               int thold = bss_conf->cqm_rssi_thold;
+               int hyst = bss_conf->cqm_rssi_hyst;
+
+               last_event = link->last_cqm_rssi_event;
+               if (thold && sig < thold &&
+                   (last_event == 0 || sig < last_event - hyst)) {
+                       link->last_cqm_rssi_event = sig;
+                       ieee80211_cqm_rssi_notify(vif,
+                                                 NL80211_CQM_RSSI_THRESHOLD_EVENT_LOW,
+                                                 sig, GFP_KERNEL);
+               } else if (sig > thold &&
+                          (last_event == 0 || sig > last_event + hyst)) {
+                       link->last_cqm_rssi_event = sig;
+                       ieee80211_cqm_rssi_notify(vif,
+                                                 NL80211_CQM_RSSI_THRESHOLD_EVENT_HIGH,
+                                                 sig, GFP_KERNEL);
+               }
+       }
 
        if (!iwl_mld_emlsr_active(vif)) {
                /* We're not in EMLSR and our signal is bad,