Received: by 2002:a05:7412:251c:b0:e2:908c:2ebd with SMTP id w28csp1156152rda; Mon, 23 Oct 2023 04:35:24 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHF19++hlOXO2dIOE8EHF3B4qOwOq7+qkGIakhj3rjw/BdMkdN9HHVQYtTEBp2JU0cHPz+1 X-Received: by 2002:a05:6a20:1453:b0:174:32c:dfcb with SMTP id a19-20020a056a20145300b00174032cdfcbmr13851332pzi.31.1698060923983; Mon, 23 Oct 2023 04:35:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698060923; cv=none; d=google.com; s=arc-20160816; b=ysznCCipSRc7tVjKmwzONvdLuGqghIN+m6/lk0BmOSMxZSH+Av7m55T9UXIJmpRTQE em0CuGq7JpdE18zKDpJd9CwieTrNNRKsDB2ggWfe5zlkVxkG/9cGzRVpP82UQcgdC+ML UAulHoBj6gocCMnJxq6dYsfx8OMIZWuLPUP9mbvT8rJHjhKHWNBkgbCbS3u73d6oid51 +kl78ERX6AvpgytoW1jMGdgBiQZuhwb0Bc80+gm+p6tOOb8jZ8rL6/dn3ZhNFGmKzTPl VHYvLxu/cNkarv61O5onQzHv8pI6ybrx9pRZNj5rPUh0mMMEo67cTxAPd7RpniYzwlAy Z2TA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=BKv/1jMR+An6Sd0wIyrhfjGh0OgkF6whzW/ih74CHzs=; fh=2rHh+X7BTEMOKMjtmcVUv2NxQAAAInNIJMVig2I9gE4=; b=vShXTv5peHCitWtF+pug4aov+6sFBd2xmtZ7CCkAH4bPYW2X9hV9U/kybndC8X98lV Yfn7cFzGeUXyTxYaa/AlpKJ0Y5Fsu9Wr+GmUMd/s6Mv6KCypbgitv/uQjkJzVMWjLYQE BHypLperj2cT3YG6RukFmv1SXzcvnZ85fQrEk/cyTei4yBv+mLEVSLfNw2QBCTZgu5RD fxCv2dXtqAl6I+pBeX56YM9ETTVCUd/+UgS9CBGWkIRVUf0QRkxx2QBHg3hDjDGh1Nm4 xJ3+F40coMvLlSS6wcF1DwKiGxwKjx7f6rTeJ1ACqssSMLhN+Hh7QM8IRMGOFdDBwsHq l7YA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@dberlin.org header.s=google header.b="F9dr2HK/"; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id d38-20020a631d66000000b00578b37ad24bsi6188619pgm.619.2023.10.23.04.35.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Oct 2023 04:35:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; dkim=pass header.i=@dberlin.org header.s=google header.b="F9dr2HK/"; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 3D9EA8048C11; Mon, 23 Oct 2023 04:35:21 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234046AbjJWLfN (ORCPT + 52 others); Mon, 23 Oct 2023 07:35:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36838 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234036AbjJWLfL (ORCPT ); Mon, 23 Oct 2023 07:35:11 -0400 Received: from mail-lj1-x236.google.com (mail-lj1-x236.google.com [IPv6:2a00:1450:4864:20::236]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CFE67FF for ; Mon, 23 Oct 2023 04:35:08 -0700 (PDT) Received: by mail-lj1-x236.google.com with SMTP id 38308e7fff4ca-2b9338e4695so43616451fa.2 for ; Mon, 23 Oct 2023 04:35:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dberlin.org; s=google; t=1698060907; x=1698665707; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=BKv/1jMR+An6Sd0wIyrhfjGh0OgkF6whzW/ih74CHzs=; b=F9dr2HK/+bAF3Ezlv7Ak3I/z/DHrVbelVXPam5M2NSmKmuQX0swZFcrUyzsCl2g9wn oL2AJztSxa2QtvWMZxQuTAH0KuGQXnTpEs9OJpsNyXf1Cr3S2OWgz4T8DRwk+3jKUsGF qz3y8AqwQGwSFhs1VUTEGb4Y6U8nqHK1uqFD6FJ0Z+FWsrZnCG5/qGHaPG68NO0dhv0c a18mxR8NLWwBXCNA2oIZib843W2p2CHn51wzS+xB0a46buJxbTlABim4oQ6sFqjkuNll Xs/GhnZxUEH/LECjoxbnUV5t0AP2U5eDjhJ7RKA5V217VL8HQ18vIihTImQqAA8ynccG Hzfw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698060907; x=1698665707; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=BKv/1jMR+An6Sd0wIyrhfjGh0OgkF6whzW/ih74CHzs=; b=mq37b6IX63zAL1vQSMVE+6xRX6NLA75Z8KoyU+JxFqbN0RSyLA8ScvJVOV82+JaAQ4 GZVDyOAFDr+NtJDebE1IAUbgM/RIrMH76JzAvZBc5o6TFN89C6J0JMkCrN71K8Dff13V YSskrgbzejzszcmcQrHyOVO6WM5nGMTXZAQyCmeRcdnelirvtiGhfHxrrK9sohzod+Bu CkaPdIRsJK2JZ9HBzW5L/c+dkFF4PrEqOhS2XQA+8WW2BakCPHrCYONk2R5sfKJN+/os ahZOjIc2qafjt8T225tVm3JO2dQ8ZXm4/pgDbHaroTVtlN9V73Ykp8Tl6ZiOfVledHdj cKuQ== X-Gm-Message-State: AOJu0YxfOh0735sJpxC9XYh5XPRbMdt1lyzPXBlDt0lU29J9Zm9fbT// uW2iIT2NsZX3+R05ij9hSXeDGuHNrLbqeUVHJd2Y6Q== X-Received: by 2002:a2e:9a92:0:b0:2c5:106f:540f with SMTP id p18-20020a2e9a92000000b002c5106f540fmr7002887lji.43.1698060906729; Mon, 23 Oct 2023 04:35:06 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Daniel Berlin Date: Mon, 23 Oct 2023 07:34:55 -0400 Message-ID: Subject: Re: [PATCH 1/1] [brcmfmac] Fix regulatory domain handling to reset bands properly To: Arend van Spriel Cc: Arend van Spriel , Franky Lin , Hante Meuleman , SHA-cyfmac-dev-list@infineon.com, brcm80211-dev-list.pdl@broadcom.com, linux-kernel@vger.kernel.org, linux-wireless@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Mon, 23 Oct 2023 04:35:21 -0700 (PDT) On Mon, Oct 23, 2023 at 4:38=E2=80=AFAM Arend van Spriel wrote: > > On 10/21/2023 4:40 PM, Daniel Berlin wrote: > > As an aside, the alternative would be to simply not ignore any > > attempts to set the regulatory domain, regardless of whether it's 00 > > or the chip is already set to that country. > > It doesn't happen that often, so it's not clear it's worth avoiding it = at all. > > There are some things i'd have to fix to make it work resiliently well > > (for example, i know we set the 2g bw cap where we do because it has > > to be done with the interface down), but i can fix those if needed. > > Please do not top post. > > The firmware has its own regulatory information (actually the CLM blob > holds that information) which is independent of the wireless regulatory > database in the kernel. As such trying to configure country '00' will > simply fail as it is not known inside CLM blob. > > The firmware needs a > country abbreviation *and* a revision. Hence we require a mapping of > country code to tuple. If that mapping is not in place we > bail out setting the country in the regulatory notifier. > > From the description below it is not clear what problem is fixed here > in terms of user experience. As far as the stack and kernel are concerned, it gets stuck in the custom regulatory domain ('99') and sets the max power levels, bandwidth caps, etc in the capabilities to match. If you look at the phy info, it will clearly show you this. You are correct that the chip maintains its own view of power levels (though most drivers set them, we do not), but the bandwidth caps are respected, for example. Note also that '00' is recognized by at least this firmware, though I agree it depends on whether/what is done in the CLM blob. All that said, even if it changed nothing in the chip itself, it would still be displaying completely wrong info to the user. I'm happy to update the description if that is your main concern. > > Regards, > Arend > > > On Thu, Oct 19, 2023 at 10:18=E2=80=AFAM Daniel Berlin wrote: > >> > >> Currently, we ignore the default country in the reg notifier. > >> We also register a custom regulatory domain, which is set > >> as the default. > >> As a result, the chip is likely to be set to the correct country, > >> but the regulatory domain will not match it. > >> > >> When the regulatory notifier is then called, we see the countries > >> are the same and do not change anything, even though the domain > >> is wrong. > >> > >> This patch forces us to reset the bands on the first country change > >> even if the chip is already set to that country. > >> > >> We also restore the original band info before reconstructing channel > >> info, as the new regdom power limits may be higher than what is > >> currently set. > >> > >> Signed-off-by: Daniel Berlin > >> --- > >> .../broadcom/brcm80211/brcmfmac/cfg80211.c | 38 +++++++++++++++--= -- > >> .../broadcom/brcm80211/brcmfmac/cfg80211.h | 2 + > >> 2 files changed, 33 insertions(+), 7 deletions(-)