2023-06-12 16:10:40

by Greenman, Gregory

[permalink] [raw]
Subject: [PATCH 00/15] 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(-)

--
2.38.1



2023-06-12 16:10:40

by Greenman, Gregory

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

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.

Signed-off-by: Avraham Stern <[email protected]>
Signed-off-by: Gregory Greenman <[email protected]>
---
.../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(+)

diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/debugfs-vif.c b/drivers/net/wireless/intel/iwlwifi/mvm/debugfs-vif.c
index 3613b1fdc5d9..762bce70e262 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/debugfs-vif.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/debugfs-vif.c
@@ -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)
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h b/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h
index 90cb8eeec47c..afcc55231bbc 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h
@@ -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];
};
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/rs-fw.c b/drivers/net/wireless/intel/iwlwifi/mvm/rs-fw.c
index e77b6157f759..992642edfcbe 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/rs-fw.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/rs-fw.c
@@ -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),
--
2.38.1


2023-06-12 16:10:42

by Greenman, Gregory

[permalink] [raw]
Subject: [PATCH 03/15] wifi: iwlwifi: mvm: Handle return value for iwl_mvm_sta_init

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()")
Signed-off-by: Mukesh Sisodiya <[email protected]>
Signed-off-by: Gregory Greenman <[email protected]>
---
drivers/net/wireless/intel/iwlwifi/mvm/sta.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/sta.c b/drivers/net/wireless/intel/iwlwifi/mvm/sta.c
index b9b9082676d4..5e11b101d02e 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/sta.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/sta.c
@@ -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);
--
2.38.1


2023-06-12 16:10:44

by Greenman, Gregory

[permalink] [raw]
Subject: [PATCH 05/15] wifi: iwlwifi: update response for mcc_update command

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.

Signed-off-by: Abhishek Naik <[email protected]>
Signed-off-by: Johannes Berg <[email protected]>
Signed-off-by: Gregory Greenman <[email protected]>
---
.../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(-)

diff --git a/drivers/net/wireless/intel/iwlwifi/fw/api/nvm-reg.h b/drivers/net/wireless/intel/iwlwifi/fw/api/nvm-reg.h
index 71cce6dfeaf9..28bfabb399b2 100644
--- a/drivers/net/wireless/intel/iwlwifi/fw/api/nvm-reg.h
+++ b/drivers/net/wireless/intel/iwlwifi/fw/api/nvm-reg.h
@@ -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)
diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c b/drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c
index cf19e8a561e9..7edb98ef8093 100644
--- a/drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c
+++ b/drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c
@@ -173,34 +173,34 @@ enum iwl_nvm_channel_flags {
};

