[NOUPSTREAM] wifi: iwlwifi: mvm: reduce diff with upstream

type=maint
ticket=none

Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Change-Id: Ia863d65b78b4b6be3cbbce490bef709a26d3ea96
Reviewed-on: https://gerritwcs.ir.intel.com/c/iwlwifi-stack-dev/+/108028
tested: iil_jenkins iil_jenkins <EC.GER.UNIX.IIL.JENKINS@INTEL.COM>
Reviewed-by: Johannes Berg <johannes.berg@intel.com>
x-iwlwifi-stack-dev: e9fa0ec281e783226ecb06c66bf27bf362aaf5ef
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/fw.c b/drivers/net/wireless/intel/iwlwifi/mvm/fw.c
index 7cc395f..e3d0a73 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/fw.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/fw.c
@@ -1764,9 +1764,6 @@
 	}
 #endif /* CPTCFG_IWLMVM_VENDOR_CMDS */
 
-	if (!mvm->ptp_data.ptp_clock)
-		iwl_mvm_ptp_init(mvm);
-
 	if (test_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status)) {
 		iwl_mvm_send_recovery_cmd(mvm, ERROR_RECOVERY_UPDATE_DB);
 
@@ -1776,6 +1773,9 @@
 						 IWL_TIME_SYNC_PROTOCOL_FTM);
 	}
 
+	if (!mvm->ptp_data.ptp_clock)
+		iwl_mvm_ptp_init(mvm);
+
 	ret = iwl_mvm_ppag_init(mvm);
 	if (ret)
 		goto error;
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/link.c b/drivers/net/wireless/intel/iwlwifi/mvm/link.c
index 0089743..d3ea54d 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/link.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/link.c
@@ -193,7 +193,8 @@
 	if (data.lift_block) {
 		mutex_lock(&mvm->mutex);
 		iwl_mvm_unblock_esr(mvm, bss_vif, IWL_MVM_ESR_BLOCKED_NON_BSS);
-		mutex_unlock(&mvm->mutex);}
+		mutex_unlock(&mvm->mutex);
+	}
 
 	return 0;
 }
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c b/drivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c
index 2e89969..bc384ef 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c
@@ -604,20 +604,20 @@
 	u32 dtim_offs;
 
 	/*
-	* The DTIM count counts down, so when it is N that means N
-	* more beacon intervals happen until the DTIM TBTT. Therefore
-	* add this to the current time. If that ends up being in the
-	* future, the firmware will handle it.
-	*
-	* Also note that the system_timestamp (which we get here as
-	* "sync_device_ts") and TSF timestamp aren't at exactly the
-	* same offset in the frame -- the TSF is at the first symbol
-	* of the TSF, the system timestamp is at signal acquisition
-	* time. This means there's an offset between them of at most
-	* a few hundred microseconds (24 * 8 bits + PLCP time gives
-	* 384us in the longest case), this is currently not relevant
-	* as the firmware wakes up around 2ms before the TBTT.
-	*/
+	 * The DTIM count counts down, so when it is N that means N
+	 * more beacon intervals happen until the DTIM TBTT. Therefore
+	 * add this to the current time. If that ends up being in the
+	 * future, the firmware will handle it.
+	 *
+	 * Also note that the system_timestamp (which we get here as
+	 * "sync_device_ts") and TSF timestamp aren't at exactly the
+	 * same offset in the frame -- the TSF is at the first symbol
+	 * of the TSF, the system timestamp is at signal acquisition
+	 * time. This means there's an offset between them of at most
+	 * a few hundred microseconds (24 * 8 bits + PLCP time gives
+	 * 384us in the longest case), this is currently not relevant
+	 * as the firmware wakes up around 2ms before the TBTT.
+	 */
 	dtim_offs = link_conf->sync_dtim_count *
 			link_conf->beacon_int;
 	/* convert TU to usecs */
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mld-key.c b/drivers/net/wireless/intel/iwlwifi/mvm/mld-key.c
index a6e70ac..0fc4a7d 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/mld-key.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/mld-key.c
@@ -38,8 +38,7 @@
 	if (!sta && vif->type == NL80211_IFTYPE_STATION)
 		sta = mvmvif->ap_sta;
 
