From patchwork Fri Apr 12 08:53:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mingyen Hsieh X-Patchwork-Id: 788579 Received: from mailgw02.mediatek.com (unknown [210.61.82.184]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2942153E2B for ; Fri, 12 Apr 2024 08:54:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=210.61.82.184 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712912053; cv=none; b=lnZWiu9+khp6QVPEorJxdPm469d9sC/FqWlAuchTOjXehQ8z6xMsh3IgndSQg9Jq1bO2HgyjOL77TGjfySuGXjX6zU8teo90rMEGcN0k330d3XP9FCM4PVsc/6cj/RjesYKzmPWmkUKpzSE/qo4Y2n2n25P+HRk2qq5sTQ5r2YU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712912053; c=relaxed/simple; bh=gV6QO15hzr3rqH5uNZxNncGpQ09deA7YpjI/SJB8uIA=; h=From:To:CC:Subject:Date:Message-ID:MIME-Version:Content-Type; b=qrDq/I6YCqvkTDwO5l26J/nKFKJRAKTKaJ46Lr+XCeyCYqlTIFV6bb7b+/y/LwKIm+IUerkL98TSI086KfPQC451mLw1yVjtrBNtm9l80IkO62spwr+/ppj05s8TY4KgrIH4SRXsTEZgC5nKyObuAAKVAOfC7rrG1t4LsCKMeh0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=mediatek.com; spf=pass smtp.mailfrom=mediatek.com; dkim=pass (1024-bit key) header.d=mediatek.com header.i=@mediatek.com header.b=ZEuztPpa; arc=none smtp.client-ip=210.61.82.184 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=mediatek.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=mediatek.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=mediatek.com header.i=@mediatek.com header.b="ZEuztPpa" X-UUID: 360c1e34f8aa11ee935d6952f98a51a9-20240412 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Type:MIME-Version:Message-ID:Date:Subject:CC:To:From; bh=Oa0IHlTEkqm/Zd9yc51OmvWVeaF8/iRSN+iJu9U4MUM=; b=ZEuztPpaoChX/gDOkSEkGkx2mMU3eNh9Y9IAjJCfOrsfS4IcEOpvqHp+lvhb8pNgHeLg68cM2T2iq9H0wnjOtoszVpTSXRddHNP7bUr5aRAV/6uAfmUw/zGfCOcvwfUGUqj+BtjG9YJ5VMFFN9AG1DMOU/y9a3CcqIQaZJyp5so=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.37, REQID:934bc3d7-6557-430b-acb6-a9fc0226f8b1, IP:0, U RL:0,TC:0,Content:0,EDM:0,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTION: release,TS:0 X-CID-META: VersionHash:6f543d0, CLOUDID:10b2d5fa-ed05-4274-9204-014369d201e8, B ulkID:nil,BulkQuantity:0,Recheck:0,SF:102,TC:nil,Content:0,EDM:-3,IP:nil,U RL:0,File:nil,RT:nil,Bulk:nil,QS:nil,BEC:nil,COL:0,OSI:0,OSA:0,AV:0,LES:1, SPR:NO,DKR:0,DKP:0,BRR:0,BRE:0 X-CID-BVR: 0 X-CID-BAS: 0,_,0,_ X-CID-FACTOR: TF_CID_SPAM_SNR X-UUID: 360c1e34f8aa11ee935d6952f98a51a9-20240412 Received: from mtkmbs14n2.mediatek.inc [(172.21.101.76)] by mailgw02.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 1992218361; Fri, 12 Apr 2024 16:54:02 +0800 Received: from mtkmbs11n1.mediatek.inc (172.21.101.185) by mtkmbs13n1.mediatek.inc (172.21.101.193) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.26; Fri, 12 Apr 2024 16:54:01 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkmbs11n1.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.1118.26 via Frontend Transport; Fri, 12 Apr 2024 16:54:01 +0800 From: Mingyen Hsieh To: , CC: , , , , , , , , , , , , , , Leon Yen , Ming Yen Hsieh Subject: [PATCH] wifi: mt76: mt7921: avoid undesired changes of the preset regulatory domain Date: Fri, 12 Apr 2024 16:53:57 +0800 Message-ID: <20240412085357.13756-1-mingyen.hsieh@mediatek.com> X-Mailer: git-send-email 2.18.0 Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Leon Yen Some countries have strict RF restrictions where changing the regulatory domain dynamically based on the connected AP is not acceptable. This patch disables Beacon country IE hinting when a valid country code is set from usersland (e.g., by system using iw or CRDA). Signed-off-by: Leon Yen Signed-off-by: Ming Yen Hsieh Tested-by: David Ruth --- drivers/net/wireless/mediatek/mt76/mt7921/init.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/init.c b/drivers/net/wireless/mediatek/mt76/mt7921/init.c index ef0c721d26e3..3c9a5fcd6924 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7921/init.c +++ b/drivers/net/wireless/mediatek/mt76/mt7921/init.c @@ -135,6 +135,13 @@ mt7921_regd_notifier(struct wiphy *wiphy, dev->mt76.region = request->dfs_region; dev->country_ie_env = request->country_ie_env; + if (request->initiator == NL80211_REGDOM_SET_BY_USER) { + if (dev->mt76.alpha2[0] == '0' && dev->mt76.alpha2[1] == '0') + wiphy->regulatory_flags &= ~REGULATORY_COUNTRY_IE_IGNORE; + else + wiphy->regulatory_flags |= REGULATORY_COUNTRY_IE_IGNORE; + } + if (pm->suspended) return;