Skip to contentSkip to conversation

wifi: iwlwifi: updates - 2023-10-17

PATCH New [email protected] 1 participant 15 messages Oct 17, 2023 Intel wireless wifi link (iwlwifi)

lore
Share & tools
lore
#0 lore raw

cover wifi: iwlwifi: updates - 2023-10-17

From: Gregory Greenman <[email protected]>

Hi,

This patch set includes iwlwifi patches intended for v6.7.

It contains:
* update session protection to be MLO aware
* remove support for RSS on 9000 devices and simplify the reorder buffe
* cleanups and bugfixes

Thanks,
Gregory

Benjamin Berg (1):
wifi: iwlwifi: mvm: Return success if link could not be removed

Daniel Gabay (1):
wifi: iwlwifi: add support for SNPS DPHYIP region type

Emmanuel Grumbach (2):
wifi: iwlwifi: disable multi rx queue for 9000
wifi: iwlwifi: mvm: simplify the reorder buffer

Gregory Greenman (2):
wifi: iwlwifi: mvm: fix size check for fw_link_id
wifi: iwlwifi: mvm: fix regdb initialization

Johannes Berg (4):
wifi: iwlwifi: api: fix center_freq label in PHY diagram
wifi: iwlwifi: mvm: remove set_tim callback for MLD ops
wifi: iwlwifi: mvm: fix netif csum flags
wifi: iwlwifi: pcie: synchronize IRQs before NAPI

Miri Korenblit (3):
wifi: iwlwifi: make time_events MLO aware
wifi: iwlwifi: support link_id in SESSION_PROTECTION cmd
wifi: iwlwifi: support link id in SESSION_PROTECTION_NOTIF

Yedidya Benshimol (1):
wifi: iwlwifi: mvm: update IGTK in mvmvif upon D3 resume

 drivers/net/wireless/intel/iwlwifi/cfg/bz.c   |   4 +-
 drivers/net/wireless/intel/iwlwifi/cfg/sc.c   |   2 +-
 .../wireless/intel/iwlwifi/fw/api/dbg-tlv.h   |   3 +
 .../wireless/intel/iwlwifi/fw/api/phy-ctxt.h  |   4 +-
 .../intel/iwlwifi/fw/api/time-event.h         |  21 +-
 drivers/net/wireless/intel/iwlwifi/fw/dbg.c   |  56 ++-
 .../net/wireless/intel/iwlwifi/iwl-config.h   |   5 +-
 drivers/net/wireless/intel/iwlwifi/iwl-prph.h |   4 +
 .../net/wireless/intel/iwlwifi/iwl-trans.h    |   2 +-
 drivers/net/wireless/intel/iwlwifi/mvm/d3.c   |  12 +-
 drivers/net/wireless/intel/iwlwifi/mvm/link.c |   7 +-
 .../net/wireless/intel/iwlwifi/mvm/mac80211.c |  25 +-
 .../wireless/intel/iwlwifi/mvm/mld-mac80211.c |  10 +-
 drivers/net/wireless/intel/iwlwifi/mvm/mvm.h  |  35 +-
 drivers/net/wireless/intel/iwlwifi/mvm/nvm.c  |   2 +-
 drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c | 324 ++----------------
 drivers/net/wireless/intel/iwlwifi/mvm/sta.c  |  18 +-
 drivers/net/wireless/intel/iwlwifi/mvm/sta.h  |   7 -
 drivers/net/wireless/intel/iwlwifi/mvm/tdls.c |   2 +-
 .../wireless/intel/iwlwifi/mvm/time-event.c   | 115 +++++--
 .../wireless/intel/iwlwifi/mvm/time-event.h   |   4 +-
 .../wireless/intel/iwlwifi/pcie/trans-gen2.c  |   1 +
 .../net/wireless/intel/iwlwifi/pcie/trans.c   |   1 +
 23 files changed, 254 insertions(+), 410 deletions(-)
Signature · 1 line
2.38.1
#1 lore raw

PATCH 1/14 wifi: iwlwifi: make time_events MLO aware

From: Miri Korenblit <[email protected]>

As session protection API is moving to be per link instead of per mac, move the time events to be per link too.

Since there is only one concurrent time event per mac, it feels unnecessary to have the time_event as a member of iwl_mvm_link_info. (That way we will have to iterate over all links each time we want to clear a time event, and also we will need mac80211 to tell us the link id when mgd_tx_complete() is called.)
So leave this as a member of iwl_mvm_vif, but add the link id to the time_event structure.

The link id in time_event will only be maintained and used for:
1. When SESSION_PROTECTION_CMD is supported (before it, we don't have MLO)
2. For time_events of types SESSION_PROTECT_CONF_ASSOC, SESSION_PROTECT_CONF_P2P_DEVICE_DISCOV, and SESSION_PROTECT_CONF_P2P_GO_NEGOTIATION
(not for aux roc/ Hot Spot time_events).

For P2P, non-MLO connections, and pre-MLD API, deflink id, meaning 0, will be used

---
 drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c     |  9 +++++----
 drivers/net/wireless/intel/iwlwifi/mvm/mld-mac80211.c |  8 +++++++-
 drivers/net/wireless/intel/iwlwifi/mvm/mvm.h          |  3 ++-
 drivers/net/wireless/intel/iwlwifi/mvm/tdls.c         |  2 +-
 drivers/net/wireless/intel/iwlwifi/mvm/time-event.c   | 10 ++++++++--
 drivers/net/wireless/intel/iwlwifi/mvm/time-event.h   |  4 +++-
 6 files changed, 26 insertions(+), 10 deletions(-)
drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c +5 -4
index ba087c5ba6e1..38ee1629ec4b 100644
@@ -2462,7 +2462,7 @@ static void iwl_mvm_cfg_he_sta(struct iwl_mvm *mvm,
 }
 
 void iwl_mvm_protect_assoc(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
-			   u32 duration_override)
+			   u32 duration_override, unsigned int link_id)
 {
 	u32 duration = IWL_MVM_TE_SESSION_PROTECTION_MAX_TIME_MS;
 	u32 min_duration = IWL_MVM_TE_SESSION_PROTECTION_MIN_TIME_MS;
@@ -2482,7 +2482,8 @@ void iwl_mvm_protect_assoc(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
 	if (fw_has_capa(&mvm->fw->ucode_capa,
 			IWL_UCODE_TLV_CAPA_SESSION_PROT_CMD))
 		iwl_mvm_schedule_session_protection(mvm, vif, 900,
-						    min_duration, false);
+						    min_duration, false,
+						    link_id);
 	else
 		iwl_mvm_protect_session(mvm, vif, duration,
 					min_duration, 500, false);
@@ -2670,7 +2671,7 @@ static void iwl_mvm_bss_info_changed_station(struct iwl_mvm *mvm,
 				 * time could be small without us having heard
 				 * a beacon yet.
 				 */
-				iwl_mvm_protect_assoc(mvm, vif, 0);
+				iwl_mvm_protect_assoc(mvm, vif, 0, 0);
 			}
 
 			iwl_mvm_sf_update(mvm, vif, false);
@@ -4009,7 +4010,7 @@ void iwl_mvm_mac_mgd_prepare_tx(struct ieee80211_hw *hw,
 	struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw);
 
 	mutex_lock(&mvm->mutex);
-	iwl_mvm_protect_assoc(mvm, vif, info->duration);
+	iwl_mvm_protect_assoc(mvm, vif, info->duration, info->link_id);
 	mutex_unlock(&mvm->mutex);
 }
 