/**
- * enum iwl_reg_capa_flags - global flags applied for the whole regulatory
+ * enum iwl_reg_capa_flags_v1 - global flags applied for the whole regulatory
* domain.
- * @REG_CAPA_BF_CCD_LOW_BAND: Beam-forming or Cyclic Delay Diversity in the
+ * @REG_CAPA_V1_BF_CCD_LOW_BAND: Beam-forming or Cyclic Delay Diversity in the
* 2.4Ghz band is allowed.
- * @REG_CAPA_BF_CCD_HIGH_BAND: Beam-forming or Cyclic Delay Diversity in the
+ * @REG_CAPA_V1_BF_CCD_HIGH_BAND: Beam-forming or Cyclic Delay Diversity in the
* 5Ghz band is allowed.
- * @REG_CAPA_160MHZ_ALLOWED: 11ac channel with a width of 160Mhz is allowed
+ * @REG_CAPA_V1_160MHZ_ALLOWED: 11ac channel with a width of 160Mhz is allowed
* for this regulatory domain (valid only in 5Ghz).
- * @REG_CAPA_80MHZ_ALLOWED: 11ac channel with a width of 80Mhz is allowed
+ * @REG_CAPA_V1_80MHZ_ALLOWED: 11ac channel with a width of 80Mhz is allowed
* for this regulatory domain (valid only in 5Ghz).
- * @REG_CAPA_MCS_8_ALLOWED: 11ac with MCS 8 is allowed.
- * @REG_CAPA_MCS_9_ALLOWED: 11ac with MCS 9 is allowed.
- * @REG_CAPA_40MHZ_FORBIDDEN: 11n channel with a width of 40Mhz is forbidden
+ * @REG_CAPA_V1_MCS_8_ALLOWED: 11ac with MCS 8 is allowed.
+ * @REG_CAPA_V1_MCS_9_ALLOWED: 11ac with MCS 9 is allowed.
+ * @REG_CAPA_V1_40MHZ_FORBIDDEN: 11n channel with a width of 40Mhz is forbidden
* for this regulatory domain (valid only in 5Ghz).
- * @REG_CAPA_DC_HIGH_ENABLED: DC HIGH allowed.
- * @REG_CAPA_11AX_DISABLED: 11ax is forbidden for this regulatory domain.
+ * @REG_CAPA_V1_DC_HIGH_ENABLED: DC HIGH allowed.
+ * @REG_CAPA_V1_11AX_DISABLED: 11ax is forbidden for this regulatory domain.
*/
-enum iwl_reg_capa_flags {
- REG_CAPA_BF_CCD_LOW_BAND = BIT(0),
- REG_CAPA_BF_CCD_HIGH_BAND = BIT(1),
- REG_CAPA_160MHZ_ALLOWED = BIT(2),
- REG_CAPA_80MHZ_ALLOWED = BIT(3),
- REG_CAPA_MCS_8_ALLOWED = BIT(4),
- REG_CAPA_MCS_9_ALLOWED = BIT(5),
- REG_CAPA_40MHZ_FORBIDDEN = BIT(7),
- REG_CAPA_DC_HIGH_ENABLED = BIT(9),
- REG_CAPA_11AX_DISABLED = BIT(10),
-};
+enum iwl_reg_capa_flags_v1 {
+ REG_CAPA_V1_BF_CCD_LOW_BAND = BIT(0),
+ REG_CAPA_V1_BF_CCD_HIGH_BAND = BIT(1),
+ REG_CAPA_V1_160MHZ_ALLOWED = BIT(2),
+ REG_CAPA_V1_80MHZ_ALLOWED = BIT(3),
+ REG_CAPA_V1_MCS_8_ALLOWED = BIT(4),
+ REG_CAPA_V1_MCS_9_ALLOWED = BIT(5),
+ REG_CAPA_V1_40MHZ_FORBIDDEN = BIT(7),
+ REG_CAPA_V1_DC_HIGH_ENABLED = BIT(9),
+ REG_CAPA_V1_11AX_DISABLED = BIT(10),
+}; /* GEO_CHANNEL_CAPABILITIES_API_S_VER_1 */

/**
* enum iwl_reg_capa_flags_v2 - global flags applied for the whole regulatory
@@ -234,7 +234,31 @@ enum iwl_reg_capa_flags_v2 {
REG_CAPA_V2_WEATHER_DISABLED = BIT(7),
REG_CAPA_V2_40MHZ_ALLOWED = BIT(8),
REG_CAPA_V2_11AX_DISABLED = BIT(10),
-};
+}; /* GEO_CHANNEL_CAPABILITIES_API_S_VER_2 */
+
+/**
+ * enum iwl_reg_capa_flags_v4 - global flags applied for the whole regulatory
+ * domain.
+ * @REG_CAPA_V4_160MHZ_ALLOWED: 11ac channel with a width of 160Mhz is allowed
+ * for this regulatory domain (valid only in 5Ghz).
+ * @REG_CAPA_V4_80MHZ_ALLOWED: 11ac channel with a width of 80Mhz is allowed
+ * for this regulatory domain (valid only in 5Ghz).
+ * @REG_CAPA_V4_MCS_12_ALLOWED: 11ac with MCS 12 is allowed.
+ * @REG_CAPA_V4_MCS_13_ALLOWED: 11ac with MCS 13 is allowed.
+ * @REG_CAPA_V4_11BE_DISABLED: 11be is forbidden for this regulatory domain.
+ * @REG_CAPA_V4_11AX_DISABLED: 11ax is forbidden for this regulatory domain.
+ * @REG_CAPA_V4_320MHZ_ALLOWED: 11be channel with a width of 320Mhz is allowed
+ * for this regulatory domain (valid only in 5GHz).
+ */
+enum iwl_reg_capa_flags_v4 {
+ REG_CAPA_V4_160MHZ_ALLOWED = BIT(3),
+ REG_CAPA_V4_80MHZ_ALLOWED = BIT(4),
+ REG_CAPA_V4_MCS_12_ALLOWED = BIT(5),
+ REG_CAPA_V4_MCS_13_ALLOWED = BIT(6),
+ REG_CAPA_V4_11BE_DISABLED = BIT(8),
+ REG_CAPA_V4_11AX_DISABLED = BIT(13),
+ REG_CAPA_V4_320MHZ_ALLOWED = BIT(16),
+}; /* GEO_CHANNEL_CAPABILITIES_API_S_VER_4 */

