Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp23190pxv; Wed, 21 Jul 2021 14:23:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxTaSsqGGpPu27gwc6N6JPB1hX/SgrRkxVgUaB9TYdLUsv5OcWOlCVtG8ffcSFy8/toknhR X-Received: by 2002:a6b:f41a:: with SMTP id i26mr28087934iog.162.1626902638843; Wed, 21 Jul 2021 14:23:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626902638; cv=none; d=google.com; s=arc-20160816; b=pNvGn9vrV9Yyzl2UFWfS6UD2JZzMsj1pqOWmIAcDh+RzVyfQwuNXpaQ/JsWBhiif/u s3NrJD3auInSrODyfsWfe5zkxz1W7ERyLnbaJhBAU8beIiU1tn+E4TBrwHWsxhH8DxjN yT82e/o57f6gl2m9bXTXkDICY392qqGFgr+dR6+83Rrc3O43MoQ71bEkqnTJKZGW4fEj yqKzaASES4oadmkvNU+8/qziZVs2GMLFs07D9T2v1pWiUCPogvvHUI3ogzpK0N/HJwPw HDN7ERnnkNf7iD0mxWNCrBipoZFAUQmx77511QWSNt435MfOrNOfhEkl/9aenOmDCYfi ipXw== 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 :dmarc-filter:sender:dkim-signature; bh=ZNqUb9UHUwfNPy7Oe0uKc3fVtisXthGHPhG2433Lw7M=; b=KE4kUX8t42P7QrkoJx+2gAiyQGszybfMQLhC88Jsr6KXXP/N5F4ySoR0jGV5xR98Ze RCJKySw87zxREL9j36BtTSkqc/nG/4VSnsYxRwHiJKvdNhk8xuhl7Cn8HyIvwAGp9gEt SGv4nADg50g8JAc1LQyXtNYQd63hTJ8yNbd6wa0R3tPoblyU87H/nOgczAbRLZmj8tOk ew7x/7HbE1YM/AIscKhGtwfIGXKdODHxZ/WWuB1IPQA/WyAc5hoLG/maZs97rdXSnAxi C+rY+Wc5AuuL9SSisKpfbrqt0c0sa5j6ngccHwVC+THbkvWN+kH8LezrQzB1TMt6nkIo j24Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mg.codeaurora.org header.s=smtp header.b=dtTIYsAY; 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 u11si37093397jau.121.2021.07.21.14.23.47; Wed, 21 Jul 2021 14:23:58 -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=@mg.codeaurora.org header.s=smtp header.b=dtTIYsAY; 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 S229684AbhGUUkO (ORCPT + 99 others); Wed, 21 Jul 2021 16:40:14 -0400 Received: from m43-7.mailgun.net ([69.72.43.7]:24942 "EHLO m43-7.mailgun.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229675AbhGUUkN (ORCPT ); Wed, 21 Jul 2021 16:40:13 -0400 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1626902449; h=Content-Transfer-Encoding: MIME-Version: References: In-Reply-To: Message-Id: Date: Subject: Cc: To: From: Sender; bh=ZNqUb9UHUwfNPy7Oe0uKc3fVtisXthGHPhG2433Lw7M=; b=dtTIYsAY8TNAGM2yg1New3wenYLv8Hx6skf+wAVweWMq1z5wK9/1ybjRXZ+cjGgx7Tbog5V1 04i4AbxyHbqN7bE/Fvsix/l0I1pogMYeQt4OhJf+CwUZzzmdVis7Ac03k3DbnYCRJMRozfmI 4r/j7i3MDi57ezNbtI9t4UzZaJ0= X-Mailgun-Sending-Ip: 69.72.43.7 X-Mailgun-Sid: WyI3YTAwOSIsICJsaW51eC13aXJlbGVzc0B2Z2VyLmtlcm5lbC5vcmciLCAiYmU5ZTRhIl0= Received: from smtp.codeaurora.org (ec2-35-166-182-171.us-west-2.compute.amazonaws.com [35.166.182.171]) by smtp-out-n03.prod.us-east-1.postgun.com with SMTP id 60f88fb1b653fbdadd8e8bd5 (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Wed, 21 Jul 2021 21:20:49 GMT Sender: jouni=codeaurora.org@mg.codeaurora.org Received: by smtp.codeaurora.org (Postfix, from userid 1001) id 541C1C433F1; Wed, 21 Jul 2021 21:20:48 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-caf-mail-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=ALL_TRUSTED,BAYES_00,SPF_FAIL autolearn=no autolearn_force=no version=3.4.0 Received: from jouni.codeaurora.org (85-76-67-217-nat.elisa-mobile.fi [85.76.67.217]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: jouni) by smtp.codeaurora.org (Postfix) with ESMTPSA id 3B34DC433D3; Wed, 21 Jul 2021 21:20:46 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 3B34DC433D3 Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; spf=fail smtp.mailfrom=jouni@codeaurora.org From: Jouni Malinen To: Kalle Valo Cc: ath11k@lists.infradead.org, linux-wireless@vger.kernel.org, Sriram R , Jouni Malinen Subject: [PATCH 03/12] ath11k: Avoid reg rules update during firmware recovery Date: Thu, 22 Jul 2021 00:20:20 +0300 Message-Id: <20210721212029.142388-3-jouni@codeaurora.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210721212029.142388-1-jouni@codeaurora.org> References: <20210721212029.142388-1-jouni@codeaurora.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org From: Sriram R During firmware recovery, the default reg rules which are received via WMI_REG_CHAN_LIST_CC_EVENT can overwrite the currently configured user regd. See below snap for example, root@OpenWrt:/# iw reg get | grep country country FR: DFS-ETSI country FR: DFS-ETSI country FR: DFS-ETSI country FR: DFS-ETSI root@OpenWrt:/# echo assert > /sys/kernel/debug/ath11k/ipq8074\ hw2.0/simulate_f w_crash [ 5290.471696] ath11k c000000.wifi1: pdev 1 successfully recovered root@OpenWrt:/# iw reg get | grep country country FR: DFS-ETSI country US: DFS-FCC country US: DFS-FCC country US: DFS-FCC In the above, the user configured country 'FR' is overwritten when the rules of default country 'US' are received and updated during recovery. Hence avoid processing of these rules in general during firmware recovery as they have been already applied during driver registration or after last set user country is configured. This scenario applies for both AP and STA devices basically because cfg80211 is not aware of the recovery and only the driver recovers, but changing or resetting of the reg domain during recovery is not needed so as to continue with the configured regdomain currently in use. Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.4.0.1-01460-QCAHKSWPL_SILICONZ-1 Signed-off-by: Sriram R Signed-off-by: Jouni Malinen --- drivers/net/wireless/ath/ath11k/wmi.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/drivers/net/wireless/ath/ath11k/wmi.c b/drivers/net/wireless/ath/ath11k/wmi.c index a95756dc14a1..6880c7527df8 100644 --- a/drivers/net/wireless/ath/ath11k/wmi.c +++ b/drivers/net/wireless/ath/ath11k/wmi.c @@ -5848,6 +5848,17 @@ static int ath11k_reg_chan_list_event(struct ath11k_base *ab, struct sk_buff *sk pdev_idx = reg_info->phy_id; + /* Avoid default reg rule updates sent during FW recovery if + * it is already available + */ + spin_lock(&ab->base_lock); + if (test_bit(ATH11K_FLAG_RECOVERY, &ab->dev_flags) && + ab->default_regd[pdev_idx]) { + spin_unlock(&ab->base_lock); + goto mem_free; + } + spin_unlock(&ab->base_lock); + if (pdev_idx >= ab->num_radios) { /* Process the event for phy0 only if single_pdev_only * is true. If pdev_idx is valid but not 0, discard the -- 2.25.1