-	/*
-	 * During remove the STA was removed and the group keys come later
+	/* During remove the STA was removed and the group keys come later
 	 * (which sounds like a bad sequence, but remember that to mac80211 the
 	 * group keys have no sta pointer), so we don't have a STA now.
 	 * Since this happens for group keys only, just use the link_info as
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mld-mac.c b/drivers/net/wireless/intel/iwlwifi/mvm/mld-mac.c
index 91f5ffb..2421c06 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/mld-mac.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/mld-mac.c
@@ -43,8 +43,7 @@
 	if (iwlwifi_mod_params.disable_11ax)
 		return;
 
-	/*
-	 * If we have MLO enabled, then the firmware needs to enable
+	/* If we have MLO enabled, then the firmware needs to enable
 	 * address translation for the station(s) we add. That depends
 	 * on having EHT enabled in firmware, which in turn depends on
 	 * mac80211 in the code below.
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mld-mac80211.c b/drivers/net/wireless/intel/iwlwifi/mvm/mld-mac80211.c
index da9ea92..b5db94f 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/mld-mac80211.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/mld-mac80211.c
@@ -18,8 +18,7 @@
 
 	mvmvif->mvm = mvm;
 
-	/*
-	 * Not much to do here. The stack will not allow interface
+	/* Not much to do here. The stack will not allow interface
 	 * types or combinations that we didn't advertise, so we
 	 * don't really have to check the types.
 	 */
@@ -150,8 +149,7 @@
 
 	iwl_mvm_vif_dbgfs_rm_link(mvm, vif);
 
-	/*
-	 * For AP/GO interface, the tear down of the resources allocated to the
+	/* For AP/GO interface, the tear down of the resources allocated to the
 	 * interface is be handled as part of the stop_ap flow.
 	 */
 	if (vif->type == NL80211_IFTYPE_AP ||
@@ -296,11 +294,12 @@
 	return ret;
 }
 
-static int __iwl_mvm_mld_assign_vif_chanctx(struct iwl_mvm *mvm,
-					    struct ieee80211_vif *vif,
-					    struct ieee80211_bss_conf *link_conf,
-					    struct ieee80211_chanctx_conf *ctx,
-					    bool switching_chanctx)
+static int
+__iwl_mvm_mld_assign_vif_chanctx(struct iwl_mvm *mvm,
+				 struct ieee80211_vif *vif,
+				 struct ieee80211_bss_conf *link_conf,
+				 struct ieee80211_chanctx_conf *ctx,
+				 bool switching_chanctx)
 {
 	u16 *phy_ctxt_id = (u16 *)ctx->drv_priv;
 	struct iwl_mvm_phy_ctxt *phy_ctxt = &mvm->phy_ctxts[*phy_ctxt_id];
@@ -351,8 +350,7 @@
 	if (ret)
 		goto out;
 
-	/*
-	 * Initialize rate control for the AP station, since we might be
+	/* Initialize rate control for the AP station, since we might be
 	 * doing a link switch here - we cannot initialize it before since
 	 * this needs the phy context assigned (and in FW?), and we cannot
 	 * do it later because it needs to be initialized as soon as we're
@@ -399,7 +397,8 @@
 	return 0;
 
 deactivate:
-	iwl_mvm_link_changed(mvm, vif, link_conf, LINK_CONTEXT_MODIFY_ACTIVE, false);
+	iwl_mvm_link_changed(mvm, vif, link_conf, LINK_CONTEXT_MODIFY_ACTIVE,
+			     false);
 out:
 	mvmvif->link[link_id]->phy_ctxt = NULL;
 	iwl_mvm_power_update_mac(mvm);
@@ -482,11 +481,12 @@
 	return ret;
 }
 
-static void __iwl_mvm_mld_unassign_vif_chanctx(struct iwl_mvm *mvm,
-					       struct ieee80211_vif *vif,
-					       struct ieee80211_bss_conf *link_conf,
-					       struct ieee80211_chanctx_conf *ctx,
-					       bool switching_chanctx)
+static void
+__iwl_mvm_mld_unassign_vif_chanctx(struct iwl_mvm *mvm,
+				   struct ieee80211_vif *vif,
+				   struct ieee80211_bss_conf *link_conf,
+				   struct ieee80211_chanctx_conf *ctx,
+				   bool switching_chanctx)
 {
 	struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
 	unsigned int n_active = iwl_mvm_mld_count_active_links(mvmvif);
@@ -659,10 +659,9 @@
 	if (ret)
 		return ret;
 
-	/*
-	* Send the bcast station. At this stage the TBTT and DTIM time
-	* events are added and applied to the scheduler
-	*/
+	/* Send the bcast station. At this stage the TBTT and DTIM time
+	 * events are added and applied to the scheduler
+	 */
 	ret = iwl_mvm_mld_add_bcast_sta(mvm, vif, link_conf);
 	if (ret)
 		goto out_rm_mcast;
@@ -777,10 +776,11 @@
 	return false;
 }
 