/*
* API v2 for reg_capa_flags is relevant from version 6 and onwards of the
@@ -242,23 +266,33 @@ enum iwl_reg_capa_flags_v2 {
*/
#define REG_CAPA_V2_RESP_VER 6

+/* API v4 for reg_capa_flags is relevant from version 8 and onwards of the
+ * MCC update command response.
+ */
+#define REG_CAPA_V4_RESP_VER 8
+
/**
* struct iwl_reg_capa - struct for global regulatory capabilities, Used for
* handling the different APIs of reg_capa_flags.
*
* @allow_40mhz: 11n channel with a width of 40Mhz is allowed
- * for this regulatory domain (valid only in 5Ghz).
+ * for this regulatory domain.
* @allow_80mhz: 11ac channel with a width of 80Mhz is allowed
- * for this regulatory domain (valid only in 5Ghz).
+ * for this regulatory domain (valid only in 5 and 6 Ghz).
* @allow_160mhz: 11ac channel with a width of 160Mhz is allowed
- * for this regulatory domain (valid only in 5Ghz).
+ * for this regulatory domain (valid only in 5 and 6 Ghz).
+ * @allow_320mhz: 11be channel with a width of 320Mhz is allowed
+ * for this regulatory domain (valid only in 6 Ghz).
* @disable_11ax: 11ax is forbidden for this regulatory domain.
+ * @disable_11be: 11be is forbidden for this regulatory domain.
*/
struct iwl_reg_capa {
- u16 allow_40mhz;
- u16 allow_80mhz;
- u16 allow_160mhz;
- u16 disable_11ax;
+ bool allow_40mhz;
+ bool allow_80mhz;
+ bool allow_160mhz;
+ bool allow_320mhz;
+ bool disable_11ax;
+ bool disable_11be;
};