drivers/net/wireless/intel/iwlwifi/mvm/mld-mac80211.c +7 -1
index e5f386ae862d..8402482a74a0 100644
@@ -851,6 +851,12 @@ static void iwl_mvm_mld_vif_cfg_changed_station(struct iwl_mvm *mvm,
 
 			if (!test_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status) &&
 			    protect) {
+				/* We are in assoc so only one link is active-
+				 * The association link
+				 */
+				unsigned int link_id =
+					ffs(vif->active_links) - 1;
+
 				/* If we're not restarting and still haven't
 				 * heard a beacon (dtim period unknown) then
 				 * make sure we still have enough minimum time
@@ -860,7 +866,7 @@ static void iwl_mvm_mld_vif_cfg_changed_station(struct iwl_mvm *mvm,
 				 * time could be small without us having heard
 				 * a beacon yet.
 				 */
-				iwl_mvm_protect_assoc(mvm, vif, 0);
+				iwl_mvm_protect_assoc(mvm, vif, 0, link_id);
 			}
 
 			iwl_mvm_sf_update(mvm, vif, false);
drivers/net/wireless/intel/iwlwifi/mvm/mvm.h +2 -1
index f81f1ec3bb79..0bd2a8bcaee5 100644
@@ -121,6 +121,7 @@ struct iwl_mvm_time_event_data {
 	 * if the te is in the time event list or not (when id == TE_MAX)
 	 */
 	u32 id;
+	u8 link_id;
 };
 
  /* Power management */
@@ -1956,7 +1957,7 @@ int iwl_mvm_cancel_roc(struct ieee80211_hw *hw,
 		       struct ieee80211_vif *vif);
 /*Session Protection */
 void iwl_mvm_protect_assoc(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
-			   u32 duration_override);
+			   u32 duration_override, unsigned int link_id);
 
 /* Quota management */
 static inline size_t iwl_mvm_quota_cmd_size(struct iwl_mvm *mvm)
drivers/net/wireless/intel/iwlwifi/mvm/tdls.c +1 -1
index fac992af3ddb..e7d5f4ebeb25 100644
@@ -155,7 +155,7 @@ void iwl_mvm_mac_mgd_protect_tdls_discover(struct ieee80211_hw *hw,
 	if (fw_has_capa(&mvm->fw->ucode_capa,
 			IWL_UCODE_TLV_CAPA_SESSION_PROT_CMD))
 		iwl_mvm_schedule_session_protection(mvm, vif, duration,
-						    duration, true);
+						    duration, true, link_id);
 	else
 		iwl_mvm_protect_session(mvm, vif, duration,
 					duration, 100, true);
drivers/net/wireless/intel/iwlwifi/mvm/time-event.c +8 -2
index 7ab6cabda9a4..54e57c7ecfc8 100644
@@ -42,6 +42,7 @@ void iwl_mvm_te_clear_data(struct iwl_mvm *mvm,
 	te_data->uid = 0;
 	te_data->id = TE_MAX;
 	te_data->vif = NULL;
+	te_data->link_id = -1;
 }
 
 void iwl_mvm_roc_done_wk(struct work_struct *wk)
