linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Luca Coelho <luca@coelho.fi>
To: kvalo@codeaurora.org
Cc: luca@coelho.fi, linux-wireless@vger.kernel.org
Subject: [PATCH 05/12] iwlwifi: mvm: don't change band on bound PHY contexts
Date: Sat, 12 Jun 2021 14:32:38 +0300	[thread overview]
Message-ID: <iwlwifi.20210612142637.e9ac313f70f3.I713b9d109957df7e7d9ed0861d5377ce3f8fccd3@changeid> (raw)
In-Reply-To: <20210612113245.691117-1-luca@coelho.fi>

From: Johannes Berg <johannes.berg@intel.com>

When we have a P2P Device active, we attempt to only change the
PHY context it uses when we get a new remain-on-channel, if the
P2P Device is the only user of the PHY context.

This is fine if we're switching within a band, but if we're
switching bands then the switch implies a removal and re-add
of the PHY context, which isn't permitted by the firmware while
it's bound to an interface.

Fix the code to skip the unbind/release/... cycle only if the
band doesn't change (or we have old devices that can switch the
band on the fly as well.)

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
---
 .../net/wireless/intel/iwlwifi/mvm/mac80211.c | 24 ++++++++++++++-----
 1 file changed, 18 insertions(+), 6 deletions(-)

diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
index 8fff558ac821..80dd4506f205 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
@@ -3838,6 +3838,7 @@ static int iwl_mvm_roc(struct ieee80211_hw *hw,
 	struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
 	struct cfg80211_chan_def chandef;
 	struct iwl_mvm_phy_ctxt *phy_ctxt;
+	bool band_change_removal;
 	int ret, i;
 
 	IWL_DEBUG_MAC80211(mvm, "enter (%d, %d, %d)\n", channel->hw_value,
@@ -3918,19 +3919,30 @@ static int iwl_mvm_roc(struct ieee80211_hw *hw,
 	cfg80211_chandef_create(&chandef, channel, NL80211_CHAN_NO_HT);
 
 	/*
-	 * Change the PHY context configuration as it is currently referenced
-	 * only by the P2P Device MAC
+	 * Check if the remain-on-channel is on a different band and that
+	 * requires context removal, see iwl_mvm_phy_ctxt_changed(). If
+	 * so, we'll need to release and then re-configure here, since we
+	 * must not remove a PHY context that's part of a binding.
 	 */
-	if (mvmvif->phy_ctxt->ref == 1) {
+	band_change_removal =
+		fw_has_capa(&mvm->fw->ucode_capa,
+			    IWL_UCODE_TLV_CAPA_BINDING_CDB_SUPPORT) &&
+		mvmvif->phy_ctxt->channel->band != chandef.chan->band;
+
+	if (mvmvif->phy_ctxt->ref == 1 && !band_change_removal) {
+		/*
+		 * Change the PHY context configuration as it is currently
+		 * referenced only by the P2P Device MAC (and we can modify it)
+		 */
 		ret = iwl_mvm_phy_ctxt_changed(mvm, mvmvif->phy_ctxt,
 					       &chandef, 1, 1);
 		if (ret)
 			goto out_unlock;
 	} else {
 		/*
-		 * The PHY context is shared with other MACs. Need to remove the
-		 * P2P Device from the binding, allocate an new PHY context and
-		 * create a new binding
+		 * The PHY context is shared with other MACs (or we're trying to
+		 * switch bands), so remove the P2P Device from the binding,
+		 * allocate an new PHY context and create a new binding.
 		 */
 		phy_ctxt = iwl_mvm_get_free_phy_ctxt(mvm);
 		if (!phy_ctxt) {
-- 
2.32.0.rc2


  parent reply	other threads:[~2021-06-12 11:32 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-12 11:32 [PATCH 00/12] iwlwifi: updates intended for v5.14 2021-06-12 Luca Coelho
2021-06-12 11:32 ` [PATCH 01/12] iwlwifi: mvm: support BIOS enable/disable for 11ax in Russia Luca Coelho
2021-06-22 12:12   ` Luca Coelho
2021-06-12 11:32 ` [PATCH 02/12] iwlwifi: mvm: pass the clock type to iwl_mvm_get_sync_time() Luca Coelho
2021-06-12 11:32 ` [PATCH 03/12] iwlwifi: mvm: fix indentation in some scan functions Luca Coelho
2021-06-12 11:32 ` [PATCH 04/12] iwlwifi: remove unused REMOTE_WAKE_CONFIG_CMD definitions Luca Coelho
2021-06-12 11:32 ` Luca Coelho [this message]
2021-06-12 11:32 ` [PATCH 06/12] iwlwifi: pcie: handle pcim_iomap_table() failures better Luca Coelho
2021-06-12 11:32 ` [PATCH 07/12] iwlwifi: increase PNVM load timeout Luca Coelho
2021-06-12 11:32 ` [PATCH 08/12] iwlwifi: pcie: Add support for AX231 radio module with Ma devices Luca Coelho
2021-06-12 11:32 ` [PATCH 09/12] iwlwifi: pcie: print interrupt number, not index Luca Coelho
2021-06-12 11:32 ` [PATCH 10/12] iwlwifi: pcie: remove CSR_HW_RF_ID_TYPE_CHIP_ID Luca Coelho
2021-06-12 11:32 ` [PATCH 11/12] iwlwifi: remove duplicate iwl_ax201_cfg_qu_hr declaration Luca Coelho
2021-06-12 11:32 ` [PATCH 12/12] iwlwifi: yoyo: support region TLV version 2 Luca Coelho

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=iwlwifi.20210612142637.e9ac313f70f3.I713b9d109957df7e7d9ed0861d5377ce3f8fccd3@changeid \
    --to=luca@coelho.fi \
    --cc=kvalo@codeaurora.org \
    --cc=linux-wireless@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).