static inline void iwl_nvm_print_channel_flags(struct device *dev, u32 level,
@@ -1538,20 +1572,27 @@ static u32 iwl_nvm_get_regdom_bw_flags(const u16 *nvm_chan,
return flags;
}

-static struct iwl_reg_capa iwl_get_reg_capa(u16 flags, u8 resp_ver)
+static struct iwl_reg_capa iwl_get_reg_capa(u32 flags, u8 resp_ver)
{
- struct iwl_reg_capa reg_capa;
-
- if (resp_ver >= REG_CAPA_V2_RESP_VER) {
+ struct iwl_reg_capa reg_capa = {};
+
+ if (resp_ver >= REG_CAPA_V4_RESP_VER) {
+ reg_capa.allow_40mhz = true;
+ reg_capa.allow_80mhz = flags & REG_CAPA_V4_80MHZ_ALLOWED;
+ reg_capa.allow_160mhz = flags & REG_CAPA_V4_160MHZ_ALLOWED;
+ reg_capa.allow_320mhz = flags & REG_CAPA_V4_320MHZ_ALLOWED;
+ reg_capa.disable_11ax = flags & REG_CAPA_V4_11AX_DISABLED;
+ reg_capa.disable_11be = flags & REG_CAPA_V4_11BE_DISABLED;
+ } else if (resp_ver >= REG_CAPA_V2_RESP_VER) {
reg_capa.allow_40mhz = flags & REG_CAPA_V2_40MHZ_ALLOWED;
reg_capa.allow_80mhz = flags & REG_CAPA_V2_80MHZ_ALLOWED;
reg_capa.allow_160mhz = flags & REG_CAPA_V2_160MHZ_ALLOWED;
reg_capa.disable_11ax = flags & REG_CAPA_V2_11AX_DISABLED;
} else {
- reg_capa.allow_40mhz = !(flags & REG_CAPA_40MHZ_FORBIDDEN);
- reg_capa.allow_80mhz = flags & REG_CAPA_80MHZ_ALLOWED;
- reg_capa.allow_160mhz = flags & REG_CAPA_160MHZ_ALLOWED;
- reg_capa.disable_11ax = flags & REG_CAPA_11AX_DISABLED;
+ reg_capa.allow_40mhz = !(flags & REG_CAPA_V1_40MHZ_FORBIDDEN);
+ reg_capa.allow_80mhz = flags & REG_CAPA_V1_80MHZ_ALLOWED;
+ reg_capa.allow_160mhz = flags & REG_CAPA_V1_160MHZ_ALLOWED;
+ reg_capa.disable_11ax = flags & REG_CAPA_V1_11AX_DISABLED;
}
return reg_capa;
}
@@ -1559,7 +1600,7 @@ static struct iwl_reg_capa iwl_get_reg_capa(u16 flags, u8 resp_ver)
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)
{
int ch_idx;
u16 ch_flags;
diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.h b/drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.h
index e01f7751cf11..c79f72d54482 100644
--- a/drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.h
+++ b/drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.h
@@ -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.
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
index f8fd34305e69..96577dcc22b7 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
@@ -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)) {
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h b/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h
index afcc55231bbc..cb0a8b860e67 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h
@@ -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);
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/nvm.c b/drivers/net/wireless/intel/iwlwifi/mvm/nvm.c
index fdf60afb0f3f..f67ab8ee18c2 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/nvm.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/nvm.c
@@ -404,7 +404,7 @@ int iwl_nvm_init(struct iwl_mvm *mvm)
return ret < 0 ? ret : 0;
}