@@ -951,6 +952,9 @@ iwl_mvm_start_p2p_roc_session_protection(struct iwl_mvm *mvm,
 	/* The time_event_data.id field is reused to save session
 	 * protection's configuration.
 	 */
+
+	mvmvif->time_event_data.link_id = 0;
+
 	switch (type) {
 	case IEEE80211_ROC_TYPE_NORMAL:
 		mvmvif->time_event_data.id =
@@ -1231,7 +1235,8 @@ static bool iwl_mvm_session_prot_notif(struct iwl_notif_wait_data *notif_wait,
 void iwl_mvm_schedule_session_protection(struct iwl_mvm *mvm,
 					 struct ieee80211_vif *vif,
 					 u32 duration, u32 min_duration,
-					 bool wait_for_notif)
+					 bool wait_for_notif,
+					 unsigned int link_id)
 {
 	struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
 	struct iwl_mvm_time_event_data *te_data = &mvmvif->time_event_data;
@@ -1249,7 +1254,7 @@ void iwl_mvm_schedule_session_protection(struct iwl_mvm *mvm,
 	lockdep_assert_held(&mvm->mutex);
 
 	spin_lock_bh(&mvm->time_event_lock);
-	if (te_data->running &&
+	if (te_data->running && te_data->link_id == link_id &&
 	    time_after(te_data->end_jiffies, TU_TO_EXP_TIME(min_duration))) {
 		IWL_DEBUG_TE(mvm, "We have enough time in the current TE: %u\n",
 			     jiffies_to_msecs(te_data->end_jiffies - jiffies));
@@ -1266,6 +1271,7 @@ void iwl_mvm_schedule_session_protection(struct iwl_mvm *mvm,
 	te_data->id = le32_to_cpu(cmd.conf_id);
 	te_data->duration = le32_to_cpu(cmd.duration_tu);
 	te_data->vif = vif;
+	te_data->link_id = link_id;
 	spin_unlock_bh(&mvm->time_event_lock);
 
 	IWL_DEBUG_TE(mvm, "Add new session protection, duration %d TU\n",
drivers/net/wireless/intel/iwlwifi/mvm/time-event.h +3 -1
index f77df939b6b1..49256ba4cf58 100644
@@ -206,11 +206,13 @@ iwl_mvm_te_scheduled(struct iwl_mvm_time_event_data *te_data)
  * @duration: the requested duration of the protection
  * @min_duration: the minimum duration of the protection
  * @wait_for_notif: if true, will block until the start of the protection
+ * @link_id: The link to schedule a session protection for
  */
 void iwl_mvm_schedule_session_protection(struct iwl_mvm *mvm,
 					 struct ieee80211_vif *vif,
 					 u32 duration, u32 min_duration,
-					 bool wait_for_notif);
+					 bool wait_for_notif,
+					 unsigned int link_id);
 
 /**
  * iwl_mvm_rx_session_protect_notif - handles %SESSION_PROTECTION_NOTIF
Signature · 1 line
2.38.1
#2 lore raw

PATCH 2/14 wifi: iwlwifi: support link_id in SESSION_PROTECTION cmd

In reply to [email protected]

From: Miri Korenblit <[email protected]>

FW is introducing an API change in which link ID will be used for session protection cmd. Add support for it.

---
 .../intel/iwlwifi/fw/api/time-event.h         | 11 ++-
 .../wireless/intel/iwlwifi/mvm/time-event.c   | 78 ++++++++++++++-----
 2 files changed, 64 insertions(+), 25 deletions(-)
drivers/net/wireless/intel/iwlwifi/fw/api/time-event.h +7 -4
index f0d4056199a7..701b2929c3a4 100644
@@ -1,6 +1,6 @@
 /* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */
 /*
- * Copyright (C) 2012-2014, 2018-2020, 2022 Intel Corporation
+ * Copyright (C) 2012-2014, 2018-2020, 2022-2023 Intel Corporation
  * Copyright (C) 2013-2015 Intel Mobile Communications GmbH
  * Copyright (C) 2016-2017 Intel Deutschland GmbH
  */
@@ -432,8 +432,8 @@ enum iwl_mvm_session_prot_conf_id {
 
 /**
  * struct iwl_mvm_session_prot_cmd - configure a session protection
- * @id_and_color: the id and color of the mac for which this session protection
- *	is sent
+ * @id_and_color: the id and color of the link (or mac, for command version 1)
+ *	for which this session protection is sent
  * @action: can be either FW_CTXT_ACTION_ADD or FW_CTXT_ACTION_REMOVE,
  *	see &enum iwl_ctxt_action
  * @conf_id: see &enum iwl_mvm_session_prot_conf_id
@@ -454,7 +454,10 @@ struct iwl_mvm_session_prot_cmd {
 	__le32 duration_tu;
 	__le32 repetition_count;
 	__le32 interval;
-} __packed; /* SESSION_PROTECTION_CMD_API_S_VER_1 */
+} __packed;
+/* SESSION_PROTECTION_CMD_API_S_VER_1 and
+ * SESSION_PROTECTION_CMD_API_S_VER_2
+ */
 
 /**
  * struct iwl_mvm_session_prot_notif - session protection started / ended
drivers/net/wireless/intel/iwlwifi/mvm/time-event.c +57 -21

153 lines not on this page · raw message

Signature · 1 line
2.38.1
#3 lore raw

PATCH 3/14 wifi: iwlwifi: support link id in SESSION_PROTECTION_NOTIF

In reply to [email protected]

From: Miri Korenblit <[email protected]>

FW is introducing an API change in which link ID will be used for session protection notif. Add support for it.

---
 .../intel/iwlwifi/fw/api/time-event.h         | 10 ++++---
 .../wireless/intel/iwlwifi/mvm/time-event.c   | 27 +++++++++++++++++--
 2 files changed, 32 insertions(+), 5 deletions(-)
drivers/net/wireless/intel/iwlwifi/fw/api/time-event.h +7 -3
index 701b2929c3a4..2e15be71c957 100644
@@ -461,7 +461,8 @@ struct iwl_mvm_session_prot_cmd {
 
 /**
  * struct iwl_mvm_session_prot_notif - session protection started / ended
- * @mac_id: the mac id for which the session protection started / ended
+ * @mac_link_id: the mac id (or link id, for notif ver > 2) for which the
+ *	session protection started / ended
  * @status: 1 means success, 0 means failure
  * @start: 1 means the session protection started, 0 means it ended
  * @conf_id: see &enum iwl_mvm_session_prot_conf_id
@@ -470,10 +471,13 @@ struct iwl_mvm_session_prot_cmd {
  * and end even the firmware could not schedule it.
  */
 struct iwl_mvm_session_prot_notif {
-	__le32 mac_id;
+	__le32 mac_link_id;
 	__le32 status;
 	__le32 start;
 	__le32 conf_id;
-} __packed; /* SESSION_PROTECTION_NOTIFICATION_API_S_VER_2 */
+} __packed;
+/* SESSION_PROTECTION_NOTIFICATION_API_S_VER_2 and
+ * SESSION_PROTECTION_NOTIFICATION_API_S_VER_3
+ */
 
 #endif /* __iwl_fw_api_time_event_h__ */
drivers/net/wireless/intel/iwlwifi/mvm/time-event.c +25 -2
index ecbebef80791..218fdf1ed530 100644
@@ -898,18 +898,41 @@ void iwl_mvm_rx_session_protect_notif(struct iwl_mvm *mvm,
 {
 	struct iwl_rx_packet *pkt = rxb_addr(rxb);
 	struct iwl_mvm_session_prot_notif *notif = (void *)pkt->data;
+	unsigned int ver =
+		iwl_fw_lookup_cmd_ver(mvm->fw,
+				      WIDE_ID(MAC_CONF_GROUP,
+					      SESSION_PROTECTION_CMD), 2);
+	int id = le32_to_cpu(notif->mac_link_id);
 	struct ieee80211_vif *vif;
 	struct iwl_mvm_vif *mvmvif;
+	unsigned int notif_link_id;
 
 	rcu_read_lock();
-	vif = iwl_mvm_rcu_dereference_vif_id(mvm, le32_to_cpu(notif->mac_id),
-					     true);
+
+	if (ver <= 2) {
+		vif = iwl_mvm_rcu_dereference_vif_id(mvm, id, true);
+	} else {
+		struct ieee80211_bss_conf *link_conf =
+			iwl_mvm_rcu_fw_link_id_to_link_conf(mvm, id, true);
+
+		if (!link_conf)
+			goto out_unlock;
+
+		notif_link_id = link_conf->link_id;
+		vif = link_conf->vif;
+	}
 
 	if (!vif)
 		goto out_unlock;
 
 	mvmvif = iwl_mvm_vif_from_mac80211(vif);
 
+	if (WARN(ver > 2 && mvmvif->time_event_data.link_id >= 0 &&
+		 mvmvif->time_event_data.link_id != notif_link_id,
+		 "SESION_PROTECTION_NOTIF was received for link %u, while the current time event is on link %u\n",
+		 notif_link_id, mvmvif->time_event_data.link_id))
+		goto out_unlock;
+
 	/* The vif is not a P2P_DEVICE, maintain its time_event_data */
 	if (vif->type != NL80211_IFTYPE_P2P_DEVICE) {
 		struct iwl_mvm_time_event_data *te_data =
Signature · 1 line
2.38.1
#4 lore raw

PATCH 4/14 wifi: iwlwifi: api: fix center_freq label in PHY diagram

In reply to [email protected]

From: Johannes Berg <[email protected]>

Somehow I managed to put the EHT line in the wrong place and also didn't indent the center_freq label correctly. Fix it.

---
 drivers/net/wireless/intel/iwlwifi/fw/api/phy-ctxt.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/wireless/intel/iwlwifi/fw/api/phy-ctxt.h +2 -2
index 8fe42cff1102..306ed88de463 100644
@@ -1,6 +1,6 @@
 /* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */
 /*
- * Copyright (C) 2012-2014, 2018, 2020-2022 Intel Corporation
+ * Copyright (C) 2012-2014, 2018, 2020-2023 Intel Corporation
  * Copyright (C) 2013-2015 Intel Mobile Communications GmbH
  * Copyright (C) 2016-2017 Intel Deutschland GmbH
  */
@@ -25,8 +25,8 @@
  * For legacy set bit means upper channel, otherwise lower.
  * For VHT - bit-2 marks if the control is lower/upper relative to center-freq
  *   bits-1:0 mark the distance from the center freq. for 20Mhz, offset is 0.
- *                                   center_freq
  * For EHT - bit-3 is used for extended distance
+ *                                           center_freq
  *                                                |
  * 40Mhz                                     |____|____|
  * 80Mhz                                |____|____|____|____|
Signature · 1 line
2.38.1
#5 lore raw

PATCH 5/14 wifi: iwlwifi: mvm: remove set_tim callback for MLD ops

In reply to [email protected]

From: Johannes Berg <[email protected]>

In new firmware, we don't need this any more and it won't be called any more by mac80211, since powersave handling is all done by firmware. Remove it from the MLD ops.

---
 drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c     | 4 ++--
 drivers/net/wireless/intel/iwlwifi/mvm/mld-mac80211.c | 2 --
 drivers/net/wireless/intel/iwlwifi/mvm/mvm.h          | 2 --
 3 files changed, 2 insertions(+), 6 deletions(-)
drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c +2 -2
index 38ee1629ec4b..c1c9cdf49a41 100644
@@ -5273,8 +5273,8 @@ int iwl_mvm_tx_last_beacon(struct ieee80211_hw *hw)
 	return mvm->ibss_manager;
 }
 
-int iwl_mvm_set_tim(struct ieee80211_hw *hw, struct ieee80211_sta *sta,
-		    bool set)
+static int iwl_mvm_set_tim(struct ieee80211_hw *hw, struct ieee80211_sta *sta,
+			   bool set)
 {
 	struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw);
 	struct iwl_mvm_sta *mvm_sta = iwl_mvm_sta_from_mac80211(sta);
drivers/net/wireless/intel/iwlwifi/mvm/mld-mac80211.c +0 -2
index 8402482a74a0..407b34a224c1 100644
@@ -1266,8 +1266,6 @@ const struct ieee80211_ops iwl_mvm_mld_hw_ops = {
 
 	.tx_last_beacon = iwl_mvm_tx_last_beacon,
 
-	.set_tim = iwl_mvm_set_tim,
-
 	.channel_switch = iwl_mvm_channel_switch,
 	.pre_channel_switch = iwl_mvm_pre_channel_switch,
 	.post_channel_switch = iwl_mvm_post_channel_switch,
drivers/net/wireless/intel/iwlwifi/mvm/mvm.h +0 -2
index 0bd2a8bcaee5..385bbeca4796 100644
@@ -2688,8 +2688,6 @@ void iwl_mvm_remove_chanctx(struct ieee80211_hw *hw,
 void iwl_mvm_change_chanctx(struct ieee80211_hw *hw,
 			    struct ieee80211_chanctx_conf *ctx, u32 changed);
 int iwl_mvm_tx_last_beacon(struct ieee80211_hw *hw);
-int iwl_mvm_set_tim(struct ieee80211_hw *hw, struct ieee80211_sta *sta,
-		    bool set);
 void iwl_mvm_channel_switch(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
 			    struct ieee80211_channel_switch *chsw);
 int iwl_mvm_pre_channel_switch(struct ieee80211_hw *hw,
Signature · 1 line
2.38.1
#6 lore raw

PATCH 6/14 wifi: iwlwifi: mvm: fix netif csum flags

In reply to [email protected]

From: Johannes Berg <[email protected]>

We shouldn't advertise arbitrary checksum flags since we had to remove support for it due to broken hardware.

Fixes ec18e7d4d20d ("wifi: iwlwifi: mvm: use old checksum for Bz A-step")
---
 drivers/net/wireless/intel/iwlwifi/cfg/bz.c     | 4 ++--
 drivers/net/wireless/intel/iwlwifi/cfg/sc.c     | 2 +-
 drivers/net/wireless/intel/iwlwifi/iwl-config.h | 5 +----
 3 files changed, 4 insertions(+), 7 deletions(-)
drivers/net/wireless/intel/iwlwifi/cfg/bz.c +2 -2
index b2ebc8146465..ed097dd394c9 100644
@@ -158,7 +158,7 @@ const struct iwl_cfg iwl_cfg_bz = {
 	.fw_name_mac = "bz",
 	.uhb_supported = true,
 	IWL_DEVICE_BZ,
-	.features = IWL_TX_CSUM_NETIF_FLAGS_BZ | NETIF_F_RXCSUM,
+	.features = IWL_TX_CSUM_NETIF_FLAGS | NETIF_F_RXCSUM,
 	.num_rbds = IWL_NUM_RBDS_BZ_EHT,
 };
 
@@ -166,7 +166,7 @@ const struct iwl_cfg iwl_cfg_gl = {
 	.fw_name_mac = "gl",
 	.uhb_supported = true,
 	IWL_DEVICE_BZ,
-	.features = IWL_TX_CSUM_NETIF_FLAGS_BZ | NETIF_F_RXCSUM,
+	.features = IWL_TX_CSUM_NETIF_FLAGS | NETIF_F_RXCSUM,
 	.num_rbds = IWL_NUM_RBDS_BZ_EHT,
 };
 
drivers/net/wireless/intel/iwlwifi/cfg/sc.c +1 -1
index fea4551ea86a..bc1e75ee946a 100644
@@ -151,7 +151,7 @@ const struct iwl_cfg iwl_cfg_sc = {
 	.fw_name_mac = "sc",
 	.uhb_supported = true,
 	IWL_DEVICE_SC,
-	.features = IWL_TX_CSUM_NETIF_FLAGS_BZ | NETIF_F_RXCSUM,
+	.features = IWL_TX_CSUM_NETIF_FLAGS | NETIF_F_RXCSUM,
 	.num_rbds = IWL_NUM_RBDS_SC_EHT,
 };
 
drivers/net/wireless/intel/iwlwifi/iwl-config.h +1 -4
index 90bebdf85c06..02ded22295c1 100644
@@ -86,10 +86,7 @@ enum iwl_nvm_type {
 #define IWL_DEFAULT_MAX_TX_POWER 22
 #define IWL_TX_CSUM_NETIF_FLAGS (NETIF_F_IPV6_CSUM | NETIF_F_IP_CSUM |\
 				 NETIF_F_TSO | NETIF_F_TSO6)
-#define IWL_TX_CSUM_NETIF_FLAGS_BZ (NETIF_F_HW_CSUM | NETIF_F_TSO | NETIF_F_TSO6)
-#define IWL_CSUM_NETIF_FLAGS_MASK (IWL_TX_CSUM_NETIF_FLAGS | \
-				   IWL_TX_CSUM_NETIF_FLAGS_BZ | \
-				   NETIF_F_RXCSUM)
+#define IWL_CSUM_NETIF_FLAGS_MASK (IWL_TX_CSUM_NETIF_FLAGS | NETIF_F_RXCSUM)
 
 /* Antenna presence definitions */
 #define	ANT_NONE	0x0
Signature · 1 line
2.38.1
#7 lore raw

PATCH 7/14 wifi: iwlwifi: add support for SNPS DPHYIP region type

In reply to [email protected]

From: Daniel Gabay <[email protected]>

Add the required logic for parsing and dumping this new region.

---
 .../wireless/intel/iwlwifi/fw/api/dbg-tlv.h   |  3 +
 drivers/net/wireless/intel/iwlwifi/fw/dbg.c   | 56 ++++++++++++++++++-
 drivers/net/wireless/intel/iwlwifi/iwl-prph.h |  4 ++
 3 files changed, 62 insertions(+), 1 deletion(-)
drivers/net/wireless/intel/iwlwifi/fw/api/dbg-tlv.h +3 -0
index fb421500f261..394747deb269 100644
@@ -159,6 +159,7 @@ struct iwl_fw_ini_region_internal_buffer {
  *	&IWL_FW_INI_REGION_PAGING, &IWL_FW_INI_REGION_CSR,
  *	&IWL_FW_INI_REGION_DRAM_IMR and &IWL_FW_INI_REGION_PCI_IOSF_CONFIG
  *	&IWL_FW_INI_REGION_DBGI_SRAM, &FW_TLV_DEBUG_REGION_TYPE_DBGI_SRAM,
+ *	&IWL_FW_INI_REGION_PERIPHERY_SNPS_DPHYIP,
  * @dev_addr_range: device address range configuration. Used by
  *	&IWL_FW_INI_REGION_PERIPHERY_MAC_RANGE and
  *	&IWL_FW_INI_REGION_PERIPHERY_PHY_RANGE
@@ -392,6 +393,7 @@ enum iwl_fw_ini_buffer_location {
  * @IWL_FW_INI_REGION_DBGI_SRAM: periphery registers of DBGI SRAM
  * @IWL_FW_INI_REGION_PERIPHERY_MAC_RANGE: a range of periphery registers of MAC
  * @IWL_FW_INI_REGION_PERIPHERY_PHY_RANGE: a range of periphery registers of PHY
+ * @IWL_FW_INI_REGION_PERIPHERY_SNPS_DPHYIP: periphery registers of SNPS DPHYIP
  * @IWL_FW_INI_REGION_NUM: number of region types
  */
 enum iwl_fw_ini_region_type {
@@ -416,6 +418,7 @@ enum iwl_fw_ini_region_type {
 	IWL_FW_INI_REGION_DBGI_SRAM,
 	IWL_FW_INI_REGION_PERIPHERY_MAC_RANGE,
 	IWL_FW_INI_REGION_PERIPHERY_PHY_RANGE,
+	IWL_FW_INI_REGION_PERIPHERY_SNPS_DPHYIP,
 	IWL_FW_INI_REGION_NUM
 }; /* FW_TLV_DEBUG_REGION_TYPE_API_E */
 
drivers/net/wireless/intel/iwlwifi/fw/dbg.c +55 -1

74 lines not on this page · raw message

drivers/net/wireless/intel/iwlwifi/iwl-prph.h +4 -0
index da035dbfbdb0..dd32c287b983 100644
@@ -516,4 +516,8 @@ enum {
 #define WFPM_LMAC2_PD_NOTIFICATION 0xA033CC
 #define WFPM_LMAC2_PD_RE_READ BIT(31)
 
+#define DPHYIP_INDIRECT			0xA2D800
+#define DPHYIP_INDIRECT_RD_MSK		0xFF000000
+#define DPHYIP_INDIRECT_RD_SHIFT	24
+
 #endif				/* __iwl_prph_h__ */
Signature · 1 line
2.38.1
#8 lore raw

PATCH 8/14 wifi: iwlwifi: pcie: synchronize IRQs before NAPI

In reply to [email protected]

From: Johannes Berg <[email protected]>

When we want to synchronize the NAPI, which was added in commit 5af2bb3168db ("wifi: iwlwifi: call napi_synchronize() before freeing rx/tx queues"), we also need to make sure we can't actually reschedule the NAPI. Yes, this happens while interrupts are disabled, but interrupts may still be running or pending. Also call iwl_pcie_synchronize_irqs() to ensure we won't reschedule the NAPI.

Fixes 4cf2f5904d97 ("iwlwifi: queue: avoid memory leak in reset flow")
---
 drivers/net/wireless/intel/iwlwifi/pcie/trans-gen2.c | 1 +
 drivers/net/wireless/intel/iwlwifi/pcie/trans.c      | 1 +
 2 files changed, 2 insertions(+)
drivers/net/wireless/intel/iwlwifi/pcie/trans-gen2.c +1 -0
index 085c4b49be87..c9e5bda8f0b7 100644
@@ -161,6 +161,7 @@ void _iwl_trans_pcie_gen2_stop_device(struct iwl_trans *trans)
 	if (test_and_clear_bit(STATUS_DEVICE_ENABLED, &trans->status)) {
 		IWL_DEBUG_INFO(trans,
 			       "DEVICE_ENABLED bit was set and is now cleared\n");
+		iwl_pcie_synchronize_irqs(trans);
 		iwl_pcie_rx_napi_sync(trans);
 		iwl_txq_gen2_tx_free(trans);
 		iwl_pcie_rx_stop(trans);
drivers/net/wireless/intel/iwlwifi/pcie/trans.c +1 -0
index 385e152f04fe..a468e5efeecd 100644
@@ -1264,6 +1264,7 @@ static void _iwl_trans_pcie_stop_device(struct iwl_trans *trans)
 	if (test_and_clear_bit(STATUS_DEVICE_ENABLED, &trans->status)) {
 		IWL_DEBUG_INFO(trans,
 			       "DEVICE_ENABLED bit was set and is now cleared\n");
+		iwl_pcie_synchronize_irqs(trans);
 		iwl_pcie_rx_napi_sync(trans);
 		iwl_pcie_tx_stop(trans);
 		iwl_pcie_rx_stop(trans);
Signature · 1 line
2.38.1
#9 lore raw

PATCH 9/14 wifi: iwlwifi: mvm: fix size check for fw_link_id

In reply to [email protected]

From: Gregory Greenman <[email protected]>

Check that fw_link_id does not exceed the size of link_id_to_link_conf array. There's no any codepath that can cause that, but it's still safer to verify in case fw_link_id gets corrupted.

---
 drivers/net/wireless/intel/iwlwifi/mvm/link.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/wireless/intel/iwlwifi/mvm/link.c +2 -2
index d0d5ebc03d53..c3831440a019 100644
@@ -60,7 +60,7 @@ int iwl_mvm_add_link(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
 	if (link_info->fw_link_id == IWL_MVM_FW_LINK_ID_INVALID) {
 		link_info->fw_link_id = iwl_mvm_get_free_fw_link_id(mvm,
 								    mvmvif);
-		if (link_info->fw_link_id == IWL_MVM_FW_LINK_ID_INVALID)
+		if (link_info->fw_link_id >= ARRAY_SIZE(mvm->link_id_to_link_conf))
 			return -EINVAL;
 
 		rcu_assign_pointer(mvm->link_id_to_link_conf[link_info->fw_link_id],
@@ -243,7 +243,7 @@ int iwl_mvm_remove_link(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
 	int ret;
 
 	if (WARN_ON(!link_info ||
-		    link_info->fw_link_id == IWL_MVM_FW_LINK_ID_INVALID))
+		    link_info->fw_link_id >= ARRAY_SIZE(mvm->link_id_to_link_conf)))
 		return -EINVAL;
 
 	RCU_INIT_POINTER(mvm->link_id_to_link_conf[link_info->fw_link_id],
Signature · 1 line
2.38.1
#10 lore raw

PATCH 10/14 wifi: iwlwifi: mvm: Return success if link could not be removed

In reply to [email protected]

From: Benjamin Berg <[email protected]>

iwl_mvm_remove_link would return an error if the link could not be removed. However, doing so prevents recovery if a link was not uploaded to the FW in the first place and the link_info was not allocated or fw_link_id is not set.

Returning success means that we can still try to continue with adding new links in change_vif_links.

---
 drivers/net/wireless/intel/iwlwifi/mvm/link.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/wireless/intel/iwlwifi/mvm/link.c +2 -1
index c3831440a019..be48b0fc9cb6 100644
@@ -242,9 +242,10 @@ int iwl_mvm_remove_link(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
 	struct iwl_link_config_cmd cmd = {};
 	int ret;
 
+	/* mac80211 thought we have the link, but it was never configured */
 	if (WARN_ON(!link_info ||
 		    link_info->fw_link_id >= ARRAY_SIZE(mvm->link_id_to_link_conf)))
-		return -EINVAL;
+		return 0;
 
 	RCU_INIT_POINTER(mvm->link_id_to_link_conf[link_info->fw_link_id],
 			 NULL);
Signature · 1 line
2.38.1
#11 lore raw

PATCH 11/14 wifi: iwlwifi: disable multi rx queue for 9000

In reply to [email protected]

From: Emmanuel Grumbach <[email protected]>

Multi rx queue allows to spread the load of the Rx streams on different CPUs. 9000 series required complex synchronization mechanisms from the driver side since the hardware / firmware is not able to provide information about duplicate packets and timeouts inside the reordering buffer.

Users have complained that for newer devices, all those synchronization mechanisms have caused spurious packet drops. Those packet drops disappeared if we simplify the code, but unfortunately, we can't have RSS enabled on 9000 series without this complex code.

Remove support for RSS on 9000 so that we can make the code much simpler for newer devices and fix the bugs for them.

The down side of this patch is a that all the Rx path will be routed to a single CPU, but this has never been an issue, the modern CPUs are just fast enough to cope with all the traffic.

---
 drivers/net/wireless/intel/iwlwifi/iwl-trans.h    |  2 +-
 drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c |  4 +++-
 drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c     | 11 ++++++++++-
 3 files changed, 14 insertions(+), 3 deletions(-)
drivers/net/wireless/intel/iwlwifi/iwl-trans.h +1 -1
index 3d58a2b9518c..cab4d7351088 100644
@@ -279,7 +279,7 @@ static inline void iwl_free_rxb(struct iwl_rx_cmd_buffer *r)
 #define IWL_MGMT_TID		15
 #define IWL_FRAME_LIMIT	64
 #define IWL_MAX_RX_HW_QUEUES	16
-#define IWL_9000_MAX_RX_HW_QUEUES	6
+#define IWL_9000_MAX_RX_HW_QUEUES	1
 
 /**
  * enum iwl_wowlan_status - WoWLAN image/device status
drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c +3 -1
index c1c9cdf49a41..28da98e75e52 100644
@@ -376,7 +376,9 @@ int iwl_mvm_mac_setup_register(struct iwl_mvm *mvm)
 		ieee80211_hw_set(hw, HAS_RATE_CONTROL);
 	}
 
-	if (iwl_mvm_has_new_rx_api(mvm))
+	/* We want to use the mac80211's reorder buffer for 9000 */
+	if (iwl_mvm_has_new_rx_api(mvm) &&
+	    mvm->trans->trans_cfg->device_family > IWL_DEVICE_FAMILY_9000)
 		ieee80211_hw_set(hw, SUPPORTS_REORDERING_BUFFER);
 
 	if (fw_has_capa(&mvm->fw->ucode_capa,
drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c +10 -1
index 041afc97a911..17c3d00d4d27 100644
@@ -957,6 +957,9 @@ static bool iwl_mvm_reorder(struct iwl_mvm *mvm,
 	baid = (reorder & IWL_RX_MPDU_REORDER_BAID_MASK) >>
 		IWL_RX_MPDU_REORDER_BAID_SHIFT;
 
+	if (mvm->trans->trans_cfg->device_family == IWL_DEVICE_FAMILY_9000)
+		return false;
+
 	/*
 	 * This also covers the case of receiving a Block Ack Request
 	 * outside a BA session; we'll pass it to mac80211 and that
@@ -2617,9 +2620,15 @@ void iwl_mvm_rx_mpdu_mq(struct iwl_mvm *mvm, struct napi_struct *napi,
 
 	if (!iwl_mvm_reorder(mvm, napi, queue, sta, skb, desc) &&
 	    likely(!iwl_mvm_time_sync_frame(mvm, skb, hdr->addr2)) &&
-	    likely(!iwl_mvm_mei_filter_scan(mvm, skb)))
+	    likely(!iwl_mvm_mei_filter_scan(mvm, skb))) {
+		if (mvm->trans->trans_cfg->device_family == IWL_DEVICE_FAMILY_9000 &&
+		    (desc->mac_flags2 & IWL_RX_MPDU_MFLG2_AMSDU) &&
+		    !(desc->amsdu_info & IWL_RX_MPDU_AMSDU_LAST_SUBFRAME))
+			rx_status->flag |= RX_FLAG_AMSDU_MORE;
+
 		iwl_mvm_pass_packet_to_mac80211(mvm, napi, skb, queue, sta,
 						link_sta);
+	}
 out:
 	rcu_read_unlock();
 }
Signature · 1 line
2.38.1
#12 lore raw

PATCH 12/14 wifi: iwlwifi: mvm: simplify the reorder buffer

In reply to [email protected]

From: Emmanuel Grumbach <[email protected]>

The firmware / hardware of devices supporting RSS is able to report duplicates and packets that time out inside the reoder buffer. We can now remove all the complex logic that was implemented to keep all the Rx queues more the less synchronized: we used to send a message to all the queues through the firmware to teach the different queues about what is the current SSN every 2048 packets.

Now that we rely on the firmware / hardware to detect duplicates, we can completely remove the code that did that in the driver and it has been reported that this code was spuriously dropping legit packets.

---
 drivers/net/wireless/intel/iwlwifi/mvm/mvm.h  |  28 +-
 drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c | 313 +-----------------
 drivers/net/wireless/intel/iwlwifi/mvm/sta.c  |  18 +-
 drivers/net/wireless/intel/iwlwifi/mvm/sta.h  |   7 -
 4 files changed, 24 insertions(+), 342 deletions(-)
drivers/net/wireless/intel/iwlwifi/mvm/mvm.h +3 -25
index 385bbeca4796..81f7b0a644f9 100644
@@ -647,18 +647,9 @@ struct iwl_mvm_tcm {
  * @queue: queue of this reorder buffer
  * @last_amsdu: track last ASMDU SN for duplication detection
  * @last_sub_index: track ASMDU sub frame index for duplication detection
- * @reorder_timer: timer for frames are in the reorder buffer. For AMSDU
- *	it is the time of last received sub-frame
- * @removed: prevent timer re-arming
  * @valid: reordering is valid for this queue
  * @lock: protect reorder buffer internal state
  * @mvm: mvm pointer, needed for frame timer context
- * @consec_oldsn_drops: consecutive drops due to old SN
- * @consec_oldsn_ampdu_gp2: A-MPDU GP2 timestamp to track
- *	when to apply old SN consecutive drop workaround
- * @consec_oldsn_prev_drop: track whether or not an MPDU
- *	that was single/part of the previous A-MPDU was
- *	dropped due to old SN
  */
 struct iwl_mvm_reorder_buffer {
 	u16 head_sn;
@@ -667,33 +658,21 @@ struct iwl_mvm_reorder_buffer {
 	int queue;
 	u16 last_amsdu;
 	u8 last_sub_index;
-	struct timer_list reorder_timer;
-	bool removed;
 	bool valid;
 	spinlock_t lock;
 	struct iwl_mvm *mvm;
-	unsigned int consec_oldsn_drops;
-	u32 consec_oldsn_ampdu_gp2;
-	unsigned int consec_oldsn_prev_drop:1;
 } ____cacheline_aligned_in_smp;
 
 /**
- * struct _iwl_mvm_reorder_buf_entry - reorder buffer entry per-queue/per-seqno
+ * struct iwl_mvm_reorder_buf_entry - reorder buffer entry per-queue/per-seqno
  * @frames: list of skbs stored
- * @reorder_time: time the packet was stored in the reorder buffer
  */
-struct _iwl_mvm_reorder_buf_entry {
-	struct sk_buff_head frames;
-	unsigned long reorder_time;
-};
-
-/* make this indirection to get the aligned thing */
 struct iwl_mvm_reorder_buf_entry {
-	struct _iwl_mvm_reorder_buf_entry e;
+	struct sk_buff_head frames;
 }
 #ifndef __CHECKER__
 /* sparse doesn't like this construct: "bad integer constant expression" */
-__aligned(roundup_pow_of_two(sizeof(struct _iwl_mvm_reorder_buf_entry)))
+__aligned(roundup_pow_of_two(sizeof(struct sk_buff_head)))
 #endif
 ;
 
@@ -2335,7 +2314,6 @@ void iwl_mvm_sync_rx_queues_internal(struct iwl_mvm *mvm,
 				     enum iwl_mvm_rxq_notif_type type,
 				     bool sync,
 				     const void *data, u32 size);
-void iwl_mvm_reorder_timer_expired(struct timer_list *t);
 struct ieee80211_vif *iwl_mvm_get_bss_vif(struct iwl_mvm *mvm);
 struct ieee80211_vif *iwl_mvm_get_vif_by_macid(struct iwl_mvm *mvm, u32 macid);
 bool iwl_mvm_is_vif_assoc(struct iwl_mvm *mvm);
drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c +18 -295

438 lines not on this page · raw message

drivers/net/wireless/intel/iwlwifi/mvm/sta.c +3 -15
index 9c5ce4c52a05..bba96a968890 100644
@@ -2719,18 +2719,9 @@ static void iwl_mvm_free_reorder(struct iwl_mvm *mvm,
 		WARN_ON(1);
 
 		for (j = 0; j < reorder_buf->buf_size; j++)
-			__skb_queue_purge(&entries[j].e.frames);
-		/*
-		 * Prevent timer re-arm. This prevents a very far fetched case
-		 * where we timed out on the notification. There may be prior
-		 * RX frames pending in the RX queue before the notification
-		 * that might get processed between now and the actual deletion
-		 * and we would re-arm the timer although we are deleting the
-		 * reorder buffer.
-		 */
-		reorder_buf->removed = true;
+			__skb_queue_purge(&entries[j].frames);
+
 		spin_unlock_bh(&reorder_buf->lock);
-		del_timer_sync(&reorder_buf->reorder_timer);
 	}
 }
 
@@ -2750,15 +2741,12 @@ static void iwl_mvm_init_reorder_buffer(struct iwl_mvm *mvm,
 		reorder_buf->num_stored = 0;
 		reorder_buf->head_sn = ssn;
 		reorder_buf->buf_size = buf_size;
-		/* rx reorder timer */
-		timer_setup(&reorder_buf->reorder_timer,
-			    iwl_mvm_reorder_timer_expired, 0);
 		spin_lock_init(&reorder_buf->lock);
 		reorder_buf->mvm = mvm;
 		reorder_buf->queue = i;
 		reorder_buf->valid = false;
 		for (j = 0; j < reorder_buf->buf_size; j++)
-			__skb_queue_head_init(&entries[j].e.frames);
+			__skb_queue_head_init(&entries[j].frames);
 	}
 }
 
drivers/net/wireless/intel/iwlwifi/mvm/sta.h +0 -7
index 7738fdf1d336..b33a0ce096d4 100644
@@ -286,12 +286,10 @@ struct iwl_mvm_key_pn {
  *
  * @IWL_MVM_RXQ_EMPTY: empty sync notification
  * @IWL_MVM_RXQ_NOTIF_DEL_BA: notify RSS queues of delBA
- * @IWL_MVM_RXQ_NSSN_SYNC: notify all the RSS queues with the new NSSN
  */
 enum iwl_mvm_rxq_notif_type {
 	IWL_MVM_RXQ_EMPTY,
 	IWL_MVM_RXQ_NOTIF_DEL_BA,
-	IWL_MVM_RXQ_NSSN_SYNC,
 };
 
 /**
@@ -315,11 +313,6 @@ struct iwl_mvm_delba_data {
 	u32 baid;
 } __packed;
 
-struct iwl_mvm_nssn_sync_data {
-	u32 baid;
-	u32 nssn;
-} __packed;
-
 /**
  * struct iwl_mvm_rxq_dup_data - per station per rx queue data
  * @last_seq: last sequence per tid for duplicate packet detection
Signature · 1 line
2.38.1
#13 lore raw

PATCH 13/14 wifi: iwlwifi: mvm: update IGTK in mvmvif upon D3 resume

In reply to [email protected]

From: Yedidya Benshimol <[email protected]>

During the D3 resume flow, all new rekeys are passed from the FW. Because the FW supports only one IGTK at a time, every IGTK rekey update should be done by removing the last IGTK. The mvmvif holds a pointer to the last IGTK for that reason and thus should be updated when a new IGTK is passed upon resume.

Fixes 04f78e242fff ("wifi: iwlwifi: mvm: Add support for IGTK in D3 resume flow")
---
 drivers/net/wireless/intel/iwlwifi/mvm/d3.c | 10 ++++++++++
 1 file changed, 10 insertions(+)
drivers/net/wireless/intel/iwlwifi/mvm/d3.c +10 -0
index ffb1fdd7ee32..46ee280231ea 100644
@@ -2031,6 +2031,16 @@ iwl_mvm_d3_igtk_bigtk_rekey_add(struct iwl_wowlan_status_data *status,
 	if (IS_ERR(key_config))
 		return false;
 	ieee80211_set_key_rx_seq(key_config, 0, &seq);
+
+	if (key_config->keyidx == 4 || key_config->keyidx == 5) {
+		struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
+		int link_id = vif->active_links ? __ffs(vif->active_links) : 0;
+		struct iwl_mvm_vif_link_info *mvm_link =
+			mvmvif->link[link_id];
+
+		mvm_link->igtk = key_config;
+	}
+
 	return true;
 }
 
Signature · 1 line
2.38.1
#14 lore raw

PATCH 14/14 wifi: iwlwifi: mvm: fix regdb initialization

In reply to [email protected]

From: Gregory Greenman <[email protected]>

In order to get regulatory domain, driver sends MCC_UPDATE_CMD to the FW. One of the parameters in the response is the status which can tell if the regdomain has changed or not.

When iwl_mvm_init_mcc() is called during iwl_op_mode_mvm_start(), then sband is still NULL and channel parameters (i.e. chan->flags) cannot be initialized. When, further in the flow, iwl_mvm_update_mcc() is called during iwl_mvm_up(), it first checks if the regdomain has changed and then skips the update if it remains the same. But, since channel parameters weren't initialized yet, the update should be forced in this codepath. Fix that by adding a corresponding parameter to iwl_mvm_init_fw_regd().

---
 drivers/net/wireless/intel/iwlwifi/mvm/d3.c       | 2 +-
 drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c | 8 +++++---
 drivers/net/wireless/intel/iwlwifi/mvm/mvm.h      | 2 +-
 drivers/net/wireless/intel/iwlwifi/mvm/nvm.c      | 2 +-
 4 files changed, 8 insertions(+), 6 deletions(-)
drivers/net/wireless/intel/iwlwifi/mvm/d3.c +1 -1
index 46ee280231ea..92c45571bd69 100644
@@ -818,7 +818,7 @@ static int iwl_mvm_d3_reprogram(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
 	if (ret)
 		IWL_ERR(mvm, "Failed to send quota: %d\n", ret);
 
-	if (iwl_mvm_is_lar_supported(mvm) && iwl_mvm_init_fw_regd(mvm))
+	if (iwl_mvm_is_lar_supported(mvm) && iwl_mvm_init_fw_regd(mvm, false))
 		IWL_ERR(mvm, "Failed to initialize D3 LAR information\n");
 
 	return 0;
drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c +5 -3
index 28da98e75e52..bb330f1b5d9e 100644
@@ -186,7 +186,7 @@ struct ieee80211_regdomain *iwl_mvm_get_current_regdomain(struct iwl_mvm *mvm,
 				     MCC_SOURCE_OLD_FW, changed);
 }
 
-int iwl_mvm_init_fw_regd(struct iwl_mvm *mvm)
+int iwl_mvm_init_fw_regd(struct iwl_mvm *mvm, bool force_regd_sync)
 {
 	enum iwl_mcc_source used_src;
 	struct ieee80211_regdomain *regd;
@@ -213,8 +213,10 @@ int iwl_mvm_init_fw_regd(struct iwl_mvm *mvm)
 	if (IS_ERR_OR_NULL(regd))
 		return -EIO;
 
-	/* update cfg80211 if the regdomain was changed */
-	if (changed)
+	/* update cfg80211 if the regdomain was changed or the caller explicitly
+	 * asked to update regdomain
+	 */
+	if (changed || force_regd_sync)
 		ret = regulatory_set_wiphy_regd_sync(mvm->hw->wiphy, regd);
 	else
 		ret = 0;
drivers/net/wireless/intel/iwlwifi/mvm/mvm.h +1 -1
index 81f7b0a644f9..760cebf22fee 100644
@@ -2241,7 +2241,7 @@ struct ieee80211_regdomain *iwl_mvm_get_regdomain(struct wiphy *wiphy,
 						  bool *changed);
 struct ieee80211_regdomain *iwl_mvm_get_current_regdomain(struct iwl_mvm *mvm,
 							  bool *changed);
-int iwl_mvm_init_fw_regd(struct iwl_mvm *mvm);
+int iwl_mvm_init_fw_regd(struct iwl_mvm *mvm, bool force_regd_sync);
 void iwl_mvm_update_changed_regdom(struct iwl_mvm *mvm);
 
 /* smart fifo */
drivers/net/wireless/intel/iwlwifi/mvm/nvm.c +1 -1
index 17a1e5717dde..c0dd441e800e 100644
@@ -573,7 +573,7 @@ int iwl_mvm_init_mcc(struct iwl_mvm *mvm)
 	 * try to replay the last set MCC to FW. If it doesn't exist,
 	 * queue an update to cfg80211 to retrieve the default alpha2 from FW.
 	 */
-	retval = iwl_mvm_init_fw_regd(mvm);
+	retval = iwl_mvm_init_fw_regd(mvm, true);
 	if (retval != -ENOENT)
 		return retval;
 
Signature · 1 line
2.38.1