Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp629835pxv; Thu, 15 Jul 2021 11:58:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxASja/Ca5niRNBvFpVZBVZgFV81AAPu3jHE0dcVW+4/St4b9gdWdRpISk1mb7NferjJ9Ij X-Received: by 2002:a02:628b:: with SMTP id d133mr5289470jac.27.1626375502087; Thu, 15 Jul 2021 11:58:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626375502; cv=none; d=google.com; s=arc-20160816; b=cLLVNc5Hj/vqsLoDTK/JA89VAzH6TxWW8cFKyDQFtJ5fu4uYhaW1A+sHNZlKq88/qL mQJz+qcERcnmuTn1XzWkM4fx+S6+zYQBJHRb7L+B5q9gEe52/9ikN/NFHXw8jn2DzsRr 9BA+MOTyuHpxglvjIgWW52wnAYA9rkL4q0Vv/QVH/t2PvJs/FNKdoq6i/t3bjJGbplyz EwuNcdbQ7rksqaL/ZTix2zNr/NXn21OO8rDISp0utUaHfckAfh1t6L9ix1l7Vtv1/kbk FH0JiIm3Q4ow7RjS+dbYUjxrEYYcZJDBE44yG4UkjKVUQEPARYSi1plu9qeAMMPseb/g q0ig== 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=hGMYBiY/Bf2nVt8MiQ9BNk7AynSvvUrjsX0c6UzKEpY=; b=dg3konHDuiuUWqo0UxUlVmFKLj7x/PS1bv/kQUR0Tm0gfzlAigN0Qyo2u2b6dCvPhT CB1L8T38kGykJTgqFF8WQr/fUAZ0MAkfwnLmcXqx3hLE/qu1uSKJxNQ0YYpqr1uTKFCd 96z5Zb1DEfrBghWkQlGbS+JcZWZ1N0NSC1dKQ1zkzkv3EgBkuXU4g8wT+AjFqzxfUSJ/ /BD1mOLkeAFcNcgRgcB7VjMgJBOMYrdffP42o43Fh8x/roMqIQQIhN+GQ2hSevW0lrH1 h2VPcAd9mvAvx04NUBofqMXq/ZDoE5crnBSdTEg0/ISpwr/PCRcGLdXZnbLDWsM1qZKM ZGVw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=uGCvwUCc; 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 z10si8135783ioq.37.2021.07.15.11.58.09; Thu, 15 Jul 2021 11:58:22 -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=uGCvwUCc; 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 S242674AbhGOS7v (ORCPT + 99 others); Thu, 15 Jul 2021 14:59:51 -0400 Received: from mail.kernel.org ([198.145.29.99]:57022 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239286AbhGOSxA (ORCPT ); Thu, 15 Jul 2021 14:53:00 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id C6DCC613CA; Thu, 15 Jul 2021 18:50:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1626375006; bh=L8p0SwQFqnS23W3Kn4oqQgCrUhp80/4lWpUPylWHEpE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uGCvwUCcXjVLmWpkbJHrJoDbtT/0eFnE9b/6Tgk7GVA2RbMgxc3oAssQor/dY3YAx F4D11ZOJayNwcC03bU0NJt32KGhbTQrzsQoXC7EuwhZMXeeHW1+wjltrcpxhlvuI+i OFzY0njPk9V+V1YodF+wrcoJ+0N8PSd5zRycV8jo= 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.10 102/215] iwlwifi: mvm: dont change band on bound PHY contexts Date: Thu, 15 Jul 2021 20:37:54 +0200 Message-Id: <20210715182617.349250475@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210715182558.381078833@linuxfoundation.org> References: <20210715182558.381078833@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 d42165559df6..8cba923b1ec6 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c @@ -3794,6 +3794,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, @@ -3874,19 +3875,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