-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)
{
@@ -412,7 +412,7 @@ iwl_mvm_update_mcc(struct iwl_mvm *mvm, const char *alpha2,
.mcc = cpu_to_le16(alpha2[0] << 8 | alpha2[1]),
.source_id = (u8)src_id,
};
- struct iwl_mcc_update_resp *resp_cp;
+ struct iwl_mcc_update_resp_v8 *resp_cp;
struct iwl_rx_packet *pkt;
struct iwl_host_cmd cmd = {
.id = MCC_UPDATE_CMD,
@@ -420,7 +420,7 @@ iwl_mvm_update_mcc(struct iwl_mvm *mvm, const char *alpha2,
.data = { &mcc_update_cmd },
};

- int ret;
+ int ret, resp_ver;
u32 status;
int resp_len, n_channels;
u16 mcc;
@@ -439,24 +439,60 @@ iwl_mvm_update_mcc(struct iwl_mvm *mvm, const char *alpha2,

pkt = cmd.resp_pkt;

+ resp_ver = iwl_fw_lookup_notif_ver(mvm->fw, IWL_ALWAYS_LONG_GROUP,
+ MCC_UPDATE_CMD, 0);
+
/* Extract MCC response */
- if (fw_has_capa(&mvm->fw->ucode_capa,
- IWL_UCODE_TLV_CAPA_MCC_UPDATE_11AX_SUPPORT)) {
- struct iwl_mcc_update_resp *mcc_resp = (void *)pkt->data;
+ if (resp_ver >= 8) {
+ struct iwl_mcc_update_resp_v8 *mcc_resp_v8 = (void *)pkt->data;
+
+ n_channels = __le32_to_cpu(mcc_resp_v8->n_channels);
+ if (iwl_rx_packet_payload_len(pkt) !=
+ struct_size(mcc_resp_v8, channels, n_channels)) {
+ resp_cp = ERR_PTR(-EINVAL);
+ goto exit;
+ }
+ resp_len = struct_size(resp_cp, channels, n_channels);
+ resp_cp = kzalloc(resp_len, GFP_KERNEL);
+ if (!resp_cp) {
+ resp_cp = ERR_PTR(-ENOMEM);
+ goto exit;
+ }
+ resp_cp->status = mcc_resp_v8->status;
+ resp_cp->mcc = mcc_resp_v8->mcc;
+ resp_cp->cap = mcc_resp_v8->cap;
+ resp_cp->source_id = mcc_resp_v8->source_id;
+ resp_cp->time = mcc_resp_v8->time;
+ resp_cp->geo_info = mcc_resp_v8->geo_info;
+ resp_cp->n_channels = mcc_resp_v8->n_channels;
+ memcpy(resp_cp->channels, mcc_resp_v8->channels,
+ n_channels * sizeof(__le32));
+ } else if (fw_has_capa(&mvm->fw->ucode_capa,
+ IWL_UCODE_TLV_CAPA_MCC_UPDATE_11AX_SUPPORT)) {
+ struct iwl_mcc_update_resp_v4 *mcc_resp_v4 = (void *)pkt->data;

- n_channels = __le32_to_cpu(mcc_resp->n_channels);
+ n_channels = __le32_to_cpu(mcc_resp_v4->n_channels);
if (iwl_rx_packet_payload_len(pkt) !=
- struct_size(mcc_resp, channels, n_channels)) {
+ struct_size(mcc_resp_v4, channels, n_channels)) {
resp_cp = ERR_PTR(-EINVAL);
goto exit;
}
- resp_len = sizeof(struct iwl_mcc_update_resp) +
- n_channels * sizeof(__le32);
- resp_cp = kmemdup(mcc_resp, resp_len, GFP_KERNEL);
+ resp_len = struct_size(resp_cp, channels, n_channels);
+ resp_cp = kzalloc(resp_len, GFP_KERNEL);
if (!resp_cp) {
resp_cp = ERR_PTR(-ENOMEM);
goto exit;
}
+
+ resp_cp->status = mcc_resp_v4->status;
+ resp_cp->mcc = mcc_resp_v4->mcc;
+ resp_cp->cap = cpu_to_le32(le16_to_cpu(mcc_resp_v4->cap));
+ resp_cp->source_id = mcc_resp_v4->source_id;
+ resp_cp->time = mcc_resp_v4->time;
+ resp_cp->geo_info = mcc_resp_v4->geo_info;
+ resp_cp->n_channels = mcc_resp_v4->n_channels;
+ memcpy(resp_cp->channels, mcc_resp_v4->channels,
+ n_channels * sizeof(__le32));
} else {
struct iwl_mcc_update_resp_v3 *mcc_resp_v3 = (void *)pkt->data;

@@ -466,8 +502,7 @@ iwl_mvm_update_mcc(struct iwl_mvm *mvm, const char *alpha2,
resp_cp = ERR_PTR(-EINVAL);
goto exit;
}
- resp_len = sizeof(struct iwl_mcc_update_resp) +
- n_channels * sizeof(__le32);
+ resp_len = struct_size(resp_cp, channels, n_channels);
resp_cp = kzalloc(resp_len, GFP_KERNEL);
if (!resp_cp) {
resp_cp = ERR_PTR(-ENOMEM);
@@ -476,7 +511,7 @@ iwl_mvm_update_mcc(struct iwl_mvm *mvm, const char *alpha2,

resp_cp->status = mcc_resp_v3->status;
resp_cp->mcc = mcc_resp_v3->mcc;
- resp_cp->cap = cpu_to_le16(mcc_resp_v3->cap);
+ resp_cp->cap = cpu_to_le32(mcc_resp_v3->cap);
resp_cp->source_id = mcc_resp_v3->source_id;
resp_cp->time = mcc_resp_v3->time;
resp_cp->geo_info = mcc_resp_v3->geo_info;
--
2.38.1


2023-06-12 16:10:49

by Greenman, Gregory

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

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.

Signed-off-by: Mukesh Sisodiya <[email protected]>
Signed-off-by: Gregory Greenman <[email protected]>
---
drivers/net/wireless/intel/iwlwifi/mvm/power.c | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/power.c b/drivers/net/wireless/intel/iwlwifi/mvm/power.c
index ac1dae52556f..19839cc44eb3 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/power.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/power.c
@@ -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;
}
--
2.38.1


2023-06-12 16:10:50

by Greenman, Gregory

[permalink] [raw]
Subject: [PATCH 06/15] wifi: iwlwifi: bump FW API to 79 for AX devices

From: Gregory Greenman <[email protected]>

Start supporting API version 79 for AX devices.

Signed-off-by: Gregory Greenman <[email protected]>
---
drivers/net/wireless/intel/iwlwifi/cfg/22000.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/intel/iwlwifi/cfg/22000.c b/drivers/net/wireless/intel/iwlwifi/cfg/22000.c
index 2cf3af284680..fce4fcdc4dfb 100644
--- a/drivers/net/wireless/intel/iwlwifi/cfg/22000.c
+++ b/drivers/net/wireless/intel/iwlwifi/cfg/22000.c
@@ -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 */
--
2.38.1


2023-06-12 16:11:27

by Greenman, Gregory

[permalink] [raw]
Subject: [PATCH 10/15] wifi: iwlwifi: fw: print PC register value instead of address

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")
Signed-off-by: Mukesh Sisodiya <[email protected]>
Signed-off-by: Gregory Greenman <[email protected]>
---
drivers/net/wireless/intel/iwlwifi/fw/dump.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/intel/iwlwifi/fw/dump.c b/drivers/net/wireless/intel/iwlwifi/fw/dump.c
index 64e83f30f947..23388261e97f 100644
--- a/drivers/net/wireless/intel/iwlwifi/fw/dump.c
+++ b/drivers/net/wireless/intel/iwlwifi/fw/dump.c
@@ -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) {
--
2.38.1


2023-06-12 16:11:30

by Greenman, Gregory

[permalink] [raw]
Subject: [PATCH 13/15] wifi: iwlwifi: pass ESR parameters to the firmware

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.

Signed-off-by: Emmanuel Grumbach <[email protected]>
Signed-off-by: Gregory Greenman <[email protected]>
---
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(-)

diff --git a/drivers/net/wireless/intel/iwlwifi/fw/api/mac-cfg.h b/drivers/net/wireless/intel/iwlwifi/fw/api/mac-cfg.h
index a4cb24934a01..184db5a6f06f 100644
--- a/drivers/net/wireless/intel/iwlwifi/fw/api/mac-cfg.h
+++ b/drivers/net/wireless/intel/iwlwifi/fw/api/mac-cfg.h
@@ -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;
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
index 96577dcc22b7..f7e2ca7eebf0 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
@@ -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,
},
};

diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mld-mac.c b/drivers/net/wireless/intel/iwlwifi/mvm/mld-mac.c
index 99bf71a2b690..0ff99deb0ae7 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/mld-mac.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/mld-mac.c
@@ -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);
--
2.38.1


2023-06-12 16:11:32

by Greenman, Gregory

[permalink] [raw]
Subject: [PATCH 11/15] wifi: iwlwifi: mvm: always set MH len in offload_assist

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.

Signed-off-by: Johannes Berg <[email protected]>
Signed-off-by: Gregory Greenman <[email protected]>
---
drivers/net/wireless/intel/iwlwifi/mvm/tx.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/tx.c b/drivers/net/wireless/intel/iwlwifi/mvm/tx.c
index ccd1e41604f3..547694c89ffa 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/tx.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/tx.c
@@ -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)
--
2.38.1


2023-06-12 16:11:33

by Greenman, Gregory

[permalink] [raw]
Subject: [PATCH 07/15] wifi: iwlwifi: mvm: fix getting LDPC/STBC support

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.

Signed-off-by: Mukesh Sisodiya <[email protected]>
Signed-off-by: Gregory Greenman <[email protected]>
---
drivers/net/wireless/intel/iwlwifi/mvm/tx.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/tx.c b/drivers/net/wireless/intel/iwlwifi/mvm/tx.c
index 5fa6f98b8e55..ccd1e41604f3 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/tx.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/tx.c
@@ -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;
--
2.38.1


2023-06-12 16:11:33

by Greenman, Gregory

[permalink] [raw]
Subject: [PATCH 09/15] wifi: iwlwifi: unify checks for HW error values

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.

Signed-off-by: Johannes Berg <[email protected]>
Signed-off-by: Gregory Greenman <[email protected]>
---
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(-)

diff --git a/drivers/net/wireless/intel/iwlwifi/fw/dbg.c b/drivers/net/wireless/intel/iwlwifi/fw/dbg.c
index 3c5a43a619c6..3253d89e522a 100644
--- a/drivers/net/wireless/intel/iwlwifi/fw/dbg.c
+++ b/drivers/net/wireless/intel/iwlwifi/fw/dbg.c
@@ -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;
}
diff --git a/drivers/net/wireless/intel/iwlwifi/fw/dump.c b/drivers/net/wireless/intel/iwlwifi/fw/dump.c
index f86f7b4baa18..64e83f30f947 100644
--- a/drivers/net/wireless/intel/iwlwifi/fw/dump.c
+++ b/drivers/net/wireless/intel/iwlwifi/fw/dump.c
@@ -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");
diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-io.c b/drivers/net/wireless/intel/iwlwifi/iwl-io.c
index 396f2c997da6..c60f9466c5fd 100644
--- a/drivers/net/wireless/intel/iwlwifi/iwl-io.c
+++ b/drivers/net/wireless/intel/iwlwifi/iwl-io.c
@@ -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);
diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-trans.h b/drivers/net/wireless/intel/iwlwifi/iwl-trans.h
index d9e465d0f4af..1fa035decc03 100644
--- a/drivers/net/wireless/intel/iwlwifi/iwl-trans.h
+++ b/drivers/net/wireless/intel/iwlwifi/iwl-trans.h
@@ -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
******************************************************/
diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/rx.c b/drivers/net/wireless/intel/iwlwifi/pcie/rx.c
index 0d7890f99a5f..4ee4886babcb 100644
--- a/drivers/net/wireless/intel/iwlwifi/pcie/rx.c
+++ b/drivers/net/wireless/intel/iwlwifi/pcie/rx.c
@@ -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.
diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/trans.c b/drivers/net/wireless/intel/iwlwifi/pcie/trans.c
index 15419397ac73..7240beca6419 100644
--- a/drivers/net/wireless/intel/iwlwifi/pcie/trans.c
+++ b/drivers/net/wireless/intel/iwlwifi/pcie/trans.c
@@ -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) {
--
2.38.1


2023-06-12 16:11:33

by Greenman, Gregory

[permalink] [raw]
Subject: [PATCH 12/15] wifi: iwlwifi: debugfs: add ppag capa to fw info file

From: Alon Giladi <[email protected]>

Add information about ppag_china_bit_support capability.

Signed-off-by: Alon Giladi <[email protected]>
Signed-off-by: Gregory Greenman <[email protected]>
---
drivers/net/wireless/intel/iwlwifi/fw/debugfs.c | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/intel/iwlwifi/fw/debugfs.c b/drivers/net/wireless/intel/iwlwifi/fw/debugfs.c
index 607e07ed2477..ebacf0e9fb0f 100644
--- a/drivers/net/wireless/intel/iwlwifi/fw/debugfs.c
+++ b/drivers/net/wireless/intel/iwlwifi/fw/debugfs.c
@@ -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];