-static void iwl_mvm_mld_link_info_changed_station(struct iwl_mvm *mvm,
-						  struct ieee80211_vif *vif,
-						  struct ieee80211_bss_conf *link_conf,
-						  u64 changes)
+static void
+iwl_mvm_mld_link_info_changed_station(struct iwl_mvm *mvm,
+				      struct ieee80211_vif *vif,
+				      struct ieee80211_bss_conf *link_conf,
+				      u64 changes)
 {
 	struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
 	bool has_he, has_eht;
@@ -880,8 +880,7 @@
 	unsigned int i;
 	int ret;
 
-	/*
-	 * This might get called without active links during the
+	/* This might get called without active links during the
 	 * chanctx switch, but we don't care about it anyway.
 	 */
 	if (changes == BSS_CHANGED_IDLE)
@@ -1123,8 +1122,7 @@
 
 	mvm_link->queue_params[ac] = *params;
 
-	/*
-	 * No need to update right away, we'll get BSS_CHANGED_QOS
+	/* No need to update right away, we'll get BSS_CHANGED_QOS
 	 * The exception is P2P_DEVICE interface which needs immediate update.
 	 */
 	if (vif->type == NL80211_IFTYPE_P2P_DEVICE) {
@@ -1206,7 +1204,8 @@
 		new_link[i]->fw_link_id = IWL_MVM_FW_LINK_ID_INVALID;
 
 		for (r = 0; r < NUM_IWL_MVM_SMPS_REQ; r++)
-			new_link[i]->smps_requests[r] = IEEE80211_SMPS_AUTOMATIC;
+			new_link[i]->smps_requests[r] =
+				IEEE80211_SMPS_AUTOMATIC;
 	}
 
 	mutex_lock(&mvm->mutex);
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mld-sta.c b/drivers/net/wireless/intel/iwlwifi/mvm/mld-sta.c
index abcb55c..9b5aeb1 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/mld-sta.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/mld-sta.c
@@ -241,8 +241,7 @@
 				       IWL_MAX_TID_COUNT, &wdg_timeout);
 }
 
-/*
- * Allocate a new station entry for the broadcast station to the given vif,
+/* Allocate a new station entry for the broadcast station to the given vif,
  * and send it to the FW.
  * Note that each AP/GO mac should have its own multicast station.
  */
@@ -263,8 +262,7 @@
 		    vif->type != NL80211_IFTYPE_ADHOC))
 		return -EOPNOTSUPP;
 
-	/*
-	 * In IBSS, ieee80211_check_queues() sets the cab_queue to be
+	/* In IBSS, ieee80211_check_queues() sets the cab_queue to be
 	 * invalid, so make sure we use the queue we want.
 	 * Note that this is done here as we want to avoid making DQA
 	 * changes in mac80211 layer.
@@ -300,8 +298,7 @@
 {
 	lockdep_assert_held(&mvm->mutex);
 
-	/*
-	 * In CDB NICs we need to specify which lmac to use for aux activity;
+	/* In CDB NICs we need to specify which lmac to use for aux activity;
 	 * use the link_id argument place to send lmac_id to the function.
 	 */
 	return iwl_mvm_mld_add_int_sta(mvm, &mvm->aux_sta, &mvm->aux_queue,
@@ -396,8 +393,7 @@
 				      true, IWL_MAX_TID_COUNT, queueptr);
 }
 
-/*
- * Send the FW a request to remove the station from it's internal data
+/* Send the FW a request to remove the station from it's internal data
  * structures, and in addition remove it from the local data structure.
  */
 int iwl_mvm_mld_rm_mcast_sta(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
@@ -496,7 +492,8 @@
 	cmd.tx_ampdu_max_size = cpu_to_le32(agg_size);
 
 	if (sta->wme) {
-		cmd.sp_length = cpu_to_le32(sta->max_sp ? sta->max_sp * 2 : 128);
+		cmd.sp_length =
+			cpu_to_le32(sta->max_sp ? sta->max_sp * 2 : 128);
 		cmd.uapsd_acs = cpu_to_le32(iwl_mvm_get_sta_uapsd_acs(sta));
 	}
 
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h b/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h
index fcad674..bffce07 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h
@@ -567,7 +567,6 @@
 	     link_id++)							\
 		if ((mvm_vif)->link[link_id])
 
