Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net
[sfrench/cifs-2.6.git] / drivers / net / wireless / intel / iwlwifi / mvm / mac-ctxt.c
index 25a5a31e63c2a33a0fc0bbe7317f65df62b9e8de..228ede7b8957c9645a3a3436f297513595d8e37c 100644 (file)
@@ -1,6 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause
 /*
- * Copyright (C) 2012-2014, 2018-2023 Intel Corporation
+ * Copyright (C) 2012-2014, 2018-2024 Intel Corporation
  * Copyright (C) 2013-2014 Intel Mobile Communications GmbH
  * Copyright (C) 2015-2017 Intel Deutschland GmbH
  */
@@ -466,7 +466,7 @@ void iwl_mvm_set_fw_protection_flags(struct iwl_mvm *mvm,
                break;
        case IEEE80211_HT_OP_MODE_PROTECTION_20MHZ:
                /* Protect when channel wider than 20MHz */
-               if (link_conf->chandef.width > NL80211_CHAN_WIDTH_20)
+               if (link_conf->chanreq.oper.width > NL80211_CHAN_WIDTH_20)
                        *protection_flags |= cpu_to_le32(ht_flag);
                break;
        default:
@@ -505,7 +505,7 @@ void iwl_mvm_set_fw_qos_params(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
        if (link_conf->qos)
                *qos_flags |= cpu_to_le32(MAC_QOS_FLG_UPDATE_EDCA);
 
-       if (link_conf->chandef.width != NL80211_CHAN_WIDTH_20_NOHT)
+       if (link_conf->chanreq.oper.width != NL80211_CHAN_WIDTH_20_NOHT)
                *qos_flags |= cpu_to_le32(MAC_QOS_FLG_TGN);
 }
 
@@ -921,8 +921,8 @@ u8 iwl_mvm_mac_ctxt_get_lowest_rate(struct iwl_mvm *mvm,
                link_conf = rcu_dereference(vif->link_conf[link_id]);
                if (link_conf) {
                        basic = link_conf->basic_rates;
-                       if (link_conf->chandef.chan)
-                               band = link_conf->chandef.chan->band;
+                       if (link_conf->chanreq.oper.chan)
+                               band = link_conf->chanreq.oper.chan->band;
                }
                rcu_read_unlock();
        }
@@ -1477,8 +1477,8 @@ static void iwl_mvm_csa_count_down(struct iwl_mvm *mvm,
 
        mvmvif->csa_countdown = true;
 
-       if (!ieee80211_beacon_cntdwn_is_complete(csa_vif)) {
-               int c = ieee80211_beacon_update_cntdwn(csa_vif);
+       if (!ieee80211_beacon_cntdwn_is_complete(csa_vif, 0)) {
+               int c = ieee80211_beacon_update_cntdwn(csa_vif, 0);
 
                iwl_mvm_mac_ctxt_beacon_changed(mvm, csa_vif,
                                                &csa_vif->bss_conf);
@@ -1497,7 +1497,7 @@ static void iwl_mvm_csa_count_down(struct iwl_mvm *mvm,
                }
        } else if (!iwl_mvm_te_scheduled(&mvmvif->time_event_data)) {
                /* we don't have CSA NoA scheduled yet, switch now */
-               ieee80211_csa_finish(csa_vif);
+               ieee80211_csa_finish(csa_vif, 0);
                RCU_INIT_POINTER(mvm->csa_vif, NULL);
        }
 }
@@ -1637,10 +1637,22 @@ void iwl_mvm_rx_missed_beacons_notif(struct iwl_mvm *mvm,
         * TODO: the threshold should be adjusted based on latency conditions,
         * and/or in case of a CS flow on one of the other AP vifs.
         */
-       if (rx_missed_bcon > IWL_MVM_MISSED_BEACONS_THRESHOLD_LONG)
-               iwl_mvm_connection_loss(mvm, vif, "missed beacons");
-       else if (rx_missed_bcon_since_rx > IWL_MVM_MISSED_BEACONS_THRESHOLD)
-               ieee80211_beacon_loss(vif);
+       if (rx_missed_bcon >= IWL_MVM_MISSED_BEACONS_THRESHOLD_LONG) {
+               if (rx_missed_bcon_since_rx >= IWL_MVM_MISSED_BEACONS_SINCE_RX_THOLD) {
+                       iwl_mvm_connection_loss(mvm, vif, "missed beacons");
+               } else {
+                       IWL_WARN(mvm,
+                                "missed beacons exceeds threshold, but receiving data. Stay connected, Expect bugs.\n");
+                       IWL_WARN(mvm,
+                                "missed_beacons:%d, missed_beacons_since_rx:%d\n",
+                                rx_missed_bcon, rx_missed_bcon_since_rx);
+               }
+       } else if (rx_missed_bcon_since_rx > IWL_MVM_MISSED_BEACONS_THRESHOLD) {
+               if (!iwl_mvm_has_new_tx_api(mvm))
+                       ieee80211_beacon_loss(vif);
+               else
+                       ieee80211_cqm_beacon_loss_notify(vif, GFP_ATOMIC);
+       }
 
        iwl_dbg_tlv_time_point(&mvm->fwrt,
                               IWL_FW_INI_TIME_POINT_MISSED_BEACONS, &tp_data);
@@ -1843,7 +1855,7 @@ void iwl_mvm_channel_switch_start_notif(struct iwl_mvm *mvm,
                                      msecs_to_jiffies(IWL_MVM_CS_UNBLOCK_TX_TIMEOUT *
                                                       csa_vif->bss_conf.beacon_int));
 
-               ieee80211_csa_finish(csa_vif);
+               ieee80211_csa_finish(csa_vif, 0);
 
                rcu_read_unlock();