--
2.38.1


2023-06-12 16:11:46

by Greenman, Gregory

[permalink] [raw]
Subject: [PATCH 15/15] wifi: iwlwifi: mvm: Propagate ERP slot changes to FW

From: Ilan Peer <[email protected]>

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

Signed-off-by: Ilan Peer <[email protected]>
Signed-off-by: Gregory Greenman <[email protected]>
---
drivers/net/wireless/intel/iwlwifi/mvm/mld-mac80211.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mld-mac80211.c b/drivers/net/wireless/intel/iwlwifi/mvm/mld-mac80211.c
index ff99bf91f931..cb4df8c6f9de 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/mld-mac80211.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/mld-mac80211.c
@@ -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,
--
2.38.1


2023-06-12 16:11:47

by Greenman, Gregory

[permalink] [raw]
Subject: [PATCH 14/15] wifi: iwlwifi: mvm: FTM responder MLO support

From: Avraham Stern <[email protected]>

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

Signed-off-by: Avraham Stern <[email protected]>
Signed-off-by: Gregory Greenman <[email protected]>
---
.../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(-)

diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/ftm-responder.c b/drivers/net/wireless/intel/iwlwifi/mvm/ftm-responder.c
index 1b6fb73ddfc7..b49781d1a07a 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/ftm-responder.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/ftm-responder.c
@@ -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,
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
index f7e2ca7eebf0..bf78b7df4700 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
@@ -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",
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mld-mac80211.c b/drivers/net/wireless/intel/iwlwifi/mvm/mld-mac80211.c
index 5e28a1645aa9..ff99bf91f931 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/mld-mac80211.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/mld-mac80211.c
@@ -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",
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h b/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h
index cb0a8b860e67..3f9cc4502db1 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h
@@ -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,
--
2.38.1