-
 static inline struct iwl_mvm_vif *
 iwl_mvm_vif_from_mac80211(struct ieee80211_vif *vif)
 {
@@ -697,7 +696,6 @@
 	IWL_MVM_TRAFFIC_HIGH,
 };
 
-
 DECLARE_EWMA(rate, 16, 16)
 
 struct iwl_mvm_tcm_mac {
@@ -1220,13 +1218,12 @@
 	bool fw_static_smps_request;
 
 	unsigned long bt_coex_last_tcm_ts;
+	struct iwl_mvm_tcm tcm;
 
 	u8 uapsd_noagg_bssid_write_idx;
 	struct mac_address uapsd_noagg_bssids[IWL_MVM_UAPSD_NOAGG_BSSIDS_NUM]
 		__aligned(2);
 
-	struct iwl_mvm_tcm tcm;
-
 #ifdef CPTCFG_IWLMVM_TDLS_PEER_CACHE
 	struct list_head tdls_peer_cache_list;
 	u32 tdls_peer_cache_cnt;
@@ -1367,7 +1364,10 @@
 
 	/* does a monitor vif exist (only one can exist hence bool) */
 	bool monitor_on;
-	/* primary channel place relative the whole bandwidth in gaps of 80Mhz */
+	/*
+	 * primary channel position relative to he whole bandwidth,
+	 * in steps of 80 MHz
+	 */
 	u8 monitor_p80;
 
 	/* sniffer data to include in radiotap */
@@ -1387,13 +1387,14 @@
 	bool sta_remove_requires_queue_remove;
 	bool mld_api_is_used;
 
+	bool pldr_sync;
+
 	struct iwl_time_sync_data time_sync;
 
 	struct iwl_mvm_acs_survey *acs_survey;
 
 	/* Firmware RFI state &enum iwl_rfi_support_reason */
 	u32 fw_rfi_state;
-	bool pldr_sync;
 	bool rfi_wlan_master;
 	bool force_enable_rfi;
 	bool statistics_clear;
@@ -1686,18 +1687,18 @@
 	return mvm->trans->trans_cfg->device_family >= IWL_DEVICE_FAMILY_22000;
 }
 
-static inline bool iwl_mvm_is_reduced_config_scan_supported(struct iwl_mvm *mvm)
-{
-	return fw_has_api(&mvm->fw->ucode_capa,
-			  IWL_UCODE_TLV_API_REDUCED_SCAN_CONFIG);
-}
-
 static inline bool iwl_mvm_is_scan_ext_chan_supported(struct iwl_mvm *mvm)
 {
 	return fw_has_api(&mvm->fw->ucode_capa,
 			  IWL_UCODE_TLV_API_SCAN_EXT_CHAN_VER);
 }
 
+static inline bool iwl_mvm_is_reduced_config_scan_supported(struct iwl_mvm *mvm)
+{
+	return fw_has_api(&mvm->fw->ucode_capa,
+			  IWL_UCODE_TLV_API_REDUCED_SCAN_CONFIG);
+}
+
 static inline bool iwl_mvm_is_band_in_rx_supported(struct iwl_mvm *mvm)
 {
 	return fw_has_api(&mvm->fw->ucode_capa,
@@ -2380,10 +2381,11 @@
 				enum iwl_mvm_smps_type_request req_type,
 				enum ieee80211_smps_mode smps_request,
 				unsigned int link_id);
-void iwl_mvm_update_smps_on_active_links(struct iwl_mvm *mvm,
-					 struct ieee80211_vif *vif,
-					 enum iwl_mvm_smps_type_request req_type,
-					 enum ieee80211_smps_mode smps_request);
+void
+iwl_mvm_update_smps_on_active_links(struct iwl_mvm *mvm,
+				    struct ieee80211_vif *vif,
+				    enum iwl_mvm_smps_type_request req_type,
+				    enum ieee80211_smps_mode smps_request);
 bool iwl_mvm_rx_diversity_allowed(struct iwl_mvm *mvm,
 				  struct iwl_mvm_phy_ctxt *ctxt);
 void iwl_mvm_update_link_smps(struct ieee80211_vif *vif,
@@ -2763,11 +2765,12 @@
 				       bool switching_chanctx);
 };
 
