Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp4572320pxv; Tue, 6 Jul 2021 04:21:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxl9zyXG8cKu1yGkX3kCCS92DPk3iSqen6/+SDQKqgIyola9N7fDZyZ9Y3KZ3PVyevaWrOf X-Received: by 2002:a92:d07:: with SMTP id 7mr12653484iln.114.1625570516833; Tue, 06 Jul 2021 04:21:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625570516; cv=none; d=google.com; s=arc-20160816; b=QFq/UnFzWhgFn0IIUWhgzzujhOKZJAYgEZ+C4y33WFtxgQm9y15ZJO/LK/iBh1MGOW N7+2jVXmj1TEe2syBqNTJXXO/n8VUoh1NeMCMU4/VzvAFwLBqZ9LqFd5r0QmO71DHyqa Dh92ZYDlaZxo5LhJE8UHdZ5c3xD1lxruZg22q1STpmFH9ok9Lv6g5n94R5rLftBjoV0w zoDngtlGpJWSS3hxPTKGdzb7wZ4dP+MvTSLm+LfroX/KAO4fK2FlXHPVnxq5Aq0jC7Sn 3EtDxrMr1RTu5TXpjcblZaTLgU6+GxYCoVzvbMITADlyEcsWHCLKb+UKp1WTOY6bzvNV BB2Q== 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=5KTKtPU8jZHTGok82lcsFqCZ7PSSMl0MiE033Wcb2dg=; b=N8un7O1rwhPZOylUCkcJl2HWx0S58h7bLFaUOCIAD7lgZS3WamVO9lXsTLGWTu/ZEP uVlel3CRJW8lzE+V0/IBn9Kkzp7xeHtIiocsAfIgRgmnlSIZBrU78xVAQSYSnrkz6Rdp 5n6wCM62oMmqdTT20DCm8JIe1wxNVk0G4bMS4jjU9cQN4bovwPLpH0rVrez/7k7oduZR ckUXwlM+at/djLDTsZ2+lIV4mzxNYcPbjxq9j8SQN4MX7aFfbTc93IQs7QWbh2sa7LJO nrvvdE2LFRJCvRqoWgdNZ95WjC6eY2lM9UI/0KBw5KcYAp/r5QmL6T+nlzu/07BSc8VI 9vYQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=JLzBQJdZ; 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 b7si19818720ile.135.2021.07.06.04.21.44; Tue, 06 Jul 2021 04:21:56 -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=JLzBQJdZ; 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 S233558AbhGFLXg (ORCPT + 99 others); Tue, 6 Jul 2021 07:23:36 -0400 Received: from mail.kernel.org ([198.145.29.99]:54822 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233378AbhGFLUx (ORCPT ); Tue, 6 Jul 2021 07:20:53 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id DDD4B61C75; Tue, 6 Jul 2021 11:17:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1625570250; bh=N+NjFiyd8DvIA9L1V+wHXA3UPj7jZ0d5f+aLc2aQ30I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JLzBQJdZWVtdfQh+79CuP7/GRpwwyont8rj/7sOUypQxNdZUJcyWTn/b9yWqrV08L G6exk9Tz2N5ME6L9jrdg7dy+YJ0rPyxiohoz8UUGRgquSc5h2mqVZNosPywJ1XQsFw FnoW/2aSLfB8nDp5gnsZrweU4AU+dgXxvJaDNzprrs0HL/4UGPevq3azznUkMxNIIh QQc/lfl34s0drIVhOd2CEzg+MryWzLh58E5swl41ug9+DEf6TIleSPgq6JEfcEi0LE xp5uAFb2UhYW6fdCdkjuO6ItmYAP9AvDvq0dExH9GsI8h75Le86eIq11vQYaD1mBnV qDtBOv/l0tkjQ== 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 5.13 149/189] iwlwifi: mvm: don't change band on bound PHY contexts Date: Tue, 6 Jul 2021 07:13:29 -0400 Message-Id: <20210706111409.2058071-149-sashal@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210706111409.2058071-1-sashal@kernel.org> References: <20210706111409.2058071-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 607d5d564928..141d9fc299b0 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c @@ -3800,6 +3800,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, @@ -3880,19 +3881,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