2023-06-14 10:22:40

by Johannes Berg

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

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.
>
> Signed-off-by: Avraham Stern <[email protected]>
> Signed-off-by: Gregory Greenman <[email protected]>
> ---
> .../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(+)
>
> diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/debugfs-vif.c b/drivers/net/wireless/intel/iwlwifi/mvm/debugfs-vif.c
> index 3613b1fdc5d9..762bce70e262 100644
> --- a/drivers/net/wireless/intel/iwlwifi/mvm/debugfs-vif.c
> +++ b/drivers/net/wireless/intel/iwlwifi/mvm/debugfs-vif.c
> @@ -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);

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

2023-06-14 10:23:14

by Johannes Berg

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

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.

> /* 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

2023-06-14 12:37:03

by Johannes Berg

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

On Wed, 2023-06-14 at 12:28 +0000, Greenman, Gregory wrote:
> On Wed, 2023-06-14 at 12:07 +0200, Johannes Berg wrote:
> > 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.
> >
> > >         /* 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
>
> 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

2023-06-14 12:40:45

by Greenman, Gregory

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

On Wed, 2023-06-14 at 12:07 +0200, Johannes Berg wrote:
> 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.
>
> >         /* 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

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?

2023-06-14 15:14:22

by Greenman, Gregory

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

On Wed, 2023-06-14 at 12:03 +0200, Johannes Berg wrote:
> 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.
> >
> > Signed-off-by: Avraham Stern <[email protected]>
> > Signed-off-by: Gregory Greenman <[email protected]>
> > ---
> >  .../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(+)
> >
> > diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/debugfs-vif.c b/drivers/net/wireless/intel/iwlwifi/mvm/debugfs-vif.c
> > index 3613b1fdc5d9..762bce70e262 100644
> > --- a/drivers/net/wireless/intel/iwlwifi/mvm/debugfs-vif.c
> > +++ b/drivers/net/wireless/intel/iwlwifi/mvm/debugfs-vif.c
> > @@ -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);
>
> 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

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.