Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp656377pxv; Thu, 15 Jul 2021 12:38:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwgxr7ZCdPHc860jzISbZtROIA4GuwHG3J2VxrOjfsZMoYrv4cCQVZytRuaFROC/2cAQPyD X-Received: by 2002:a17:907:770f:: with SMTP id kw15mr7234679ejc.23.1626377916955; Thu, 15 Jul 2021 12:38:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626377916; cv=none; d=google.com; s=arc-20160816; b=uY8KWW1JMmlrrbjyAa/TlqXiZd9aDX0UC+tL4kEwsod4r+KhhRTW6UyG+PC1v3jVPp GqtVOBL/05n2RC1Bl+UEj8jWiWLdkpNIv9/eRr7ygjkZw7/WAZ2nYqRRtzE9HuQ6Z+QQ 3BU1nDGxNRqY28g3cIHmdPMSAurUGmMazRwO3oBX4UfESNCmzIe6br4dhwRiLTasBnG6 J/bK24Tma+ksRZ4o/U/Tht7KahFdYWWO3GRH7ZwcJVPJ4Jb8Z/fNzHPPgb0hLCXR6w+U HNF+o9aZJvOg+IR6G30I24SqdvFeyB1xh7IuXpyunQ3al4UXkCdYeaMY0zExpXan+SGS bUzw== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=5KTKtPU8jZHTGok82lcsFqCZ7PSSMl0MiE033Wcb2dg=; b=evWu83yVk2jGVud3WdI5nJUhfthuQY3L8Fl/VSZMedvG6bsuDOC/y1QksVoQ8rNrmn rv0QV9CKucjUxE62i6K73NIB9V+XyiKWRyvWgEnItcEA4mrg8e8o4JpAxgp3xoOXFlgs S5X5W6FwC8BloVwyLvpryJtWoNkV8WP/wndITUWzoDX+lgH5QzM5SFa+IsmXMo/HivcU Tppvx6woIHYy5cHQTTzjU2RjwzPq/mOBIbbUsA/a9LNrjSudXbLx75JpFslMX8EPbqZn zeNoA/UeGZbS83p5QgHMKaEn1HGBKJdfscIpcVu7qUor9xjrtNp5F+uCn845zo3Av90p kcLQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=XVQMZcSk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n8si9573256edy.1.2021.07.15.12.38.14; Thu, 15 Jul 2021 12:38:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-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=@linuxfoundation.org header.s=korg header.b=XVQMZcSk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344490AbhGOTfO (ORCPT + 99 others); Thu, 15 Jul 2021 15:35:14 -0400 Received: from mail.kernel.org ([198.145.29.99]:51470 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243555AbhGOTLl (ORCPT ); Thu, 15 Jul 2021 15:11:41 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 5550D613E9; Thu, 15 Jul 2021 19:08:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1626376126; bh=N+NjFiyd8DvIA9L1V+wHXA3UPj7jZ0d5f+aLc2aQ30I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XVQMZcSklc4p3mMsjdgaPB7JLBtuMti1m2kxsKyBJMnifudzCiM5cwu0q8G1m3X9w vVs7S7SGRu2pIJtSpuRwL/OKcgc1qsHyIwH/0qcjKZJdUXD3F0zYHuvSoXoEbhD6x7 CLTmM6lZQUqQwv8fk8H6S56LppvVWT1JOrMvYdAo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Johannes Berg , Luca Coelho , Sasha Levin Subject: [PATCH 5.13 138/266] iwlwifi: mvm: dont change band on bound PHY contexts Date: Thu, 15 Jul 2021 20:38:13 +0200 Message-Id: <20210715182638.084682826@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210715182613.933608881@linuxfoundation.org> References: <20210715182613.933608881@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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