-int iwl_mvm_switch_vif_chanctx_common(struct ieee80211_hw *hw,
-				      struct ieee80211_vif_chanctx_switch *vifs,
-				      int n_vifs,
-				      enum ieee80211_chanctx_switch_mode mode,
-				      const struct iwl_mvm_switch_vif_chanctx_ops *ops);
+int
+iwl_mvm_switch_vif_chanctx_common(struct ieee80211_hw *hw,
+				  struct ieee80211_vif_chanctx_switch *vifs,
+				  int n_vifs,
+				  enum ieee80211_chanctx_switch_mode mode,
+				  const struct iwl_mvm_switch_vif_chanctx_ops *ops);
 
 /* Channel info utils */
 static inline bool iwl_mvm_has_ultra_hb_channel(struct iwl_mvm *mvm)
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/ops.c b/drivers/net/wireless/intel/iwlwifi/mvm/ops.c
index 585848d..5b3b591 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/ops.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/ops.c
@@ -696,6 +696,14 @@
 /* Please keep this array *SORTED* by hex value.
  * Access is done through binary search
  */
+static const struct iwl_hcmd_names iwl_mvm_statistics_names[] = {
+	HCMD_NAME(STATISTICS_OPER_NOTIF),
+	HCMD_NAME(STATISTICS_OPER_PART1_NOTIF),
+};
+
+/* Please keep this array *SORTED* by hex value.
+ * Access is done through binary search
+ */
 static const struct iwl_hcmd_names iwl_mvm_debug_names[] = {
 	HCMD_NAME(LMAC_RD_WR),
 	HCMD_NAME(UMAC_RD_WR),
@@ -711,14 +719,6 @@
 /* Please keep this array *SORTED* by hex value.
  * Access is done through binary search
  */
-static const struct iwl_hcmd_names iwl_mvm_statistics_names[] = {
-	HCMD_NAME(STATISTICS_OPER_NOTIF),
-	HCMD_NAME(STATISTICS_OPER_PART1_NOTIF),
-};
-
-/* Please keep this array *SORTED* by hex value.
- * Access is done through binary search
- */
 static const struct iwl_hcmd_names iwl_mvm_scan_names[] = {
 	HCMD_NAME(CHANNEL_SURVEY_NOTIF),
 	HCMD_NAME(OFFLOAD_MATCH_INFO_NOTIF),
@@ -1000,118 +1000,6 @@
 	return 0;
 }
 
-static void iwl_mvm_me_conn_status(void *priv, const struct iwl_mei_conn_info *conn_info)
-{
-	struct iwl_mvm *mvm = priv;
-	struct iwl_mvm_csme_conn_info *prev_conn_info, *curr_conn_info;
-
-	/*
-	 * This is protected by the guarantee that this function will not be
-	 * called twice on two different threads
-	 */
-	prev_conn_info = rcu_dereference_protected(mvm->csme_conn_info, true);
-
-	curr_conn_info = kzalloc(sizeof(*curr_conn_info), GFP_KERNEL);
-	if (!curr_conn_info)
-		return;
-
-	curr_conn_info->conn_info = *conn_info;
-
-	rcu_assign_pointer(mvm->csme_conn_info, curr_conn_info);
-
-	if (prev_conn_info)
-		kfree_rcu(prev_conn_info, rcu_head);
-}
-
-static void iwl_mvm_mei_rfkill(void *priv, bool blocked,
-			       bool csme_taking_ownership)
-{
-	struct iwl_mvm *mvm = priv;
-
-	if (blocked && !IWL_MVM_MEI_REPORT_RFKILL && !csme_taking_ownership)
-		return;
-
-	mvm->mei_rfkill_blocked = blocked;
-	if (!mvm->hw_registered)
-		return;
-
-	wiphy_rfkill_set_hw_state_reason(mvm->hw->wiphy,
-					 mvm->mei_rfkill_blocked,
-					 RFKILL_HARD_BLOCK_NOT_OWNER);
-}
-
-static void iwl_mvm_mei_roaming_forbidden(void *priv, bool forbidden)
-{
-	struct iwl_mvm *mvm = priv;
-
-	if (!mvm->hw_registered || !mvm->csme_vif)
-		return;
-
-#ifdef CPTCFG_IWLMVM_VENDOR_CMDS
-	iwl_mvm_send_roaming_forbidden_event(mvm, mvm->csme_vif, forbidden);
-#endif
-}
-
-static void iwl_mvm_sap_connected_wk(struct work_struct *wk)
-{
-	struct iwl_mvm *mvm =
-		container_of(wk, struct iwl_mvm, sap_connected_wk);
-	int ret;
-
-	ret = iwl_mvm_start_get_nvm(mvm);
-	if (ret)
-		goto out_free;
-
-	ret = iwl_mvm_start_post_nvm(mvm);
-	if (ret)
-		goto out_free;
-
-	return;
-
-out_free:
-	IWL_ERR(mvm, "Couldn't get started...\n");
-	iwl_mei_start_unregister();
-	iwl_mei_unregister_complete();
-	iwl_fw_flush_dumps(&mvm->fwrt);
-	iwl_mvm_thermal_exit(mvm);
-	iwl_fw_runtime_free(&mvm->fwrt);
-#ifdef CPTCFG_IWLWIFI_DEVICE_TESTMODE
-	iwl_dnt_free(mvm->trans);
-#endif
-	iwl_phy_db_free(mvm->phy_db);
-	kfree(mvm->scan_cmd);
-	iwl_trans_op_mode_leave(mvm->trans);
-	kfree(mvm->nvm_data);
-	kfree(mvm->mei_nvm_data);
-
-	ieee80211_free_hw(mvm->hw);
-}
-
-static void iwl_mvm_mei_sap_connected(void *priv)
-{
-	struct iwl_mvm *mvm = priv;
-
-	if (!mvm->hw_registered)
-		schedule_work(&mvm->sap_connected_wk);
-}
-
-static void iwl_mvm_mei_nic_stolen(void *priv)
-{
-	struct iwl_mvm *mvm = priv;
-
-	rtnl_lock();
-	cfg80211_shutdown_all_interfaces(mvm->hw->wiphy);
-	rtnl_unlock();
-}
-
-static const struct iwl_mei_ops mei_ops = {
-	.me_conn_status = iwl_mvm_me_conn_status,
-	.rfkill = iwl_mvm_mei_rfkill,
-	.roaming_forbidden = iwl_mvm_mei_roaming_forbidden,
-	.sap_connected = iwl_mvm_mei_sap_connected,
-	.nic_stolen = iwl_mvm_mei_nic_stolen,
-};
-
 struct iwl_mvm_frob_txf_data {
 	u8 *buf;
 	size_t buflen;
@@ -1289,6 +1177,118 @@
 	.frob_mem = iwl_mvm_frob_mem,
 };
 
+static void iwl_mvm_me_conn_status(void *priv, const struct iwl_mei_conn_info *conn_info)
+{
+	struct iwl_mvm *mvm = priv;
+	struct iwl_mvm_csme_conn_info *prev_conn_info, *curr_conn_info;
+
+	/*
+	 * This is protected by the guarantee that this function will not be
+	 * called twice on two different threads
+	 */
+	prev_conn_info = rcu_dereference_protected(mvm->csme_conn_info, true);
+
+	curr_conn_info = kzalloc(sizeof(*curr_conn_info), GFP_KERNEL);
+	if (!curr_conn_info)
+		return;
+
+	curr_conn_info->conn_info = *conn_info;
+
+	rcu_assign_pointer(mvm->csme_conn_info, curr_conn_info);
+
+	if (prev_conn_info)
+		kfree_rcu(prev_conn_info, rcu_head);
+}
+
+static void iwl_mvm_mei_rfkill(void *priv, bool blocked,
+			       bool csme_taking_ownership)
+{
+	struct iwl_mvm *mvm = priv;
+
+	if (blocked && !IWL_MVM_MEI_REPORT_RFKILL && !csme_taking_ownership)
+		return;
+
+	mvm->mei_rfkill_blocked = blocked;
+	if (!mvm->hw_registered)
+		return;
+
+	wiphy_rfkill_set_hw_state_reason(mvm->hw->wiphy,
+					 mvm->mei_rfkill_blocked,
+					 RFKILL_HARD_BLOCK_NOT_OWNER);
+}
+
+static void iwl_mvm_mei_roaming_forbidden(void *priv, bool forbidden)
+{
+	struct iwl_mvm *mvm = priv;
+
+	if (!mvm->hw_registered || !mvm->csme_vif)
+		return;
+
+#ifdef CPTCFG_IWLMVM_VENDOR_CMDS
+	iwl_mvm_send_roaming_forbidden_event(mvm, mvm->csme_vif, forbidden);
+#endif
+}
+
+static void iwl_mvm_sap_connected_wk(struct work_struct *wk)
+{
+	struct iwl_mvm *mvm =
+		container_of(wk, struct iwl_mvm, sap_connected_wk);
+	int ret;
+
+	ret = iwl_mvm_start_get_nvm(mvm);
+	if (ret)
+		goto out_free;
+
+	ret = iwl_mvm_start_post_nvm(mvm);
+	if (ret)
+		goto out_free;
+
+	return;
+
+out_free:
+	IWL_ERR(mvm, "Couldn't get started...\n");
+	iwl_mei_start_unregister();
+	iwl_mei_unregister_complete();
+	iwl_fw_flush_dumps(&mvm->fwrt);
+	iwl_mvm_thermal_exit(mvm);
+	iwl_fw_runtime_free(&mvm->fwrt);
+#ifdef CPTCFG_IWLWIFI_DEVICE_TESTMODE
+	iwl_dnt_free(mvm->trans);
+#endif
+	iwl_phy_db_free(mvm->phy_db);
+	kfree(mvm->scan_cmd);
+	iwl_trans_op_mode_leave(mvm->trans);
+	kfree(mvm->nvm_data);
+	kfree(mvm->mei_nvm_data);
+
+	ieee80211_free_hw(mvm->hw);
+}
+
+static void iwl_mvm_mei_sap_connected(void *priv)
+{
+	struct iwl_mvm *mvm = priv;
+
+	if (!mvm->hw_registered)
+		schedule_work(&mvm->sap_connected_wk);
+}
+
+static void iwl_mvm_mei_nic_stolen(void *priv)
+{
+	struct iwl_mvm *mvm = priv;
+
+	rtnl_lock();
+	cfg80211_shutdown_all_interfaces(mvm->hw->wiphy);
+	rtnl_unlock();
+}
+
+static const struct iwl_mei_ops mei_ops = {
+	.me_conn_status = iwl_mvm_me_conn_status,
+	.rfkill = iwl_mvm_mei_rfkill,
+	.roaming_forbidden = iwl_mvm_mei_roaming_forbidden,
+	.sap_connected = iwl_mvm_mei_sap_connected,
+	.nic_stolen = iwl_mvm_mei_nic_stolen,
+};
+
 static void iwl_mvm_find_link_selection_vif(void *_data, u8 *mac,
 					    struct ieee80211_vif *vif)
 {
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/phy-ctxt.c b/drivers/net/wireless/intel/iwlwifi/mvm/phy-ctxt.c
index e961ac9..1df1561 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/phy-ctxt.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/phy-ctxt.c
@@ -147,8 +147,7 @@
 	iwl_mvm_set_chan_info_chandef(mvm, &cmd->ci, chandef);
 
 	/* we only support RLC command version 2 */
-	if (iwl_fw_lookup_cmd_ver(mvm->fw, WIDE_ID(DATA_PATH_GROUP,
-						   RLC_CONFIG_CMD), 0) < 2)
+	if (iwl_fw_lookup_cmd_ver(mvm->fw, WIDE_ID(DATA_PATH_GROUP, RLC_CONFIG_CMD), 0) < 2)
 		iwl_mvm_phy_ctxt_set_rxchain(mvm, ctxt, &cmd->rxchain_info,
 					     chains_static, chains_dynamic);
 }
diff --git a/versions b/versions
index 8b863a4..4b6b748 100644
--- a/versions
+++ b/versions
@@ -2,4 +2,4 @@
 BACKPORTED_KERNEL_VERSION="(see git)"
 BACKPORTED_KERNEL_NAME="iwlwifi"
 BACKPORTS_BUILD_TSTAMP=__DATE__ \" \" __TIME__
-BACKPORTS_GIT_TRACKED="iwlwifi-stack-public:master:12202:174340b9"
+BACKPORTS_GIT_TRACKED="iwlwifi-stack-public:master:12203:e9fa0ec2"