Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp4582862pxv; Tue, 6 Jul 2021 04:36:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxnuIR+CDo+Ew/ZWRkiZWDtdhw/UgVSj2oyIs8QOIUpT11V+2fZLgGwugoM16Mk3S8yTuHF X-Received: by 2002:a17:907:2bc7:: with SMTP id gv7mr18224334ejc.417.1625571418292; Tue, 06 Jul 2021 04:36:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625571418; cv=none; d=google.com; s=arc-20160816; b=M+L84AM8qeNcJ5K8VuvXwWW9ndE8uPBDDbhOH/35H/MQDWz69hYD4/QJr4PP8g+5tY TxM7705KvZNaryMpS35d0V92NvLmiCIhyjHnzd2kjJLG55pFAUsAfBggrMAfQ0msAstR Ws4R80V8J3lHMRu73SDixbYXuXnH3umju7eYgDEIGp9HyaPofXcM5WN61f9ebO6IfJr1 9dCNK1mny4nKgkOaxsEqfbrNI1Ca8XCVsm4YeP2JMR7UKFGcnC9N/xnFL/3zyVjMY4K0 hKBcwWaFy4vs3KKWzPRVDvtgMDF20YYvs1WzwH+I0zBeIIvgKX6S8l35F7EYR2hHP344 An6Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=lhVMoruq3wI+tga1os9plARmaWcNHy9vw6tjXWQZjt4=; b=JA9A7IEbpVMTBvHTAL8hXfCR9vpFpv88RWs2ZGnIXdAVYmX57CN3h+KC2vQ7i26q3+ IbcI8vJ84h4bYR4u0OPnj05E32TeFcBtUKLDkhlHjCLPBB+L9apVIerFXXCBoLsWx92Q lOCz5Z+fcorhOS8KdEtWxNqGiDso8ltZSybfEhpeZ27Poa08dTV5F/jIoH73gZMyDMLL 2lC6IJu+qty5e5fdl7QAZ4qKnt6H4FMN0ZsgPUhISK3AtJiXZHQmnBXzCT/gwp76rxSt QHdVfK0hH0xP3PpAgrD+ZY+rBNgq5Kj5izM9ZGSgAKS54eJxiZCJdg+HvS+nDYvd9Kyi oDrg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="uHBu/vuW"; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g7si13347698ejh.141.2021.07.06.04.36.35; Tue, 06 Jul 2021 04:36:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="uHBu/vuW"; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237883AbhGFLhj (ORCPT + 99 others); Tue, 6 Jul 2021 07:37:39 -0400 Received: from mail.kernel.org ([198.145.29.99]:47570 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237417AbhGFLgI (ORCPT ); Tue, 6 Jul 2021 07:36:08 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 56CFD61D8B; Tue, 6 Jul 2021 11:27:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1625570852; bh=xGHE1GzfeUaCbq123ZkdknOkaKgkF8UPgtE/Z3QZN1E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uHBu/vuWp7ELIClXkB90UWnjknVQ5lo3LODzTO0dAJXCAUsRFAhSw2zkN4G90nfn3 F1fjuPFBruQcJleIDRuj0ZTmK2GeaBACE9esB7WnZW/IoBv0WYaXGPgF06iwZAb/V4 JoRSxjfO0bsQD+W5nHkDTfzDNP3BaPgsmdzjHfoNt+ZHtCcYCJvMX13ZWCNWNBWptS C8llcAuJTLY7DYe6b1nCI7+no0IGpb38K49VIyny/EYWFyJGLrBJOQ0dEi+cbEEjB8 MMMxMp8QBG6sT+3O8wAzzKbVkQAnNffXVHvoLI1kbxHmCMpj0Wwrl27AokSxxGzugx rI7vaHVnfIPmA== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Johannes Berg , Luca Coelho , Sasha Levin , linux-wireless@vger.kernel.org, netdev@vger.kernel.org Subject: [PATCH AUTOSEL 4.19 42/55] iwlwifi: mvm: don't change band on bound PHY contexts Date: Tue, 6 Jul 2021 07:26:25 -0400 Message-Id: <20210706112638.2065023-42-sashal@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210706112638.2065023-1-sashal@kernel.org> References: <20210706112638.2065023-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org From: Johannes Berg [ Upstream commit 8835a64f74c46baebfc946cd5a2c861b866ebcee ] 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 Signed-off-by: Luca Coelho Link: https://lore.kernel.org/r/iwlwifi.20210612142637.e9ac313f70f3.I713b9d109957df7e7d9ed0861d5377ce3f8fccd3@changeid Signed-off-by: Luca Coelho Signed-off-by: Sasha Levin --- .../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 2fad20c845b4..697a66acba9c 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c @@ -3496,6 +3496,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, @@ -3565,19 +3566,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.30.2