2021-03-31 09:16:02

by Luca Coelho

[permalink] [raw]
Subject: [PATCH 00/12] iwlwifi: updates intended for v5.13 2021-03-31

From: Luca Coelho <[email protected]>

Hi,

Here's the second set of patches intended for v5.13. It's the usual
development, new features, cleanups and bugfixes.

The changes are:

* One fix in PMF;
* Some new regulatory features;
* Support for passive scan in 6GHz;
* Some improvements in the sync queue implementation;
* Support for new devices;
* Some other small fixes, clean-ups and improvements.

As usual, I'm pushing this to a pending branch, for kbuild bot, and
will send a pull-request later.

Please review.

Cheers,
Luca.


Avraham Stern (1):
iwlwifi: mvm: when associated with PMF, use protected NDP ranging
negotiation

Harish Mitty (1):
iwlwifi: mvm: refactor ACPI DSM evaluation function

Ilan Peer (1):
iwlwifi: mvm: Add support for 6GHz passive scan

Johannes Berg (3):
iwlwifi: mvm: write queue_sync_state only for sync
iwlwifi: mvm: clean up queue sync implementation
iwlwifi: pcie: try to grab NIC access early

Miri Korenblit (2):
iwlwifi: mvm: enable PPAG in China
iwlwifi: mvm: support BIOS enable/disable for 11ax in Ukraine

Mordechay Goodstein (1):
iwlwifi: move iwl_configure_rxq to be used by other op_modes

Ravi Darsi (1):
iwlwifi: mvm: Use IWL_INFO in fw_reset_handshake()

ybaruch (2):
iwlwifi: add ax201 killer device
iwlwifi: add new so-gf device

.../net/wireless/intel/iwlwifi/cfg/22000.c | 4 +
drivers/net/wireless/intel/iwlwifi/fw/acpi.c | 84 ++++++-
drivers/net/wireless/intel/iwlwifi/fw/acpi.h | 13 +-
.../wireless/intel/iwlwifi/fw/api/nvm-reg.h | 3 +
.../net/wireless/intel/iwlwifi/fw/api/power.h | 22 +-
.../net/wireless/intel/iwlwifi/fw/api/rx.h | 30 ---
.../net/wireless/intel/iwlwifi/fw/api/scan.h | 8 +
drivers/net/wireless/intel/iwlwifi/fw/file.h | 3 +
drivers/net/wireless/intel/iwlwifi/fw/init.c | 59 +++++
.../net/wireless/intel/iwlwifi/fw/runtime.h | 1 +
.../net/wireless/intel/iwlwifi/iwl-config.h | 2 +
.../wireless/intel/iwlwifi/mvm/constants.h | 2 +
drivers/net/wireless/intel/iwlwifi/mvm/d3.c | 2 +
.../intel/iwlwifi/mvm/ftm-initiator.c | 9 +
drivers/net/wireless/intel/iwlwifi/mvm/fw.c | 209 +++++-------------
.../net/wireless/intel/iwlwifi/mvm/mac80211.c | 49 ++--
drivers/net/wireless/intel/iwlwifi/mvm/mvm.h | 11 +-
drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c | 58 +----
drivers/net/wireless/intel/iwlwifi/mvm/scan.c | 128 +++++++++++
drivers/net/wireless/intel/iwlwifi/mvm/sta.c | 10 +-
drivers/net/wireless/intel/iwlwifi/mvm/sta.h | 38 +++-
drivers/net/wireless/intel/iwlwifi/pcie/drv.c | 29 ++-
.../wireless/intel/iwlwifi/pcie/trans-gen2.c | 4 +-
23 files changed, 491 insertions(+), 287 deletions(-)

--
2.31.0


2021-03-31 09:16:08

by Luca Coelho

[permalink] [raw]
Subject: [PATCH 01/12] iwlwifi: mvm: write queue_sync_state only for sync

From: Johannes Berg <[email protected]>

We use mvm->queue_sync_state to wait for synchronous queue sync
messages, but if an async one happens inbetween we shouldn't
clear mvm->queue_sync_state after sending the async one, that
can run concurrently (at least from the CPU POV) with another
synchronous queue sync.

Signed-off-by: Johannes Berg <[email protected]>
Signed-off-by: Luca Coelho <[email protected]>
---
drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
index 9ed6e2783cc4..fbd37a19b6e0 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
@@ -5177,9 +5177,10 @@ void iwl_mvm_sync_rx_queues_internal(struct iwl_mvm *mvm,
}

out:
- mvm->queue_sync_state = 0;
- if (notif->sync)
+ if (notif->sync) {
+ mvm->queue_sync_state = 0;
mvm->queue_sync_cookie++;
+ }
}

static void iwl_mvm_sync_rx_queues(struct ieee80211_hw *hw)
--
2.31.0

2021-03-31 09:16:09

by Luca Coelho

[permalink] [raw]
Subject: [PATCH 03/12] iwlwifi: mvm: when associated with PMF, use protected NDP ranging negotiation

From: Avraham Stern <[email protected]>

When associated to the resonder with PMF, request to protect the NDP
ranging negotiation with PMF.

Signed-off-by: Avraham Stern <[email protected]>
Signed-off-by: Luca Coelho <[email protected]>
---
drivers/net/wireless/intel/iwlwifi/mvm/ftm-initiator.c | 9 +++++++++
1 file changed, 9 insertions(+)

diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/ftm-initiator.c b/drivers/net/wireless/intel/iwlwifi/mvm/ftm-initiator.c
index 24ca2934bea0..a456b8a0ae58 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/ftm-initiator.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/ftm-initiator.c
@@ -490,6 +490,15 @@ iwl_mvm_ftm_put_target(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
if (vif->bss_conf.assoc &&
!memcmp(peer->addr, vif->bss_conf.bssid, ETH_ALEN)) {
struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
+ struct ieee80211_sta *sta;
+
+ rcu_read_lock();
+
+ sta = rcu_dereference(mvm->fw_id_to_mac_id[mvmvif->ap_sta_id]);
+ if (sta->mfp)
+ FTM_PUT_FLAG(PMF);
+
+ rcu_read_unlock();

target->sta_id = mvmvif->ap_sta_id;
} else {
--
2.31.0

2021-03-31 09:16:15

by Luca Coelho

[permalink] [raw]
Subject: [PATCH 05/12] iwlwifi: pcie: try to grab NIC access early

From: Johannes Berg <[email protected]>

Sometimes some NICs may fail to initialize, but if we have
such a scenario we may only see an alive timeout (i.e. the
firmware doesn't send us the alive message), and that will
only cause us to fail the interface up.

Try to once grab NIC access during device probe to ensure
we can properly talk to the hardware at all, and to do all
the potential workarounds in that function.

Since we now finish NIC init here, we can remove it from
the later potential read of the RF ID.

Signed-off-by: Johannes Berg <[email protected]>
Signed-off-by: Luca Coelho <[email protected]>
---
drivers/net/wireless/intel/iwlwifi/pcie/drv.c | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)

diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/drv.c b/drivers/net/wireless/intel/iwlwifi/pcie/drv.c
index 8e3fc160e083..3186de93d769 100644
--- a/drivers/net/wireless/intel/iwlwifi/pcie/drv.c
+++ b/drivers/net/wireless/intel/iwlwifi/pcie/drv.c
@@ -1112,6 +1112,24 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)

trans_pcie = IWL_TRANS_GET_PCIE_TRANS(iwl_trans);

+ /*
+ * Let's try to grab NIC access early here. Sometimes, NICs may
+ * fail to initialize, and if that happens it's better if we see
+ * issues early on (and can reprobe, per the logic inside), than
+ * first trying to load the firmware etc. and potentially only
+ * detecting any problems when the first interface is brought up.
+ */
+ ret = iwl_finish_nic_init(iwl_trans, trans);
+ if (ret)
+ goto out_free_trans;
+ if (iwl_trans_grab_nic_access(iwl_trans)) {
+ /* all good */
+ iwl_trans_release_nic_access(iwl_trans);
+ } else {
+ ret = -EIO;
+ goto out_free_trans;
+ }
+
iwl_trans->hw_rf_id = iwl_read32(iwl_trans, CSR_HW_RF_ID);

for (i = 0; i < ARRAY_SIZE(iwl_dev_info_table); i++) {
--
2.31.0

2021-03-31 09:16:15

by Luca Coelho

[permalink] [raw]
Subject: [PATCH 04/12] iwlwifi: add ax201 killer device

From: ybaruch <[email protected]>

add new killer devices configurations.

Signed-off-by: ybaruch <[email protected]>
Signed-off-by: Luca Coelho <[email protected]>
---
drivers/net/wireless/intel/iwlwifi/cfg/22000.c | 4 ++++
drivers/net/wireless/intel/iwlwifi/iwl-config.h | 2 ++
drivers/net/wireless/intel/iwlwifi/pcie/drv.c | 2 ++
3 files changed, 8 insertions(+)

diff --git a/drivers/net/wireless/intel/iwlwifi/cfg/22000.c b/drivers/net/wireless/intel/iwlwifi/cfg/22000.c
index bea3d5f3014a..d775cd9c1394 100644
--- a/drivers/net/wireless/intel/iwlwifi/cfg/22000.c
+++ b/drivers/net/wireless/intel/iwlwifi/cfg/22000.c
@@ -399,6 +399,10 @@ const char iwl_ax201_killer_1650s_name[] =
"Killer(R) Wi-Fi 6 AX1650s 160MHz Wireless Network Adapter (201D2W)";
const char iwl_ax201_killer_1650i_name[] =
"Killer(R) Wi-Fi 6 AX1650i 160MHz Wireless Network Adapter (201NGW)";
+const char iwl_ax210_killer_1675w_name[] =
+ "Killer(R) Wi-Fi 6E AX1675w 160MHz Wireless Network Adapter (210D2W)";
+const char iwl_ax210_killer_1675x_name[] =
+ "Killer(R) Wi-Fi 6E AX1675x 160MHz Wireless Network Adapter (210NGW)";

const struct iwl_cfg iwl_qu_b0_hr1_b0 = {
.fw_name_pre = IWL_QU_B_HR_B_FW_PRE,
diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-config.h b/drivers/net/wireless/intel/iwlwifi/iwl-config.h
index bbf3a7d9ea55..01a4cdf45d0d 100644
--- a/drivers/net/wireless/intel/iwlwifi/iwl-config.h
+++ b/drivers/net/wireless/intel/iwlwifi/iwl-config.h
@@ -502,6 +502,8 @@ extern const char iwl_ax200_killer_1650w_name[];
extern const char iwl_ax200_killer_1650x_name[];
extern const char iwl_ax201_killer_1650s_name[];
extern const char iwl_ax201_killer_1650i_name[];
+extern const char iwl_ax210_killer_1675w_name[];
+extern const char iwl_ax210_killer_1675x_name[];
extern const char iwl_ma_name[];
extern const char iwl_ax211_name[];
extern const char iwl_ax411_name[];
diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/drv.c b/drivers/net/wireless/intel/iwlwifi/pcie/drv.c
index 15561a14a098..8e3fc160e083 100644
--- a/drivers/net/wireless/intel/iwlwifi/pcie/drv.c
+++ b/drivers/net/wireless/intel/iwlwifi/pcie/drv.c
@@ -618,6 +618,8 @@ static const struct iwl_dev_info iwl_dev_info_table[] = {
IWL_DEV_INFO(0x2725, 0x4020, iwlax210_2ax_cfg_ty_gf_a0, NULL),
IWL_DEV_INFO(0x2725, 0x6020, iwlax210_2ax_cfg_ty_gf_a0, NULL),
IWL_DEV_INFO(0x2725, 0x6024, iwlax210_2ax_cfg_ty_gf_a0, NULL),
+ IWL_DEV_INFO(0x2725, 0x1673, iwlax210_2ax_cfg_ty_gf_a0, iwl_ax210_killer_1675w_name),
+ IWL_DEV_INFO(0x2725, 0x1674, iwlax210_2ax_cfg_ty_gf_a0, iwl_ax210_killer_1675x_name),
IWL_DEV_INFO(0x7A70, 0x0090, iwlax211_2ax_cfg_so_gf_a0_long, NULL),
IWL_DEV_INFO(0x7A70, 0x0098, iwlax211_2ax_cfg_so_gf_a0_long, NULL),
IWL_DEV_INFO(0x7A70, 0x00B0, iwlax411_2ax_cfg_so_gf4_a0_long, NULL),
--
2.31.0

2021-03-31 09:16:15

by Luca Coelho

[permalink] [raw]
Subject: [PATCH 06/12] iwlwifi: mvm: Add support for 6GHz passive scan

From: Ilan Peer <[email protected]>

When doing scan while 6GHz channels are not enabled, the 6GHz band
is not scanned. Thus, if there are no APs on the 2GHz and 5GHz bands
(that will allow discovery of geographic location etc. that would
allow enabling the 6GHz channels) but there are non collocated APs
on 6GHz PSC channels these would never be discovered.

To overcome this, FW added support for performing passive UHB scan
in case no APs were discovered during scan on the 2GHz and 5GHz
channels.

Add support for enabling such scan when the following conditions are
met:

- 6GHz channels are supported but not enabled by regulatory.
- Station interface is not associated or less than a defined time
interval passed from the last resume or HW reset flows.
- At least 4 channels are included in the scan request
- The scan request includes the widlcard SSID.
- At least 50 minutes passed from the last 6GHz passive scan.

Signed-off-by: Ilan Peer <[email protected]>
Signed-off-by: Luca Coelho <[email protected]>
---
.../net/wireless/intel/iwlwifi/fw/api/scan.h | 8 ++
drivers/net/wireless/intel/iwlwifi/fw/file.h | 3 +
.../wireless/intel/iwlwifi/mvm/constants.h | 2 +
drivers/net/wireless/intel/iwlwifi/mvm/d3.c | 2 +
.../net/wireless/intel/iwlwifi/mvm/mac80211.c | 2 +
drivers/net/wireless/intel/iwlwifi/mvm/mvm.h | 3 +
drivers/net/wireless/intel/iwlwifi/mvm/scan.c | 128 ++++++++++++++++++
7 files changed, 148 insertions(+)

diff --git a/drivers/net/wireless/intel/iwlwifi/fw/api/scan.h b/drivers/net/wireless/intel/iwlwifi/fw/api/scan.h
index 6b8ca35cec1a..b2605aefc290 100644
--- a/drivers/net/wireless/intel/iwlwifi/fw/api/scan.h
+++ b/drivers/net/wireless/intel/iwlwifi/fw/api/scan.h
@@ -634,6 +634,12 @@ enum iwl_umac_scan_general_flags2 {
* @IWL_UMAC_SCAN_GEN_FLAGS_V2_TRIGGER_UHB_SCAN: at the end of 2.4GHz and
* 5.2Ghz bands scan, trigger scan on 6GHz band to discover
* the reported collocated APs
+ * @IWL_UMAC_SCAN_GEN_FLAGS_V2_6GHZ_PASSIVE_SCAN: at the end of 2.4GHz and 5GHz
+ * bands scan, if not APs were discovered, allow scan to conitnue and scan
+ * 6GHz PSC channels in order to discover country information.
+ * @IWL_UMAC_SCAN_GEN_FLAGS_V2_6GHZ_PASSIVE_SCAN_FILTER_IN: in case
+ * &IWL_UMAC_SCAN_GEN_FLAGS_V2_6GHZ_PASSIVE_SCAN is enabled and scan is
+ * activated over 6GHz PSC channels, filter in beacons and probe responses.
*/
enum iwl_umac_scan_general_flags_v2 {
IWL_UMAC_SCAN_GEN_FLAGS_V2_PERIODIC = BIT(0),
@@ -649,6 +655,8 @@ enum iwl_umac_scan_general_flags_v2 {
IWL_UMAC_SCAN_GEN_FLAGS_V2_MULTI_SSID = BIT(10),
IWL_UMAC_SCAN_GEN_FLAGS_V2_FORCE_PASSIVE = BIT(11),
IWL_UMAC_SCAN_GEN_FLAGS_V2_TRIGGER_UHB_SCAN = BIT(12),
+ IWL_UMAC_SCAN_GEN_FLAGS_V2_6GHZ_PASSIVE_SCAN = BIT(13),
+ IWL_UMAC_SCAN_GEN_FLAGS_V2_6GHZ_PASSIVE_SCAN_FILTER_IN = BIT(14),
};

/**
diff --git a/drivers/net/wireless/intel/iwlwifi/fw/file.h b/drivers/net/wireless/intel/iwlwifi/fw/file.h
index 35dffcaf5aba..f9c5cf538ad1 100644
--- a/drivers/net/wireless/intel/iwlwifi/fw/file.h
+++ b/drivers/net/wireless/intel/iwlwifi/fw/file.h
@@ -362,6 +362,8 @@ typedef unsigned int __bitwise iwl_ucode_tlv_capa_t;
* @IWL_UCODE_TLV_CAPA_PROTECTED_TWT: Supports protection of TWT action frames
* @IWL_UCODE_TLV_CAPA_FW_RESET_HANDSHAKE: Supports the firmware handshake in
* reset flow
+ * @IWL_UCODE_TLV_CAPA_PASSIVE_6GHZ_SCAN: Support for passive scan on 6GHz PSC
+ * channels even when these are not enabled.
*
* @NUM_IWL_UCODE_TLV_CAPA: number of bits used
*/
@@ -408,6 +410,7 @@ enum iwl_ucode_tlv_capa {
IWL_UCODE_TLV_CAPA_SESSION_PROT_CMD = (__force iwl_ucode_tlv_capa_t)54,
IWL_UCODE_TLV_CAPA_PROTECTED_TWT = (__force iwl_ucode_tlv_capa_t)56,
IWL_UCODE_TLV_CAPA_FW_RESET_HANDSHAKE = (__force iwl_ucode_tlv_capa_t)57,
+ IWL_UCODE_TLV_CAPA_PASSIVE_6GHZ_SCAN = (__force iwl_ucode_tlv_capa_t)58,

/* set 2 */
IWL_UCODE_TLV_CAPA_EXTENDED_DTS_MEASURE = (__force iwl_ucode_tlv_capa_t)64,
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/constants.h b/drivers/net/wireless/intel/iwlwifi/mvm/constants.h
index 45634302801f..1343f25f1090 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/constants.h
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/constants.h
@@ -117,5 +117,7 @@
#define IWL_MVM_FTM_INITIATOR_SMOOTH_OVERSHOOT 20016
#define IWL_MVM_FTM_INITIATOR_SMOOTH_AGE_SEC 2
#define IWL_MVM_DISABLE_AP_FILS false
+#define IWL_MVM_6GHZ_PASSIVE_SCAN_TIMEOUT 3000 /* in seconds */
+#define IWL_MVM_6GHZ_PASSIVE_SCAN_ASSOC_TIMEOUT 60 /* in seconds */

#endif /* __MVM_CONSTANTS_H */
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/d3.c b/drivers/net/wireless/intel/iwlwifi/mvm/d3.c
index a7dc85c704a9..2e28cf299ef4 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/d3.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/d3.c
@@ -2028,6 +2028,8 @@ static int __iwl_mvm_resume(struct iwl_mvm *mvm, bool test)

mutex_lock(&mvm->mutex);

+ mvm->last_reset_or_resume_time_jiffies = jiffies;
+
/* get the BSS vif pointer again */
vif = iwl_mvm_get_bss_vif(mvm);
if (IS_ERR_OR_NULL(vif))
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
index fd35dd31613e..607d5d564928 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
@@ -1099,6 +1099,8 @@ int __iwl_mvm_mac_start(struct iwl_mvm *mvm)
iwl_dbg_tlv_time_point(&mvm->fwrt, IWL_FW_INI_TIME_POINT_PERIODIC,
NULL);

+ mvm->last_reset_or_resume_time_jiffies = jiffies;
+
if (ret && test_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status)) {
/* Something went wrong - we need to finish some cleanup
* that normally iwl_mvm_mac_restart_complete() below
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h b/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h
index e607ad713f88..e2a37ac7c4b1 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h
@@ -1096,6 +1096,9 @@ struct iwl_mvm {
/* sniffer data to include in radiotap */
__le16 cur_aid;
u8 cur_bssid[ETH_ALEN];
+
+ unsigned long last_6ghz_passive_scan_jiffies;
+ unsigned long last_reset_or_resume_time_jiffies;
};

/* Extract MVM priv from op_mode and _hw */
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/scan.c b/drivers/net/wireless/intel/iwlwifi/mvm/scan.c
index caf87f320094..5a0696c44f6d 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/scan.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/scan.c
@@ -43,6 +43,9 @@
/* adaptive dwell number of APs override for social channels */
#define IWL_SCAN_ADWELL_N_APS_SOCIAL_CHS 2

+/* minimal number of 2GHz and 5GHz channels in the regular scan request */
+#define IWL_MVM_6GHZ_PASSIVE_SCAN_MIN_CHANS 4
+
struct iwl_mvm_scan_timing_params {
u32 suspend_time;
u32 max_out_time;
@@ -94,6 +97,7 @@ struct iwl_mvm_scan_params {
struct cfg80211_scan_6ghz_params *scan_6ghz_params;
u32 n_6ghz_params;
bool scan_6ghz;
+ bool enable_6ghz_passive;
};

static inline void *iwl_mvm_get_scan_req_umac_data(struct iwl_mvm *mvm)
@@ -1873,6 +1877,98 @@ static u8 iwl_mvm_scan_umac_chan_flags_v2(struct iwl_mvm *mvm,
return flags;
}

+static void iwl_mvm_scan_6ghz_passive_scan(struct iwl_mvm *mvm,
+ struct iwl_mvm_scan_params *params,
+ struct ieee80211_vif *vif)
+{
+ struct ieee80211_supported_band *sband =
+ &mvm->nvm_data->bands[NL80211_BAND_6GHZ];
+ u32 n_disabled, i;
+
+ params->enable_6ghz_passive = false;
+
+ if (params->scan_6ghz)
+ return;
+
+ if (!fw_has_capa(&mvm->fw->ucode_capa,
+ IWL_UCODE_TLV_CAPA_PASSIVE_6GHZ_SCAN)) {
+ IWL_DEBUG_SCAN(mvm,
+ "6GHz passive scan: Not supported by FW\n");
+ return;
+ }
+
+ /* 6GHz passive scan allowed only on station interface */
+ if (vif->type != NL80211_IFTYPE_STATION) {
+ IWL_DEBUG_SCAN(mvm,
+ "6GHz passive scan: not station interface\n");
+ return;
+ }
+
+ /*
+ * 6GHz passive scan is allowed while associated in a defined time
+ * interval following HW reset or resume flow
+ */
+ if (vif->bss_conf.assoc &&
+ (time_before(mvm->last_reset_or_resume_time_jiffies +
+ (IWL_MVM_6GHZ_PASSIVE_SCAN_ASSOC_TIMEOUT * HZ),
+ jiffies))) {
+ IWL_DEBUG_SCAN(mvm, "6GHz passive scan: associated\n");
+ return;
+ }
+
+ /* No need for 6GHz passive scan if not enough time elapsed */
+ if (time_after(mvm->last_6ghz_passive_scan_jiffies +
+ (IWL_MVM_6GHZ_PASSIVE_SCAN_TIMEOUT * HZ), jiffies)) {
+ IWL_DEBUG_SCAN(mvm,
+ "6GHz passive scan: timeout did not expire\n");
+ return;
+ }
+
+ /* not enough channels in the regular scan request */
+ if (params->n_channels < IWL_MVM_6GHZ_PASSIVE_SCAN_MIN_CHANS) {
+ IWL_DEBUG_SCAN(mvm,
+ "6GHz passive scan: not enough channels\n");
+ return;
+ }
+
+ for (i = 0; i < params->n_ssids; i++) {
+ if (!params->ssids[i].ssid_len)
+ break;
+ }
+
+ /* not a wildcard scan, so cannot enable passive 6GHz scan */
+ if (i == params->n_ssids) {
+ IWL_DEBUG_SCAN(mvm,
+ "6GHz passive scan: no wildcard SSID\n");
+ return;
+ }
+
+ if (!sband || !sband->n_channels) {
+ IWL_DEBUG_SCAN(mvm,
+ "6GHz passive scan: no 6GHz channels\n");
+ return;
+ }
+
+ for (i = 0, n_disabled = 0; i < sband->n_channels; i++) {
+ if (sband->channels[i].flags & (IEEE80211_CHAN_DISABLED))
+ n_disabled++;
+ }
+
+ /*
+ * Not all the 6GHz channels are disabled, so no need for 6GHz passive
+ * scan
+ */
+ if (n_disabled != sband->n_channels) {
+ IWL_DEBUG_SCAN(mvm,
+ "6GHz passive scan: 6GHz channels enabled\n");
+ return;
+ }
+
+ /* all conditions to enable 6ghz passive scan are satisfied */
+ IWL_DEBUG_SCAN(mvm, "6GHz passive scan: can be enabled\n");
+ params->enable_6ghz_passive = true;
+}
+
static u16 iwl_mvm_scan_umac_flags_v2(struct iwl_mvm *mvm,
struct iwl_mvm_scan_params *params,
struct ieee80211_vif *vif,
@@ -1911,6 +2007,9 @@ static u16 iwl_mvm_scan_umac_flags_v2(struct iwl_mvm *mvm,
params->flags & NL80211_SCAN_FLAG_COLOCATED_6GHZ)
flags |= IWL_UMAC_SCAN_GEN_FLAGS_V2_TRIGGER_UHB_SCAN;

+ if (params->enable_6ghz_passive)
+ flags |= IWL_UMAC_SCAN_GEN_FLAGS_V2_6GHZ_PASSIVE_SCAN;
+
return flags;
}

@@ -2183,6 +2282,30 @@ iwl_mvm_scan_umac_fill_ch_p_v6(struct iwl_mvm *mvm,
params->n_channels,
channel_cfg_flags,
vif->type);
+
+ if (params->enable_6ghz_passive) {
+ struct ieee80211_supported_band *sband =
+ &mvm->nvm_data->bands[NL80211_BAND_6GHZ];
+ u32 i;
+
+ for (i = 0; i < sband->n_channels; i++) {
+ struct ieee80211_channel *channel =
+ &sband->channels[i];
+
+ struct iwl_scan_channel_cfg_umac *cfg =
+ &cp->channel_config[cp->count];
+
+ if (!cfg80211_channel_is_psc(channel))
+ continue;
+
+ cfg->flags = 0;
+ cfg->v2.channel_num = channel->hw_value;
+ cfg->v2.band = PHY_BAND_6;
+ cfg->v2.iter_count = 1;
+ cfg->v2.iter_interval = 0;
+ cp->count++;
+ }
+ }
}

static int iwl_mvm_scan_umac_v12(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
@@ -2500,6 +2623,8 @@ int iwl_mvm_reg_scan_start(struct iwl_mvm *mvm, struct ieee80211_vif *vif,

iwl_mvm_build_scan_probe(mvm, vif, ies, &params);

+ iwl_mvm_scan_6ghz_passive_scan(mvm, &params, vif);
+
uid = iwl_mvm_build_scan_cmd(mvm, vif, &hcmd, &params,
IWL_MVM_SCAN_REGULAR);

@@ -2524,6 +2649,9 @@ int iwl_mvm_reg_scan_start(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
mvm->scan_status |= IWL_MVM_SCAN_REGULAR;
mvm->scan_vif = iwl_mvm_vif_from_mac80211(vif);

+ if (params.enable_6ghz_passive)
+ mvm->last_6ghz_passive_scan_jiffies = jiffies;
+
schedule_delayed_work(&mvm->scan_timeout_dwork,
msecs_to_jiffies(SCAN_TIMEOUT));

--
2.31.0

2021-03-31 09:16:39

by Luca Coelho

[permalink] [raw]
Subject: [PATCH 07/12] iwlwifi: mvm: enable PPAG in China

From: Miri Korenblit <[email protected]>

Add support for ppag in China by reading revision 2 of the ppag table
from ACPI, and passing the data to the FW.
This is needed to enable OEMs to control ppag enablement
in China.

Signed-off-by: Miri Korenblit <[email protected]>
Signed-off-by: Luca Coelho <[email protected]>
---
drivers/net/wireless/intel/iwlwifi/fw/acpi.c | 9 +--
drivers/net/wireless/intel/iwlwifi/fw/acpi.h | 4 +-
.../net/wireless/intel/iwlwifi/fw/api/power.h | 22 +++---
drivers/net/wireless/intel/iwlwifi/mvm/fw.c | 76 ++++++++++++-------
4 files changed, 65 insertions(+), 46 deletions(-)

diff --git a/drivers/net/wireless/intel/iwlwifi/fw/acpi.c b/drivers/net/wireless/intel/iwlwifi/fw/acpi.c
index 82a4f7e8ba54..56c4d05c9cc2 100644
--- a/drivers/net/wireless/intel/iwlwifi/fw/acpi.c
+++ b/drivers/net/wireless/intel/iwlwifi/fw/acpi.c
@@ -181,14 +181,13 @@ union acpi_object *iwl_acpi_get_wifi_pkg(struct device *dev,
/*
* We need at least two packages, one for the revision and one
* for the data itself. Also check that the revision is valid
- * (i.e. it is an integer smaller than 2, as we currently support only
- * 2 revisions).
+ * (i.e. it is an integer (each caller has to check by itself
+ * if the returned revision is supported)).
*/
if (data->type != ACPI_TYPE_PACKAGE ||
data->package.count < 2 ||
- data->package.elements[0].type != ACPI_TYPE_INTEGER ||
- data->package.elements[0].integer.value > 1) {
- IWL_DEBUG_DEV_RADIO(dev, "Unsupported packages structure\n");
+ data->package.elements[0].type != ACPI_TYPE_INTEGER) {
+ IWL_DEBUG_DEV_RADIO(dev, "Invalid packages structure\n");
return ERR_PTR(-EINVAL);
}

diff --git a/drivers/net/wireless/intel/iwlwifi/fw/acpi.h b/drivers/net/wireless/intel/iwlwifi/fw/acpi.h
index 030c50082568..f8ea588e4fbb 100644
--- a/drivers/net/wireless/intel/iwlwifi/fw/acpi.h
+++ b/drivers/net/wireless/intel/iwlwifi/fw/acpi.h
@@ -53,8 +53,8 @@

#define ACPI_WGDS_TABLE_SIZE 3

-#define ACPI_PPAG_WIFI_DATA_SIZE ((IWL_NUM_CHAIN_LIMITS * \
- IWL_NUM_SUB_BANDS) + 2)
+#define ACPI_PPAG_WIFI_DATA_SIZE_V1 ((IWL_NUM_CHAIN_LIMITS * \
+ IWL_NUM_SUB_BANDS_V1) + 2)
#define ACPI_PPAG_WIFI_DATA_SIZE_V2 ((IWL_NUM_CHAIN_LIMITS * \
IWL_NUM_SUB_BANDS_V2) + 2)

diff --git a/drivers/net/wireless/intel/iwlwifi/fw/api/power.h b/drivers/net/wireless/intel/iwlwifi/fw/api/power.h
index 798417182d54..86445385f072 100644
--- a/drivers/net/wireless/intel/iwlwifi/fw/api/power.h
+++ b/drivers/net/wireless/intel/iwlwifi/fw/api/power.h
@@ -274,7 +274,7 @@ enum iwl_dev_tx_power_cmd_mode {
#define IWL_NUM_CHAIN_TABLES 1
#define IWL_NUM_CHAIN_TABLES_V2 2
#define IWL_NUM_CHAIN_LIMITS 2
-#define IWL_NUM_SUB_BANDS 5
+#define IWL_NUM_SUB_BANDS_V1 5
#define IWL_NUM_SUB_BANDS_V2 11

/**
@@ -300,7 +300,7 @@ struct iwl_dev_tx_power_common {
* @per_chain: per chain restrictions
*/
struct iwl_dev_tx_power_cmd_v3 {
- __le16 per_chain[IWL_NUM_CHAIN_TABLES][IWL_NUM_CHAIN_LIMITS][IWL_NUM_SUB_BANDS];
+ __le16 per_chain[IWL_NUM_CHAIN_TABLES][IWL_NUM_CHAIN_LIMITS][IWL_NUM_SUB_BANDS_V1];
} __packed; /* TX_REDUCED_POWER_API_S_VER_3 */

#define IWL_DEV_MAX_TX_POWER 0x7FFF
@@ -313,7 +313,7 @@ struct iwl_dev_tx_power_cmd_v3 {
* @reserved: reserved (padding)
*/
struct iwl_dev_tx_power_cmd_v4 {
- __le16 per_chain[IWL_NUM_CHAIN_TABLES][IWL_NUM_CHAIN_LIMITS][IWL_NUM_SUB_BANDS];
+ __le16 per_chain[IWL_NUM_CHAIN_TABLES][IWL_NUM_CHAIN_LIMITS][IWL_NUM_SUB_BANDS_V1];
u8 enable_ack_reduction;
u8 reserved[3];
} __packed; /* TX_REDUCED_POWER_API_S_VER_4 */
@@ -332,7 +332,7 @@ struct iwl_dev_tx_power_cmd_v4 {
* BIOS values. relevant if setMode is IWL_TX_POWER_MODE_SET_SAR_TIMER
*/
struct iwl_dev_tx_power_cmd_v5 {
- __le16 per_chain[IWL_NUM_CHAIN_TABLES][IWL_NUM_CHAIN_LIMITS][IWL_NUM_SUB_BANDS];
+ __le16 per_chain[IWL_NUM_CHAIN_TABLES][IWL_NUM_CHAIN_LIMITS][IWL_NUM_SUB_BANDS_V1];
u8 enable_ack_reduction;
u8 per_chain_restriction_changed;
u8 reserved[2];
@@ -454,21 +454,23 @@ struct iwl_geo_tx_power_profiles_resp {

/**
* union iwl_ppag_table_cmd - union for all versions of PPAG command
- * @v1: version 1, table revision = 0
- * @v2: version 2, table revision = 1
+ * @v1: version 1
+ * @v2: version 2
*
- * @enabled: 1 if PPAG is enabled, 0 otherwise
+ * @flags: bit 0 - indicates enablement of PPAG for ETSI
+ * bit 1 - indicates enablement of PPAG for CHINA BIOS
+ * bit 1 can be used only in v3 (identical to v2)
* @gain: table of antenna gain values per chain and sub-band
* @reserved: reserved
*/
union iwl_ppag_table_cmd {
struct {
- __le32 enabled;
- s8 gain[IWL_NUM_CHAIN_LIMITS][IWL_NUM_SUB_BANDS];
+ __le32 flags;
+ s8 gain[IWL_NUM_CHAIN_LIMITS][IWL_NUM_SUB_BANDS_V1];
s8 reserved[2];
} v1;
struct {
- __le32 enabled;
+ __le32 flags;
s8 gain[IWL_NUM_CHAIN_LIMITS][IWL_NUM_SUB_BANDS_V2];
s8 reserved[2];
} v2;
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/fw.c b/drivers/net/wireless/intel/iwlwifi/mvm/fw.c
index 5ee64f7f3c85..4f297edd8e18 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/fw.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/fw.c
@@ -29,6 +29,9 @@

#define UCODE_VALID_OK cpu_to_le32(0x1)

+#define IWL_PPAG_MASK 3
+#define IWL_PPAG_ETSI_MASK BIT(0)
+
struct iwl_mvm_alive_data {
bool valid;
u32 scd_base_addr;
@@ -773,16 +776,16 @@ int iwl_mvm_sar_select_profile(struct iwl_mvm *mvm, int prof_a, int prof_b)
} else if (fw_has_api(&mvm->fw->ucode_capa,
IWL_UCODE_TLV_API_REDUCE_TX_POWER)) {
len = sizeof(cmd.v5);
- n_subbands = IWL_NUM_SUB_BANDS;
+ n_subbands = IWL_NUM_SUB_BANDS_V1;
per_chain = cmd.v5.per_chain[0][0];
} else if (fw_has_capa(&mvm->fw->ucode_capa,
IWL_UCODE_TLV_CAPA_TX_POWER_ACK)) {
len = sizeof(cmd.v4);
- n_subbands = IWL_NUM_SUB_BANDS;
+ n_subbands = IWL_NUM_SUB_BANDS_V1;
per_chain = cmd.v4.per_chain[0][0];
} else {
len = sizeof(cmd.v3);
- n_subbands = IWL_NUM_SUB_BANDS;
+ n_subbands = IWL_NUM_SUB_BANDS_V1;
per_chain = cmd.v3.per_chain[0][0];
}

@@ -909,46 +912,50 @@ static int iwl_mvm_sar_geo_init(struct iwl_mvm *mvm)

static int iwl_mvm_get_ppag_table(struct iwl_mvm *mvm)
{
- union acpi_object *wifi_pkg, *data, *enabled;
+ union acpi_object *wifi_pkg, *data, *flags;
int i, j, ret, tbl_rev, num_sub_bands;
int idx = 2;
s8 *gain;

/*
- * The 'enabled' field is the same in v1 and v2 so we can just
+ * The 'flags' field is the same in v1 and in v2 so we can just
* use v1 to access it.
*/
- mvm->fwrt.ppag_table.v1.enabled = cpu_to_le32(0);
+ mvm->fwrt.ppag_table.v1.flags = cpu_to_le32(0);
+
data = iwl_acpi_get_object(mvm->dev, ACPI_PPAG_METHOD);
if (IS_ERR(data))
return PTR_ERR(data);

- /* try to read ppag table revision 1 */
+ /* try to read ppag table rev 2 or 1 (both have the same data size) */
wifi_pkg = iwl_acpi_get_wifi_pkg(mvm->dev, data,
ACPI_PPAG_WIFI_DATA_SIZE_V2, &tbl_rev);
if (!IS_ERR(wifi_pkg)) {
- if (tbl_rev != 1) {
+ if (tbl_rev == 1 || tbl_rev == 2) {
+ num_sub_bands = IWL_NUM_SUB_BANDS_V2;
+ gain = mvm->fwrt.ppag_table.v2.gain[0];
+ mvm->fwrt.ppag_ver = tbl_rev;
+ IWL_DEBUG_RADIO(mvm,
+ "Reading PPAG table v2 (tbl_rev=%d)\n",
+ tbl_rev);
+ goto read_table;
+ } else {
ret = -EINVAL;
goto out_free;
}
- num_sub_bands = IWL_NUM_SUB_BANDS_V2;
- gain = mvm->fwrt.ppag_table.v2.gain[0];
- mvm->fwrt.ppag_ver = 2;
- IWL_DEBUG_RADIO(mvm, "Reading PPAG table v2 (tbl_rev=1)\n");
- goto read_table;
}

/* try to read ppag table revision 0 */
wifi_pkg = iwl_acpi_get_wifi_pkg(mvm->dev, data,
- ACPI_PPAG_WIFI_DATA_SIZE, &tbl_rev);
+ ACPI_PPAG_WIFI_DATA_SIZE_V1, &tbl_rev);
if (!IS_ERR(wifi_pkg)) {
if (tbl_rev != 0) {
ret = -EINVAL;
goto out_free;
}
- num_sub_bands = IWL_NUM_SUB_BANDS;
+ num_sub_bands = IWL_NUM_SUB_BANDS_V1;
gain = mvm->fwrt.ppag_table.v1.gain[0];
- mvm->fwrt.ppag_ver = 1;
+ mvm->fwrt.ppag_ver = 0;
IWL_DEBUG_RADIO(mvm, "Reading PPAG table v1 (tbl_rev=0)\n");
goto read_table;
}
@@ -956,15 +963,17 @@ static int iwl_mvm_get_ppag_table(struct iwl_mvm *mvm)
goto out_free;

read_table:
- enabled = &wifi_pkg->package.elements[1];
- if (enabled->type != ACPI_TYPE_INTEGER ||
- (enabled->integer.value != 0 && enabled->integer.value != 1)) {
+ flags = &wifi_pkg->package.elements[1];
+
+ if (flags->type != ACPI_TYPE_INTEGER) {
ret = -EINVAL;
goto out_free;
}

- mvm->fwrt.ppag_table.v1.enabled = cpu_to_le32(enabled->integer.value);
- if (!mvm->fwrt.ppag_table.v1.enabled) {
+ mvm->fwrt.ppag_table.v1.flags = cpu_to_le32(flags->integer.value &
+ IWL_PPAG_MASK);
+
+ if (!mvm->fwrt.ppag_table.v1.flags) {
ret = 0;
goto out_free;
}
@@ -992,12 +1001,13 @@ static int iwl_mvm_get_ppag_table(struct iwl_mvm *mvm)
(j != 0 &&
(gain[i * num_sub_bands + j] > ACPI_PPAG_MAX_HB ||
gain[i * num_sub_bands + j] < ACPI_PPAG_MIN_HB))) {
- mvm->fwrt.ppag_table.v1.enabled = cpu_to_le32(0);
+ mvm->fwrt.ppag_table.v1.flags = cpu_to_le32(0);
ret = -EINVAL;
goto out_free;
}
}
}
+
ret = 0;
out_free:
kfree(data);
@@ -1015,7 +1025,7 @@ int iwl_mvm_ppag_send_cmd(struct iwl_mvm *mvm)
"PPAG capability not supported by FW, command not sent.\n");
return 0;
}
- if (!mvm->fwrt.ppag_table.v1.enabled) {
+ if (!mvm->fwrt.ppag_table.v1.flags) {
IWL_DEBUG_RADIO(mvm, "PPAG not enabled, command not sent.\n");
return 0;
}
@@ -1024,20 +1034,28 @@ int iwl_mvm_ppag_send_cmd(struct iwl_mvm *mvm)
PER_PLATFORM_ANT_GAIN_CMD,
IWL_FW_CMD_VER_UNKNOWN);
if (cmd_ver == 1) {
- num_sub_bands = IWL_NUM_SUB_BANDS;
+ num_sub_bands = IWL_NUM_SUB_BANDS_V1;
gain = mvm->fwrt.ppag_table.v1.gain[0];
cmd_size = sizeof(mvm->fwrt.ppag_table.v1);
- if (mvm->fwrt.ppag_ver == 2) {
+ if (mvm->fwrt.ppag_ver == 1 || mvm->fwrt.ppag_ver == 2) {
IWL_DEBUG_RADIO(mvm,
- "PPAG table is v2 but FW supports v1, sending truncated table\n");
+ "PPAG table rev is %d but FW supports v1, sending truncated table\n",
+ mvm->fwrt.ppag_ver);
+ mvm->fwrt.ppag_table.v1.flags &=
+ cpu_to_le32(IWL_PPAG_ETSI_MASK);
}
- } else if (cmd_ver == 2) {
+ } else if (cmd_ver == 2 || cmd_ver == 3) {
num_sub_bands = IWL_NUM_SUB_BANDS_V2;
gain = mvm->fwrt.ppag_table.v2.gain[0];
cmd_size = sizeof(mvm->fwrt.ppag_table.v2);
- if (mvm->fwrt.ppag_ver == 1) {
+ if (mvm->fwrt.ppag_ver == 0) {
IWL_DEBUG_RADIO(mvm,
"PPAG table is v1 but FW supports v2, sending padded table\n");
+ } else if (cmd_ver == 2 && mvm->fwrt.ppag_ver == 2) {
+ IWL_DEBUG_RADIO(mvm,
+ "PPAG table is v3 but FW supports v2, sending partial bitmap.\n");
+ mvm->fwrt.ppag_table.v1.flags &=
+ cpu_to_le32(IWL_PPAG_ETSI_MASK);
}
} else {
IWL_DEBUG_RADIO(mvm, "Unsupported PPAG command version\n");
@@ -1102,7 +1120,7 @@ static int iwl_mvm_ppag_init(struct iwl_mvm *mvm)
IWL_DEBUG_RADIO(mvm,
"System vendor '%s' is not in the approved list, disabling PPAG.\n",
dmi_get_system_info(DMI_SYS_VENDOR));
- mvm->fwrt.ppag_table.v1.enabled = cpu_to_le32(0);
+ mvm->fwrt.ppag_table.v1.flags = cpu_to_le32(0);
return 0;
}

--
2.31.0

2021-03-31 09:16:50

by Luca Coelho

[permalink] [raw]
Subject: [PATCH 08/12] iwlwifi: add new so-gf device

From: ybaruch <[email protected]>

add new so-gf device to the driver.

Signed-off-by: ybaruch <[email protected]>
Signed-off-by: Luca Coelho <[email protected]>
---
drivers/net/wireless/intel/iwlwifi/pcie/drv.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/drv.c b/drivers/net/wireless/intel/iwlwifi/pcie/drv.c
index 3186de93d769..a1aa2ac19256 100644
--- a/drivers/net/wireless/intel/iwlwifi/pcie/drv.c
+++ b/drivers/net/wireless/intel/iwlwifi/pcie/drv.c
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause
/*
- * Copyright (C) 2005-2014, 2018-2020 Intel Corporation
+ * Copyright (C) 2005-2014, 2018-2021 Intel Corporation
* Copyright (C) 2013-2015 Intel Mobile Communications GmbH
* Copyright (C) 2016-2017 Intel Deutschland GmbH
*/
@@ -1078,6 +1078,13 @@ static const struct iwl_dev_info iwl_dev_info_table[] = {
IWL_CFG_ANY, IWL_CFG_ANY, IWL_CFG_NO_CDB,
iwl_cfg_bz_a0_mr_a0, iwl_ma_name),

+/* So with GF */
+ _IWL_DEV_INFO(IWL_CFG_ANY, IWL_CFG_ANY,
+ IWL_CFG_MAC_TYPE_SO, IWL_CFG_ANY,
+ IWL_CFG_RF_TYPE_GF, IWL_CFG_ANY,
+ IWL_CFG_160, IWL_CFG_ANY, IWL_CFG_NO_CDB,
+ iwlax211_2ax_cfg_so_gf_a0, iwl_ax211_name)
+
#endif /* CONFIG_IWLMVM */
};

--
2.31.0

2021-03-31 09:16:51

by Luca Coelho

[permalink] [raw]
Subject: [PATCH 10/12] iwlwifi: mvm: support BIOS enable/disable for 11ax in Ukraine

From: Miri Korenblit <[email protected]>

Read the new BIOS DSM and Pass to FW if to disable\enable
11ax for Ukraine according to the BIOS key. this is
needed to enable OEMs to control enable/disable 11ax in Ukraine

Signed-off-by: Miri Korenblit <[email protected]>
Signed-off-by: Luca Coelho <[email protected]>
---
drivers/net/wireless/intel/iwlwifi/fw/acpi.c | 29 +++++++++++++++++++
drivers/net/wireless/intel/iwlwifi/fw/acpi.h | 9 ++++++
.../wireless/intel/iwlwifi/fw/api/nvm-reg.h | 3 ++
drivers/net/wireless/intel/iwlwifi/mvm/fw.c | 4 +++
4 files changed, 45 insertions(+)

diff --git a/drivers/net/wireless/intel/iwlwifi/fw/acpi.c b/drivers/net/wireless/intel/iwlwifi/fw/acpi.c
index 56c4d05c9cc2..874cc110d97f 100644
--- a/drivers/net/wireless/intel/iwlwifi/fw/acpi.c
+++ b/drivers/net/wireless/intel/iwlwifi/fw/acpi.c
@@ -695,3 +695,32 @@ int iwl_sar_geo_init(struct iwl_fw_runtime *fwrt,
return 0;
}
IWL_EXPORT_SYMBOL(iwl_sar_geo_init);
+
+u32 iwl_acpi_eval_dsm_11ax_enablement(struct device *dev)
+{
+ union acpi_object *obj;
+ u32 ret;
+
+ obj = iwl_acpi_get_dsm_object(dev, 0,
+ DSM_FUNC_11AX_ENABLEMENT, NULL,
+ &iwl_guid);
+ if (IS_ERR(obj))
+ return 0;
+
+ if (obj->type != ACPI_TYPE_INTEGER) {
+ IWL_DEBUG_DEV_RADIO(dev,
+ "ACPI: DSM method did not return a valid object, type=%d\n",
+ obj->type);
+ ret = 0;
+ goto out;
+ }
+
+ ret = obj->integer.value;
+ IWL_DEBUG_DEV_RADIO(dev,
+ "ACPI: DSM method evaluated: func=DSM_FUNC_11AX_ENABLEMENT, ret=%d\n",
+ ret);
+out:
+ ACPI_FREE(obj);
+ return ret;
+}
+IWL_EXPORT_SYMBOL(iwl_acpi_eval_dsm_11ax_enablement);
diff --git a/drivers/net/wireless/intel/iwlwifi/fw/acpi.h b/drivers/net/wireless/intel/iwlwifi/fw/acpi.h
index f8ea588e4fbb..b7389f41a009 100644
--- a/drivers/net/wireless/intel/iwlwifi/fw/acpi.h
+++ b/drivers/net/wireless/intel/iwlwifi/fw/acpi.h
@@ -77,6 +77,7 @@ enum iwl_dsm_funcs_rev_0 {
DSM_FUNC_QUERY = 0,
DSM_FUNC_DISABLE_SRD = 1,
DSM_FUNC_ENABLE_INDONESIA_5G2 = 2,
+ DSM_FUNC_11AX_ENABLEMENT = 6,
};

enum iwl_dsm_values_srd {
@@ -160,6 +161,8 @@ int iwl_sar_geo_init(struct iwl_fw_runtime *fwrt,
int iwl_acpi_get_tas(struct iwl_fw_runtime *fwrt, __le32 *block_list_array,
int *block_list_size);

+u32 iwl_acpi_eval_dsm_11ax_enablement(struct device *dev);
+
#else /* CONFIG_ACPI */

static inline void *iwl_acpi_get_object(struct device *dev, acpi_string method)
@@ -235,5 +238,11 @@ static inline int iwl_acpi_get_tas(struct iwl_fw_runtime *fwrt,
{
return -ENOENT;
}
+
+static inline u32 iwl_acpi_eval_dsm_11ax_enablement(struct device *dev)
+{
+ return 0;
+}
+
#endif /* CONFIG_ACPI */
#endif /* __iwl_fw_acpi__ */
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 fbca9dd872e7..3a358bbdde8e 100644
--- a/drivers/net/wireless/intel/iwlwifi/fw/api/nvm-reg.h
+++ b/drivers/net/wireless/intel/iwlwifi/fw/api/nvm-reg.h
@@ -414,6 +414,9 @@ enum iwl_lari_config_masks {
LARI_CONFIG_ENABLE_5G2_IN_INDONESIA_MSK = BIT(3),
};

+#define IWL_11AX_UKRAINE_MASK 3
+#define IWL_11AX_UKRAINE_SHIFT 8
+
/**
* struct iwl_lari_config_change_cmd_v1 - change LARI configuration
* @config_bitmap: bit map of the config commands. each bit will trigger a
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/fw.c b/drivers/net/wireless/intel/iwlwifi/mvm/fw.c
index b8a25943a57d..ff3967f7c66b 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/fw.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/fw.c
@@ -1213,6 +1213,10 @@ static void iwl_mvm_lari_cfg(struct iwl_mvm *mvm)
cmd.config_bitmap |=
cpu_to_le32(LARI_CONFIG_CHANGE_ETSI_TO_DISABLED_MSK);

+ ret = iwl_acpi_eval_dsm_11ax_enablement((&mvm->fwrt)->dev);
+ cmd.config_bitmap |=
+ cpu_to_le32((ret &= IWL_11AX_UKRAINE_MASK) << IWL_11AX_UKRAINE_SHIFT);
+
/* apply more config masks here */

if (cmd.config_bitmap) {
--
2.31.0

2021-03-31 09:16:51

by Luca Coelho

[permalink] [raw]
Subject: [PATCH 09/12] iwlwifi: move iwl_configure_rxq to be used by other op_modes

From: Mordechay Goodstein <[email protected]>

All the op_modes need to send this command as well. Instead of
duplicating the code from mvm, put the code in a common place.

Signed-off-by: Mordechay Goodstein <[email protected]>
Signed-off-by: Luca Coelho <[email protected]>
---
drivers/net/wireless/intel/iwlwifi/fw/init.c | 59 ++++++++++++++++++
.../net/wireless/intel/iwlwifi/fw/runtime.h | 1 +
drivers/net/wireless/intel/iwlwifi/mvm/fw.c | 61 +------------------
3 files changed, 63 insertions(+), 58 deletions(-)

diff --git a/drivers/net/wireless/intel/iwlwifi/fw/init.c b/drivers/net/wireless/intel/iwlwifi/fw/init.c
index 986913f2fbd5..2ecec00db9da 100644
--- a/drivers/net/wireless/intel/iwlwifi/fw/init.c
+++ b/drivers/net/wireless/intel/iwlwifi/fw/init.c
@@ -10,6 +10,8 @@

#include "fw/api/soc.h"
#include "fw/api/commands.h"
+#include "fw/api/rx.h"
+#include "fw/api/datapath.h"

void iwl_fw_runtime_init(struct iwl_fw_runtime *fwrt, struct iwl_trans *trans,
const struct iwl_fw *fw,
@@ -95,3 +97,60 @@ int iwl_set_soc_latency(struct iwl_fw_runtime *fwrt)
return ret;
}
IWL_EXPORT_SYMBOL(iwl_set_soc_latency);
+
+int iwl_configure_rxq(struct iwl_fw_runtime *fwrt)
+{
+ int i, num_queues, size, ret;
+ struct iwl_rfh_queue_config *cmd;
+ struct iwl_host_cmd hcmd = {
+ .id = WIDE_ID(DATA_PATH_GROUP, RFH_QUEUE_CONFIG_CMD),
+ .dataflags[0] = IWL_HCMD_DFL_NOCOPY,
+ };
+
+ /*
+ * The default queue is configured via context info, so if we
+ * have a single queue, there's nothing to do here.
+ */
+ if (fwrt->trans->num_rx_queues == 1)
+ return 0;
+
+ if (fwrt->trans->trans_cfg->device_family < IWL_DEVICE_FAMILY_22000)
+ return 0;
+
+ /* skip the default queue */
+ num_queues = fwrt->trans->num_rx_queues - 1;
+
+ size = struct_size(cmd, data, num_queues);
+
+ cmd = kzalloc(size, GFP_KERNEL);
+ if (!cmd)
+ return -ENOMEM;
+
+ cmd->num_queues = num_queues;
+
+ for (i = 0; i < num_queues; i++) {
+ struct iwl_trans_rxq_dma_data data;
+
+ cmd->data[i].q_num = i + 1;
+ iwl_trans_get_rxq_dma_data(fwrt->trans, i + 1, &data);
+
+ cmd->data[i].fr_bd_cb = cpu_to_le64(data.fr_bd_cb);
+ cmd->data[i].urbd_stts_wrptr =
+ cpu_to_le64(data.urbd_stts_wrptr);
+ cmd->data[i].ur_bd_cb = cpu_to_le64(data.ur_bd_cb);
+ cmd->data[i].fr_bd_wid = cpu_to_le32(data.fr_bd_wid);
+ }
+
+ hcmd.data[0] = cmd;
+ hcmd.len[0] = size;
+
+ ret = iwl_trans_send_cmd(fwrt->trans, &hcmd);
+
+ kfree(cmd);
+
+ if (ret)
+ IWL_ERR(fwrt, "Failed to configure RX queues: %d\n", ret);
+
+ return ret;
+}
+IWL_EXPORT_SYMBOL(iwl_configure_rxq);
diff --git a/drivers/net/wireless/intel/iwlwifi/fw/runtime.h b/drivers/net/wireless/intel/iwlwifi/fw/runtime.h
index 0dba5444f2db..35af85a5430b 100644
--- a/drivers/net/wireless/intel/iwlwifi/fw/runtime.h
+++ b/drivers/net/wireless/intel/iwlwifi/fw/runtime.h
@@ -190,5 +190,6 @@ void iwl_free_fw_paging(struct iwl_fw_runtime *fwrt);

void iwl_get_shared_mem_conf(struct iwl_fw_runtime *fwrt);
int iwl_set_soc_latency(struct iwl_fw_runtime *fwrt);
+int iwl_configure_rxq(struct iwl_fw_runtime *fwrt);

#endif /* __iwl_fw_runtime_h__ */
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/fw.c b/drivers/net/wireless/intel/iwlwifi/mvm/fw.c
index 4f297edd8e18..b8a25943a57d 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/fw.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/fw.c
@@ -73,56 +73,6 @@ static int iwl_send_rss_cfg_cmd(struct iwl_mvm *mvm)
return iwl_mvm_send_cmd_pdu(mvm, RSS_CONFIG_CMD, 0, sizeof(cmd), &cmd);
}

-static int iwl_configure_rxq(struct iwl_mvm *mvm)
-{
- int i, num_queues, size, ret;
- struct iwl_rfh_queue_config *cmd;
- struct iwl_host_cmd hcmd = {
- .id = WIDE_ID(DATA_PATH_GROUP, RFH_QUEUE_CONFIG_CMD),
- .dataflags[0] = IWL_HCMD_DFL_NOCOPY,
- };
-
- /*
- * The default queue is configured via context info, so if we
- * have a single queue, there's nothing to do here.
- */
- if (mvm->trans->num_rx_queues == 1)
- return 0;
-
- /* skip the default queue */
- num_queues = mvm->trans->num_rx_queues - 1;
-
- size = struct_size(cmd, data, num_queues);
-
- cmd = kzalloc(size, GFP_KERNEL);
- if (!cmd)
- return -ENOMEM;
-
- cmd->num_queues = num_queues;
-
- for (i = 0; i < num_queues; i++) {
- struct iwl_trans_rxq_dma_data data;
-
- cmd->data[i].q_num = i + 1;
- iwl_trans_get_rxq_dma_data(mvm->trans, i + 1, &data);
-
- cmd->data[i].fr_bd_cb = cpu_to_le64(data.fr_bd_cb);
- cmd->data[i].urbd_stts_wrptr =
- cpu_to_le64(data.urbd_stts_wrptr);
- cmd->data[i].ur_bd_cb = cpu_to_le64(data.ur_bd_cb);
- cmd->data[i].fr_bd_wid = cpu_to_le32(data.fr_bd_wid);
- }
-
- hcmd.data[0] = cmd;
- hcmd.len[0] = size;
-
- ret = iwl_mvm_send_cmd(mvm, &hcmd);
-
- kfree(cmd);
-
- return ret;
-}
-
static int iwl_mvm_send_dqa_cmd(struct iwl_mvm *mvm)
{
struct iwl_dqa_enable_cmd dqa_cmd = {
@@ -1503,14 +1453,9 @@ int iwl_mvm_up(struct iwl_mvm *mvm)
}

/* Init RSS configuration */
- if (mvm->trans->trans_cfg->device_family >= IWL_DEVICE_FAMILY_22000) {
- ret = iwl_configure_rxq(mvm);
- if (ret) {
- IWL_ERR(mvm, "Failed to configure RX queues: %d\n",
- ret);
- goto error;
- }
- }
+ ret = iwl_configure_rxq(&mvm->fwrt);
+ if (ret)
+ goto error;

if (iwl_mvm_has_new_rx_api(mvm)) {
ret = iwl_send_rss_cfg_cmd(mvm);
--
2.31.0

2021-03-31 09:16:52

by Luca Coelho

[permalink] [raw]
Subject: [PATCH 12/12] iwlwifi: mvm: Use IWL_INFO in fw_reset_handshake()

From: Ravi Darsi <[email protected]>

Debug message "firmware didn't ACK the reset - continue anyway\n"
in fw_reset_handshake() is classified as error, however this is not
an error as it is ignored. So, change it to info message for proper
classification of debug messages.

Signed-off-by: Ravi Darsi <[email protected]>
Signed-off-by: Luca Coelho <[email protected]>
---
drivers/net/wireless/intel/iwlwifi/pcie/trans-gen2.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/trans-gen2.c b/drivers/net/wireless/intel/iwlwifi/pcie/trans-gen2.c
index 497ef3405da3..73894793ed4f 100644
--- a/drivers/net/wireless/intel/iwlwifi/pcie/trans-gen2.c
+++ b/drivers/net/wireless/intel/iwlwifi/pcie/trans-gen2.c
@@ -108,8 +108,8 @@ static void iwl_trans_pcie_fw_reset_handshake(struct iwl_trans *trans)
ret = wait_event_timeout(trans_pcie->fw_reset_waitq,
trans_pcie->fw_reset_done, FW_RESET_TIMEOUT);
if (!ret)
- IWL_ERR(trans,
- "firmware didn't ACK the reset - continue anyway\n");
+ IWL_INFO(trans,
+ "firmware didn't ACK the reset - continue anyway\n");
}

void _iwl_trans_pcie_gen2_stop_device(struct iwl_trans *trans)
--
2.31.0

2021-03-31 09:16:52

by Luca Coelho

[permalink] [raw]
Subject: [PATCH 11/12] iwlwifi: mvm: refactor ACPI DSM evaluation function

From: Harish Mitty <[email protected]>

Instead of implementing the DSM evaluation function in the MVM code,
refactor it so it can be generalized and part of the common ACPI
implementation.

Signed-off-by: Harish Mitty <[email protected]>
[reworded subject and commit message]
Signed-off-by: Luca Coelho <[email protected]>
---
drivers/net/wireless/intel/iwlwifi/fw/acpi.c | 58 +++++++++++++--
drivers/net/wireless/intel/iwlwifi/fw/acpi.h | 4 +-
drivers/net/wireless/intel/iwlwifi/mvm/fw.c | 76 +-------------------
3 files changed, 55 insertions(+), 83 deletions(-)

diff --git a/drivers/net/wireless/intel/iwlwifi/fw/acpi.c b/drivers/net/wireless/intel/iwlwifi/fw/acpi.c
index 874cc110d97f..eecc76a6e408 100644
--- a/drivers/net/wireless/intel/iwlwifi/fw/acpi.c
+++ b/drivers/net/wireless/intel/iwlwifi/fw/acpi.c
@@ -696,20 +696,27 @@ int iwl_sar_geo_init(struct iwl_fw_runtime *fwrt,
}
IWL_EXPORT_SYMBOL(iwl_sar_geo_init);

-u32 iwl_acpi_eval_dsm_11ax_enablement(struct device *dev)
+static u32 iwl_acpi_eval_dsm_func(struct device *dev, enum iwl_dsm_funcs_rev_0 eval_func)
{
union acpi_object *obj;
u32 ret;

obj = iwl_acpi_get_dsm_object(dev, 0,
- DSM_FUNC_11AX_ENABLEMENT, NULL,
+ eval_func, NULL,
&iwl_guid);
- if (IS_ERR(obj))
+
+ if (IS_ERR(obj)) {
+ IWL_DEBUG_DEV_RADIO(dev,
+ "ACPI: DSM func '%d': Got Error in obj = %ld\n",
+ eval_func,
+ PTR_ERR(obj));
return 0;
+ }

if (obj->type != ACPI_TYPE_INTEGER) {
IWL_DEBUG_DEV_RADIO(dev,
- "ACPI: DSM method did not return a valid object, type=%d\n",
+ "ACPI: DSM func '%d' did not return a valid object, type=%d\n",
+ eval_func,
obj->type);
ret = 0;
goto out;
@@ -717,10 +724,49 @@ u32 iwl_acpi_eval_dsm_11ax_enablement(struct device *dev)

ret = obj->integer.value;
IWL_DEBUG_DEV_RADIO(dev,
- "ACPI: DSM method evaluated: func=DSM_FUNC_11AX_ENABLEMENT, ret=%d\n",
+ "ACPI: DSM method evaluated: func='%d', ret=%d\n",
+ eval_func,
ret);
out:
ACPI_FREE(obj);
return ret;
}
-IWL_EXPORT_SYMBOL(iwl_acpi_eval_dsm_11ax_enablement);
+
+__le32 iwl_acpi_get_lari_config_bitmap(struct iwl_fw_runtime *fwrt)
+{
+ u32 ret;
+ __le32 config_bitmap = 0;
+
+ /*
+ ** Evaluate func 'DSM_FUNC_ENABLE_INDONESIA_5G2'
+ */
+ ret = iwl_acpi_eval_dsm_func(fwrt->dev, DSM_FUNC_ENABLE_INDONESIA_5G2);
+
+ if (ret == DSM_VALUE_INDONESIA_ENABLE)
+ config_bitmap |=
+ cpu_to_le32(LARI_CONFIG_ENABLE_5G2_IN_INDONESIA_MSK);
+
+ /*
+ ** Evaluate func 'DSM_FUNC_DISABLE_SRD'
+ */
+ ret = iwl_acpi_eval_dsm_func(fwrt->dev, DSM_FUNC_DISABLE_SRD);
+
+ if (ret == DSM_VALUE_SRD_PASSIVE)
+ config_bitmap |=
+ cpu_to_le32(LARI_CONFIG_CHANGE_ETSI_TO_PASSIVE_MSK);
+
+ else if (ret == DSM_VALUE_SRD_DISABLE)
+ config_bitmap |=
+ cpu_to_le32(LARI_CONFIG_CHANGE_ETSI_TO_DISABLED_MSK);
+
+ /*
+ ** Evaluate func 'DSM_FUNC_11AX_ENABLEMENT'
+ */
+ ret = iwl_acpi_eval_dsm_func(fwrt->dev, DSM_FUNC_11AX_ENABLEMENT);
+
+ config_bitmap |=
+ cpu_to_le32((ret &= IWL_11AX_UKRAINE_MASK) << IWL_11AX_UKRAINE_SHIFT);
+
+ return config_bitmap;
+}
+IWL_EXPORT_SYMBOL(iwl_acpi_get_lari_config_bitmap);
diff --git a/drivers/net/wireless/intel/iwlwifi/fw/acpi.h b/drivers/net/wireless/intel/iwlwifi/fw/acpi.h
index b7389f41a009..d16e6ec08c9f 100644
--- a/drivers/net/wireless/intel/iwlwifi/fw/acpi.h
+++ b/drivers/net/wireless/intel/iwlwifi/fw/acpi.h
@@ -161,7 +161,7 @@ int iwl_sar_geo_init(struct iwl_fw_runtime *fwrt,
int iwl_acpi_get_tas(struct iwl_fw_runtime *fwrt, __le32 *block_list_array,
int *block_list_size);

-u32 iwl_acpi_eval_dsm_11ax_enablement(struct device *dev);
+__le32 iwl_acpi_get_lari_config_bitmap(struct iwl_fw_runtime *fwrt);

#else /* CONFIG_ACPI */

@@ -239,7 +239,7 @@ static inline int iwl_acpi_get_tas(struct iwl_fw_runtime *fwrt,
return -ENOENT;
}

-static inline u32 iwl_acpi_eval_dsm_11ax_enablement(struct device *dev)
+static inline __le32 iwl_acpi_get_lari_config_bitmap(struct iwl_fw_runtime *fwrt)
{
return 0;
}
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/fw.c b/drivers/net/wireless/intel/iwlwifi/mvm/fw.c
index ff3967f7c66b..be831dd2c05c 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/fw.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/fw.c
@@ -1112,33 +1112,6 @@ static void iwl_mvm_tas_init(struct iwl_mvm *mvm)
IWL_DEBUG_RADIO(mvm, "failed to send TAS_CONFIG (%d)\n", ret);
}

-static u8 iwl_mvm_eval_dsm_indonesia_5g2(struct iwl_mvm *mvm)
-{
- u8 value;
-
- int ret = iwl_acpi_get_dsm_u8((&mvm->fwrt)->dev, 0,
- DSM_FUNC_ENABLE_INDONESIA_5G2,
- &iwl_guid, &value);
-
- if (ret < 0)
- IWL_DEBUG_RADIO(mvm,
- "Failed to evaluate DSM function ENABLE_INDONESIA_5G2, ret=%d\n",
- ret);
-
- else if (value >= DSM_VALUE_INDONESIA_MAX)
- IWL_DEBUG_RADIO(mvm,
- "DSM function ENABLE_INDONESIA_5G2 return invalid value, value=%d\n",
- value);
-
- else if (value == DSM_VALUE_INDONESIA_ENABLE) {
- IWL_DEBUG_RADIO(mvm,
- "Evaluated DSM function ENABLE_INDONESIA_5G2: Enabling 5g2\n");
- return DSM_VALUE_INDONESIA_ENABLE;
- }
- /* default behaviour is disabled */
- return DSM_VALUE_INDONESIA_DISABLE;
-}
-
static u8 iwl_mvm_eval_dsm_rfi(struct iwl_mvm *mvm)
{
u8 value;
@@ -1163,59 +1136,12 @@ static u8 iwl_mvm_eval_dsm_rfi(struct iwl_mvm *mvm)
return DSM_VALUE_RFI_DISABLE;
}

-static u8 iwl_mvm_eval_dsm_disable_srd(struct iwl_mvm *mvm)
-{
- u8 value;
- int ret = iwl_acpi_get_dsm_u8((&mvm->fwrt)->dev, 0,
- DSM_FUNC_DISABLE_SRD,
- &iwl_guid, &value);
-
- if (ret < 0)
- IWL_DEBUG_RADIO(mvm,
- "Failed to evaluate DSM function DISABLE_SRD, ret=%d\n",
- ret);
-
- else if (value >= DSM_VALUE_SRD_MAX)
- IWL_DEBUG_RADIO(mvm,
- "DSM function DISABLE_SRD return invalid value, value=%d\n",
- value);
-
- else if (value == DSM_VALUE_SRD_PASSIVE) {
- IWL_DEBUG_RADIO(mvm,
- "Evaluated DSM function DISABLE_SRD: setting SRD to passive\n");
- return DSM_VALUE_SRD_PASSIVE;
-
- } else if (value == DSM_VALUE_SRD_DISABLE) {
- IWL_DEBUG_RADIO(mvm,
- "Evaluated DSM function DISABLE_SRD: disabling SRD\n");
- return DSM_VALUE_SRD_DISABLE;
- }
- /* default behaviour is active */
- return DSM_VALUE_SRD_ACTIVE;
-}
-
static void iwl_mvm_lari_cfg(struct iwl_mvm *mvm)
{
- u8 ret;
int cmd_ret;
struct iwl_lari_config_change_cmd_v2 cmd = {};

- if (iwl_mvm_eval_dsm_indonesia_5g2(mvm) == DSM_VALUE_INDONESIA_ENABLE)
- cmd.config_bitmap |=
- cpu_to_le32(LARI_CONFIG_ENABLE_5G2_IN_INDONESIA_MSK);
-
- ret = iwl_mvm_eval_dsm_disable_srd(mvm);
- if (ret == DSM_VALUE_SRD_PASSIVE)
- cmd.config_bitmap |=
- cpu_to_le32(LARI_CONFIG_CHANGE_ETSI_TO_PASSIVE_MSK);
-
- else if (ret == DSM_VALUE_SRD_DISABLE)
- cmd.config_bitmap |=
- cpu_to_le32(LARI_CONFIG_CHANGE_ETSI_TO_DISABLED_MSK);
-
- ret = iwl_acpi_eval_dsm_11ax_enablement((&mvm->fwrt)->dev);
- cmd.config_bitmap |=
- cpu_to_le32((ret &= IWL_11AX_UKRAINE_MASK) << IWL_11AX_UKRAINE_SHIFT);
+ cmd.config_bitmap = iwl_acpi_get_lari_config_bitmap(&mvm->fwrt);

/* apply more config masks here */

--
2.31.0

2021-03-31 09:17:50

by Luca Coelho

[permalink] [raw]
Subject: [PATCH 02/12] iwlwifi: mvm: clean up queue sync implementation

From: Johannes Berg <[email protected]>

When we do queue sync, it's confusing that we have the structures
declared in the FW API header files that aren't really firmware,
and the union is also confusing - especially now in the code that
checks the size on the return.

So rework this: change the type of sync and whether to do it in a
synchronous fashion to arguments, and build the data structure in
the function, so we don't need the union.

Signed-off-by: Johannes Berg <[email protected]>
Signed-off-by: Luca Coelho <[email protected]>
---
.../net/wireless/intel/iwlwifi/fw/api/rx.h | 30 ----------
.../net/wireless/intel/iwlwifi/mvm/mac80211.c | 44 +++++++++-----
drivers/net/wireless/intel/iwlwifi/mvm/mvm.h | 8 +--
drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c | 58 ++++---------------
drivers/net/wireless/intel/iwlwifi/mvm/sta.c | 10 ++--
drivers/net/wireless/intel/iwlwifi/mvm/sta.h | 38 +++++++++---
6 files changed, 80 insertions(+), 108 deletions(-)

diff --git a/drivers/net/wireless/intel/iwlwifi/fw/api/rx.h b/drivers/net/wireless/intel/iwlwifi/fw/api/rx.h
index 2c74db823778..3f13b572915a 100644
--- a/drivers/net/wireless/intel/iwlwifi/fw/api/rx.h
+++ b/drivers/net/wireless/intel/iwlwifi/fw/api/rx.h
@@ -779,36 +779,6 @@ struct iwl_rxq_sync_notification {
u8 payload[];
} __packed; /* MULTI_QUEUE_DRV_SYNC_HDR_CMD_API_S_VER_1 */

-/**
- * enum iwl_mvm_rxq_notif_type - Internal message identifier
- *
- * @IWL_MVM_RXQ_EMPTY: empty sync notification
- * @IWL_MVM_RXQ_NOTIF_DEL_BA: notify RSS queues of delBA
- * @IWL_MVM_RXQ_NSSN_SYNC: notify all the RSS queues with the new NSSN
- */
-enum iwl_mvm_rxq_notif_type {
- IWL_MVM_RXQ_EMPTY,
- IWL_MVM_RXQ_NOTIF_DEL_BA,
- IWL_MVM_RXQ_NSSN_SYNC,
-};
-
-/**
- * struct iwl_mvm_internal_rxq_notif - Internal representation of the data sent
- * in &iwl_rxq_sync_cmd. Should be DWORD aligned.
- * FW is agnostic to the payload, so there are no endianity requirements.
- *
- * @type: value from &iwl_mvm_rxq_notif_type
- * @sync: ctrl path is waiting for all notifications to be received
- * @cookie: internal cookie to identify old notifications
- * @data: payload
- */
-struct iwl_mvm_internal_rxq_notif {
- u16 type;
- u16 sync;
- u32 cookie;
- u8 data[];
-} __packed;
-
/**
* enum iwl_mvm_pm_event - type of station PM event
* @IWL_MVM_PM_EVENT_AWAKE: station woke up
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
index fbd37a19b6e0..fd35dd31613e 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
@@ -5144,28 +5144,50 @@ static void iwl_mvm_mac_event_callback(struct ieee80211_hw *hw,
}

void iwl_mvm_sync_rx_queues_internal(struct iwl_mvm *mvm,
- struct iwl_mvm_internal_rxq_notif *notif,
- u32 size)
+ enum iwl_mvm_rxq_notif_type type,
+ bool sync,
+ const void *data, u32 size)
{
- u32 qmask = BIT(mvm->trans->num_rx_queues) - 1;
+ struct {
+ struct iwl_rxq_sync_cmd cmd;
+ struct iwl_mvm_internal_rxq_notif notif;
+ } __packed cmd = {
+ .cmd.rxq_mask = cpu_to_le32(BIT(mvm->trans->num_rx_queues) - 1),
+ .cmd.count =
+ cpu_to_le32(sizeof(struct iwl_mvm_internal_rxq_notif) +
+ size),
+ .notif.type = type,
+ .notif.sync = sync,
+ };
+ struct iwl_host_cmd hcmd = {
+ .id = WIDE_ID(DATA_PATH_GROUP, TRIGGER_RX_QUEUES_NOTIF_CMD),
+ .data[0] = &cmd,
+ .len[0] = sizeof(cmd),
+ .data[1] = data,
+ .len[1] = size,
+ .flags = sync ? 0 : CMD_ASYNC,
+ };
int ret;

+ /* size must be a multiple of DWORD */
+ if (WARN_ON(cmd.cmd.count & cpu_to_le32(3)))
+ return;

if (!iwl_mvm_has_new_rx_api(mvm))
return;

- if (notif->sync) {
- notif->cookie = mvm->queue_sync_cookie;
+ if (sync) {
+ cmd.notif.cookie = mvm->queue_sync_cookie;
mvm->queue_sync_state = (1 << mvm->trans->num_rx_queues) - 1;
}

- ret = iwl_mvm_notify_rx_queue(mvm, qmask, notif, size, !notif->sync);
+ ret = iwl_mvm_send_cmd(mvm, &hcmd);
if (ret) {
IWL_ERR(mvm, "Failed to trigger RX queues sync (%d)\n", ret);
goto out;
}

- if (notif->sync) {
+ if (sync) {
lockdep_assert_held(&mvm->mutex);
ret = wait_event_timeout(mvm->rx_sync_waitq,
READ_ONCE(mvm->queue_sync_state) == 0 ||
@@ -5177,7 +5199,7 @@ void iwl_mvm_sync_rx_queues_internal(struct iwl_mvm *mvm,
}

out:
- if (notif->sync) {
+ if (sync) {
mvm->queue_sync_state = 0;
mvm->queue_sync_cookie++;
}
@@ -5186,13 +5208,9 @@ void iwl_mvm_sync_rx_queues_internal(struct iwl_mvm *mvm,
static void iwl_mvm_sync_rx_queues(struct ieee80211_hw *hw)
{
struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw);
- struct iwl_mvm_internal_rxq_notif data = {
- .type = IWL_MVM_RXQ_EMPTY,
- .sync = 1,
- };

mutex_lock(&mvm->mutex);
- iwl_mvm_sync_rx_queues_internal(mvm, &data, sizeof(data));
+ iwl_mvm_sync_rx_queues_internal(mvm, IWL_MVM_RXQ_EMPTY, true, NULL, 0);
mutex_unlock(&mvm->mutex);
}

diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h b/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h
index 0a963d01b825..e607ad713f88 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h
@@ -1570,9 +1570,6 @@ void iwl_mvm_rx_frame_release(struct iwl_mvm *mvm, struct napi_struct *napi,
struct iwl_rx_cmd_buffer *rxb, int queue);
void iwl_mvm_rx_bar_frame_release(struct iwl_mvm *mvm, struct napi_struct *napi,
struct iwl_rx_cmd_buffer *rxb, int queue);
-int iwl_mvm_notify_rx_queue(struct iwl_mvm *mvm, u32 rxq_mask,
- const struct iwl_mvm_internal_rxq_notif *notif,
- u32 notif_size, bool async);
void iwl_mvm_rx_queue_notif(struct iwl_mvm *mvm, struct napi_struct *napi,
struct iwl_rx_cmd_buffer *rxb, int queue);
void iwl_mvm_rx_tx_cmd(struct iwl_mvm *mvm, struct iwl_rx_cmd_buffer *rxb);
@@ -2001,8 +1998,9 @@ void iwl_mvm_rx_tdls_notif(struct iwl_mvm *mvm, struct iwl_rx_cmd_buffer *rxb);
void iwl_mvm_tdls_ch_switch_work(struct work_struct *work);

void iwl_mvm_sync_rx_queues_internal(struct iwl_mvm *mvm,
- struct iwl_mvm_internal_rxq_notif *notif,
- u32 size);
+ enum iwl_mvm_rxq_notif_type type,
+ bool sync,
+ const void *data, u32 size);
void iwl_mvm_reorder_timer_expired(struct timer_list *t);
struct ieee80211_vif *iwl_mvm_get_bss_vif(struct iwl_mvm *mvm);
struct ieee80211_vif *iwl_mvm_get_vif_by_macid(struct iwl_mvm *mvm, u32 macid);
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c b/drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c
index c21736f80c29..5d40177dcf06 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c
@@ -520,37 +520,6 @@ static bool iwl_mvm_is_dup(struct ieee80211_sta *sta, int queue,
return false;
}

-int iwl_mvm_notify_rx_queue(struct iwl_mvm *mvm, u32 rxq_mask,
- const struct iwl_mvm_internal_rxq_notif *notif,
- u32 notif_size, bool async)
-{
- u8 buf[sizeof(struct iwl_rxq_sync_cmd) +
- sizeof(struct iwl_mvm_rss_sync_notif)];
- struct iwl_rxq_sync_cmd *cmd = (void *)buf;
- u32 data_size = sizeof(*cmd) + notif_size;
- int ret;
-
- /*
- * size must be a multiple of DWORD
- * Ensure we don't overflow buf
- */
- if (WARN_ON(notif_size & 3 ||
- notif_size > sizeof(struct iwl_mvm_rss_sync_notif)))
- return -EINVAL;
-
- cmd->rxq_mask = cpu_to_le32(rxq_mask);
- cmd->count = cpu_to_le32(notif_size);
- cmd->flags = 0;
- memcpy(cmd->payload, notif, notif_size);
-
- ret = iwl_mvm_send_cmd_pdu(mvm,
- WIDE_ID(DATA_PATH_GROUP,
- TRIGGER_RX_QUEUES_NOTIF_CMD),
- async ? CMD_ASYNC : 0, data_size, cmd);
-
- return ret;
-}
-
/*
* Returns true if sn2 - buffer_size < sn1 < sn2.
* To be used only in order to compare reorder buffer head with NSSN.
@@ -566,15 +535,13 @@ static bool iwl_mvm_is_sn_less(u16 sn1, u16 sn2, u16 buffer_size)
static void iwl_mvm_sync_nssn(struct iwl_mvm *mvm, u8 baid, u16 nssn)
{
if (IWL_MVM_USE_NSSN_SYNC) {
- struct iwl_mvm_rss_sync_notif notif = {
- .metadata.type = IWL_MVM_RXQ_NSSN_SYNC,
- .metadata.sync = 0,
- .nssn_sync.baid = baid,
- .nssn_sync.nssn = nssn,
+ struct iwl_mvm_nssn_sync_data notif = {
+ .baid = baid,
+ .nssn = nssn,
};

- iwl_mvm_sync_rx_queues_internal(mvm, (void *)&notif,
- sizeof(notif));
+ iwl_mvm_sync_rx_queues_internal(mvm, IWL_MVM_RXQ_NSSN_SYNC, false,
+ &notif, sizeof(notif));
}
}

@@ -823,8 +790,7 @@ void iwl_mvm_rx_queue_notif(struct iwl_mvm *mvm, struct napi_struct *napi,
"invalid notification size %d (%d)",
len, (int)(sizeof(*notif) + sizeof(*internal_notif))))
return;
- /* remove only the firmware header, we want all of our payload below */
- len -= sizeof(*notif);
+ len -= sizeof(*notif) + sizeof(*internal_notif);

if (internal_notif->sync &&
mvm->queue_sync_cookie != internal_notif->cookie) {
@@ -834,21 +800,19 @@ void iwl_mvm_rx_queue_notif(struct iwl_mvm *mvm, struct napi_struct *napi,

switch (internal_notif->type) {
case IWL_MVM_RXQ_EMPTY:
- WARN_ONCE(len != sizeof(*internal_notif),
- "invalid empty notification size %d (%d)",
- len, (int)sizeof(*internal_notif));
+ WARN_ONCE(len, "invalid empty notification size %d", len);
break;
case IWL_MVM_RXQ_NOTIF_DEL_BA:
- if (WARN_ONCE(len != sizeof(struct iwl_mvm_rss_sync_notif),
+ if (WARN_ONCE(len != sizeof(struct iwl_mvm_delba_data),
"invalid delba notification size %d (%d)",
- len, (int)sizeof(struct iwl_mvm_rss_sync_notif)))
+ len, (int)sizeof(struct iwl_mvm_delba_data)))
break;
iwl_mvm_del_ba(mvm, queue, (void *)internal_notif->data);
break;
case IWL_MVM_RXQ_NSSN_SYNC:
- if (WARN_ONCE(len != sizeof(struct iwl_mvm_rss_sync_notif),
+ if (WARN_ONCE(len != sizeof(struct iwl_mvm_nssn_sync_data),
"invalid nssn sync notification size %d (%d)",
- len, (int)sizeof(struct iwl_mvm_rss_sync_notif)))
+ len, (int)sizeof(struct iwl_mvm_nssn_sync_data)))
break;
iwl_mvm_nssn_sync(mvm, napi, queue,
(void *)internal_notif->data);
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/sta.c b/drivers/net/wireless/intel/iwlwifi/mvm/sta.c
index 3a411bbda5fd..f618368eda83 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/sta.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/sta.c
@@ -2441,12 +2441,12 @@ int iwl_mvm_rm_mcast_sta(struct iwl_mvm *mvm, struct ieee80211_vif *vif)

static void iwl_mvm_sync_rxq_del_ba(struct iwl_mvm *mvm, u8 baid)
{
- struct iwl_mvm_rss_sync_notif notif = {
- .metadata.type = IWL_MVM_RXQ_NOTIF_DEL_BA,
- .metadata.sync = 1,
- .delba.baid = baid,
+ struct iwl_mvm_delba_data notif = {
+ .baid = baid,
};
- iwl_mvm_sync_rx_queues_internal(mvm, (void *)&notif, sizeof(notif));
+
+ iwl_mvm_sync_rx_queues_internal(mvm, IWL_MVM_RXQ_NOTIF_DEL_BA, true,
+ &notif, sizeof(notif));
};

static void iwl_mvm_free_reorder(struct iwl_mvm *mvm,
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/sta.h b/drivers/net/wireless/intel/iwlwifi/mvm/sta.h
index 35a18b96aac5..32b4d1935788 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/sta.h
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/sta.h
@@ -281,6 +281,36 @@ struct iwl_mvm_key_pn {
} ____cacheline_aligned_in_smp q[];
};

+/**
+ * enum iwl_mvm_rxq_notif_type - Internal message identifier
+ *
+ * @IWL_MVM_RXQ_EMPTY: empty sync notification
+ * @IWL_MVM_RXQ_NOTIF_DEL_BA: notify RSS queues of delBA
+ * @IWL_MVM_RXQ_NSSN_SYNC: notify all the RSS queues with the new NSSN
+ */
+enum iwl_mvm_rxq_notif_type {
+ IWL_MVM_RXQ_EMPTY,
+ IWL_MVM_RXQ_NOTIF_DEL_BA,
+ IWL_MVM_RXQ_NSSN_SYNC,
+};
+
+/**
+ * struct iwl_mvm_internal_rxq_notif - Internal representation of the data sent
+ * in &iwl_rxq_sync_cmd. Should be DWORD aligned.
+ * FW is agnostic to the payload, so there are no endianity requirements.
+ *
+ * @type: value from &iwl_mvm_rxq_notif_type
+ * @sync: ctrl path is waiting for all notifications to be received
+ * @cookie: internal cookie to identify old notifications
+ * @data: payload
+ */
+struct iwl_mvm_internal_rxq_notif {
+ u16 type;
+ u16 sync;
+ u32 cookie;
+ u8 data[];
+} __packed;
+
struct iwl_mvm_delba_data {
u32 baid;
} __packed;
@@ -290,14 +320,6 @@ struct iwl_mvm_nssn_sync_data {
u32 nssn;
} __packed;

-struct iwl_mvm_rss_sync_notif {
- struct iwl_mvm_internal_rxq_notif metadata;
- union {
- struct iwl_mvm_delba_data delba;
- struct iwl_mvm_nssn_sync_data nssn_sync;
- };
-} __packed;
-
/**
* struct iwl_mvm_rxq_dup_data - per station per rx queue data
* @last_seq: last sequence per tid for duplicate packet detection
--
2.31.0

2021-03-31 12:05:29

by Ben Greear

[permalink] [raw]
Subject: Re: [PATCH 06/12] iwlwifi: mvm: Add support for 6GHz passive scan

On 3/31/21 2:14 AM, Luca Coelho wrote:
> From: Ilan Peer <[email protected]>
>
> When doing scan while 6GHz channels are not enabled, the 6GHz band
> is not scanned. Thus, if there are no APs on the 2GHz and 5GHz bands
> (that will allow discovery of geographic location etc. that would
> allow enabling the 6GHz channels) but there are non collocated APs
> on 6GHz PSC channels these would never be discovered.
>
> To overcome this, FW added support for performing passive UHB scan
> in case no APs were discovered during scan on the 2GHz and 5GHz
> channels.
>
> Add support for enabling such scan when the following conditions are
> met:
>
> - 6GHz channels are supported but not enabled by regulatory.
> - Station interface is not associated or less than a defined time
> interval passed from the last resume or HW reset flows.
> - At least 4 channels are included in the scan request
> - The scan request includes the widlcard SSID.
> - At least 50 minutes passed from the last 6GHz passive scan.

Why are you trying so hard to not do passive scans? This seems like it
is set up for all sorts of frustration.

Thanks,
Ben

--
Ben Greear <[email protected]>
Candela Technologies Inc http://www.candelatech.com

2021-04-11 09:43:50

by Luca Coelho

[permalink] [raw]
Subject: Re: [PATCH 06/12] iwlwifi: mvm: Add support for 6GHz passive scan

On Wed, 2021-03-31 at 05:03 -0700, Ben Greear wrote:
> On 3/31/21 2:14 AM, Luca Coelho wrote:
> > From: Ilan Peer <[email protected]>
> >
> > When doing scan while 6GHz channels are not enabled, the 6GHz band
> > is not scanned. Thus, if there are no APs on the 2GHz and 5GHz bands
> > (that will allow discovery of geographic location etc. that would
> > allow enabling the 6GHz channels) but there are non collocated APs
> > on 6GHz PSC channels these would never be discovered.
> >
> > To overcome this, FW added support for performing passive UHB scan
> > in case no APs were discovered during scan on the 2GHz and 5GHz
> > channels.
> >
> > Add support for enabling such scan when the following conditions are
> > met:
> >
> > - 6GHz channels are supported but not enabled by regulatory.
> > - Station interface is not associated or less than a defined time
> >    interval passed from the last resume or HW reset flows.
> > - At least 4 channels are included in the scan request
> > - The scan request includes the widlcard SSID.
> > - At least 50 minutes passed from the last 6GHz passive scan.
>
> Why are you trying so hard to not do passive scans? This seems like it
> is set up for all sorts of frustration.

This is because of regulatory restrictions. Maybe Ilan can clarify
more.

--
Cheers,
Luca.

2021-04-11 10:26:03

by Peer, Ilan

[permalink] [raw]
Subject: RE: [PATCH 06/12] iwlwifi: mvm: Add support for 6GHz passive scan

Hi Ben,

> -----Original Message-----
> From: Ben Greear <[email protected]>
> Sent: Wednesday, March 31, 2021 15:04
> To: Luca Coelho <[email protected]>; [email protected]
> Cc: [email protected]
> Subject: Re: [PATCH 06/12] iwlwifi: mvm: Add support for 6GHz passive scan
>
> On 3/31/21 2:14 AM, Luca Coelho wrote:
> > From: Ilan Peer <[email protected]>
> >
> > When doing scan while 6GHz channels are not enabled, the 6GHz band is
> > not scanned. Thus, if there are no APs on the 2GHz and 5GHz bands
> > (that will allow discovery of geographic location etc. that would
> > allow enabling the 6GHz channels) but there are non collocated APs on
> > 6GHz PSC channels these would never be discovered.
> >
> > To overcome this, FW added support for performing passive UHB scan in
> > case no APs were discovered during scan on the 2GHz and 5GHz channels.
> >
> > Add support for enabling such scan when the following conditions are
> > met:
> >
> > - 6GHz channels are supported but not enabled by regulatory.
> > - Station interface is not associated or less than a defined time
> > interval passed from the last resume or HW reset flows.
> > - At least 4 channels are included in the scan request
> > - The scan request includes the widlcard SSID.
> > - At least 50 minutes passed from the last 6GHz passive scan.
>
> Why are you trying so hard to not do passive scans? This seems like it is set
> up for all sorts of frustration.
>

This logic enables a special 'passive' scan which is not directly intended for discovery of APs for connection etc. but
for discovery of APs with country information in the beacons/probe responses, so the fw could use this information
as an input that might allow it to enable 6GHz channels (which are supported but are disabled). This special scan
is intended for cases that the device does not have any other regulatory information that allows it to enable the 6GHz channels.
Once these channels are enabled, we use passive scan as needed.

We generally try to avoid passive scan on all the 6GHz channels as this is a long flow that takes at least 6 seconds (as there are
such 64 channels) and with the discovery mechanisms defined for the 6GHz is not really needed.

Hope this clarifies things.

Regards,

Ilan.

2021-04-11 11:36:27

by Ben Greear

[permalink] [raw]
Subject: Re: [PATCH 06/12] iwlwifi: mvm: Add support for 6GHz passive scan

On 4/11/21 3:14 AM, Peer, Ilan wrote:
> Hi Ben,
>
>> -----Original Message-----
>> From: Ben Greear <[email protected]>
>> Sent: Wednesday, March 31, 2021 15:04
>> To: Luca Coelho <[email protected]>; [email protected]
>> Cc: [email protected]
>> Subject: Re: [PATCH 06/12] iwlwifi: mvm: Add support for 6GHz passive scan
>>
>> On 3/31/21 2:14 AM, Luca Coelho wrote:
>>> From: Ilan Peer <[email protected]>
>>>
>>> When doing scan while 6GHz channels are not enabled, the 6GHz band is
>>> not scanned. Thus, if there are no APs on the 2GHz and 5GHz bands
>>> (that will allow discovery of geographic location etc. that would
>>> allow enabling the 6GHz channels) but there are non collocated APs on
>>> 6GHz PSC channels these would never be discovered.
>>>
>>> To overcome this, FW added support for performing passive UHB scan in
>>> case no APs were discovered during scan on the 2GHz and 5GHz channels.
>>>
>>> Add support for enabling such scan when the following conditions are
>>> met:
>>>
>>> - 6GHz channels are supported but not enabled by regulatory.
>>> - Station interface is not associated or less than a defined time
>>> interval passed from the last resume or HW reset flows.
>>> - At least 4 channels are included in the scan request
>>> - The scan request includes the widlcard SSID.
>>> - At least 50 minutes passed from the last 6GHz passive scan.
>>
>> Why are you trying so hard to not do passive scans? This seems like it is set
>> up for all sorts of frustration.
>>
>
> This logic enables a special 'passive' scan which is not directly intended for discovery of APs for connection etc. but
> for discovery of APs with country information in the beacons/probe responses, so the fw could use this information
> as an input that might allow it to enable 6GHz channels (which are supported but are disabled). This special scan
> is intended for cases that the device does not have any other regulatory information that allows it to enable the 6GHz channels.
> Once these channels are enabled, we use passive scan as needed.
>
> We generally try to avoid passive scan on all the 6GHz channels as this is a long flow that takes at least 6 seconds (as there are
> such 64 channels) and with the discovery mechanisms defined for the 6GHz is not really needed.

If the station comes up and does a 6E passive scan and does not find any AP, perhaps because 6Ghz AP was turned on 1 minute after the station
tried to initially scan, this means that it will take 50 minutes before it can have a chance to scan
the AP and connect to the Internet? If station cannot connect after a relatively short time,
then I think it should scan as widely as it can in order find some possible way to connect.

And why care about 'at least 4 channels'. If we know the AP channel, and can scan exactly there, then your
concern about taking a long time is resolved.

How else can we tell the radio that 6E is allowed? I previously tried all sorts of things
to enable 6E channels so that I could more easily set the radio to sniff one of those channels
in monitor mode, and I had no luck.

If all of the 6E channels are marked as passive, what harm is it to enable the channels
in the regdom from the beginning?

Thanks,
Ben

>
> Hope this clarifies things.
>
> Regards,
>
> Ilan.
>


--
Ben Greear <[email protected]>
Candela Technologies Inc http://www.candelatech.com

2021-04-11 12:36:56

by Peer, Ilan

[permalink] [raw]
Subject: RE: [PATCH 06/12] iwlwifi: mvm: Add support for 6GHz passive scan

Hi,

> > This logic enables a special 'passive' scan which is not directly
> > intended for discovery of APs for connection etc. but for discovery of
> > APs with country information in the beacons/probe responses, so the fw
> > could use this information as an input that might allow it to enable 6GHz
> channels (which are supported but are disabled). This special scan is intended
> for cases that the device does not have any other regulatory information that
> allows it to enable the 6GHz channels.
> > Once these channels are enabled, we use passive scan as needed.
> >
> > We generally try to avoid passive scan on all the 6GHz channels as
> > this is a long flow that takes at least 6 seconds (as there are such 64
> channels) and with the discovery mechanisms defined for the 6GHz is not
> really needed.
>
> If the station comes up and does a 6E passive scan and does not find any AP,
> perhaps because 6Ghz AP was turned on 1 minute after the station tried to
> initially scan, this means that it will take 50 minutes before it can have a
> chance to scan the AP and connect to the Internet? If station cannot connect
> after a relatively short time, then I think it should scan as widely as it can in
> order find some possible way to connect.
>

The purpose of this heuristic was to handle a very specific corner case where there are
no APs on the 2GHz/5GHz bands and there are only one or more non-collocated APs
on the 6GHz band. Based on our understanding, this is not a very likely situation and thus,
due to other consideration e.g., power KPIs etc., the above conditions were defined. However,
as you can see in the patch, there are options to tune the heuristic to be more aggressive,
and if it would indeed be needed we can change the behavior such cases.

> And why care about 'at least 4 channels'. If we know the AP channel, and can
> scan exactly there, then your concern about taking a long time is resolved.
>

The assumption was that while a connection was not established a full scan
is expected, so that's why the above condition was set. However, I'll take this
with my colleagues and see if this condition can be removed or defined
differently.

> How else can we tell the radio that 6E is allowed? I previously tried all sorts of
> things to enable 6E channels so that I could more easily set the radio to sniff
> one of those channels in monitor mode, and I had no luck.
>

Are you asking specifically for iwlwifi devices? I'm not familiar with a simple
way to do so other the one described here, but I can check if you need it.

> If all of the 6E channels are marked as passive, what harm is it to enable the
> channels in the regdom from the beginning?
>

AFAIK, as the 6GHz regulatory is still evolving, we are not yet allowed to do so. But once again,
If you are interested I can further check this our regulatory team.

Regards,

Ilan.

2021-04-11 17:48:39

by Ben Greear

[permalink] [raw]
Subject: Re: [PATCH 06/12] iwlwifi: mvm: Add support for 6GHz passive scan

On 4/11/21 5:14 AM, Peer, Ilan wrote:
> Hi,
>
>>> This logic enables a special 'passive' scan which is not directly
>>> intended for discovery of APs for connection etc. but for discovery of
>>> APs with country information in the beacons/probe responses, so the fw
>>> could use this information as an input that might allow it to enable 6GHz
>> channels (which are supported but are disabled). This special scan is intended
>> for cases that the device does not have any other regulatory information that
>> allows it to enable the 6GHz channels.
>>> Once these channels are enabled, we use passive scan as needed.
>>>
>>> We generally try to avoid passive scan on all the 6GHz channels as
>>> this is a long flow that takes at least 6 seconds (as there are such 64
>> channels) and with the discovery mechanisms defined for the 6GHz is not
>> really needed.
>>
>> If the station comes up and does a 6E passive scan and does not find any AP,
>> perhaps because 6Ghz AP was turned on 1 minute after the station tried to
>> initially scan, this means that it will take 50 minutes before it can have a
>> chance to scan the AP and connect to the Internet? If station cannot connect
>> after a relatively short time, then I think it should scan as widely as it can in
>> order find some possible way to connect.
>>
>
> The purpose of this heuristic was to handle a very specific corner case where there are
> no APs on the 2GHz/5GHz bands and there are only one or more non-collocated APs
> on the 6GHz band. Based on our understanding, this is not a very likely situation and thus,
> due to other consideration e.g., power KPIs etc., the above conditions were defined. However,
> as you can see in the patch, there are options to tune the heuristic to be more aggressive,
> and if it would indeed be needed we can change the behavior such cases.

Yes, and I can tweak the code myself if needed. But better if upstream driver
is already nice as possible.

>> And why care about 'at least 4 channels'. If we know the AP channel, and can
>> scan exactly there, then your concern about taking a long time is resolved.
>>
>
> The assumption was that while a connection was not established a full scan
> is expected, so that's why the above condition was set. However, I'll take this
> with my colleagues and see if this condition can be removed or defined
> differently.

The complexity of the restrictions are going to silently break certain configs that
a user can reasonable expect to work I think.

>
>> How else can we tell the radio that 6E is allowed? I previously tried all sorts of
>> things to enable 6E channels so that I could more easily set the radio to sniff
>> one of those channels in monitor mode, and I had no luck.
>>
>
> Are you asking specifically for iwlwifi devices? I'm not familiar with a simple
> way to do so other the one described here, but I can check if you need it.

Yes. ax210 in particular.

>
>> If all of the 6E channels are marked as passive, what harm is it to enable the
>> channels in the regdom from the beginning?
>>
>
> AFAIK, as the 6GHz regulatory is still evolving, we are not yet allowed to do so. But once again,
> If you are interested I can further check this our regulatory team.

Your patch enables passive scan of 6Ghz when no regulatory specifically allows it.
I think just enabling the band as passive is the same thing, but significantly
simplifies things. If there are regulatory reasons to not allow even passsive scanning on 6E,
then your patch breaks that. If not, then just always allow 6E channels to be available in
passive mode.

The logic to optimize scanning time and channels belongs up in the supplicant
and other higher level code that can take user input/config and make decisions using info
that the driver will never have.

Thanks,
Ben

>
> Regards,
>
> Ilan.
>


--
Ben Greear <[email protected]>
Candela Technologies Inc http://www.candelatech.com

2021-04-12 10:23:40

by Luca Coelho

[permalink] [raw]
Subject: Re: [PATCH 05/12] iwlwifi: pcie: try to grab NIC access early

On Wed, 2021-03-31 at 12:14 +0300, Luca Coelho wrote:
> From: Johannes Berg <[email protected]>
>
> Sometimes some NICs may fail to initialize, but if we have
> such a scenario we may only see an alive timeout (i.e. the
> firmware doesn't send us the alive message), and that will
> only cause us to fail the interface up.
>
> Try to once grab NIC access during device probe to ensure
> we can properly talk to the hardware at all, and to do all
> the potential workarounds in that function.
>
> Since we now finish NIC init here, we can remove it from
> the later potential read of the RF ID.
>
> Signed-off-by: Johannes Berg <[email protected]>
> Signed-off-by: Luca Coelho <[email protected]>
> ---

This patch is included in Emmanuel's iwlmei series, so I'll drop it
from this series.

--
Cheers,
Luca.

2021-04-12 10:25:14

by Luca Coelho

[permalink] [raw]
Subject: Re: [PATCH 01/12] iwlwifi: mvm: write queue_sync_state only for sync

Luca Coelho <[email protected]> wrote:

> From: Johannes Berg <[email protected]>
>
> We use mvm->queue_sync_state to wait for synchronous queue sync
> messages, but if an async one happens inbetween we shouldn't
> clear mvm->queue_sync_state after sending the async one, that
> can run concurrently (at least from the CPU POV) with another
> synchronous queue sync.
>
> Signed-off-by: Johannes Berg <[email protected]>
> Signed-off-by: Luca Coelho <[email protected]>

11 patches applied to iwlwifi-next.git, thanks.

ac2d58b34dc9 iwlwifi: mvm: write queue_sync_state only for sync
d96fbcbb5040 iwlwifi: mvm: clean up queue sync implementation
35d261a2d9fa iwlwifi: mvm: when associated with PMF, use protected NDP ranging negotiation
920484e82ea5 iwlwifi: add ax201 killer device
f05a69e2c7d7 iwlwifi: mvm: Add support for 6GHz passive scan
7143a6771d2c iwlwifi: mvm: enable PPAG in China
4eedace3b6d6 iwlwifi: add new so-gf device
c3e599ec1757 iwlwifi: move iwl_configure_rxq to be used by other op_modes
bc0411c5b1f8 iwlwifi: mvm: support BIOS enable/disable for 11ax in Ukraine
d4eb23d659d3 iwlwifi: mvm: refactor ACPI DSM evaluation function
86817a2ea413 iwlwifi: mvm: Use IWL_INFO in fw_reset_handshake()

2021-04-13 15:17:24

by Peer, Ilan

[permalink] [raw]
Subject: RE: [PATCH 06/12] iwlwifi: mvm: Add support for 6GHz passive scan

Hi Ben,

> -----Original Message-----
> From: Ben Greear <[email protected]>
> Sent: Sunday, April 11, 2021 19:15
> To: Peer, Ilan <[email protected]>; Luca Coelho <[email protected]>;
> [email protected]urora.org
> Cc: [email protected]
> Subject: Re: [PATCH 06/12] iwlwifi: mvm: Add support for 6GHz passive scan
>
> On 4/11/21 5:14 AM, Peer, Ilan wrote:
> > Hi,
> >
> >>> This logic enables a special 'passive' scan which is not directly
> >>> intended for discovery of APs for connection etc. but for discovery
> >>> of APs with country information in the beacons/probe responses, so
> >>> the fw could use this information as an input that might allow it to
> >>> enable 6GHz
> >> channels (which are supported but are disabled). This special scan is
> >> intended for cases that the device does not have any other regulatory
> >> information that allows it to enable the 6GHz channels.
> >>> Once these channels are enabled, we use passive scan as needed.
> >>>
> >>> We generally try to avoid passive scan on all the 6GHz channels as
> >>> this is a long flow that takes at least 6 seconds (as there are such
> >>> 64
> >> channels) and with the discovery mechanisms defined for the 6GHz is
> >> not really needed.
> >>
> >> If the station comes up and does a 6E passive scan and does not find
> >> any AP, perhaps because 6Ghz AP was turned on 1 minute after the
> >> station tried to initially scan, this means that it will take 50
> >> minutes before it can have a chance to scan the AP and connect to the
> >> Internet? If station cannot connect after a relatively short time,
> >> then I think it should scan as widely as it can in order find some possible
> way to connect.
> >>
> >
> > The purpose of this heuristic was to handle a very specific corner
> > case where there are no APs on the 2GHz/5GHz bands and there are only
> > one or more non-collocated APs on the 6GHz band. Based on our
> > understanding, this is not a very likely situation and thus, due to
> > other consideration e.g., power KPIs etc., the above conditions were
> > defined. However, as you can see in the patch, there are options to tune
> the heuristic to be more aggressive, and if it would indeed be needed we can
> change the behavior such cases.
>
> Yes, and I can tweak the code myself if needed. But better if upstream
> driver is already nice as possible.
>

As I emphasized above, this entire 6GHz passive scan concept is only targeting a very specific
corner case that tries to handle the case that we have no information about the current MCC.
I've raised your points with our regulatory team and they further emphasized that for the common
use case of station operation, as this is expected to be a rare case, they prefer have this logic as
it is implemented.

> >> And why care about 'at least 4 channels'. If we know the AP channel,
> >> and can scan exactly there, then your concern about taking a long time is
> resolved.
> >>
> >
> > The assumption was that while a connection was not established a full
> > scan is expected, so that's why the above condition was set. However,
> > I'll take this with my colleagues and see if this condition can be
> > removed or defined differently.
>
> The complexity of the restrictions are going to silently break certain configs
> that a user can reasonable expect to work I think.

Based on the intended use of this flow, we do not think that this is going to break
user configurations.

>
> >
> >> How else can we tell the radio that 6E is allowed? I previously
> >> tried all sorts of things to enable 6E channels so that I could more
> >> easily set the radio to sniff one of those channels in monitor mode, and I
> had no luck.
> >>
> >
> > Are you asking specifically for iwlwifi devices? I'm not familiar with
> > a simple way to do so other the one described here, but I can check if you
> need it.
>
> Yes. ax210 in particular.
>

With the current regulatory settings that our NICs ships with, the regulatory team stated that
if the device finds enough APs with consistent country code in their beacons (also on legacy bands),
e.g., US country code, then the FW would be able to update the MCC, and if the MCC enables the
6GHz channels then they would be enabled. Thus, the special case of 6GHz passive scan would not be needed.

> >
> >> If all of the 6E channels are marked as passive, what harm is it to
> >> enable the channels in the regdom from the beginning?
> >>
> >
> > AFAIK, as the 6GHz regulatory is still evolving, we are not yet
> > allowed to do so. But once again, If you are interested I can further check
> this our regulatory team.
>
> Your patch enables passive scan of 6Ghz when no regulatory specifically
> allows it.
> I think just enabling the band as passive is the same thing, but significantly
> simplifies things. If there are regulatory reasons to not allow even passsive
> scanning on 6E, then your patch breaks that. If not, then just always allow 6E
> channels to be available in passive mode.
>

The decision was not to enable 6GHz passive scan if not needed as it has a high
penalty in terms on time and power KPIs. When the 6GHz channels are enabled,
our device follows the discovery mechanisms define in Draft IEEE802.11ax which
minimize the scan time and out of channel activity, which is the preferable way.

> The logic to optimize scanning time and channels belongs up in the supplicant
> and other higher level code that can take user input/config and make
> decisions using info that the driver will never have.
>

Agree on this point, but since current wpa_supplicant version and older ones have
no such support than in practice enabling all the 6GHz channels to allow passive
scanning by default would incur penalties in scan/connection time and power.

Hope this helps.

Regards,

Ilan.