Skip to contentSkip to conversation

wifi: iwlwifi: updates intended for v6.5 2023-06-12

PATCH In review [email protected] 3 participants 22 messages Jun 12, 2023 – Jun 14, 2023 Intel wireless wifi link (iwlwifi)

lore
Share & tools
lore
#0 lore raw

cover wifi: iwlwifi: updates intended for v6.5 2023-06-12

From: Gregory Greenman <[email protected]>

Hi,

This patch set includes iwlwifi patches intended for v6.5. It contains a number of fixes and cleanups along with a continuation of MLO work.

It also advances the firmware API to 79.

Thanks,
Gregory

Abhishek Naik (1):
wifi: iwlwifi: update response for mcc_update command

Alon Giladi (1):
wifi: iwlwifi: debugfs: add ppag capa to fw info file

Avraham Stern (3):
wifi: iwlwifi: mvm: debugfs: add entry for setting maximum TXOP time
wifi: iwlwifi: mvm: FTM initiator MLO support
wifi: iwlwifi: mvm: FTM responder MLO support

Benjamin Berg (1):
wifi: iwlwifi: make debugfs entries link specific

Emmanuel Grumbach (1):
wifi: iwlwifi: pass ESR parameters to the firmware

Gregory Greenman (1):
wifi: iwlwifi: bump FW API to 79 for AX devices

Ilan Peer (1):
wifi: iwlwifi: mvm: Propagate ERP slot changes to FW

Johannes Berg (2):
wifi: iwlwifi: unify checks for HW error values
wifi: iwlwifi: mvm: always set MH len in offload_assist

Mukesh Sisodiya (4):
wifi: iwlwifi: mvm: Handle return value for iwl_mvm_sta_init
wifi: iwlwifi: mvm: fix getting LDPC/STBC support
wifi: iwlwifi: mvm: Add NULL check before dereferencing the pointer
wifi: iwlwifi: fw: print PC register value instead of address

 .../net/wireless/intel/iwlwifi/cfg/22000.c    |   2 +-
 .../wireless/intel/iwlwifi/fw/api/mac-cfg.h   |   4 +-
 .../wireless/intel/iwlwifi/fw/api/nvm-reg.h   |  35 +++-
 drivers/net/wireless/intel/iwlwifi/fw/dbg.c   |   4 +-
 .../net/wireless/intel/iwlwifi/fw/debugfs.c   |  13 +-
 drivers/net/wireless/intel/iwlwifi/fw/dump.c  |   9 +-
 drivers/net/wireless/intel/iwlwifi/iwl-io.c   |   4 +-
 .../wireless/intel/iwlwifi/iwl-nvm-parse.c    | 117 +++++++----
 .../wireless/intel/iwlwifi/iwl-nvm-parse.h    |   4 +-
 .../net/wireless/intel/iwlwifi/iwl-trans.h    |   5 +
 .../wireless/intel/iwlwifi/mvm/debugfs-vif.c  |  38 ++++
 .../net/wireless/intel/iwlwifi/mvm/debugfs.c  | 198 ++++++++++++++----
 .../intel/iwlwifi/mvm/ftm-initiator.c         |  48 +++--
 .../intel/iwlwifi/mvm/ftm-responder.c         |  23 +-
 .../net/wireless/intel/iwlwifi/mvm/mac80211.c |  21 +-
 .../net/wireless/intel/iwlwifi/mvm/mld-mac.c  |  12 ++
 .../wireless/intel/iwlwifi/mvm/mld-mac80211.c |  12 +-
 drivers/net/wireless/intel/iwlwifi/mvm/mvm.h  |  19 +-
 drivers/net/wireless/intel/iwlwifi/mvm/nvm.c  |  63 ++++--
 .../net/wireless/intel/iwlwifi/mvm/power.c    |  14 +-
 .../net/wireless/intel/iwlwifi/mvm/rs-fw.c    |   7 +-
 drivers/net/wireless/intel/iwlwifi/mvm/sta.c  |   2 +
 drivers/net/wireless/intel/iwlwifi/mvm/sta.h  |   9 +-
 drivers/net/wireless/intel/iwlwifi/mvm/tx.c   |  10 +-
 drivers/net/wireless/intel/iwlwifi/pcie/rx.c  |   2 +-
 .../net/wireless/intel/iwlwifi/pcie/trans.c   |   2 +-
 26 files changed, 506 insertions(+), 171 deletions(-)
Signature · 1 line
2.38.1
#1 lore raw

PATCH 1/15 wifi: iwlwifi: make debugfs entries link specific

From: Benjamin Berg <[email protected]>

All of the station elements are really elements for the link. Create them from the correct callback and return the link specific information rather than always using the default link.

---
 .../net/wireless/intel/iwlwifi/mvm/debugfs.c  | 198 ++++++++++++++----
 .../net/wireless/intel/iwlwifi/mvm/mac80211.c |   2 +-
 .../wireless/intel/iwlwifi/mvm/mld-mac80211.c |   2 +-
 drivers/net/wireless/intel/iwlwifi/mvm/mvm.h  |   8 +-
 .../net/wireless/intel/iwlwifi/mvm/rs-fw.c    |   4 +-
 drivers/net/wireless/intel/iwlwifi/mvm/sta.h  |   9 +-
 6 files changed, 169 insertions(+), 54 deletions(-)
drivers/net/wireless/intel/iwlwifi/mvm/debugfs.c +156 -42
index 84a488538427..c037b2ad5fa1 100644
@@ -391,13 +391,14 @@ static ssize_t iwl_dbgfs_stations_read(struct file *file, char __user *user_buf,
 	return simple_read_from_buffer(user_buf, count, ppos, buf, pos);
 }
 
