]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
wifi: iwlwifi: mvm: tell the firmware about CSA with mode=1
authorEmmanuel Grumbach <emmanuel.grumbach@intel.com>
Sun, 1 Sep 2024 04:17:51 +0000 (07:17 +0300)
committerJohannes Berg <johannes.berg@intel.com>
Tue, 3 Sep 2024 09:55:26 +0000 (11:55 +0200)
When we de-activate a link because it started a CSA with mode=1, we want
to tell the firmware it can no longer transmit any frame for that link.
The firmware will do that on its own if the CSA indication (beacon /
action frame) was  received on that same link, but with MLO, things got
more complex and the firmware can't track cross link CSA.

Tell the firmware if we de-activate a link because of CSA with mode=1 to
prevent it from transmitting, even if it is only an NDP PM=1 frame that
is part of the de-activation flow.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20240901071542.4bef89d438d4.If7147a7a84054e67c05414c753d73f4e2e0e6e37@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
drivers/net/wireless/intel/iwlwifi/fw/api/mac-cfg.h
drivers/net/wireless/intel/iwlwifi/mvm/link.c
drivers/net/wireless/intel/iwlwifi/mvm/mld-mac80211.c
drivers/net/wireless/intel/iwlwifi/mvm/mvm.h

index 7af580d1c99c16f61b391dd762869933d3cf2235..73586e547e57fb0f4db181829c077770d69394d1 100644 (file)
@@ -454,6 +454,9 @@ enum iwl_link_ctx_flags {
  * @listen_lmac: indicates whether the link should be allocated on the Listen
  *     Lmac or on the Main Lmac. Cannot be changed on an active Link.
  *     Relevant only for eSR.
+ * @block_tx: tell the firmware that this link can't Tx. This should be used
+ *     only when a link is de-activated because of CSA with mode = 1.
+ *     Available since version 5.
  * @reserved1: in version 2, listen_lmac became reserved
  * @cck_rates: basic rates available for CCK
  * @ofdm_rates: basic rates available for OFDM
@@ -498,7 +501,10 @@ struct iwl_link_config_cmd {
        __le32 active;
        union {
                __le32 listen_lmac;
-               __le32 reserved1;
+               struct {
+                       u8 block_tx;
+                       u8 reserved1[3];
+               };
        };
        __le32 cck_rates;
        __le32 ofdm_rates;
@@ -529,7 +535,7 @@ struct iwl_link_config_cmd {
        u8 ibss_bssid_addr[6];
        __le16 reserved_for_ibss_bssid_addr;
        __le32 reserved3[8];
-} __packed; /* LINK_CONTEXT_CONFIG_CMD_API_S_VER_1, _VER_2, _VER_3, _VER_4 */
+} __packed; /* LINK_CONTEXT_CONFIG_CMD_API_S_VER_1, _VER_2, _VER_3, _VER_4, _VER_5 */
 
 /* Currently FW supports link ids in the range 0-3 and can have
  * at most two active links for each vif.
index d151d935e12ac860f755934c6f8cbbf6bb9e577b..bc8d0612774774e3b06d53ba7fc556d57d80c5ea 100644 (file)
@@ -234,10 +234,15 @@ int iwl_mvm_link_changed(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
                WARN_ON_ONCE(active == link_info->active);
 
                /* When deactivating a link session protection should
-                * be stopped
+                * be stopped. Also let the firmware know if we can't Tx.
                 */
-               if (!active && vif->type == NL80211_IFTYPE_STATION)
+               if (!active && vif->type == NL80211_IFTYPE_STATION) {
                        iwl_mvm_stop_session_protection(mvm, vif);
+                       if (link_info->csa_block_tx) {
+                               cmd.block_tx = 1;
+                               link_info->csa_block_tx = false;
+                       }
+               }
        }
 
        cmd.link_id = cpu_to_le32(link_info->fw_link_id);
index 72bb6865dd635c512a9a8e56998baab14e62b7c4..f2378e0fb2fb38edf6259d583442ff80af881c2c 100644 (file)
@@ -1341,6 +1341,22 @@ iwl_mvm_mld_mac_pre_channel_switch(struct ieee80211_hw *hw,
                else
                        selected = primary;
 
+               /*
+                * remembers to tell the firmware that this link can't tx
+                * Note that this logic seems to be unrelated to esr, but it
+                * really is needed only when esr is active. When we have a
+                * single link, the firmware will handle all this on its own.
+                * In multi-link scenarios, we can learn about the CSA from
+                * another link and this logic is too complex for the firmware
+                * to track.
+                * Since we want to de-activate the link that got a CSA, we
+                * need to tell the firmware not to send any frame on that link
+                * as the firmware may not be aware that link is under a CSA
+                * with mode=1 (no Tx allowed).
+                */
+               if (chsw->block_tx && mvmvif->link[chsw->link_id])
+                       mvmvif->link[chsw->link_id]->csa_block_tx = true;
+
                iwl_mvm_exit_esr(mvm, vif, IWL_MVM_ESR_EXIT_CSA, selected);
                mutex_unlock(&mvm->mutex);
 
index 68464f892e85728ef90caa108ba90f9f445a729c..26adf9f9b8c3475d241e626df89352f75eaf515b 100644 (file)
@@ -299,6 +299,7 @@ struct iwl_probe_resp_data {
  * @active: indicates the link is active in FW (for sanity checking)
  * @cab_queue: content-after-beacon (multicast) queue
  * @listen_lmac: indicates this link is allocated to the listen LMAC
+ * @csa_block_tx: we got CSA with mode=1
  * @mcast_sta: multicast station
  * @phy_ctxt: phy context allocated to this link, if any
  * @bf_data: beacon filtering data
@@ -324,6 +325,7 @@ struct iwl_mvm_vif_link_info {
        bool he_ru_2mhz_block;
        bool active;
        bool listen_lmac;
+       bool csa_block_tx;
 
        u16 cab_queue;
        /* Assigned while mac80211 has the link in a channel context,