Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp1299681pxj; Sat, 12 Jun 2021 04:36:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzBlKtWWmj4E7GxdDDrdjSoX+/Is7ZlcHQMHM++pO9E9swsOsWCK6e4nLwRQYTuxsXvLHMt X-Received: by 2002:a17:906:b317:: with SMTP id n23mr7672841ejz.324.1623497809475; Sat, 12 Jun 2021 04:36:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623497809; cv=none; d=google.com; s=arc-20160816; b=liIQuJYJlUcTLIPOaXysrP9pcMr6mHU+xe0X7O9RJtph8Zi1DJtvQuiq9DbiWHY5tC 3qQ5W3oScpwDQFIi/vplH4DiO/WU54/aC8FXDTft9w9eSGM3IqvILaSxtsmbKqxHhVML w3giVt7YOweW/n34IkqQIgC72gKwM96pkE4U2mcs0vQRAoR40hvDRnJliFgyr3g42er8 Cvp+x2nEsBIKRN4vZJRvvcHaRGQwvVxwSrd6Vv2IHpRILz3tCYix5ez05KwgoVxbWAtE kJP2YraSZy4+i1cOY8M6THkPy5dpibThzqrLtXBSbNNM90Y59jbtvLHNH1F7ERWepYTn soIg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:subject:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:cc:to:from; bh=clHFkJC4CC9n7jaJ/PvpOumMZYqJ/BI7sGNVxr/WQMg=; b=FNjtNxwJFGTc65GHH4CWRfuCfKwa0UOoSSV9FHiRSNjxTgZhjIeTUdddYT33a2dAUe 7vT4Omyya5HLfrJwkxxoclge/AMucJz82jji8eMzKrun3ezYTyw5R71pOFft3TrJ5kZJ H/Ea303pEKh/Jmql9YdRilzoFpiTey2+tVWnk+zBVq6YbUQINCMAObrvaSGd6+fFI71X BIclFVQ2bSlGlMpx9cmbyNKgKYdp35EIhJzV3atOM4FawD/W4N9CwVrvDnbG2w8rAyka 0KlVZHfWlYXZAb+Tm6OScAdOVad16mJXOPHi5J56dH+r4fZ+uU8wP+YQg477pXzvBTAj yN8w== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f3si6752198edt.290.2021.06.12.04.36.26; Sat, 12 Jun 2021 04:36:49 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231236AbhFLLew (ORCPT + 99 others); Sat, 12 Jun 2021 07:34:52 -0400 Received: from paleale.coelho.fi ([176.9.41.70]:47570 "EHLO farmhouse.coelho.fi" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S231196AbhFLLev (ORCPT ); Sat, 12 Jun 2021 07:34:51 -0400 Received: from [192.130.48.226] (helo=kveik.superpark.guest) by farmhouse.coelho.fi with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94) (envelope-from ) id 1ls1sf-001V8i-HJ; Sat, 12 Jun 2021 14:32:51 +0300 From: Luca Coelho To: kvalo@codeaurora.org Cc: luca@coelho.fi, linux-wireless@vger.kernel.org Date: Sat, 12 Jun 2021 14:32:38 +0300 Message-Id: X-Mailer: git-send-email 2.32.0.rc2 In-Reply-To: <20210612113245.691117-1-luca@coelho.fi> References: <20210612113245.691117-1-luca@coelho.fi> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Checker-Version: SpamAssassin 3.4.5-pre1 (2020-06-20) on farmhouse.coelho.fi X-Spam-Level: X-Spam-Status: No, score=-2.9 required=5.0 tests=ALL_TRUSTED,BAYES_00 autolearn=ham autolearn_force=no version=3.4.5-pre1 Subject: [PATCH 05/12] iwlwifi: mvm: don't change band on bound PHY contexts Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org From: Johannes Berg 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 --- .../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