-static ssize_t iwl_dbgfs_rs_data_read(struct file *file, char __user *user_buf,
+static ssize_t iwl_dbgfs_rs_data_read(struct ieee80211_link_sta *link_sta,
+				      struct iwl_mvm_sta *mvmsta,
+				      struct iwl_mvm *mvm,
+				      struct iwl_mvm_link_sta *mvm_link_sta,
+				      char __user *user_buf,
 				      size_t count, loff_t *ppos)
 {
-	struct ieee80211_sta *sta = file->private_data;
-	struct iwl_mvm_sta *mvmsta = iwl_mvm_sta_from_mac80211(sta);
-	struct iwl_lq_sta_rs_fw *lq_sta = &mvmsta->deflink.lq_sta.rs_fw;
-	struct iwl_mvm *mvm = lq_sta->pers.drv;
+	struct iwl_lq_sta_rs_fw *lq_sta = &mvm_link_sta->lq_sta.rs_fw;
 	static const size_t bufsz = 2048;
 	char *buff;
 	int desc = 0;
@@ -407,8 +408,6 @@ static ssize_t iwl_dbgfs_rs_data_read(struct file *file, char __user *user_buf,
 	if (!buff)
 		return -ENOMEM;
 
-	mutex_lock(&mvm->mutex);
-
 	desc += scnprintf(buff + desc, bufsz - desc, "sta_id %d\n",
 			  lq_sta->pers.sta_id);
 	desc += scnprintf(buff + desc, bufsz - desc,
@@ -429,18 +428,19 @@ static ssize_t iwl_dbgfs_rs_data_read(struct file *file, char __user *user_buf,
 				     lq_sta->last_rate_n_flags);
 	if (desc < bufsz - 1)
 		buff[desc++] = '\n';
-	mutex_unlock(&mvm->mutex);
 
 	ret = simple_read_from_buffer(user_buf, count, ppos, buff, desc);
 	kfree(buff);
 	return ret;
 }
 
-static ssize_t iwl_dbgfs_amsdu_len_write(struct ieee80211_sta *sta,
+static ssize_t iwl_dbgfs_amsdu_len_write(struct ieee80211_link_sta *link_sta,
+					 struct iwl_mvm_sta *mvmsta,
+					 struct iwl_mvm *mvm,
+					 struct iwl_mvm_link_sta *mvm_link_sta,
 					 char *buf, size_t count,
 					 loff_t *ppos)
 {
-	struct iwl_mvm_sta *mvmsta = iwl_mvm_sta_from_mac80211(sta);
 	int i;
 	u16 amsdu_len;
 
@@ -448,36 +448,39 @@ static ssize_t iwl_dbgfs_amsdu_len_write(struct ieee80211_sta *sta,
 		return -EINVAL;
 
 	/* only change from debug set <-> debug unset */
-	if (amsdu_len && mvmsta->orig_amsdu_len)
+	if (amsdu_len && mvm_link_sta->orig_amsdu_len)
 		return -EBUSY;
 
 	if (amsdu_len) {
-		mvmsta->orig_amsdu_len = sta->cur->max_amsdu_len;
-		sta->deflink.agg.max_amsdu_len = amsdu_len;
-		sta->deflink.agg.max_amsdu_len = amsdu_len;
-		for (i = 0; i < ARRAY_SIZE(sta->deflink.agg.max_tid_amsdu_len); i++)
-			sta->deflink.agg.max_tid_amsdu_len[i] = amsdu_len;
+		mvm_link_sta->orig_amsdu_len = link_sta->agg.max_amsdu_len;
+		link_sta->agg.max_amsdu_len = amsdu_len;
+		link_sta->agg.max_amsdu_len = amsdu_len;
+		for (i = 0; i < ARRAY_SIZE(link_sta->agg.max_tid_amsdu_len); i++)
+			link_sta->agg.max_tid_amsdu_len[i] = amsdu_len;
 	} else {
-		sta->deflink.agg.max_amsdu_len = mvmsta->orig_amsdu_len;
-		mvmsta->orig_amsdu_len = 0;
+		link_sta->agg.max_amsdu_len = mvm_link_sta->orig_amsdu_len;
+		mvm_link_sta->orig_amsdu_len = 0;
 	}
 
+	ieee80211_sta_recalc_aggregates(link_sta->sta);
+
 	return count;
 }
 
-static ssize_t iwl_dbgfs_amsdu_len_read(struct file *file,
+static ssize_t iwl_dbgfs_amsdu_len_read(struct ieee80211_link_sta *link_sta,
+					struct iwl_mvm_sta *mvmsta,
+					struct iwl_mvm *mvm,
+					struct iwl_mvm_link_sta *mvm_link_sta,
 					char __user *user_buf,
 					size_t count, loff_t *ppos)
 {
-	struct ieee80211_sta *sta = file->private_data;
-	struct iwl_mvm_sta *mvmsta = iwl_mvm_sta_from_mac80211(sta);
-
 	char buf[32];
 	int pos;
 
-	pos = scnprintf(buf, sizeof(buf), "current %d ", sta->cur->max_amsdu_len);
+	pos = scnprintf(buf, sizeof(buf), "current %d ",
+			link_sta->agg.max_amsdu_len);
 	pos += scnprintf(buf + pos, sizeof(buf) - pos, "stored %d\n",
-			 mvmsta->orig_amsdu_len);
+			 mvm_link_sta->orig_amsdu_len);
 
 	return simple_read_from_buffer(user_buf, count, ppos, buf, pos);
 }
@@ -1596,17 +1599,127 @@ static ssize_t iwl_dbgfs_dbg_time_point_write(struct iwl_mvm *mvm,
 #define MVM_DEBUGFS_ADD_FILE(name, parent, mode) \
 	MVM_DEBUGFS_ADD_FILE_ALIAS(#name, name, parent, mode)
 
-#define MVM_DEBUGFS_WRITE_STA_FILE_OPS(name, bufsz) \
-	_MVM_DEBUGFS_WRITE_FILE_OPS(name, bufsz, struct ieee80211_sta)
-#define MVM_DEBUGFS_READ_WRITE_STA_FILE_OPS(name, bufsz) \
-	_MVM_DEBUGFS_READ_WRITE_FILE_OPS(name, bufsz, struct ieee80211_sta)
+static ssize_t
+_iwl_dbgfs_link_sta_wrap_write(ssize_t (*real)(struct ieee80211_link_sta *,
+					       struct iwl_mvm_sta *,
+					       struct iwl_mvm *,
+					       struct iwl_mvm_link_sta *,
+					       char *,
+					       size_t, loff_t *),
+			   struct file *file,
+			   char *buf, size_t buf_size, loff_t *ppos)
+{
+	struct ieee80211_link_sta *link_sta = file->private_data;
+	struct iwl_mvm_sta *mvmsta = iwl_mvm_sta_from_mac80211(link_sta->sta);
+	struct iwl_mvm *mvm = iwl_mvm_vif_from_mac80211(mvmsta->vif)->mvm;
+	struct iwl_mvm_link_sta *mvm_link_sta;
+	ssize_t ret;
 
-#define MVM_DEBUGFS_ADD_STA_FILE_ALIAS(alias, name, parent, mode) do {	\
-		debugfs_create_file(alias, mode, parent, sta,		\
-				    &iwl_dbgfs_##name##_ops);		\
-	} while (0)
-#define MVM_DEBUGFS_ADD_STA_FILE(name, parent, mode) \
-	MVM_DEBUGFS_ADD_STA_FILE_ALIAS(#name, name, parent, mode)
+	mutex_lock(&mvm->mutex);
+
+	mvm_link_sta = rcu_dereference_protected(mvmsta->link[link_sta->link_id],
+						 lockdep_is_held(&mvm->mutex));
+	if (WARN_ON(!mvm_link_sta)) {
+		mutex_unlock(&mvm->mutex);
+		return -ENODEV;
+	}
+
+	ret = real(link_sta, mvmsta, mvm, mvm_link_sta, buf, buf_size, ppos);
+
+	mutex_unlock(&mvm->mutex);
+
+	return ret;
+}
+
+static ssize_t
+_iwl_dbgfs_link_sta_wrap_read(ssize_t (*real)(struct ieee80211_link_sta *,
+					      struct iwl_mvm_sta *,
+					      struct iwl_mvm *,
+					      struct iwl_mvm_link_sta *,
+					      char __user *,
+					      size_t, loff_t *),
+			   struct file *file,
+			   char __user *user_buf, size_t count, loff_t *ppos)
+{
+	struct ieee80211_link_sta *link_sta = file->private_data;
+	struct iwl_mvm_sta *mvmsta = iwl_mvm_sta_from_mac80211(link_sta->sta);
+	struct iwl_mvm *mvm = iwl_mvm_vif_from_mac80211(mvmsta->vif)->mvm;
+	struct iwl_mvm_link_sta *mvm_link_sta;
+	ssize_t ret;
+
+	mutex_lock(&mvm->mutex);
+
+	mvm_link_sta = rcu_dereference_protected(mvmsta->link[link_sta->link_id],
+						 lockdep_is_held(&mvm->mutex));
+	if (WARN_ON(!mvm_link_sta)) {
+		mutex_unlock(&mvm->mutex);
+		return -ENODEV;
+	}
+
+	ret = real(link_sta, mvmsta, mvm, mvm_link_sta, user_buf, count, ppos);
+
+	mutex_unlock(&mvm->mutex);
+
+	return ret;
+}
+
+#define MVM_DEBUGFS_LINK_STA_WRITE_WRAPPER(name, buflen)		\
+static ssize_t _iwl_dbgfs_link_sta_##name##_write(struct file *file,	\
+					 const char __user *user_buf,	\
+					 size_t count, loff_t *ppos)	\
+{									\
+	char buf[buflen] = {};						\
+	size_t buf_size = min(count, sizeof(buf) -  1);			\
+									\
+	if (copy_from_user(buf, user_buf, sizeof(buf)))			\
+		return -EFAULT;						\
+									\
+	return _iwl_dbgfs_link_sta_wrap_write(iwl_dbgfs_##name##_write,	\
+					      file,			\
+					      buf, buf_size, ppos);	\
+}									\
+
+#define MVM_DEBUGFS_LINK_STA_READ_WRAPPER(name)		\
+static ssize_t _iwl_dbgfs_link_sta_##name##_read(struct file *file,	\
+					 char __user *user_buf,		\
+					 size_t count, loff_t *ppos)	\
+{									\
+	return _iwl_dbgfs_link_sta_wrap_read(iwl_dbgfs_##name##_read,	\
+					     file,			\
+					     user_buf, count, ppos);	\
+}									\
+
+#define MVM_DEBUGFS_WRITE_LINK_STA_FILE_OPS(name, bufsz)		\
+MVM_DEBUGFS_LINK_STA_WRITE_WRAPPER(name, bufsz)				\
+static const struct file_operations iwl_dbgfs_link_sta_##name##_ops = {	\
+	.write = _iwl_dbgfs_link_sta_##name##_write,			\
+	.open = simple_open,						\
+	.llseek = generic_file_llseek,					\
+}
+
+#define MVM_DEBUGFS_READ_LINK_STA_FILE_OPS(name)			\
+MVM_DEBUGFS_LINK_STA_READ_WRAPPER(name)					\
+static const struct file_operations iwl_dbgfs_link_sta_##name##_ops = {	\
+	.read = _iwl_dbgfs_link_sta_##name##_read,			\
+	.open = simple_open,						\
+	.llseek = generic_file_llseek,					\
+}
+
+#define MVM_DEBUGFS_READ_WRITE_LINK_STA_FILE_OPS(name, bufsz)		\
+MVM_DEBUGFS_LINK_STA_READ_WRAPPER(name)					\
+MVM_DEBUGFS_LINK_STA_WRITE_WRAPPER(name, bufsz)				\
+static const struct file_operations iwl_dbgfs_link_sta_##name##_ops = {	\
+	.read = _iwl_dbgfs_link_sta_##name##_read,			\
+	.write = _iwl_dbgfs_link_sta_##name##_write,			\
+	.open = simple_open,						\
+	.llseek = generic_file_llseek,					\
+}
+
+#define MVM_DEBUGFS_ADD_LINK_STA_FILE_ALIAS(alias, name, parent, mode)	\
+		debugfs_create_file(alias, mode, parent, link_sta,	\
+				    &iwl_dbgfs_link_sta_##name##_ops)
+#define MVM_DEBUGFS_ADD_LINK_STA_FILE(name, parent, mode) \
+	MVM_DEBUGFS_ADD_LINK_STA_FILE_ALIAS(#name, name, parent, mode)
 
 static ssize_t
 iwl_dbgfs_prph_reg_read(struct file *file,
@@ -1891,7 +2004,7 @@ MVM_DEBUGFS_READ_WRITE_FILE_OPS(sram, 64);
 MVM_DEBUGFS_READ_WRITE_FILE_OPS(set_nic_temperature, 64);
 MVM_DEBUGFS_READ_FILE_OPS(nic_temp);
 MVM_DEBUGFS_READ_FILE_OPS(stations);
-MVM_DEBUGFS_READ_FILE_OPS(rs_data);
+MVM_DEBUGFS_READ_LINK_STA_FILE_OPS(rs_data);
 MVM_DEBUGFS_READ_FILE_OPS(bt_notif);
 MVM_DEBUGFS_READ_FILE_OPS(bt_cmd);
 MVM_DEBUGFS_READ_WRITE_FILE_OPS(disable_power_off, 64);
@@ -1921,7 +2034,7 @@ MVM_DEBUGFS_READ_FILE_OPS(sar_geo_profile);
 MVM_DEBUGFS_READ_FILE_OPS(wifi_6e_enable);
 #endif
 
-MVM_DEBUGFS_READ_WRITE_STA_FILE_OPS(amsdu_len, 16);
+MVM_DEBUGFS_READ_WRITE_LINK_STA_FILE_OPS(amsdu_len, 16);
 
 MVM_DEBUGFS_READ_WRITE_FILE_OPS(he_sniffer_params, 32);
 
@@ -2068,17 +2181,18 @@ static const struct file_operations iwl_dbgfs_mem_ops = {
 	.llseek = default_llseek,
 };
 
-void iwl_mvm_sta_add_debugfs(struct ieee80211_hw *hw,
-			     struct ieee80211_vif *vif,
-			     struct ieee80211_sta *sta,
-			     struct dentry *dir)
+void iwl_mvm_link_sta_add_debugfs(struct ieee80211_hw *hw,
+				  struct ieee80211_vif *vif,
+				  struct ieee80211_link_sta *link_sta,
+				  struct dentry *dir)
 {
 	struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw);
 
 	if (iwl_mvm_has_tlc_offload(mvm)) {
-		MVM_DEBUGFS_ADD_STA_FILE(rs_data, dir, 0400);
+		MVM_DEBUGFS_ADD_LINK_STA_FILE(rs_data, dir, 0400);
 	}
-	MVM_DEBUGFS_ADD_STA_FILE(amsdu_len, dir, 0600);
+
+	MVM_DEBUGFS_ADD_LINK_STA_FILE(amsdu_len, dir, 0600);
 }
 
 void iwl_mvm_dbgfs_register(struct iwl_mvm *mvm)
drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c +1 -1
index 91c38d42d034..f8fd34305e69 100644
@@ -6255,7 +6255,7 @@ const struct ieee80211_ops iwl_mvm_hw_ops = {
 
 	.can_aggregate_in_amsdu = iwl_mvm_mac_can_aggregate,
 #ifdef CONFIG_IWLWIFI_DEBUGFS
-	.sta_add_debugfs = iwl_mvm_sta_add_debugfs,
+	.link_sta_add_debugfs = iwl_mvm_link_sta_add_debugfs,
 #endif
 	.set_hw_timestamp = iwl_mvm_set_hw_timestamp,
 };
drivers/net/wireless/intel/iwlwifi/mvm/mld-mac80211.c +1 -1
index fb06cf94fcc3..5e28a1645aa9 100644
@@ -1093,7 +1093,7 @@ const struct ieee80211_ops iwl_mvm_mld_hw_ops = {
 	.abort_pmsr = iwl_mvm_abort_pmsr,
 
 #ifdef CONFIG_IWLWIFI_DEBUGFS
-	.sta_add_debugfs = iwl_mvm_sta_add_debugfs,
+	.link_sta_add_debugfs = iwl_mvm_link_sta_add_debugfs,
 #endif
 	.set_hw_timestamp = iwl_mvm_set_hw_timestamp,
 
drivers/net/wireless/intel/iwlwifi/mvm/mvm.h +4 -4
index 7b5db55ebe92..90cb8eeec47c 100644
@@ -2337,10 +2337,10 @@ int iwl_mvm_get_sar_geo_profile(struct iwl_mvm *mvm);
 int iwl_mvm_ppag_send_cmd(struct iwl_mvm *mvm);
 void iwl_mvm_get_acpi_tables(struct iwl_mvm *mvm);
 #ifdef CONFIG_IWLWIFI_DEBUGFS
-void iwl_mvm_sta_add_debugfs(struct ieee80211_hw *hw,
-			     struct ieee80211_vif *vif,
-			     struct ieee80211_sta *sta,
-			     struct dentry *dir);
+void iwl_mvm_link_sta_add_debugfs(struct ieee80211_hw *hw,
+				  struct ieee80211_vif *vif,
+				  struct ieee80211_link_sta *link_sta,
+				  struct dentry *dir);
 #endif
 
 /* new MLD related APIs */
drivers/net/wireless/intel/iwlwifi/mvm/rs-fw.c +2 -2
index f72d1ca3cfed..e77b6157f759 100644
@@ -478,7 +478,7 @@ void iwl_mvm_tlc_update_notif(struct iwl_mvm *mvm,
 		IWL_DEBUG_RATE(mvm, "new rate: %s\n", pretty_rate);
 	}
 
-	if (flags & IWL_TLC_NOTIF_FLAG_AMSDU && !mvmsta->orig_amsdu_len) {
+	if (flags & IWL_TLC_NOTIF_FLAG_AMSDU && !mvm_link_sta->orig_amsdu_len) {
 		u16 size = le32_to_cpu(notif->amsdu_size);
 		int i;
 
@@ -488,7 +488,7 @@ void iwl_mvm_tlc_update_notif(struct iwl_mvm *mvm,
 			 * so also check with orig_amsdu_len which holds the
 			 * original data before debugfs changed the value
 			 */
-			WARN_ON(mvmsta->orig_amsdu_len < size);
+			WARN_ON(mvm_link_sta->orig_amsdu_len < size);
 			goto out;
 		}
 
drivers/net/wireless/intel/iwlwifi/mvm/sta.h +5 -4
index 9acc01b7a4c9..7364346a1209 100644
@@ -336,6 +336,9 @@ struct iwl_mvm_rxq_dup_data {
  * @sta_id: the index of the station in the fw
  * @lq_sta: holds rate scaling data, either for the case when RS is done in
  *	the driver - %rs_drv or in the FW - %rs_fw.
+ * @orig_amsdu_len: used to save the original amsdu_len when it is changed via
+ *      debugfs.  If it's set to 0, it means that it is it's not set via
+ *      debugfs.
  * @avg_energy: energy as reported by FW statistics notification
  */
 struct iwl_mvm_link_sta {
@@ -346,6 +349,8 @@ struct iwl_mvm_link_sta {
 		struct iwl_lq_sta rs_drv;
 	} lq_sta;
 
+	u16 orig_amsdu_len;
+
 	u8 avg_energy;
 };
 
@@ -375,9 +380,6 @@ struct iwl_mvm_link_sta {
  * @amsdu_enabled: bitmap of TX AMSDU allowed TIDs.
  *	In case TLC offload is not active it is either 0xFFFF or 0.
  * @max_amsdu_len: max AMSDU length
- * @orig_amsdu_len: used to save the original amsdu_len when it is changed via
- *      debugfs.  If it's set to 0, it means that it is it's not set via
- *      debugfs.
  * @agg_tids: bitmap of tids whose status is operational aggregated (IWL_AGG_ON)
  * @sleeping: sta sleep transitions in power management
  * @sleep_tx_count: the number of frames that we told the firmware to let out
@@ -429,7 +431,6 @@ struct iwl_mvm_sta {
 	bool disable_tx;
 	u16 amsdu_enabled;
 	u16 max_amsdu_len;
-	u16 orig_amsdu_len;
 	bool sleeping;
 	u8 agg_tids;
 	u8 sleep_tx_count;
Signature · 1 line
2.38.1
#2 lore raw

PATCH 2/15 wifi: iwlwifi: mvm: debugfs: add entry for setting maximum TXOP time

In reply to [email protected]

From: Avraham Stern <[email protected]>

Add an entry for setting the maximum TXOP time in microseconds. The configured value can be read from the same entry.

---
 .../wireless/intel/iwlwifi/mvm/debugfs-vif.c  | 38 +++++++++++++++++++
 drivers/net/wireless/intel/iwlwifi/mvm/mvm.h  |  3 ++
 .../net/wireless/intel/iwlwifi/mvm/rs-fw.c    |  3 ++
 3 files changed, 44 insertions(+)
drivers/net/wireless/intel/iwlwifi/mvm/debugfs-vif.c +38 -0
index 3613b1fdc5d9..762bce70e262 100644
@@ -679,6 +679,42 @@ static ssize_t iwl_dbgfs_quota_min_read(struct file *file,
 	return simple_read_from_buffer(user_buf, count, ppos, buf, len);
 }
 
+static ssize_t iwl_dbgfs_max_tx_op_write(struct ieee80211_vif *vif, char *buf,
+					 size_t count, loff_t *ppos)
+{
+	struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
+	struct iwl_mvm *mvm = mvmvif->mvm;
+	u16 value;
+	int ret;
+
+	ret = kstrtou16(buf, 0, &value);
+	if (ret)
+		return ret;
+
+	mutex_lock(&mvm->mutex);
+	mvmvif->max_tx_op = value;
+	mutex_unlock(&mvm->mutex);
+
+	return count;
+}
+
+static ssize_t iwl_dbgfs_max_tx_op_read(struct file *file,
+					char __user *user_buf,
+					size_t count, loff_t *ppos)
+{
+	struct ieee80211_vif *vif = file->private_data;
+	struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
+	struct iwl_mvm *mvm = mvmvif->mvm;
+	char buf[10];
+	int len;
+
+	mutex_lock(&mvm->mutex);
+	len = scnprintf(buf, sizeof(buf), "%hu\n", mvmvif->max_tx_op);
+	mutex_unlock(&mvm->mutex);
+
+	return simple_read_from_buffer(user_buf, count, ppos, buf, len);
+}
+
 #define MVM_DEBUGFS_WRITE_FILE_OPS(name, bufsz) \
 	_MVM_DEBUGFS_WRITE_FILE_OPS(name, bufsz, struct ieee80211_vif)
 #define MVM_DEBUGFS_READ_WRITE_FILE_OPS(name, bufsz) \
@@ -698,6 +734,7 @@ MVM_DEBUGFS_READ_WRITE_FILE_OPS(uapsd_misbehaving, 20);
 MVM_DEBUGFS_READ_WRITE_FILE_OPS(rx_phyinfo, 10);
 MVM_DEBUGFS_READ_WRITE_FILE_OPS(quota_min, 32);
 MVM_DEBUGFS_READ_FILE_OPS(os_device_timediff);
+MVM_DEBUGFS_READ_WRITE_FILE_OPS(max_tx_op, 10);
 
 
 void iwl_mvm_vif_dbgfs_register(struct iwl_mvm *mvm, struct ieee80211_vif *vif)
@@ -733,6 +770,7 @@ void iwl_mvm_vif_dbgfs_register(struct iwl_mvm *mvm, struct ieee80211_vif *vif)
 	MVM_DEBUGFS_ADD_FILE_VIF(rx_phyinfo, mvmvif->dbgfs_dir, 0600);
 	MVM_DEBUGFS_ADD_FILE_VIF(quota_min, mvmvif->dbgfs_dir, 0600);
 	MVM_DEBUGFS_ADD_FILE_VIF(os_device_timediff, mvmvif->dbgfs_dir, 0400);
+	MVM_DEBUGFS_ADD_FILE_VIF(max_tx_op, mvmvif->dbgfs_dir, 0600);
 
 	if (vif->type == NL80211_IFTYPE_STATION && !vif->p2p &&
 	    mvmvif == mvm->bf_allowed_vif)
drivers/net/wireless/intel/iwlwifi/mvm/mvm.h +3 -0
index 90cb8eeec47c..afcc55231bbc 100644
@@ -358,6 +358,7 @@ struct iwl_mvm_vif_link_info {
  * @csa_failed: CSA failed to schedule time event, report an error later
  * @csa_bcn_pending: indicates that we are waiting for a beacon on a new channel
  * @features: hw features active for this vif
+ * @max_tx_op: max TXOP in usecs for all ACs, zero for no limit.
  */
 struct iwl_mvm_vif {
 	struct iwl_mvm *mvm;
@@ -443,6 +444,8 @@ struct iwl_mvm_vif {
 		struct ieee80211_key_conf __rcu *keys[2];
 	} bcn_prot;
 
+	u16 max_tx_op;
+
 	struct iwl_mvm_vif_link_info deflink;
 	struct iwl_mvm_vif_link_info *link[IEEE80211_MLD_MAX_NUM_LINKS];
 };
drivers/net/wireless/intel/iwlwifi/mvm/rs-fw.c +3 -0
index e77b6157f759..992642edfcbe 100644
@@ -588,6 +588,7 @@ void iwl_mvm_rs_fw_rate_init(struct iwl_mvm *mvm,
 				cpu_to_le16(max_amsdu_len) : 0,
 	};
 	unsigned int link_id = link_conf->link_id;
+	struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(mvmsta->vif);
 	int cmd_ver;
 	int ret;
 
@@ -616,6 +617,8 @@ void iwl_mvm_rs_fw_rate_init(struct iwl_mvm *mvm,
 	 */
 	sta->deflink.agg.max_amsdu_len = max_amsdu_len;
 
+	cfg_cmd.max_tx_op = cpu_to_le16(mvmvif->max_tx_op);
+
 	cmd_ver = iwl_fw_lookup_cmd_ver(mvm->fw,
 					WIDE_ID(DATA_PATH_GROUP,
 						TLC_MNG_CONFIG_CMD),
Signature · 1 line
2.38.1
#3 lore raw

Re: [PATCH 02/15] wifi: iwlwifi: mvm: debugfs: add entry for setting maximum TXOP time

Quoted 26 lines · On Mon, 2023-06-12 at 18:51 +0300, [email protected] wrote:

From: Avraham Stern <[email protected]>

Add an entry for setting the maximum TXOP time in microseconds. The configured value can be read from the same entry.

---
 .../wireless/intel/iwlwifi/mvm/debugfs-vif.c  | 38 +++++++++++++++++++
 drivers/net/wireless/intel/iwlwifi/mvm/mvm.h  |  3 ++
 .../net/wireless/intel/iwlwifi/mvm/rs-fw.c    |  3 ++
 3 files changed, 44 insertions(+)
drivers/net/wireless/intel/iwlwifi/mvm/debugfs-vif.c +5 -0
index 3613b1fdc5d9..762bce70e262 100644
@@ -679,6 +679,42 @@ static ssize_t iwl_dbgfs_quota_min_read(struct file *file,
 	return simple_read_from_buffer(user_buf, count, ppos, buf, len);
 }
 
+static ssize_t iwl_dbgfs_max_tx_op_write(struct ieee80211_vif *vif, char *buf,
+					 size_t count, loff_t *ppos)
+{
+	struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
+	struct iwl_mvm *mvm = mvmvif->mvm;

drivers/net/wireless/intel/iwlwifi/mvm/debugfs-vif.c static ssize_t iwl_dbgfs_quota_min_read(struct file *file, · line 696

Quoted 10 lines
drivers/net/wireless/intel/iwlwifi/mvm/debugfs-vif.c +10 -0
+	u16 value;
+	int ret;
+
+	ret = kstrtou16(buf, 0, &value);
+	if (ret)
+		return ret;
+
+	mutex_lock(&mvm->mutex);
+	mvmvif->max_tx_op = value;
+	mutex_unlock(&mvm->mutex);

This is a strange debugfs file, it only takes effect the next time iwl_mvm_rs_fw_rate_init() is called, which can be kind of random? Seems like it should force a reinit?

johannes

#4 lore raw

Re: [PATCH 02/15] wifi: iwlwifi: mvm: debugfs: add entry for setting maximum TXOP time

Quoted 42 lines · Johannes Berg
Quoted 26 lines · On Mon, 2023-06-12 at 18:51 +0300, [email protected] wrote:

From: Avraham Stern <[email protected]>

Add an entry for setting the maximum TXOP time in microseconds. The configured value can be read from the same entry.

---
 .../wireless/intel/iwlwifi/mvm/debugfs-vif.c  | 38 +++++++++++++++++++ drivers/net/wireless/intel/iwlwifi/mvm/mvm.h  |  3 ++ .../net/wireless/intel/iwlwifi/mvm/rs-fw.c    |  3 ++

 3 files changed, 44 insertions(+)
drivers/net/wireless/intel/iwlwifi/mvm/debugfs-vif.c +0 -0
index 3613b1fdc5d9..762bce70e262 100644
@@ -679,6 +679,42 @@ static ssize_t iwl_dbgfs_quota_min_read(struct file *file,
         return simple_read_from_buffer(user_buf, count, ppos, buf, len);
  }

drivers/net/wireless/intel/iwlwifi/mvm/debugfs-vif.c +5 -0
+static ssize_t iwl_dbgfs_max_tx_op_write(struct ieee80211_vif *vif, char *buf,
+                                        size_t count, loff_t *ppos)
+{
+       struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
+       struct iwl_mvm *mvm = mvmvif->mvm;

drivers/net/wireless/intel/iwlwifi/mvm/debugfs-vif.c static ssize_t iwl_dbgfs_quota_min_read(struct file *file, · line 696

Quoted 10 lines
drivers/net/wireless/intel/iwlwifi/mvm/debugfs-vif.c +10 -0
+       u16 value;
+       int ret;
+
+       ret = kstrtou16(buf, 0, &value);
+       if (ret)
+               return ret;
+
+       mutex_lock(&mvm->mutex);
+       mvmvif->max_tx_op = value;
+       mutex_unlock(&mvm->mutex);

This is a strange debugfs file, it only takes effect the next time iwl_mvm_rs_fw_rate_init() is called, which can be kind of random? Seems like it should force a reinit?

Quoted 1 line

johannes

You're right. We need to add some fixes to this commit. Let's drop it meanwhile, I'll send a new version later. I've verified that there're no any conflicts without this patch.

#5 lore raw

PATCH 3/15 wifi: iwlwifi: mvm: Handle return value for iwl_mvm_sta_init

In reply to [email protected]

From: Mukesh Sisodiya <[email protected]>

sta_init function can fail and if it returns an error then driver should not send the request to fw to add a station.

Fixes 69aef848052b ("wifi: iwlwifi: mvm: refactor iwl_mvm_add_sta(), iwl_mvm_rm_sta()")
---
 drivers/net/wireless/intel/iwlwifi/mvm/sta.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/net/wireless/intel/iwlwifi/mvm/sta.c +2 -0
index b9b9082676d4..5e11b101d02e 100644
@@ -1859,6 +1859,8 @@ int iwl_mvm_add_sta(struct iwl_mvm *mvm,
 
 	ret = iwl_mvm_sta_init(mvm, vif, sta, sta_id,
 			       sta->tdls ? IWL_STA_TDLS_LINK : IWL_STA_LINK);
+	if (ret)
+		goto err;
 
 update_fw:
 	ret = iwl_mvm_sta_send_to_fw(mvm, sta, sta_update, sta_flags);
Signature · 1 line
2.38.1
#6 lore raw

PATCH 4/15 wifi: iwlwifi: mvm: FTM initiator MLO support

In reply to [email protected]

From: Avraham Stern <[email protected]>

When checking if the initiator is associated to the responder, iterate over all active links.

---
 .../intel/iwlwifi/mvm/ftm-initiator.c         | 48 ++++++++++++-------
 1 file changed, 31 insertions(+), 17 deletions(-)
drivers/net/wireless/intel/iwlwifi/mvm/ftm-initiator.c +31 -17
index 652a603c4500..233ae81884a0 100644
@@ -72,15 +72,24 @@ int iwl_mvm_ftm_add_pasn_sta(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
 	 * the TK is already configured for this station, so it
 	 * shouldn't be set again here.
 	 */
-	if (vif->cfg.assoc &&
-	    !memcmp(addr, vif->bss_conf.bssid, ETH_ALEN)) {
+	if (vif->cfg.assoc) {
 		struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
+		struct ieee80211_bss_conf *link_conf;
+		unsigned int link_id;
 		struct ieee80211_sta *sta;
+		u8 sta_id;
 
 		rcu_read_lock();
-		sta = rcu_dereference(mvm->fw_id_to_mac_id[mvmvif->deflink.ap_sta_id]);
-		if (!IS_ERR_OR_NULL(sta) && sta->mfp)
-			expected_tk_len = 0;
+		for_each_vif_active_link(vif, link_conf, link_id) {
+			if (memcmp(addr, link_conf->bssid, ETH_ALEN))
+				continue;
+
+			sta_id = mvmvif->link[link_id]->ap_sta_id;
+			sta = rcu_dereference(mvm->fw_id_to_mac_id[sta_id]);
+			if (!IS_ERR_OR_NULL(sta) && sta->mfp)
+				expected_tk_len = 0;
+			break;
+		}
 		rcu_read_unlock();
 	}
 
@@ -518,25 +527,30 @@ iwl_mvm_ftm_put_target(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
 
 	iwl_mvm_ftm_put_target_common(mvm, peer, target);
 
-	if (vif->cfg.assoc &&
-	    !memcmp(peer->addr, vif->bss_conf.bssid, ETH_ALEN)) {
+	if (vif->cfg.assoc) {
 		struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
 		struct ieee80211_sta *sta;
+		struct ieee80211_bss_conf *link_conf;
+		unsigned int link_id;
 
 		rcu_read_lock();
+		for_each_vif_active_link(vif, link_conf, link_id) {
+			if (memcmp(peer->addr, link_conf->bssid, ETH_ALEN))
+				continue;
+
+			target->sta_id = mvmvif->link[link_id]->ap_sta_id;
+			sta = rcu_dereference(mvm->fw_id_to_mac_id[target->sta_id]);
+			if (WARN_ON_ONCE(IS_ERR_OR_NULL(sta))) {
+				rcu_read_unlock();
+				return PTR_ERR_OR_ZERO(sta);
+			}
 
-		sta = rcu_dereference(mvm->fw_id_to_mac_id[mvmvif->deflink.ap_sta_id]);
-		if (WARN_ON_ONCE(IS_ERR_OR_NULL(sta))) {
-			rcu_read_unlock();
-			return PTR_ERR_OR_ZERO(sta);
+			if (sta->mfp && (peer->ftm.trigger_based ||
+					 peer->ftm.non_trigger_based))
+				FTM_PUT_FLAG(PMF);
+			break;
 		}
-
-		if (sta->mfp && (peer->ftm.trigger_based || peer->ftm.non_trigger_based))
-			FTM_PUT_FLAG(PMF);
-
 		rcu_read_unlock();
-
-		target->sta_id = mvmvif->deflink.ap_sta_id;
 	} else {
 		target->sta_id = IWL_MVM_INVALID_STA;
 	}
Signature · 1 line
2.38.1
#7 lore raw

PATCH 5/15 wifi: iwlwifi: update response for mcc_update command

In reply to [email protected]

From: Abhishek Naik <[email protected]>

Add support for the MCC update response version 8. Versions 5-6 are already covered by the existing flags conversion, and 7 isn't used.

The capabilities field in iwl_mcc_update_resp is 32 bits wide now, and the flags moved, so some more changes are needed.

While at it, convert the flags to bool (to avoid having to deal with BIT(16) specially etc.) and use the struct_size() macro for the memory allocation.

---
 .../wireless/intel/iwlwifi/fw/api/nvm-reg.h   |  35 +++++-
 .../wireless/intel/iwlwifi/iwl-nvm-parse.c    | 117 ++++++++++++------
 .../wireless/intel/iwlwifi/iwl-nvm-parse.h    |   4 +-
 .../net/wireless/intel/iwlwifi/mvm/mac80211.c |   4 +-
 drivers/net/wireless/intel/iwlwifi/mvm/mvm.h  |   2 +-
 drivers/net/wireless/intel/iwlwifi/mvm/nvm.c  |  63 +++++++---
 6 files changed, 166 insertions(+), 59 deletions(-)
drivers/net/wireless/intel/iwlwifi/fw/api/nvm-reg.h +33 -2
index 71cce6dfeaf9..28bfabb399b2 100644
@@ -322,7 +322,7 @@ struct iwl_mcc_update_resp_v3 {
 } __packed; /* LAR_UPDATE_MCC_CMD_RESP_S_VER_3 */
 
 /**
- * struct iwl_mcc_update_resp - response to MCC_UPDATE_CMD.
+ * struct iwl_mcc_update_resp_v4 - response to MCC_UPDATE_CMD.
  * Contains the new channel control profile map, if changed, and the new MCC
  * (mobile country code).
  * The new MCC may be different than what was requested in MCC_UPDATE_CMD.
@@ -338,7 +338,7 @@ struct iwl_mcc_update_resp_v3 {
  * @channels: channel control data map, DWORD for each channel. Only the first
  *	16bits are used.
  */
-struct iwl_mcc_update_resp {
+struct iwl_mcc_update_resp_v4 {
 	__le32 status;
 	__le16 mcc;
 	__le16 cap;
@@ -350,6 +350,37 @@ struct iwl_mcc_update_resp {
 	__le32 channels[];
 } __packed; /* LAR_UPDATE_MCC_CMD_RESP_S_VER_4 */
 
+/**
+ * struct iwl_mcc_update_resp_v8 - response to MCC_UPDATE_CMD.
+ * Contains the new channel control profile map, if changed, and the new MCC
+ * (mobile country code).
+ * The new MCC may be different than what was requested in MCC_UPDATE_CMD.
+ * @status: see &enum iwl_mcc_update_status
+ * @mcc: the new applied MCC
+ * @padding: padding for 2 bytes.
+ * @cap: capabilities for all channels which matches the MCC
+ * @time: time elapsed from the MCC test start (in units of 30 seconds)
+ * @geo_info: geographic specific profile information
+ *     see &enum iwl_geo_information.
+ * @source_id: the MCC source, see iwl_mcc_source
+ * @reserved: for four bytes alignment.
+ * @n_channels: number of channels in @channels_data.
+ * @channels: channel control data map, DWORD for each channel. Only the first
+ *     16bits are used.
+ */
+struct iwl_mcc_update_resp_v8 {
+	__le32 status;
+	__le16 mcc;
+	u8 padding[2];
+	__le32 cap;
+	__le16 time;
+	__le16 geo_info;
+	u8 source_id;
+	u8 reserved[3];
+	__le32 n_channels;
+	__le32 channels[];
+} __packed; /* LAR_UPDATE_MCC_CMD_RESP_S_VER_8 */
+
 /**
  * struct iwl_mcc_chub_notif - chub notifies of mcc change
  * (MCC_CHUB_UPDATE_CMD = 0xc9)
drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c +79 -38

170 lines not on this page · raw message

drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.h +2 -2
index e01f7751cf11..c79f72d54482 100644
@@ -1,6 +1,6 @@
 /* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */
 /*
- * Copyright (C) 2005-2015, 2018-2021 Intel Corporation
+ * Copyright (C) 2005-2015, 2018-2022 Intel Corporation
  * Copyright (C) 2016-2017 Intel Deutschland GmbH
  */
 #ifndef __iwl_nvm_parse_h__
@@ -50,7 +50,7 @@ iwl_parse_nvm_data(struct iwl_trans *trans, const struct iwl_cfg *cfg,
 struct ieee80211_regdomain *
 iwl_parse_nvm_mcc_info(struct device *dev, const struct iwl_cfg *cfg,
 		       int num_of_ch, __le32 *channels, u16 fw_mcc,
-		       u16 geo_info, u16 cap, u8 resp_ver);
+		       u16 geo_info, u32 cap, u8 resp_ver);
 
 /**
  * struct iwl_nvm_section - describes an NVM section in memory.
drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c +2 -2
index f8fd34305e69..96577dcc22b7 100644
@@ -108,7 +108,7 @@ struct ieee80211_regdomain *iwl_mvm_get_regdomain(struct wiphy *wiphy,
 	struct ieee80211_regdomain *regd = NULL;
 	struct ieee80211_hw *hw = wiphy_to_ieee80211_hw(wiphy);
 	struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw);
-	struct iwl_mcc_update_resp *resp;
+	struct iwl_mcc_update_resp_v8 *resp;
 	u8 resp_ver;
 
 	IWL_DEBUG_LAR(mvm, "Getting regdomain data for %s from FW\n", alpha2);
@@ -138,7 +138,7 @@ struct ieee80211_regdomain *iwl_mvm_get_regdomain(struct wiphy *wiphy,
 				      resp->channels,
 				      __le16_to_cpu(resp->mcc),
 				      __le16_to_cpu(resp->geo_info),
-				      __le16_to_cpu(resp->cap), resp_ver);
+				      le32_to_cpu(resp->cap), resp_ver);
 	/* Store the return source id */
 	src_id = resp->source_id;
 	if (IS_ERR_OR_NULL(regd)) {
drivers/net/wireless/intel/iwlwifi/mvm/mvm.h +1 -1
index afcc55231bbc..cb0a8b860e67 100644
@@ -2222,7 +2222,7 @@ static inline void iwl_mvm_vendor_cmds_register(struct iwl_mvm *mvm) {}
 #endif
 
 /* Location Aware Regulatory */
-struct iwl_mcc_update_resp *
+struct iwl_mcc_update_resp_v8 *
 iwl_mvm_update_mcc(struct iwl_mvm *mvm, const char *alpha2,
 		   enum iwl_mcc_source src_id);
 int iwl_mvm_init_mcc(struct iwl_mvm *mvm);
drivers/net/wireless/intel/iwlwifi/mvm/nvm.c +49 -14

109 lines not on this page · raw message

Signature · 1 line
2.38.1
#8 lore raw

PATCH 6/15 wifi: iwlwifi: bump FW API to 79 for AX devices

In reply to [email protected]

From: Gregory Greenman <[email protected]>

Start supporting API version 79 for AX devices.

---
 drivers/net/wireless/intel/iwlwifi/cfg/22000.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/intel/iwlwifi/cfg/22000.c +1 -1
index 2cf3af284680..fce4fcdc4dfb 100644
@@ -10,7 +10,7 @@
 #include "fw/api/txq.h"
 
 /* Highest firmware API version supported */
-#define IWL_22000_UCODE_API_MAX	78
+#define IWL_22000_UCODE_API_MAX	79
 #define IWL_22500_UCODE_API_MAX	77
 
 /* Lowest firmware API version supported */
Signature · 1 line
2.38.1
#9 lore raw

PATCH 7/15 wifi: iwlwifi: mvm: fix getting LDPC/STBC support

In reply to [email protected]

From: Mukesh Sisodiya <[email protected]>

Use flags field from struct ieee80211_tx_info in order to get LDPC/STBC support. The rate parameter, used originally, is 16 bits only and does not have details of LDPC/STBC support.

---
 drivers/net/wireless/intel/iwlwifi/mvm/tx.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/wireless/intel/iwlwifi/mvm/tx.c +2 -2
index 5fa6f98b8e55..ccd1e41604f3 100644
@@ -343,9 +343,9 @@ static u32 iwl_mvm_get_inject_tx_rate(struct iwl_mvm *mvm,
 			result |= RATE_MCS_SGI_MSK_V1;
 		if (rate->flags & IEEE80211_TX_RC_40_MHZ_WIDTH)
 			result |= u32_encode_bits(1, RATE_MCS_CHAN_WIDTH_MSK_V1);
-		if (rate->flags & IEEE80211_TX_CTL_LDPC)
+		if (info->flags & IEEE80211_TX_CTL_LDPC)
 			result |= RATE_MCS_LDPC_MSK_V1;
-		if (u32_get_bits(rate->flags, IEEE80211_TX_CTL_STBC))
+		if (u32_get_bits(info->flags, IEEE80211_TX_CTL_STBC))
 			result |= RATE_MCS_STBC_MSK;
 	} else {
 		return 0;
Signature · 1 line
2.38.1
#10 lore raw

PATCH 8/15 wifi: iwlwifi: mvm: Add NULL check before dereferencing the pointer

In reply to [email protected]

From: Mukesh Sisodiya <[email protected]>

The p2p, bss and ap vif pointers are assigned based on the mode. All pointers will not have valid value at same time and can be NULL, based on configured mode. This can lead to NULL pointer access. Add NULL pointer check before accessing the data from vif pointer.

---
 drivers/net/wireless/intel/iwlwifi/mvm/power.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)
drivers/net/wireless/intel/iwlwifi/mvm/power.c +8 -6
index ac1dae52556f..19839cc44eb3 100644
@@ -647,30 +647,32 @@ static void iwl_mvm_power_set_pm(struct iwl_mvm *mvm,
 		return;
 
 	/* enable PM on bss if bss stand alone */
-	if (vifs->bss_active && !vifs->p2p_active && !vifs->ap_active) {
+	if (bss_mvmvif && vifs->bss_active && !vifs->p2p_active &&
+	    !vifs->ap_active) {
 		bss_mvmvif->pm_enabled = true;
 		return;
 	}
 
 	/* enable PM on p2p if p2p stand alone */
-	if (vifs->p2p_active && !vifs->bss_active && !vifs->ap_active) {
+	if (p2p_mvmvif && vifs->p2p_active && !vifs->bss_active &&
+	    !vifs->ap_active) {
 		p2p_mvmvif->pm_enabled = true;
 		return;
 	}
 
-	if (vifs->bss_active && vifs->p2p_active)
+	if (p2p_mvmvif && bss_mvmvif && vifs->bss_active && vifs->p2p_active)
 		client_same_channel =
 			iwl_mvm_have_links_same_channel(bss_mvmvif, p2p_mvmvif);
 
-	if (vifs->bss_active && vifs->ap_active)
+	if (bss_mvmvif && ap_mvmvif && vifs->bss_active && vifs->ap_active)
 		ap_same_channel =
 			iwl_mvm_have_links_same_channel(bss_mvmvif, ap_mvmvif);
 
 	/* clients are not stand alone: enable PM if DCM */
 	if (!(client_same_channel || ap_same_channel)) {
-		if (vifs->bss_active)
+		if (bss_mvmvif && vifs->bss_active)
 			bss_mvmvif->pm_enabled = true;
-		if (vifs->p2p_active)
+		if (p2p_mvmvif && vifs->p2p_active)
 			p2p_mvmvif->pm_enabled = true;
 		return;
 	}
Signature · 1 line
2.38.1
#11 lore raw

Re: [PATCH 08/15] wifi: iwlwifi: mvm: Add NULL check before dereferencing the pointer

Quoted 6 lines · On Mon, 2023-06-12 at 18:51 +0300, [email protected] wrote:

From: Mukesh Sisodiya <[email protected]>

The p2p, bss and ap vif pointers are assigned based on the mode. All pointers will not have valid value at same time and can be NULL, based on configured mode. This can lead to NULL pointer access.

This is not true.

drivers/net/wireless/intel/iwlwifi/mvm/power.c static void iwl_mvm_power_set_pm(struct iwl_mvm *mvm, · line 651

Quoted 5 lines
drivers/net/wireless/intel/iwlwifi/mvm/power.c +2 -1
 	/* enable PM on bss if bss stand alone */
-	if (vifs->bss_active && !vifs->p2p_active && !vifs->ap_active) {
+	if (bss_mvmvif && vifs->bss_active && !vifs->p2p_active &&
+	    !vifs->ap_active) {

The pointers can only be NULL iff *_active is false, however, it may be false even if the pointer is non-NULL, so it's not exactly the same.

Probably a static checker thing that didn't understand it?

johannes

#12 lore raw

Re: [PATCH 08/15] wifi: iwlwifi: mvm: Add NULL check before dereferencing the pointer

Quoted 16 lines · Johannes Berg
Quoted 6 lines · On Mon, 2023-06-12 at 18:51 +0300, [email protected] wrote:

From: Mukesh Sisodiya <[email protected]>

The p2p, bss and ap vif pointers are assigned based on the mode. All pointers will not have valid value at same time and can be NULL, based on configured mode. This can lead to NULL pointer access.

This is not true.

Quoted 5 lines

        /* enable PM on bss if bss stand alone */
-       if (vifs->bss_active && !vifs->p2p_active && !vifs->ap_active) { +       if (bss_mvmvif && vifs->bss_active && !vifs->p2p_active && +           !vifs->ap_active) {

Quoted 6 lines

The pointers can only be NULL iff *_active is false, however, it may be false even if the pointer is non-NULL, so it's not exactly the same.

Probably a static checker thing that didn't understand it?

johannes

Right, so the commit message could be rephrased like this:
"While vif pointers are protected by the corresponding "*active" fields, static checkers can get confused sometimes. Add an explicit check."

Do you want me to resend it with the fixed commit message?

#13 lore raw

Re: [PATCH 08/15] wifi: iwlwifi: mvm: Add NULL check before dereferencing the pointer

Quoted 22 lines · Gregory
Quoted 21 lines · Johannes Berg
Quoted 6 lines · On Mon, 2023-06-12 at 18:51 +0300, [email protected] wrote:

From: Mukesh Sisodiya <[email protected]>

The p2p, bss and ap vif pointers are assigned based on the mode. All pointers will not have valid value at same time and can be NULL, based on configured mode. This can lead to NULL pointer access.

This is not true.

Quoted 5 lines

        /* enable PM on bss if bss stand alone */
-       if (vifs->bss_active && !vifs->p2p_active && !vifs->ap_active) { +       if (bss_mvmvif && vifs->bss_active && !vifs->p2p_active && +           !vifs->ap_active) {

The pointers can only be NULL iff *_active is false, however, it may be false even if the pointer is non-NULL, so it's not exactly the same.

Probably a static checker thing that didn't understand it?

Quoted 7 lines
Quoted 1 line

johannes

Right, so the commit message could be rephrased like this:
"While vif pointers are protected by the corresponding "*active" fields, static checkers can get confused sometimes. Add an explicit check."

Do you want me to resend it with the fixed commit message?

Yes please. I also delegated this and the other one to you in patchwork again.

johannes

#14 lore raw

PATCH 9/15 wifi: iwlwifi: unify checks for HW error values

In reply to [email protected]

From: Johannes Berg <[email protected]>

The hardware, depending on which part fails or times out, returns 0xA5A5A5A. or 0x5A5A5A5. with the lowest 4 bits encoding some further reason/status. However, mostly we don't really need to care about the exact reasons, so unify the checks for this to avoid hardcoding those magic values all over the driver.

---
 drivers/net/wireless/intel/iwlwifi/fw/dbg.c     | 4 ++--
 drivers/net/wireless/intel/iwlwifi/fw/dump.c    | 2 +-
 drivers/net/wireless/intel/iwlwifi/iwl-io.c     | 4 +++-
 drivers/net/wireless/intel/iwlwifi/iwl-trans.h  | 5 +++++
 drivers/net/wireless/intel/iwlwifi/pcie/rx.c    | 2 +-
 drivers/net/wireless/intel/iwlwifi/pcie/trans.c | 2 +-
 6 files changed, 13 insertions(+), 6 deletions(-)
drivers/net/wireless/intel/iwlwifi/fw/dbg.c +2 -2
index 3c5a43a619c6..3253d89e522a 100644
@@ -1038,7 +1038,7 @@ iwl_dump_ini_prph_mac_iter(struct iwl_fw_runtime *fwrt,
 	range->range_data_size = reg->dev_addr.size;
 	for (i = 0; i < le32_to_cpu(reg->dev_addr.size); i += 4) {
 		prph_val = iwl_read_prph(fwrt->trans, addr + i);
-		if ((prph_val & ~0xf) == 0xa5a5a5a0)
+		if (iwl_trans_is_hw_error_value(prph_val))
 			return -EBUSY;
 		*val++ = cpu_to_le32(prph_val);
 	}
@@ -1562,7 +1562,7 @@ iwl_dump_ini_dbgi_sram_iter(struct iwl_fw_runtime *fwrt,
 		prph_data = iwl_read_prph_no_grab(fwrt->trans, (i % 2) ?
 					  DBGI_SRAM_TARGET_ACCESS_RDATA_MSB :
 					  DBGI_SRAM_TARGET_ACCESS_RDATA_LSB);
-		if ((prph_data & ~0xf) == 0xa5a5a5a0) {
+		if (iwl_trans_is_hw_error_value(prph_data)) {
 			iwl_trans_release_nic_access(fwrt->trans);
 			return -EBUSY;
 		}
drivers/net/wireless/intel/iwlwifi/fw/dump.c +1 -1
index f86f7b4baa18..64e83f30f947 100644
@@ -194,7 +194,7 @@ static void iwl_fwrt_dump_lmac_error_log(struct iwl_fw_runtime *fwrt, u8 lmac_nu
 
 	/* check if there is a HW error */
 	val = iwl_trans_read_mem32(trans, base);
-	if (((val & ~0xf) == 0xa5a5a5a0) || ((val & ~0xf) == 0x5a5a5a50)) {
+	if (iwl_trans_is_hw_error_value(val)) {
 		int err;
 
 		IWL_ERR(trans, "HW error, resetting before reading\n");
drivers/net/wireless/intel/iwlwifi/iwl-io.c +3 -1
index 396f2c997da6..c60f9466c5fd 100644
@@ -1,6 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause
 /*
- * Copyright (C) 2003-2014, 2018-2021 Intel Corporation
+ * Copyright (C) 2003-2014, 2018-2022 Intel Corporation
  * Copyright (C) 2015-2016 Intel Deutschland GmbH
  */
 #include <linux/delay.h>
@@ -72,6 +72,7 @@ u32 iwl_read_direct32(struct iwl_trans *trans, u32 reg)
 		return value;
 	}
 
+	/* return as if we have a HW timeout/failure */
 	return 0x5a5a5a5a;
 }
 IWL_EXPORT_SYMBOL(iwl_read_direct32);
@@ -143,6 +144,7 @@ u32 iwl_read_prph(struct iwl_trans *trans, u32 ofs)
 		return val;
 	}
 
+	/* return as if we have a HW timeout/failure */
 	return 0x5a5a5a5a;
 }
 IWL_EXPORT_SYMBOL(iwl_read_prph);
drivers/net/wireless/intel/iwlwifi/iwl-trans.h +5 -0
index d9e465d0f4af..1fa035decc03 100644
@@ -1613,6 +1613,11 @@ struct iwl_trans *iwl_trans_alloc(unsigned int priv_size,
 int iwl_trans_init(struct iwl_trans *trans);
 void iwl_trans_free(struct iwl_trans *trans);
 
+static inline bool iwl_trans_is_hw_error_value(u32 val)
+{
+	return ((val & ~0xf) == 0xa5a5a5a0) || ((val & ~0xf) == 0x5a5a5a50);
+}
+
 /*****************************************************
 * driver (transport) register/unregister functions
 ******************************************************/
drivers/net/wireless/intel/iwlwifi/pcie/rx.c +1 -1
index 0d7890f99a5f..4ee4886babcb 100644
@@ -1873,7 +1873,7 @@ irqreturn_t iwl_pcie_irq_handler(int irq, void *dev_id)
 		return IRQ_NONE;
 	}
 
-	if (unlikely(inta == 0xFFFFFFFF || (inta & 0xFFFFFFF0) == 0xa5a5a5a0)) {
+	if (unlikely(inta == 0xFFFFFFFF || iwl_trans_is_hw_error_value(inta))) {
 		/*
 		 * Hardware disappeared. It might have
 		 * already raised an interrupt.
drivers/net/wireless/intel/iwlwifi/pcie/trans.c +1 -1
index 15419397ac73..7240beca6419 100644
@@ -1788,7 +1788,7 @@ static int iwl_trans_pcie_clear_persistence_bit(struct iwl_trans *trans)
 	}
 
 	hpm = iwl_read_umac_prph_no_grab(trans, HPM_DEBUG);
-	if (hpm != 0xa5a5a5a0 && (hpm & PERSISTENCE_BIT)) {
+	if (!iwl_trans_is_hw_error_value(hpm) && (hpm & PERSISTENCE_BIT)) {
 		u32 wprot_val = iwl_read_umac_prph_no_grab(trans, wprot);
 
 		if (wprot_val & PREG_WFPM_ACCESS) {
Signature · 1 line
2.38.1
#15 lore raw

PATCH 10/15 wifi: iwlwifi: fw: print PC register value instead of address

In reply to [email protected]

From: Mukesh Sisodiya <[email protected]>

The program counter address is read from the TLV and PC address is printed in debug messages. Read the value at PC address and print the value instead of the register address.

Fixes 5e31b3df86ec ("wifi: iwlwifi: dbg: print pc register data once fw dump occurred")
---
 drivers/net/wireless/intel/iwlwifi/fw/dump.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/net/wireless/intel/iwlwifi/fw/dump.c +6 -1
index 64e83f30f947..23388261e97f 100644
@@ -507,11 +507,16 @@ void iwl_fwrt_dump_error_logs(struct iwl_fw_runtime *fwrt)
 	iwl_fwrt_dump_fseq_regs(fwrt);
 	if (fwrt->trans->trans_cfg->device_family >= IWL_DEVICE_FAMILY_22000) {
 		pc_data = fwrt->trans->dbg.pc_data;
+
+		if (!iwl_trans_grab_nic_access(fwrt->trans))
+			return;
 		for (count = 0; count < fwrt->trans->dbg.num_pc;
 		     count++, pc_data++)
 			IWL_ERR(fwrt, "%s: 0x%x\n",
 				pc_data->pc_name,
-				pc_data->pc_address);
+				iwl_read_prph_no_grab(fwrt->trans,
+						      pc_data->pc_address));
+		iwl_trans_release_nic_access(fwrt->trans);
 	}
 
 	if (fwrt->trans->trans_cfg->device_family >= IWL_DEVICE_FAMILY_BZ) {
Signature · 1 line
2.38.1
#16 lore raw

PATCH 11/15 wifi: iwlwifi: mvm: always set MH len in offload_assist

In reply to [email protected]

From: Johannes Berg <[email protected]>

Some versions of the new hardware don't have a functional version of the new offload method, but still have stricter checks on the MAC header (MH) length in the offload assist word. Include that even if checksumming isn't offloaded to hardware.

---
 drivers/net/wireless/intel/iwlwifi/mvm/tx.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/wireless/intel/iwlwifi/mvm/tx.c +3 -3
index ccd1e41604f3..547694c89ffa 100644
@@ -44,9 +44,9 @@ static u16 iwl_mvm_tx_csum_pre_bz(struct iwl_mvm *mvm, struct sk_buff *skb,
 				  struct ieee80211_tx_info *info, bool amsdu)
 {
 	struct ieee80211_hdr *hdr = (void *)skb->data;
+	u16 mh_len = ieee80211_hdrlen(hdr->frame_control);
 	u16 offload_assist = 0;
 #if IS_ENABLED(CONFIG_INET)
-	u16 mh_len = ieee80211_hdrlen(hdr->frame_control);
 	u8 protocol = 0;
 
 	/* Do not compute checksum if already computed */
@@ -118,6 +118,8 @@ static u16 iwl_mvm_tx_csum_pre_bz(struct iwl_mvm *mvm, struct sk_buff *skb,
 	else
 		udp_hdr(skb)->check = 0;
 
+out:
+#endif
 	/*
 	 * mac header len should include IV, size is in words unless
 	 * the IV is added by the firmware like in WEP.
@@ -130,8 +132,6 @@ static u16 iwl_mvm_tx_csum_pre_bz(struct iwl_mvm *mvm, struct sk_buff *skb,
 	mh_len /= 2;
 	offload_assist |= mh_len << TX_CMD_OFFLD_MH_SIZE;
 
-out:
-#endif
 	if (amsdu)
 		offload_assist |= BIT(TX_CMD_OFFLD_AMSDU);
 	else if (ieee80211_hdrlen(hdr->frame_control) % 4)
Signature · 1 line
2.38.1
#17 lore raw

PATCH 12/15 wifi: iwlwifi: debugfs: add ppag capa to fw info file

In reply to [email protected]

From: Alon Giladi <[email protected]>

Add information about ppag_china_bit_support capability.

---
 drivers/net/wireless/intel/iwlwifi/fw/debugfs.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)
drivers/net/wireless/intel/iwlwifi/fw/debugfs.c +11 -2
index 607e07ed2477..ebacf0e9fb0f 100644
@@ -354,9 +354,18 @@ static int iwl_dbgfs_fw_info_seq_show(struct seq_file *seq, void *v)
 	const struct iwl_fw *fw = priv->fwrt->fw;
 	const struct iwl_fw_cmd_version *ver;
 	u32 cmd_id;
-
-	if (!state->pos)
+	int has_capa;
+
+	if (!state->pos) {
+		seq_puts(seq, "fw_capa:\n");
+		has_capa = fw_has_capa(&fw->ucode_capa,
+				       IWL_UCODE_TLV_CAPA_PPAG_CHINA_BIOS_SUPPORT) ? 1 : 0;
+		seq_printf(seq,
+			   "    %d: %d\n",
+			   IWL_UCODE_TLV_CAPA_PPAG_CHINA_BIOS_SUPPORT,
+			   has_capa);
 		seq_puts(seq, "fw_api_ver:\n");
+	}
 
 	ver = &fw->ucode_capa.cmd_versions[state->pos];
 
Signature · 1 line
2.38.1
#18 lore raw

PATCH 13/15 wifi: iwlwifi: pass ESR parameters to the firmware

In reply to [email protected]

From: Emmanuel Grumbach <[email protected]>

The firmware needs to know the esr_transtition_timeout to time the transition between EMLSR and single radio with the AP. Add the EMLSR support bit to the wiphy extended capabilities so that it'll be sent in our association request frame. There are some limitations in the implementation so we cannot use zero padding/transition delay; fill the correct values.

Also, feed the medium_synchronization delay to the firmware.

---
 drivers/net/wireless/intel/iwlwifi/fw/api/mac-cfg.h |  4 ++--
 drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c   | 11 ++++++++++-
 drivers/net/wireless/intel/iwlwifi/mvm/mld-mac.c    | 12 ++++++++++++
 3 files changed, 24 insertions(+), 3 deletions(-)
drivers/net/wireless/intel/iwlwifi/fw/api/mac-cfg.h +2 -2
index a4cb24934a01..184db5a6f06f 100644
@@ -236,7 +236,7 @@ struct iwl_mac_low_latency_cmd {
  *	Available only from version 2 of the command.
  *	This values comes from the EMLSR transition delay in the EML
  *	Capabilities subfield.
- * @reserved: alignment
+ * @medium_sync_delay: the value as it appeasr in P802.11be_D2.2 Figure 9-1002j.
  * @assoc_id: unique ID assigned by the AP during association
  * @reserved1: alignment
  * @data_policy: see &enum iwl_mac_data_policy
@@ -247,7 +247,7 @@ struct iwl_mac_low_latency_cmd {
 struct iwl_mac_client_data {
 	u8 is_assoc;
 	u8 esr_transition_timeout;
-	__le16 reserved;
+	__le16 medium_sync_delay;
 
 	__le16 assoc_id;
 	__le16 reserved1;
drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c +10 -1
index 96577dcc22b7..f7e2ca7eebf0 100644
@@ -245,12 +245,21 @@ static const u8 tm_if_types_ext_capa_sta[] = {
 /* Additional interface types for which extended capabilities are
  * specified separately
  */
+
+#define IWL_MVM_EMLSR_CAPA	(IEEE80211_EML_CAP_EMLSR_SUPP | \
+				 IEEE80211_EML_CAP_EMLSR_PADDING_DELAY_32US << \
+					__bf_shf(IEEE80211_EML_CAP_EMLSR_PADDING_DELAY) | \
+				 IEEE80211_EML_CAP_EMLSR_TRANSITION_DELAY_64US << \
+					__bf_shf(IEEE80211_EML_CAP_EMLSR_TRANSITION_DELAY))
+
 static const struct wiphy_iftype_ext_capab add_iftypes_ext_capa[] = {
 	{
 		.iftype = NL80211_IFTYPE_STATION,
 		.extended_capabilities = he_if_types_ext_capa_sta,
 		.extended_capabilities_mask = he_if_types_ext_capa_sta,
 		.extended_capabilities_len = sizeof(he_if_types_ext_capa_sta),
+		/* relevant only if EHT is supported */
+		.eml_capabilities = IWL_MVM_EMLSR_CAPA,
 	},
 	{
 		.iftype = NL80211_IFTYPE_STATION,
@@ -258,7 +267,7 @@ static const struct wiphy_iftype_ext_capab add_iftypes_ext_capa[] = {
 		.extended_capabilities_mask = tm_if_types_ext_capa_sta,
 		.extended_capabilities_len = sizeof(tm_if_types_ext_capa_sta),
 		/* relevant only if EHT is supported */
-		.eml_capabilities = IEEE80211_EML_CAP_EMLSR_SUPP,
+		.eml_capabilities = IWL_MVM_EMLSR_CAPA,
 	},
 };
 
drivers/net/wireless/intel/iwlwifi/mvm/mld-mac.c +12 -0
index 99bf71a2b690..0ff99deb0ae7 100644
@@ -96,6 +96,7 @@ static int iwl_mvm_mld_mac_ctxt_cmd_sta(struct iwl_mvm *mvm,
 					u32 action, bool force_assoc_off)
 {
 	struct iwl_mac_config_cmd cmd = {};
+	u16 esr_transition_timeout;
 
 	WARN_ON(vif->type != NL80211_IFTYPE_STATION);
 
@@ -133,6 +134,17 @@ static int iwl_mvm_mld_mac_ctxt_cmd_sta(struct iwl_mvm *mvm,
 	}
 
 	cmd.client.assoc_id = cpu_to_le16(vif->cfg.aid);
+	if (ieee80211_vif_is_mld(vif)) {
+		esr_transition_timeout =
+			u16_get_bits(vif->cfg.eml_cap,
+				     IEEE80211_EML_CAP_TRANSITION_TIMEOUT);
+
+		cmd.client.esr_transition_timeout =
+			min_t(u16, IEEE80211_EML_CAP_TRANSITION_TIMEOUT_128TU,
+			      esr_transition_timeout);
+		cmd.client.medium_sync_delay =
+			cpu_to_le16(vif->cfg.eml_med_sync_delay);
+	}
 
 	if (vif->probe_req_reg && vif->cfg.assoc && vif->p2p)
 		cmd.filter_flags |= cpu_to_le32(MAC_CFG_FILTER_ACCEPT_PROBE_REQ);
Signature · 1 line
2.38.1
#19 lore raw

Re: [PATCH 13/15] wifi: iwlwifi: pass ESR parameters to the firmware

kernel test robot noticed the following build errors:

Hi,

kernel test robot noticed the following build errors:

[auto build test ERROR on wireless-next/main]
[also build test ERROR on next-20230609]
[cannot apply to wireless/main linus/master v6.4-rc6]
[If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/gregory-greenman-intel-com/wifi-iwlwifi-make-debugfs-entries-link-specific/20230612-235504
base:   https://git.kernel.org/pub/scm/linux/kernel/git/wireless/wireless-next.git main
patch link:    https://lore.kernel.org/r/20230612184434.09fa06820d03.Ie9a9fd37d4948f8c5dd91161de254184b1a093c0%40changeid
patch subject: [PATCH 13/15] wifi: iwlwifi: pass ESR parameters to the firmware
config: x86_64-allyesconfig (https://download.01.org/0day-ci/archive/20230613/[email protected]/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0

reproduce (this is a W=1 build):
git remote add wireless-next https://git.kernel.org/pub/scm/linux/kernel/git/wireless/wireless-next.git
git fetch wireless-next main
git checkout wireless-next/main
b4 shazam https://lore.kernel.org/r/20230612184434.09fa06820d03.Ie9a9fd37d4948f8c5dd91161de254184b1a093c0@changeid
# save the config file
mkdir build_dir && cp config build_dir/.config
make W=1 O=build_dir ARCH=x86_64 olddefconfig
make W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash

If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All errors (new ones prefixed by >>):

drivers/net/wireless/intel/iwlwifi/mvm/mld-mac.c: In function 'iwl_mvm_mld_mac_ctxt_cmd_sta':

>> drivers/net/wireless/intel/iwlwifi/mvm/mld-mac.c:137:13: error: implicit declaration of function 'ieee80211_vif_is_mld'; did you mean 'ieee80211_vif_is_mesh'? [-Werror=implicit-function-declaration]
     137 |         if (ieee80211_vif_is_mld(vif)) {
         |             ^~~~~~~~~~~~~~~~~~~~
         |             ieee80211_vif_is_mesh

cc1: some warnings being treated as errors

vim +137 drivers/net/wireless/intel/iwlwifi/mvm/mld-mac.c

    93	
    94	static int iwl_mvm_mld_mac_ctxt_cmd_sta(struct iwl_mvm *mvm,
    95						struct ieee80211_vif *vif,
    96						u32 action, bool force_assoc_off)
    97	{
    98		struct iwl_mac_config_cmd cmd = {};
    99		u16 esr_transition_timeout;
   100	
   101		WARN_ON(vif->type != NL80211_IFTYPE_STATION);
   102	
   103		/* Fill the common data for all mac context types */
   104		iwl_mvm_mld_mac_ctxt_cmd_common(mvm, vif, &cmd, action);
   105	
   106		/*
   107		 * We always want to hear MCAST frames, if we're not authorized yet,
   108		 * we'll drop them.
   109		 */
   110		cmd.filter_flags |= cpu_to_le32(MAC_CFG_FILTER_ACCEPT_GRP);
   111	
   112		if (vif->p2p)
   113			cmd.client.ctwin =
   114				iwl_mvm_mac_ctxt_cmd_p2p_sta_get_oppps_ctwin(mvm, vif);
   115	
   116		if (vif->cfg.assoc && !force_assoc_off) {
   117			struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
   118	
   119			cmd.client.is_assoc = 1;
   120	
   121			if (!mvmvif->authorized &&
   122			    fw_has_capa(&mvm->fw->ucode_capa,
   123					IWL_UCODE_TLV_CAPA_COEX_HIGH_PRIO))
   124				cmd.client.data_policy |=
   125					cpu_to_le16(COEX_HIGH_PRIORITY_ENABLE);
   126	
   127		} else {
   128			cmd.client.is_assoc = 0;
   129	
   130			/* Allow beacons to pass through as long as we are not
   131			 * associated, or we do not have dtim period information.
   132			 */
   133			cmd.filter_flags |= cpu_to_le32(MAC_CFG_FILTER_ACCEPT_BEACON);
   134		}
   135	
   136		cmd.client.assoc_id = cpu_to_le16(vif->cfg.aid);
 > 137		if (ieee80211_vif_is_mld(vif)) {

138 esr_transition_timeout =
139 u16_get_bits(vif->cfg.eml_cap,
140 IEEE80211_EML_CAP_TRANSITION_TIMEOUT);
141
142 cmd.client.esr_transition_timeout =
143 min_t(u16, IEEE80211_EML_CAP_TRANSITION_TIMEOUT_128TU,
144 esr_transition_timeout);
145 cmd.client.medium_sync_delay =
146 cpu_to_le16(vif->cfg.eml_med_sync_delay);
147 }
148
149 if (vif->probe_req_reg && vif->cfg.assoc && vif->p2p)
150 cmd.filter_flags |= cpu_to_le32(MAC_CFG_FILTER_ACCEPT_PROBE_REQ);
151
152 if (vif->bss_conf.he_support && !iwlwifi_mod_params.disable_11ax)
153 cmd.client.data_policy |=
154 cpu_to_le16(iwl_mvm_mac_ctxt_cmd_sta_get_twt_policy(mvm, vif));
155
156 return iwl_mvm_mld_mac_ctxt_send_cmd(mvm, &cmd);
157 }
158

Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
#20 lore raw

PATCH 14/15 wifi: iwlwifi: mvm: FTM responder MLO support

In reply to [email protected]

From: Avraham Stern <[email protected]>

Add a link configuration parameter to FTM responder start instead of using the default link.

---
 .../intel/iwlwifi/mvm/ftm-responder.c         | 23 +++++++++++--------
 .../net/wireless/intel/iwlwifi/mvm/mac80211.c |  4 ++--
 .../wireless/intel/iwlwifi/mvm/mld-mac80211.c |  4 ++--
 drivers/net/wireless/intel/iwlwifi/mvm/mvm.h  |  6 +++--
 4 files changed, 21 insertions(+), 16 deletions(-)
drivers/net/wireless/intel/iwlwifi/mvm/ftm-responder.c +13 -10
index 1b6fb73ddfc7..b49781d1a07a 100644
@@ -104,7 +104,8 @@ iwl_mvm_ftm_responder_set_ndp(struct iwl_mvm *mvm,
 static int
 iwl_mvm_ftm_responder_cmd(struct iwl_mvm *mvm,
 			  struct ieee80211_vif *vif,
-			  struct cfg80211_chan_def *chandef)
+			  struct cfg80211_chan_def *chandef,
+			  struct ieee80211_bss_conf *link_conf)
 {
 	u32 cmd_id = WIDE_ID(LOCATION_GROUP, TOF_RESPONDER_CONFIG_CMD);
 	struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
@@ -119,7 +120,7 @@ iwl_mvm_ftm_responder_cmd(struct iwl_mvm *mvm,
 			cpu_to_le32(IWL_TOF_RESPONDER_CMD_VALID_CHAN_INFO |
 				    IWL_TOF_RESPONDER_CMD_VALID_BSSID |
 				    IWL_TOF_RESPONDER_CMD_VALID_STA_ID),
-		.sta_id = mvmvif->deflink.bcast_sta.sta_id,
+		.sta_id = mvmvif->link[link_conf->link_id]->bcast_sta.sta_id,
 	};
 	u8 cmd_ver = iwl_fw_lookup_cmd_ver(mvm->fw, cmd_id, 6);
 	int err;
@@ -386,7 +387,8 @@ int iwl_mvm_ftm_resp_remove_pasn_sta(struct iwl_mvm *mvm,
 	return -EINVAL;
 }
 
-int iwl_mvm_ftm_start_responder(struct iwl_mvm *mvm, struct ieee80211_vif *vif)
+int iwl_mvm_ftm_start_responder(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
+				struct ieee80211_bss_conf *bss_conf)
 {
 	struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
 	struct ieee80211_ftm_responder_params *params;
@@ -395,11 +397,11 @@ int iwl_mvm_ftm_start_responder(struct iwl_mvm *mvm, struct ieee80211_vif *vif)
 	struct iwl_mvm_phy_ctxt *phy_ctxt;
 	int ret;
 
-	params = vif->bss_conf.ftmr_params;
+	params = bss_conf->ftmr_params;
 
 	lockdep_assert_held(&mvm->mutex);
 
-	if (WARN_ON_ONCE(!vif->bss_conf.ftm_responder))
+	if (WARN_ON_ONCE(!bss_conf->ftm_responder))
 		return -EINVAL;
 
 	if (vif->p2p || vif->type != NL80211_IFTYPE_AP ||
@@ -409,7 +411,7 @@ int iwl_mvm_ftm_start_responder(struct iwl_mvm *mvm, struct ieee80211_vif *vif)
 	}
 
 	rcu_read_lock();
-	pctx = rcu_dereference(vif->bss_conf.chanctx_conf);
+	pctx = rcu_dereference(bss_conf->chanctx_conf);
 	/* Copy the ctx to unlock the rcu and send the phy ctxt. We don't care
 	 * about changes in the ctx after releasing the lock because the driver
 	 * is still protected by the mutex. */
@@ -424,7 +426,7 @@ int iwl_mvm_ftm_start_responder(struct iwl_mvm *mvm, struct ieee80211_vif *vif)
 	if (ret)
 		return ret;
 
-	ret = iwl_mvm_ftm_responder_cmd(mvm, vif, &ctx.def);
+	ret = iwl_mvm_ftm_responder_cmd(mvm, vif, &ctx.def, bss_conf);
 	if (ret)
 		return ret;
 
@@ -446,13 +448,14 @@ void iwl_mvm_ftm_responder_clear(struct iwl_mvm *mvm,
 }
 
 void iwl_mvm_ftm_restart_responder(struct iwl_mvm *mvm,
-				   struct ieee80211_vif *vif)
+				   struct ieee80211_vif *vif,
+				   struct ieee80211_bss_conf *bss_conf)
 {
-	if (!vif->bss_conf.ftm_responder)
+	if (!bss_conf->ftm_responder)
 		return;
 
 	iwl_mvm_ftm_responder_clear(mvm, vif);
-	iwl_mvm_ftm_start_responder(mvm, vif);
+	iwl_mvm_ftm_start_responder(mvm, vif, bss_conf);
 }
 
 void iwl_mvm_ftm_responder_stats(struct iwl_mvm *mvm,
drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c +2 -2
index f7e2ca7eebf0..bf78b7df4700 100644
@@ -2890,7 +2890,7 @@ static int iwl_mvm_start_ap_ibss(struct ieee80211_hw *hw,
 	if (iwl_mvm_phy_ctx_count(mvm) > 1)
 		iwl_mvm_teardown_tdls_peers(mvm);
 
-	iwl_mvm_ftm_restart_responder(mvm, vif);
+	iwl_mvm_ftm_restart_responder(mvm, vif, &vif->bss_conf);
 
 	goto out_unlock;
 
@@ -3032,7 +3032,7 @@ iwl_mvm_bss_info_changed_ap_ibss(struct iwl_mvm *mvm,
 		IWL_WARN(mvm, "Failed updating beacon data\n");
 
 	if (changes & BSS_CHANGED_FTM_RESPONDER) {
-		int ret = iwl_mvm_ftm_start_responder(mvm, vif);
+		int ret = iwl_mvm_ftm_start_responder(mvm, vif, &vif->bss_conf);
 
 		if (ret)
 			IWL_WARN(mvm, "Failed to enable FTM responder (%d)\n",
drivers/net/wireless/intel/iwlwifi/mvm/mld-mac80211.c +2 -2
index 5e28a1645aa9..ff99bf91f931 100644
@@ -422,7 +422,7 @@ static int iwl_mvm_mld_start_ap_ibss(struct ieee80211_hw *hw,
 	if (iwl_mvm_phy_ctx_count(mvm) > 1)
 		iwl_mvm_teardown_tdls_peers(mvm);
 
-	iwl_mvm_ftm_restart_responder(mvm, vif);
+	iwl_mvm_ftm_restart_responder(mvm, vif, link_conf);
 
 	goto out_unlock;
 
@@ -711,7 +711,7 @@ iwl_mvm_mld_link_info_changed_ap_ibss(struct iwl_mvm *mvm,
 
 	/* FIXME: need to decide if we need FTM responder per link */
 	if (changes & BSS_CHANGED_FTM_RESPONDER) {
-		int ret = iwl_mvm_ftm_start_responder(mvm, vif);
+		int ret = iwl_mvm_ftm_start_responder(mvm, vif, link_conf);
 
 		if (ret)
 			IWL_WARN(mvm, "Failed to enable FTM responder (%d)\n",
drivers/net/wireless/intel/iwlwifi/mvm/mvm.h +4 -2
index cb0a8b860e67..3f9cc4502db1 100644
@@ -2242,9 +2242,11 @@ int iwl_mvm_sf_update(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
 		      bool added_vif);
 
 /* FTM responder */
-int iwl_mvm_ftm_start_responder(struct iwl_mvm *mvm, struct ieee80211_vif *vif);
+int iwl_mvm_ftm_start_responder(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
+				struct ieee80211_bss_conf *bss_conf);
 void iwl_mvm_ftm_restart_responder(struct iwl_mvm *mvm,
-				   struct ieee80211_vif *vif);
+				   struct ieee80211_vif *vif,
+				   struct ieee80211_bss_conf *bss_conf);
 void iwl_mvm_ftm_responder_stats(struct iwl_mvm *mvm,
 				 struct iwl_rx_cmd_buffer *rxb);
 int iwl_mvm_ftm_resp_remove_pasn_sta(struct iwl_mvm *mvm,
Signature · 1 line
2.38.1
#21 lore raw

PATCH 15/15 wifi: iwlwifi: mvm: Propagate ERP slot changes to FW

In reply to [email protected]

From: Ilan Peer <[email protected]>

In AP mode, ERP slot changes weren't properly indicated to the FW. Fix it.

---
 drivers/net/wireless/intel/iwlwifi/mvm/mld-mac80211.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/net/wireless/intel/iwlwifi/mvm/mld-mac80211.c +5 -1
index ff99bf91f931..cb4df8c6f9de 100644
@@ -697,7 +697,11 @@ iwl_mvm_mld_link_info_changed_ap_ibss(struct iwl_mvm *mvm,
 	if (link_conf->he_support)
 		link_changes |= LINK_CONTEXT_MODIFY_HE_PARAMS;
 
-	if (changes & (BSS_CHANGED_ERP_CTS_PROT | BSS_CHANGED_HT |
+	if (changes & BSS_CHANGED_ERP_SLOT)
+		link_changes |= LINK_CONTEXT_MODIFY_RATES_INFO;
+
+	if (changes & (BSS_CHANGED_ERP_CTS_PROT | BSS_CHANGED_ERP_SLOT |
+		       BSS_CHANGED_HT |
 		       BSS_CHANGED_BANDWIDTH | BSS_CHANGED_QOS |
 		       BSS_CHANGED_HE_BSS_COLOR) &&
 		       iwl_mvm_link_changed(mvm, vif, link_conf,
Signature · 1 line
2.38.1