Received: by 2002:a05:7412:40d:b0:e2:908c:2ebd with SMTP id 13csp882330rdf; Tue, 21 Nov 2023 22:06:37 -0800 (PST) X-Google-Smtp-Source: AGHT+IHfsRmvaCj6nOvATU6w5Qq30ANauhsAZn60ZxmqT4R/QL6YSmlR3Mxnf5ON+h/AgTilCzev X-Received: by 2002:a05:6808:90:b0:3b6:d639:35b0 with SMTP id s16-20020a056808009000b003b6d63935b0mr1501387oic.50.1700633197689; Tue, 21 Nov 2023 22:06:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700633197; cv=none; d=google.com; s=arc-20160816; b=kyVWirbp8d6lqQxo5UDOfUeIs8wtJXINH41WZkkjL2ux8LVuVIlvd/wQoMs+oWqLD+ lKHG48c2KOtA5+r7B6JBzT6djDuOACVRr8De5UaU2MZKnoywMdk+/8QTZFCCsUlMIamc C4cgaFKWeqhz2pra6UR8jjbkl8IoCofFTLcdlPZhMlNqMydLsoqlqO4qqjJwc4pOKVlp Is9t1cOeEAf/jfWlFI5pLKqJ5O0mvAa6WPh+jV55SPVnLp4xQIQUB2xOPqNOncsHEk4g jme31LYXl8n46thZnNLM4z90ywa9Jp9kie4JBOY9ufU3urWEDuUAt3dgTm3TVEtcBvJX GpIA== 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; bh=qH6VBFkFkriq2CB1OSZoUSZHgKL0CyDSLEPwvzMG6pw=; fh=Yhg3/DrKkR4Hs3egnKzF2Sj5quBOazakYbmcsFQvz8A=; b=pPphf7PZy9Lcpbk3qgJTtKbIsNZLWno2glrW7wAZ4shQjJ7wtPh5iGLZYDQjylsezV xv/K1joSxVWWnVWIyDN+yJZwrTmdpg8LCSvXxHn7OUpLHME3tSAh7Ma8Ln2wPNmvXSYR 6Fdm7LXvFXNhWEmIbFWTW0dhRagFNRpOJwUYqsC55hwRWWCD3iQyZGOJBXJ1Tk7fsoH8 XHWr3DaELIeqyAkYBoZbX3S/Q/n0uJ0ZnCWibXHIhcGK9sJ5Wwl4A3/+75ZJPMfNvfJU zH+Rcx1IyaVH+tgf6N816OolDAVOdLMZUO25m9cwyKBX7IC6Znhh4MYVCdluOO/9oubd fCSg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Return-Path: Received: from groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id s19-20020a056a0008d300b006bd0842622asi12113744pfu.239.2023.11.21.22.06.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Nov 2023 22:06:37 -0800 (PST) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.35 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 groat.vger.email (Postfix) with ESMTP id 0A76880D6531; Tue, 21 Nov 2023 22:06:25 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234572AbjKVGGP (ORCPT + 54 others); Wed, 22 Nov 2023 01:06:15 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51924 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229631AbjKVGGL (ORCPT ); Wed, 22 Nov 2023 01:06:11 -0500 Received: from rtits2.realtek.com.tw (rtits2.realtek.com [211.75.126.72]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4783D10C for ; Tue, 21 Nov 2023 22:06:07 -0800 (PST) X-SpamFilter-By: ArmorX SpamTrap 5.78 with qID 3AM660gL42079019, 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.95/5.92) with ESMTPS id 3AM660gL42079019 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 22 Nov 2023 14:06:00 +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; Wed, 22 Nov 2023 14:06:01 +0800 Received: from [127.0.1.1] (172.21.69.94) 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; Wed, 22 Nov 2023 14:06:00 +0800 From: Ping-Ke Shih To: CC: , Subject: [PATCH 3/4] wifi: rtw89: debug: add debugfs entry to disable dynamic mechanism Date: Wed, 22 Nov 2023 14:04:57 +0800 Message-ID: <20231122060458.30878-4-pkshih@realtek.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20231122060458.30878-1-pkshih@realtek.com> References: <20231122060458.30878-1-pkshih@realtek.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [172.21.69.94] 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.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.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 (groat.vger.email [0.0.0.0]); Tue, 21 Nov 2023 22:06:25 -0800 (PST) A dynamic mechanism is usually an algorithm to adjust registers to adapt to different environment every two seconds. In field, it could get unexpected result, so we need to stop it and adjust registers manually, and then fine tune the algorithm. To stop mechanisms to assist debugging, add a debugfs entry shown as Disabled DM: 0x1 [0] DYNAMIC_EDCCA: X Signed-off-by: Ping-Ke Shih --- drivers/net/wireless/realtek/rtw89/core.h | 5 ++ drivers/net/wireless/realtek/rtw89/debug.c | 58 ++++++++++++++++++++++ drivers/net/wireless/realtek/rtw89/phy.c | 5 ++ 3 files changed, 68 insertions(+) diff --git a/drivers/net/wireless/realtek/rtw89/core.h b/drivers/net/wireless/realtek/rtw89/core.h index 429904987d2e..36f6a807d350 100644 --- a/drivers/net/wireless/realtek/rtw89/core.h +++ b/drivers/net/wireless/realtek/rtw89/core.h @@ -4008,6 +4008,10 @@ struct rtw89_edcca_bak { u8 th_old; }; +enum rtw89_dm_type { + RTW89_DM_DYNAMIC_EDCCA, +}; + struct rtw89_hal { u32 rx_fltr; u8 cv; @@ -4033,6 +4037,7 @@ struct rtw89_hal { enum rtw89_entity_mode entity_mode; struct rtw89_edcca_bak edcca_bak; + u32 disabled_dm_bitmap; /* bitmap of enum rtw89_dm_type */ }; #define RTW89_MAX_MAC_ID_NUM 128 diff --git a/drivers/net/wireless/realtek/rtw89/debug.c b/drivers/net/wireless/realtek/rtw89/debug.c index a3f795d240ea..f914c0750576 100644 --- a/drivers/net/wireless/realtek/rtw89/debug.c +++ b/drivers/net/wireless/realtek/rtw89/debug.c @@ -3770,6 +3770,58 @@ static int rtw89_debug_priv_stations_get(struct seq_file *m, void *v) return 0; } +#define DM_INFO(type) {RTW89_DM_ ## type, #type} + +static const struct rtw89_disabled_dm_info { + enum rtw89_dm_type type; + const char *name; +} rtw89_disabled_dm_infos[] = { + DM_INFO(DYNAMIC_EDCCA), +}; + +static int +rtw89_debug_priv_disable_dm_get(struct seq_file *m, void *v) +{ + struct rtw89_debugfs_priv *debugfs_priv = m->private; + struct rtw89_dev *rtwdev = debugfs_priv->rtwdev; + const struct rtw89_disabled_dm_info *info; + struct rtw89_hal *hal = &rtwdev->hal; + u32 disabled; + int i; + + seq_printf(m, "Disabled DM: 0x%x\n", hal->disabled_dm_bitmap); + + for (i = 0; i < ARRAY_SIZE(rtw89_disabled_dm_infos); i++) { + info = &rtw89_disabled_dm_infos[i]; + disabled = BIT(info->type) & hal->disabled_dm_bitmap; + + seq_printf(m, "[%d] %s: %c\n", info->type, info->name, + disabled ? 'X' : 'O'); + } + + return 0; +} + +static ssize_t +rtw89_debug_priv_disable_dm_set(struct file *filp, const char __user *user_buf, + size_t count, loff_t *loff) +{ + struct seq_file *m = (struct seq_file *)filp->private_data; + struct rtw89_debugfs_priv *debugfs_priv = m->private; + struct rtw89_dev *rtwdev = debugfs_priv->rtwdev; + struct rtw89_hal *hal = &rtwdev->hal; + u32 conf; + int ret; + + ret = kstrtou32_from_user(user_buf, count, 0, &conf); + if (ret) + return -EINVAL; + + hal->disabled_dm_bitmap = conf; + + return count; +} + static struct rtw89_debugfs_priv rtw89_debug_priv_read_reg = { .cb_read = rtw89_debug_priv_read_reg_get, .cb_write = rtw89_debug_priv_read_reg_select, @@ -3845,6 +3897,11 @@ static struct rtw89_debugfs_priv rtw89_debug_priv_stations = { .cb_read = rtw89_debug_priv_stations_get, }; +static struct rtw89_debugfs_priv rtw89_debug_priv_disable_dm = { + .cb_read = rtw89_debug_priv_disable_dm_get, + .cb_write = rtw89_debug_priv_disable_dm_set, +}; + #define rtw89_debugfs_add(name, mode, fopname, parent) \ do { \ rtw89_debug_priv_ ##name.rtwdev = rtwdev; \ @@ -3885,6 +3942,7 @@ void rtw89_debugfs_init(struct rtw89_dev *rtwdev) rtw89_debugfs_add_w(fw_log_manual); rtw89_debugfs_add_r(phy_info); rtw89_debugfs_add_r(stations); + rtw89_debugfs_add_rw(disable_dm); } #endif diff --git a/drivers/net/wireless/realtek/rtw89/phy.c b/drivers/net/wireless/realtek/rtw89/phy.c index 3d5bd888218e..bfb1d8cfc531 100644 --- a/drivers/net/wireless/realtek/rtw89/phy.c +++ b/drivers/net/wireless/realtek/rtw89/phy.c @@ -5091,6 +5091,11 @@ void rtw89_phy_edcca_thre_calc(struct rtw89_dev *rtwdev) void rtw89_phy_edcca_track(struct rtw89_dev *rtwdev) { + struct rtw89_hal *hal = &rtwdev->hal; + + if (hal->disabled_dm_bitmap & BIT(RTW89_DM_DYNAMIC_EDCCA)) + return; + rtw89_phy_edcca_thre_calc(rtwdev); rtw89_phy_edcca_log(rtwdev); } -- 2.25.1