Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp3616256ioo; Mon, 30 May 2022 06:09:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzQtjyEQGWOZ4vOO0hGpK8ZkOLBA8jxdX5F9ouhYYz3F69KRNs2tKGa240mTvAnds0CZhNG X-Received: by 2002:a17:907:3dac:b0:6fe:c707:94e7 with SMTP id he44-20020a1709073dac00b006fec70794e7mr35729375ejc.268.1653916169178; Mon, 30 May 2022 06:09:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653916169; cv=none; d=google.com; s=arc-20160816; b=LDLHNUMyGwNh6nBWOf9Js62N+uQZJYY6vE14DK+Htcign+5f8Zv/+j+zrl2Dw64mI8 BKJS7/8tlTqQv+I9GkEqRBl4lsxhxW1x+3s+tGPBD1h6m/Do8aYE6lYSXQrZj4+5hq0p neOmAGN5yPBUsiZ/MArMjNGSv9lil0aNArULkDbZj6ECTJT2dl9ed48q0jEr20+TqWcQ pF/KDYjCm10yWfdZvDOzV8zInjtYulnsSOjNF9V7v2TD3nBtf41hM5WrcSIgwwuCO9wW onedxmueLRJDCpUMM+SDKlv80E3EMMh8Aa/1uHlXwo0FsE2eh/6L91wo+IYqTW1/O6IZ aYiQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:date:message-id:user-agent:cc:to:references :in-reply-to:from:subject:content-transfer-encoding:mime-version :dkim-signature; bh=fldGEZZCvjYfq5P23rSMtSQhO/Ec1O3tWonMw8oFpVU=; b=G/kSJsv9lIgErAKNMub4My8iKYomErmvoOuFQ1wFVeXIyRy2DO7syx0icMRj9pRp8Y qQqlQ2PW8znxwhX18DCqQnFbMJVl0HAh5GxXCC1hrWFRVflJEABze38eubyTFI+d1UBI 6+QPnF+eZ2QeOmhObMhmDFiWUkd9T3fC5uO84rVO/jxJ7By2MJYwHHcMwQmJhrEx1e7h AZ3dU+CFp02EC9YTnUdtbObfskGdy3YX3Fw1XJNCQXHEB6/KDqHihvRDGYixZSJEjhSZ /sLJLZY9KsKJIE+y0EgrKGcCQbOyPhK1ZLrt69sSmel2pSY8edGRv6/pKqhRVwndCuX/ 90xw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=R4WZGMLl; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f37-20020a05640232a500b0042aa92d966esi7543113eda.244.2022.05.30.06.09.05; Mon, 30 May 2022 06:09:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=R4WZGMLl; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235697AbiE3L0O (ORCPT + 67 others); Mon, 30 May 2022 07:26:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52706 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235690AbiE3L0M (ORCPT ); Mon, 30 May 2022 07:26:12 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A31A27CDD0 for ; Mon, 30 May 2022 04:26:09 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 40C9BB80B9B for ; Mon, 30 May 2022 11:26:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E48F3C385B8; Mon, 30 May 2022 11:26:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1653909966; bh=oPHilKQIe5gLHuQN2VeXrTQUijPOh1oH+Vyh0JO1fl0=; h=Subject:From:In-Reply-To:References:To:Cc:Date:From; b=R4WZGMLltXB7FBGy7tauO0EfwCdU50Z8qCzJHahPBpAIwg7adLWN3u2CM+AqjdBE/ nFBGgabMKpKi0cwCjPwvLN53xR0SO4Tca37pNAnytz2JwCKBEs1nuWgXHycIipk2Lx zJLLuDvZg02dZ85euYlVyZniTpI+J+oo29brW4nY3nwrAQKbPB13NmpeVDIAEIFkBH x82Bvs9A9XtY1X6kM0m09qxsuiL89+kF3erLY+PDnAjmLrDOaNtZ46lvtkkg9tUx2C b9XUFyYCEPbrgFzml+1ZjTDHd3Bkh2zNecnc8kDQi7QcBm4ebffP3c4EQxutF7KDCo iJINGN8nR9YMg== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: Re: [PATCH] ath10k: fix regdomain info of iw reg set/get From: Kalle Valo In-Reply-To: <20220525132247.23459-1-quic_wgong@quicinc.com> References: <20220525132247.23459-1-quic_wgong@quicinc.com> To: Wen Gong Cc: , , User-Agent: pwcli/0.1.1-git (https://github.com/kvalo/pwcli/) Python/3.7.3 Message-ID: <165390996386.3436.14401468326254017675.kvalo@kernel.org> Date: Mon, 30 May 2022 11:26:05 +0000 (UTC) X-Spam-Status: No, score=-7.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Wen Gong wrote: > When wlan load, firmware report the reg code with 0x6C for QCA6174, > it is world reg which checked by ath_is_world_regd(), then the reg > will be save into reg_world_copy of ath_common in ath_regd_init(). > Later the regulatory of ath_common is updated to another country > code such as "US" in ath_reg_notifier_apply() by below call stack. > After that, regulatory_hint() is called in ath10k_mac_register() > and it lead "iw reg get" show two regdomain info as below. > > global > country US: DFS-FCC > (2400 - 2472 @ 40), (N/A, 30), (N/A) > (5150 - 5250 @ 80), (N/A, 23), (N/A), AUTO-BW > (5250 - 5350 @ 80), (N/A, 23), (0 ms), DFS, AUTO-BW > (5470 - 5730 @ 160), (N/A, 23), (0 ms), DFS > (5730 - 5850 @ 80), (N/A, 30), (N/A) > (57240 - 71000 @ 2160), (N/A, 40), (N/A) > > phy#0 > country US: DFS-FCC > (2400 - 2472 @ 40), (N/A, 30), (N/A) > (5150 - 5250 @ 80), (N/A, 23), (N/A), AUTO-BW > (5250 - 5350 @ 80), (N/A, 23), (0 ms), DFS, AUTO-BW > (5470 - 5730 @ 160), (N/A, 23), (0 ms), DFS > (5730 - 5850 @ 80), (N/A, 30), (N/A) > (57240 - 71000 @ 2160), (N/A, 40), (N/A) > > [ 4255.704975] Call Trace: > [ 4255.704983] ath_reg_notifier_apply+0xa6/0xc5 [ath] > [ 4255.704991] ath10k_reg_notifier+0x2f/0xd2 [ath10k_core] > [ 4255.705010] wiphy_regulatory_register+0x5f/0x69 [cfg80211] > [ 4255.705020] wiphy_register+0x459/0x8f0 [cfg80211] > [ 4255.705042] ? ieee80211_register_hw+0x3a6/0x7d1 [mac80211] > [ 4255.705049] ? __kmalloc+0xf4/0x218 > [ 4255.705058] ? ieee80211_register_hw+0x3a6/0x7d1 [mac80211] > [ 4255.705066] ? ath10k_mac_register+0x70/0xaab [ath10k_core] > [ 4255.705075] ieee80211_register_hw+0x51a/0x7d1 [mac80211] > [ 4255.705084] ath10k_mac_register+0x8b4/0xaab [ath10k_core] > [ 4255.705094] ath10k_core_register_work+0xa5e/0xb45 [ath10k_core] > [ 4255.705100] ? __schedule+0x61f/0x7d3 > [ 4255.705105] process_one_work+0x1b7/0x392 > [ 4255.705109] worker_thread+0x271/0x35d > [ 4255.705112] ? pr_cont_work+0x58/0x58 > [ 4255.705116] kthread+0x13f/0x147 > [ 4255.705119] ? pr_cont_work+0x58/0x58 > [ 4255.705123] ? kthread_destroy_worker+0x62/0x62 > [ 4255.705126] ret_from_fork+0x22/0x40 > > At this moment, the two regdomain info is same, when run "iw reg set KR", > the global regdomain info changed to KR, but the regdomain of phy#0 > does not change again. It leads inconsistent values between global and > phy#0 as below. > > global > country KR: DFS-JP > (2402 - 2482 @ 40), (N/A, 13), (N/A) > (5170 - 5250 @ 80), (N/A, 20), (N/A), AUTO-BW > (5250 - 5330 @ 80), (N/A, 20), (0 ms), DFS, AUTO-BW > (5490 - 5710 @ 160), (N/A, 30), (0 ms), DFS > (5735 - 5835 @ 80), (N/A, 30), (N/A) > (57000 - 66000 @ 2160), (N/A, 43), (N/A) > > phy#0 > country US: DFS-FCC > (2400 - 2472 @ 40), (N/A, 30), (N/A) > (5150 - 5250 @ 80), (N/A, 23), (N/A), AUTO-BW > (5250 - 5350 @ 80), (N/A, 23), (0 ms), DFS, AUTO-BW > (5470 - 5730 @ 160), (N/A, 23), (0 ms), DFS > (5730 - 5850 @ 80), (N/A, 30), (N/A) > (57240 - 71000 @ 2160), (N/A, 40), (N/A) > > The initial reg code is 0x6C which saved in reg_world_copy of ath_common, > and the code US is updated from cfg80211 later, so ath10k should also > check the initial reg code before regulatory_hint(). > > After this fix, regdomain info is same between "iw reg get" and "iw reg > set xx", it does not have the regdomain info of phy#0 again. > > global > country KR: DFS-JP > (2402 - 2482 @ 40), (N/A, 13), (N/A) > (5170 - 5250 @ 80), (N/A, 20), (N/A), AUTO-BW > (5250 - 5330 @ 80), (N/A, 20), (0 ms), DFS, AUTO-BW > (5490 - 5710 @ 160), (N/A, 30), (0 ms), DFS > (5735 - 5835 @ 80), (N/A, 30), (N/A) > (57000 - 66000 @ 2160), (N/A, 43), (N/A) > > This does not effect the channel list and power which ath10k used. > When the country code for regulatory_hint() in ath10k_mac_register() > is same with the global country code, then reg_set_rd_driver() of > cfg80211 called from crda which return -EALREADY to set_regdom() and > then update_all_wiphy_regulatory() will not be called while wlan load. > When run "iw reg set xx", reg_get_regdomain() which used by function > handle_channel() in net/wirelss/reg.c always use the regdomain > returned by get_cfg80211_regdom() because the initiator of last > regulatory_request is NL80211_REGDOM_SET_BY_USER, get_cfg80211_regdom() > is the global regdomain, then all the ieee80211_channel info is updated > in handle_channel() with the global regdomain. > > Tested-on: QCA6174 hw3.2 SDIO WLAN.RMH.4.4.1-00049 > Tested-on: QCA9984 hw1.0 PCI 10.4-3.6-00104 > > Signed-off-by: Wen Gong > Signed-off-by: Kalle Valo Patch applied to ath-next branch of ath.git, thanks. 8723750e2753 ath10k: fix regdomain info of iw reg set/get -- https://patchwork.kernel.org/project/linux-wireless/patch/20220525132247.23459-1-quic_wgong@quicinc.com/ https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches