Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp621463pxv; Thu, 15 Jul 2021 11:45:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzI1FnACAMfZqWPUsSpEAusydVhUWPbGe2dnMzAj0et0U1gvg5DKfLcNZ6ZJO04RRdJO+JW X-Received: by 2002:a5d:9648:: with SMTP id d8mr4147774ios.171.1626374740895; Thu, 15 Jul 2021 11:45:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626374740; cv=none; d=google.com; s=arc-20160816; b=DyNEF6y2/2ccwpcMmSnibHzF6K5B8zfGIIZZl3EjLeFnk1oadSAA2jYXPP0PbvM4oQ WSH9P09eOPf/kEkLzxagG6U6yUZxltNPDwQeW779YD1XFaguQRs28wFPkF4AnvY3x5Zl 8cVUW/amqg5iH3DjmgBeKq27dcc4HYKGT0PrUrOAe9Q8m/3Nh26duGSwQZMa7XdCCskg 9GgJo7tadgkr9gSbcX7CQH4VQSgiz2//yErEGE+Hy5kRIwDY1bugQQBaQ2P5qDk/wwa0 SiZRvhoHL07VAtK3nwVQm6jvWC5KbcWFkdrRSLuuIf1EaLYiBcQvu/jb2N+Nh0twU9QI Ufjw== 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=ATmTg7Q0cyNaFyf8YQ7WqEL76EiCRLcZsR8zs2Xj7GE=; b=1Edektp5zZjHiXKPoTdxNqoQifFvJjrYdaO785alDkTChjlhM2k23jsANW3oHNzNTD J8nzG06Bg5eUK7sql70WibwxJtqTWrrCl2ASCwf0c05q9ysJpgqFV6nr5CVUbxhPgp9j kII4bI2z2jHHGsaoqevoAzlcvK4GbKIqDjd75vZ40sg/20zUnbcSggC4yu1HOz5tbGkE o5K5lLpGy+o3jsWm5rfIOCYAOih3InlB0tk+DVV+vyZ+dOP7NJATo29AiVBf3Hq+E42Q FEI6BjJw9nVpPaXp8sExTv7sGrKH9jBnsTjvKhhJ0HdoFUTum3eQfL1HzSdCQvoRJqF8 haBg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=PVLehxEB; 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 187si7107293jau.8.2021.07.15.11.45.28; Thu, 15 Jul 2021 11:45:40 -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=PVLehxEB; 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 S237971AbhGOSqW (ORCPT + 99 others); Thu, 15 Jul 2021 14:46:22 -0400 Received: from mail.kernel.org ([198.145.29.99]:46634 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237288AbhGOSpq (ORCPT ); Thu, 15 Jul 2021 14:45:46 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id B6992613D0; Thu, 15 Jul 2021 18:42:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1626374573; bh=P5+KMcJDFo2yGi04uMWeiO0IkMItRttzt4J4oMExSnw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PVLehxEBp6v2QqXnhXSB3HpfhVxlTlpd2tgC2jscwIAjTtIn2WqWrDewbbNz3EjE1 c8SETYsfoUE4xNl7t2Y9g/22LdSJoVCvs7QfbuUANuh7EKShYMI2ZSE45k7uidYlyS Nf/eDmYXtxkS9QNqitndwkEmgmnBEAenoROrrshI= 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.4 055/122] iwlwifi: mvm: dont change band on bound PHY contexts Date: Thu, 15 Jul 2021 20:38:22 +0200 Message-Id: <20210715182503.856637778@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210715182448.393443551@linuxfoundation.org> References: <20210715182448.393443551@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 fc6430edd110..09b1a6beee77 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c @@ -3725,6 +3725,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, @@ -3794,19 +3795,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