linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/4] iwlwifi: fixes intended for 5.3 2019-08-16
@ 2019-08-16 12:55 Luca Coelho
  2019-08-16 12:55 ` [PATCH 1/4] iwlwifi: mvm: Allow multicast data frames only when associated Luca Coelho
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Luca Coelho @ 2019-08-16 12:55 UTC (permalink / raw)
  To: kvalo; +Cc: linux-wireless

From: Luca Coelho <luciano.coelho@intel.com>

This is my third patchset with fixes for v5.3.

The changes are:

* fix one bug on 22560 Tx code;
* prevent sending multicast frames when not associated;
* a couple of fixes in the card detection code.

As usual, I'm pushing this to a pending branch, for kbuild bot.  I
will assign these patches to you in patchwork so you can apply them
directly to wireless-drivers.

Cheers,
Luca.


Emmanuel Grumbach (1):
  iwlwifi: pcie: fix the byte count table format for 22560 devices

Ilan Peer (1):
  iwlwifi: mvm: Allow multicast data frames only when associated

Luca Coelho (2):
  iwlwifi: pcie: don't switch FW to qnj when ax201 is detected
  iwlwifi: pcie: fix recognition of QuZ devices

 .../net/wireless/intel/iwlwifi/mvm/mac-ctxt.c | 33 +++++++++++++++++--
 .../net/wireless/intel/iwlwifi/mvm/mac80211.c | 10 ++++++
 drivers/net/wireless/intel/iwlwifi/pcie/drv.c | 17 ++++++++++
 .../net/wireless/intel/iwlwifi/pcie/trans.c   |  1 +
 .../net/wireless/intel/iwlwifi/pcie/tx-gen2.c | 20 +++++++----
 5 files changed, 71 insertions(+), 10 deletions(-)

-- 
2.23.0.rc1


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 1/4] iwlwifi: mvm: Allow multicast data frames only when associated
  2019-08-16 12:55 [PATCH 0/4] iwlwifi: fixes intended for 5.3 2019-08-16 Luca Coelho
@ 2019-08-16 12:55 ` Luca Coelho
  2019-08-20 14:02   ` Kalle Valo
  2019-08-16 12:55 ` [PATCH 2/4] iwlwifi: pcie: fix the byte count table format for 22560 devices Luca Coelho
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 6+ messages in thread
From: Luca Coelho @ 2019-08-16 12:55 UTC (permalink / raw)
  To: kvalo; +Cc: linux-wireless

From: Ilan Peer <ilan.peer@intel.com>

The MAC context configuration always allowed multicast data frames
to pass to the driver for all MAC context types, and in the
case of station MAC context both when associated and when not
associated.

One of the outcomes of this configuration is having the FW forward
encrypted multicast frames to the driver with Rx status indicating
that the frame was not decrypted (as expected, since no keys were
configured yet) which in turn results with unnecessary error
messages.

Change this behavior to allow multicast data frames only when they
are actually expected, e.g., station MAC context is associated etc.

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
---
 .../net/wireless/intel/iwlwifi/mvm/mac-ctxt.c | 33 +++++++++++++++++--
 .../net/wireless/intel/iwlwifi/mvm/mac80211.c | 10 ++++++
 2 files changed, 40 insertions(+), 3 deletions(-)

diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c b/drivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c
index cb22d447fcb8..fe776e35b9d0 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c
@@ -554,7 +554,7 @@ static void iwl_mvm_mac_ctxt_cmd_common(struct iwl_mvm *mvm,
 		cpu_to_le32(vif->bss_conf.use_short_slot ?
 			    MAC_FLG_SHORT_SLOT : 0);
 
-	cmd->filter_flags = cpu_to_le32(MAC_FILTER_ACCEPT_GRP);
+	cmd->filter_flags = 0;
 
 	for (i = 0; i < IEEE80211_NUM_ACS; i++) {
 		u8 txf = iwl_mvm_mac_ac_to_tx_fifo(mvm, i);
@@ -623,6 +623,8 @@ static int iwl_mvm_mac_ctxt_cmd_sta(struct iwl_mvm *mvm,
 	/* We need the dtim_period to set the MAC as associated */
 	if (vif->bss_conf.assoc && vif->bss_conf.dtim_period &&
 	    !force_assoc_off) {
+		struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
+		u8 ap_sta_id = mvmvif->ap_sta_id;
 		u32 dtim_offs;
 
 		/*
@@ -658,6 +660,29 @@ static int iwl_mvm_mac_ctxt_cmd_sta(struct iwl_mvm *mvm,
 			       dtim_offs);
 
 		ctxt_sta->is_assoc = cpu_to_le32(1);
+
+		/*
+		 * allow multicast data frames only as long as the station is
+		 * authorized, i.e., GTK keys are already installed (if needed)
+		 */
+		if (ap_sta_id < IWL_MVM_STATION_COUNT) {
+			struct ieee80211_sta *sta;
+
+			rcu_read_lock();
+
+			sta = rcu_dereference(mvm->fw_id_to_mac_id[ap_sta_id]);
+			if (!IS_ERR_OR_NULL(sta)) {
+				struct iwl_mvm_sta *mvmsta =
+					iwl_mvm_sta_from_mac80211(sta);
+
+				if (mvmsta->sta_state ==
+				    IEEE80211_STA_AUTHORIZED)
+					cmd.filter_flags |=
+						cpu_to_le32(MAC_FILTER_ACCEPT_GRP);
+			}
+
+			rcu_read_unlock();
+		}
 	} else {
 		ctxt_sta->is_assoc = cpu_to_le32(0);
 
@@ -703,7 +728,8 @@ static int iwl_mvm_mac_ctxt_cmd_listener(struct iwl_mvm *mvm,
 				       MAC_FILTER_IN_CONTROL_AND_MGMT |
 				       MAC_FILTER_IN_BEACON |
 				       MAC_FILTER_IN_PROBE_REQUEST |
-				       MAC_FILTER_IN_CRC32);
+				       MAC_FILTER_IN_CRC32 |
+				       MAC_FILTER_ACCEPT_GRP);
 	ieee80211_hw_set(mvm->hw, RX_INCLUDES_FCS);
 
 	/* Allocate sniffer station */
@@ -727,7 +753,8 @@ static int iwl_mvm_mac_ctxt_cmd_ibss(struct iwl_mvm *mvm,
 	iwl_mvm_mac_ctxt_cmd_common(mvm, vif, &cmd, NULL, action);
 
 	cmd.filter_flags = cpu_to_le32(MAC_FILTER_IN_BEACON |
-				       MAC_FILTER_IN_PROBE_REQUEST);
+				       MAC_FILTER_IN_PROBE_REQUEST |
+				       MAC_FILTER_ACCEPT_GRP);
 
 	/* cmd.ibss.beacon_time/cmd.ibss.beacon_tsf are curently ignored */
 	cmd.ibss.bi = cpu_to_le32(vif->bss_conf.beacon_int);
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
index 1c904b5226aa..a7bc00d1296f 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
@@ -3327,10 +3327,20 @@ static int iwl_mvm_mac_sta_state(struct ieee80211_hw *hw,
 		/* enable beacon filtering */
 		WARN_ON(iwl_mvm_enable_beacon_filter(mvm, vif, 0));
 
+		/*
+		 * Now that the station is authorized, i.e., keys were already
+		 * installed, need to indicate to the FW that
+		 * multicast data frames can be forwarded to the driver
+		 */
+		iwl_mvm_mac_ctxt_changed(mvm, vif, false, NULL);
+
 		iwl_mvm_rs_rate_init(mvm, sta, mvmvif->phy_ctxt->channel->band,
 				     true);
 	} else if (old_state == IEEE80211_STA_AUTHORIZED &&
 		   new_state == IEEE80211_STA_ASSOC) {
+		/* Multicast data frames are no longer allowed */
+		iwl_mvm_mac_ctxt_changed(mvm, vif, false, NULL);
+
 		/* disable beacon filtering */
 		ret = iwl_mvm_disable_beacon_filter(mvm, vif, 0);
 		WARN_ON(ret &&
-- 
2.23.0.rc1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/4] iwlwifi: pcie: fix the byte count table format for 22560 devices
  2019-08-16 12:55 [PATCH 0/4] iwlwifi: fixes intended for 5.3 2019-08-16 Luca Coelho
  2019-08-16 12:55 ` [PATCH 1/4] iwlwifi: mvm: Allow multicast data frames only when associated Luca Coelho
@ 2019-08-16 12:55 ` Luca Coelho
  2019-08-16 12:55 ` [PATCH 3/4] iwlwifi: pcie: don't switch FW to qnj when ax201 is detected Luca Coelho
  2019-08-16 12:55 ` [PATCH 4/4] iwlwifi: pcie: fix recognition of QuZ devices Luca Coelho
  3 siblings, 0 replies; 6+ messages in thread
From: Luca Coelho @ 2019-08-16 12:55 UTC (permalink / raw)
  To: kvalo; +Cc: linux-wireless

From: Emmanuel Grumbach <emmanuel.grumbach@intel.com>

Starting from 22560, the byte count is expected to be in
bytes and we have now 14 bits. Ajust the code to this.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
---
 .../net/wireless/intel/iwlwifi/pcie/tx-gen2.c | 20 ++++++++++++-------
 1 file changed, 13 insertions(+), 7 deletions(-)

diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/tx-gen2.c b/drivers/net/wireless/intel/iwlwifi/pcie/tx-gen2.c
index 38d110338987..9ef6b8fe03c1 100644
--- a/drivers/net/wireless/intel/iwlwifi/pcie/tx-gen2.c
+++ b/drivers/net/wireless/intel/iwlwifi/pcie/tx-gen2.c
@@ -99,10 +99,7 @@ void iwl_pcie_gen2_update_byte_tbl(struct iwl_trans_pcie *trans_pcie,
 	u16 len = byte_cnt;
 	__le16 bc_ent;
 
-	if (trans_pcie->bc_table_dword)
-		len = DIV_ROUND_UP(len, 4);
-
-	if (WARN_ON(len > 0xFFF || idx >= txq->n_window))
+	if (WARN(idx >= txq->n_window, "%d >= %d\n", idx, txq->n_window))
 		return;
 
 	filled_tfd_size = offsetof(struct iwl_tfh_tfd, tbs) +
@@ -117,11 +114,20 @@ void iwl_pcie_gen2_update_byte_tbl(struct iwl_trans_pcie *trans_pcie,
 	 */
 	num_fetch_chunks = DIV_ROUND_UP(filled_tfd_size, 64) - 1;
 
-	bc_ent = cpu_to_le16(len | (num_fetch_chunks << 12));
-	if (trans->cfg->device_family >= IWL_DEVICE_FAMILY_22560)
+	if (trans->cfg->device_family >= IWL_DEVICE_FAMILY_22560) {
+		/* Starting from 22560, the HW expects bytes */
+		WARN_ON(trans_pcie->bc_table_dword);
+		WARN_ON(len > 0x3FFF);
+		bc_ent = cpu_to_le16(len | (num_fetch_chunks << 14));
 		scd_bc_tbl_gen3->tfd_offset[idx] = bc_ent;
-	else
+	} else {
+		/* Until 22560, the HW expects DW */
+		WARN_ON(!trans_pcie->bc_table_dword);
+		len = DIV_ROUND_UP(len, 4);
+		WARN_ON(len > 0xFFF);
+		bc_ent = cpu_to_le16(len | (num_fetch_chunks << 12));
 		scd_bc_tbl->tfd_offset[idx] = bc_ent;
+	}
 }
 
 /*
-- 
2.23.0.rc1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 3/4] iwlwifi: pcie: don't switch FW to qnj when ax201 is detected
  2019-08-16 12:55 [PATCH 0/4] iwlwifi: fixes intended for 5.3 2019-08-16 Luca Coelho
  2019-08-16 12:55 ` [PATCH 1/4] iwlwifi: mvm: Allow multicast data frames only when associated Luca Coelho
  2019-08-16 12:55 ` [PATCH 2/4] iwlwifi: pcie: fix the byte count table format for 22560 devices Luca Coelho
@ 2019-08-16 12:55 ` Luca Coelho
  2019-08-16 12:55 ` [PATCH 4/4] iwlwifi: pcie: fix recognition of QuZ devices Luca Coelho
  3 siblings, 0 replies; 6+ messages in thread
From: Luca Coelho @ 2019-08-16 12:55 UTC (permalink / raw)
  To: kvalo; +Cc: linux-wireless

From: Luca Coelho <luciano.coelho@intel.com>

We have a too generic condition that switches from Qu configurations
to QnJ configurations.  We need to exclude some configurations so that
they are not erroneously switched.  Add the ax201 configuration to the
list of exclusions.

Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
---
 drivers/net/wireless/intel/iwlwifi/pcie/trans.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/trans.c b/drivers/net/wireless/intel/iwlwifi/pcie/trans.c
index f5df5b370d78..935e35dafce5 100644
--- a/drivers/net/wireless/intel/iwlwifi/pcie/trans.c
+++ b/drivers/net/wireless/intel/iwlwifi/pcie/trans.c
@@ -3603,6 +3603,7 @@ struct iwl_trans *iwl_trans_pcie_alloc(struct pci_dev *pdev,
 	} else if (CSR_HW_RF_ID_TYPE_CHIP_ID(trans->hw_rf_id) ==
 		   CSR_HW_RF_ID_TYPE_CHIP_ID(CSR_HW_RF_ID_TYPE_HR) &&
 		   ((trans->cfg != &iwl_ax200_cfg_cc &&
+		     trans->cfg != &iwl_ax201_cfg_qu_hr &&
 		     trans->cfg != &killer1650x_2ax_cfg &&
 		     trans->cfg != &killer1650w_2ax_cfg &&
 		     trans->cfg != &iwl_ax201_cfg_quz_hr) ||
-- 
2.23.0.rc1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 4/4] iwlwifi: pcie: fix recognition of QuZ devices
  2019-08-16 12:55 [PATCH 0/4] iwlwifi: fixes intended for 5.3 2019-08-16 Luca Coelho
                   ` (2 preceding siblings ...)
  2019-08-16 12:55 ` [PATCH 3/4] iwlwifi: pcie: don't switch FW to qnj when ax201 is detected Luca Coelho
@ 2019-08-16 12:55 ` Luca Coelho
  3 siblings, 0 replies; 6+ messages in thread
From: Luca Coelho @ 2019-08-16 12:55 UTC (permalink / raw)
  To: kvalo; +Cc: linux-wireless

From: Luca Coelho <luciano.coelho@intel.com>

If the HW revision of Qu devices we found is QuZ, then we need to
switch the configuration accordingly in order to use the correct FW.

Add a block of ifs in order do that.

Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
---
 drivers/net/wireless/intel/iwlwifi/pcie/drv.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/drv.c b/drivers/net/wireless/intel/iwlwifi/pcie/drv.c
index de711c1160d3..7c5aaeaf7fe5 100644
--- a/drivers/net/wireless/intel/iwlwifi/pcie/drv.c
+++ b/drivers/net/wireless/intel/iwlwifi/pcie/drv.c
@@ -1063,6 +1063,23 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
 		else if (iwl_trans->cfg == &iwl9560_2ac_160_cfg_qu_b0_jf_b0)
 			iwl_trans->cfg = &iwl9560_2ac_160_cfg_qu_c0_jf_b0;
 	}
+
+	/* same thing for QuZ... */
+	if (iwl_trans->hw_rev == CSR_HW_REV_TYPE_QUZ) {
+		if (cfg == &iwl_ax101_cfg_qu_hr)
+			cfg = &iwl_ax101_cfg_quz_hr;
+		else if (cfg == &iwl_ax201_cfg_qu_hr)
+			cfg = &iwl_ax201_cfg_quz_hr;
+		else if (cfg == &iwl9461_2ac_cfg_qu_b0_jf_b0)
+			cfg = &iwl9461_2ac_cfg_quz_a0_jf_b0_soc;
+		else if (cfg == &iwl9462_2ac_cfg_qu_b0_jf_b0)
+			cfg = &iwl9462_2ac_cfg_quz_a0_jf_b0_soc;
+		else if (cfg == &iwl9560_2ac_cfg_qu_b0_jf_b0)
+			cfg = &iwl9560_2ac_cfg_quz_a0_jf_b0_soc;
+		else if (cfg == &iwl9560_2ac_160_cfg_qu_b0_jf_b0)
+			cfg = &iwl9560_2ac_160_cfg_quz_a0_jf_b0_soc;
+	}
+
 #endif
 
 	pci_set_drvdata(pdev, iwl_trans);
-- 
2.23.0.rc1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/4] iwlwifi: mvm: Allow multicast data frames only when associated
  2019-08-16 12:55 ` [PATCH 1/4] iwlwifi: mvm: Allow multicast data frames only when associated Luca Coelho
@ 2019-08-20 14:02   ` Kalle Valo
  0 siblings, 0 replies; 6+ messages in thread
From: Kalle Valo @ 2019-08-20 14:02 UTC (permalink / raw)
  To: Luca Coelho; +Cc: linux-wireless

Luca Coelho <luca@coelho.fi> wrote:

> From: Ilan Peer <ilan.peer@intel.com>
> 
> The MAC context configuration always allowed multicast data frames
> to pass to the driver for all MAC context types, and in the
> case of station MAC context both when associated and when not
> associated.
> 
> One of the outcomes of this configuration is having the FW forward
> encrypted multicast frames to the driver with Rx status indicating
> that the frame was not decrypted (as expected, since no keys were
> configured yet) which in turn results with unnecessary error
> messages.
> 
> Change this behavior to allow multicast data frames only when they
> are actually expected, e.g., station MAC context is associated etc.
> 
> Signed-off-by: Ilan Peer <ilan.peer@intel.com>
> Signed-off-by: Luca Coelho <luciano.coelho@intel.com>

4 patches applied to wireless-drivers.git, thanks.

50f5604476b2 iwlwifi: mvm: Allow multicast data frames only when associated
884b75696873 iwlwifi: pcie: fix the byte count table format for 22560 devices
17e40e6979aa iwlwifi: pcie: don't switch FW to qnj when ax201 is detected
5a8c31aa6357 iwlwifi: pcie: fix recognition of QuZ devices

-- 
https://patchwork.kernel.org/patch/11097607/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2019-08-20 14:02 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-16 12:55 [PATCH 0/4] iwlwifi: fixes intended for 5.3 2019-08-16 Luca Coelho
2019-08-16 12:55 ` [PATCH 1/4] iwlwifi: mvm: Allow multicast data frames only when associated Luca Coelho
2019-08-20 14:02   ` Kalle Valo
2019-08-16 12:55 ` [PATCH 2/4] iwlwifi: pcie: fix the byte count table format for 22560 devices Luca Coelho
2019-08-16 12:55 ` [PATCH 3/4] iwlwifi: pcie: don't switch FW to qnj when ax201 is detected Luca Coelho
2019-08-16 12:55 ` [PATCH 4/4] iwlwifi: pcie: fix recognition of QuZ devices Luca Coelho

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).