Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp1777133rwl; Thu, 6 Apr 2023 00:39:37 -0700 (PDT) X-Google-Smtp-Source: AKy350aG+KbdaTq9WcDK5GnCPpc8SZdvCmTZnawzdzwNGhkfoyQIxyGl6dWYy7L6//9WjmpqHXtg X-Received: by 2002:aa7:9425:0:b0:625:c9bd:57de with SMTP id y5-20020aa79425000000b00625c9bd57demr7469057pfo.30.1680766777260; Thu, 06 Apr 2023 00:39:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680766777; cv=none; d=google.com; s=arc-20160816; b=KcZMad9SkO52J1hH1TidPQHOjqjreogtSKD1CUcxL9e8t/orjzzId9A8uJDShDFvNV ljhHs3uqM3g31JUx8zUt8lcd/3uSktJuHoVjaFvIn4OOFQQYPUSqd4XoVOXGQR1XxbB9 mpqsPtucq9ownanQDQ4Mycag6vaIXxQmCQ6POcn9fsLeoZ4Tb6H+1fTHcaKOUh51x5CO 4mytjzD5jP9vgtPInMBAY01+0jpISoN/TPiSWBtYPXtQMGfyAlXTqrbsKpOIA4ycXilL r2UI5uLAPckzwGOPzbN/eTIFh95Hl+iUhC8kmV2JRjItyduYH2Nh32C6VILH+U2AjNSo /TvQ== 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 :message-id:date:subject:cc:to:from:authenticated-by; bh=3PgMJakvEpu2wsfcVUS587MycXrxbsYD3QjVmM5H/GA=; b=tN/oXHtzBTwQJkB+P6jen0Xk1cuIMDHHkSQ+wJ2qm2meefGFg1gV2lo99JEk9lSCr0 MT/HyHBKuWxmliNFaa+7hivmhlF3m2uWcWNc2Ewc9YDzEfG32ZEQKj41Ssq7TN96G67M LXm8ihxsiG9K+ahuCdD9TLh9/qaqkZANI+Hk+dfOBRZEg1Ch+fEgqZLDivGG/Kk5fNlH Wv7QqjT2Mzgd4fHLESMgTwfVpRrQEmDSNoTB4NUUxD1QdY2iE3qp/Nomi+dso//6D6t3 MFhDbaZjX9sy+WkrcEQCdIJuOb4fAP0Crw1ZA+UzEDyWVn2ps7tBNlCkXs144PtkcvXw ftmg== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z26-20020a630a5a000000b00513a793932fsi629698pgk.394.2023.04.06.00.39.25; Thu, 06 Apr 2023 00:39:37 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234950AbjDFHaU (ORCPT + 60 others); Thu, 6 Apr 2023 03:30:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44164 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233235AbjDFHaT (ORCPT ); Thu, 6 Apr 2023 03:30:19 -0400 Received: from rtits2.realtek.com.tw (rtits2.realtek.com [211.75.126.72]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EEEEBEE for ; Thu, 6 Apr 2023 00:30:17 -0700 (PDT) Authenticated-By: X-SpamFilter-By: ArmorX SpamTrap 5.77 with qID 3367TluP6007725, This message is accepted by code: ctloc85258 Received: from mail.realtek.com (rtexh36505.realtek.com.tw[172.21.6.25]) by rtits2.realtek.com.tw (8.15.2/2.81/5.90) with ESMTPS id 3367TluP6007725 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=OK); Thu, 6 Apr 2023 15:29:47 +0800 Received: from RTEXMBS04.realtek.com.tw (172.21.6.97) by RTEXH36505.realtek.com.tw (172.21.6.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.32; Thu, 6 Apr 2023 15:29:55 +0800 Received: from localhost (172.21.69.188) by RTEXMBS04.realtek.com.tw (172.21.6.97) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.7; Thu, 6 Apr 2023 15:29:54 +0800 From: Ping-Ke Shih To: CC: , Subject: [PATCH] wifi: rtw89: correct 5 MHz mask setting Date: Thu, 6 Apr 2023 15:28:41 +0800 Message-ID: <20230406072841.8308-1-pkshih@realtek.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [172.21.69.188] X-ClientProxiedBy: RTEXMBS02.realtek.com.tw (172.21.6.95) To RTEXMBS04.realtek.com.tw (172.21.6.97) X-KSE-ServerInfo: RTEXMBS04.realtek.com.tw, 9 X-KSE-AntiSpam-Interceptor-Info: fallback X-KSE-Antivirus-Interceptor-Info: fallback X-KSE-AntiSpam-Interceptor-Info: fallback X-KSE-ServerInfo: RTEXH36505.realtek.com.tw, 9 X-KSE-AntiSpam-Interceptor-Info: fallback X-KSE-Antivirus-Interceptor-Info: fallback X-KSE-AntiSpam-Interceptor-Info: fallback X-Spam-Status: No, score=0.0 required=5.0 tests=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 lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org From: Eric Huang Use primary channel index to determine which 5 MHz mask should be enable. This mask is used to prevent noise from channel edge to effect CCA threshold in wide bandwidth (>= 40 MHZ). Fixes: 1b00e9236a71 ("rtw89: 8852c: add set channel of BB part") Fixes: 6b0698984eb0 ("wifi: rtw89: 8852b: add chip_ops::set_channel") Cc: stable@vger.kernel.org Signed-off-by: Eric Huang Signed-off-by: Ping-Ke Shih --- drivers/net/wireless/realtek/rtw89/rtw8852b.c | 9 +++++---- drivers/net/wireless/realtek/rtw89/rtw8852c.c | 9 +++++---- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/drivers/net/wireless/realtek/rtw89/rtw8852b.c b/drivers/net/wireless/realtek/rtw89/rtw8852b.c index bae80984cfd51..5a46afc97a025 100644 --- a/drivers/net/wireless/realtek/rtw89/rtw8852b.c +++ b/drivers/net/wireless/realtek/rtw89/rtw8852b.c @@ -1284,7 +1284,7 @@ static void rtw8852b_ctrl_cck_en(struct rtw89_dev *rtwdev, bool cck_en) static void rtw8852b_5m_mask(struct rtw89_dev *rtwdev, const struct rtw89_chan *chan, enum rtw89_phy_idx phy_idx) { - u8 pri_ch = chan->primary_channel; + u8 pri_ch = chan->pri_ch_idx; bool mask_5m_low; bool mask_5m_en; @@ -1292,12 +1292,13 @@ static void rtw8852b_5m_mask(struct rtw89_dev *rtwdev, const struct rtw89_chan * case RTW89_CHANNEL_WIDTH_40: /* Prich=1: Mask 5M High, Prich=2: Mask 5M Low */ mask_5m_en = true; - mask_5m_low = pri_ch == 2; + mask_5m_low = pri_ch == RTW89_SC_20_LOWER; break; case RTW89_CHANNEL_WIDTH_80: /* Prich=3: Mask 5M High, Prich=4: Mask 5M Low, Else: Disable */ - mask_5m_en = pri_ch == 3 || pri_ch == 4; - mask_5m_low = pri_ch == 4; + mask_5m_en = pri_ch == RTW89_SC_20_UPMOST || + pri_ch == RTW89_SC_20_LOWEST; + mask_5m_low = pri_ch == RTW89_SC_20_LOWEST; break; default: mask_5m_en = false; diff --git a/drivers/net/wireless/realtek/rtw89/rtw8852c.c b/drivers/net/wireless/realtek/rtw89/rtw8852c.c index ba728fca91881..6cd60864eca05 100644 --- a/drivers/net/wireless/realtek/rtw89/rtw8852c.c +++ b/drivers/net/wireless/realtek/rtw89/rtw8852c.c @@ -1375,18 +1375,19 @@ static void rtw8852c_5m_mask(struct rtw89_dev *rtwdev, const struct rtw89_chan *chan, enum rtw89_phy_idx phy_idx) { - u8 pri_ch = chan->primary_channel; + u8 pri_ch = chan->pri_ch_idx; bool mask_5m_low; bool mask_5m_en; switch (chan->band_width) { case RTW89_CHANNEL_WIDTH_40: mask_5m_en = true; - mask_5m_low = pri_ch == 2; + mask_5m_low = pri_ch == RTW89_SC_20_LOWER; break; case RTW89_CHANNEL_WIDTH_80: - mask_5m_en = ((pri_ch == 3) || (pri_ch == 4)); - mask_5m_low = pri_ch == 4; + mask_5m_en = pri_ch == RTW89_SC_20_UPMOST || + pri_ch == RTW89_SC_20_LOWEST; + mask_5m_low = pri_ch == RTW89_SC_20_LOWEST; break; default: mask_5m_en = false; -- 2.25.1