Received: by 2002:a05:7412:da14:b0:e2:908c:2ebd with SMTP id fe20csp372936rdb; Fri, 6 Oct 2023 06:14:37 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGioJeQhPuKaK0a3zXHDCq1wDTgsyxgMN/9vkiORHkReXwHqBXg80oteg97ivo6jpv1lAu3 X-Received: by 2002:a05:6a20:3d90:b0:15f:faab:1bd3 with SMTP id s16-20020a056a203d9000b0015ffaab1bd3mr9375612pzi.19.1696598077405; Fri, 06 Oct 2023 06:14:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696598077; cv=none; d=google.com; s=arc-20160816; b=CKooORKcPzrMX3u8hcRIhxCaDFHoAsIJhZUaZ2HOpHSIQjNjP62I5Wyt48LH9LGYpW qZgtGaRYKqP0N+4YeL4UpkaVw+sxCJj8uBR7DjJlqyIg9n85kyGPYtHJRKXd+zcjpeFT 4+qVFysNHKvLaGzyYElsEP+r2s/IwdZ8sh6SBGv4UrRJCSyLGGK0SVUdWSOKDgMCjJ2B KlnbOI3qXS2FDowjvzmTEJDxFOtUoNNsgBM/Btro03TvbEHgnqOD6SOUAS0C+2KCGXnJ su7v+BJJ6jizbZU68OmEPDKqVVQqIV4Q8dX4phFe+DndFyytYGWGh+SpiaQbqdCDdf6h CO4w== 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=7AJdb3sTKZDGhQQvhzqJSzs03GJHNa2Zw7wl1vlYuEQ=; fh=HazNXdIX0AV/SunPhS44scAMfyv5oAksttxwN9EpOFc=; b=rUONOeQx9ZzIdgoGHxaQd2fESSutvVQTBPlZl1XvOPCoy/QIM4OxjNaQCMzyKFy+hW V0eYRZWV+zTwGlf6J9hlfEexP7Uk8FYyTfA45gplLBj7eVHXmuzLu61OxdnSnSbvzPuU PSMYRSLLMEep4CiTRTEh7qE/F3Z12EvEYxqlwiJTSl6ZOXjsrWuIn26FY/hJTvDymyGB SvL0N9FcBVapmvBc6ZG6bvZKCqobdWJ9szGqLP8l3lTDthMj81i9l3E4fxZOcbxdzLMK X8qGD/7A64TLonQOguJTPhcM2ROZy7IvL51xUhwAJwlWKzkxVijb62S6t/MJ7kFQaiv3 DiDg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Return-Path: Received: from howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id b16-20020a056a00115000b0068fc9557cddsi1512859pfm.81.2023.10.06.06.14.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Oct 2023 06:14:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::3:4 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 howler.vger.email (Postfix) with ESMTP id A2CF380ACEC0; Fri, 6 Oct 2023 06:14:34 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232288AbjJFNOK (ORCPT + 52 others); Fri, 6 Oct 2023 09:14:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60520 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232302AbjJFNOI (ORCPT ); Fri, 6 Oct 2023 09:14:08 -0400 Received: from rtits2.realtek.com.tw (rtits2.realtek.com [211.75.126.72]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DDD1893 for ; Fri, 6 Oct 2023 06:14:06 -0700 (PDT) X-SpamFilter-By: ArmorX SpamTrap 5.78 with qID 396DDra861891466, 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.92/5.92) with ESMTPS id 396DDra861891466 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 6 Oct 2023 21:13:53 +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; Fri, 6 Oct 2023 21:13:54 +0800 Received: from [127.0.1.1] (172.16.16.139) 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; Fri, 6 Oct 2023 21:13:53 +0800 From: Ping-Ke Shih To: CC: , Subject: [PATCH 3/6] wifi: rtw89: parse TX EHT rate selected by firmware from RA C2H report Date: Fri, 6 Oct 2023 21:13:24 +0800 Message-ID: <20231006131327.16806-4-pkshih@realtek.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20231006131327.16806-1-pkshih@realtek.com> References: <20231006131327.16806-1-pkshih@realtek.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [172.16.16.139] 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=2.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on howler.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 (howler.vger.email [0.0.0.0]); Fri, 06 Oct 2023 06:14:34 -0700 (PDT) X-Spam-Level: ** RA (rate adaptive) C2H report is to reflect current TX rate firmware is using. Parse C2H event encoded in EHT mode, and then user space and debugfs can use the information to know TX rate. Signed-off-by: Ping-Ke Shih --- drivers/net/wireless/realtek/rtw89/core.h | 1 + drivers/net/wireless/realtek/rtw89/phy.c | 12 ++++++++++++ 2 files changed, 13 insertions(+) diff --git a/drivers/net/wireless/realtek/rtw89/core.h b/drivers/net/wireless/realtek/rtw89/core.h index f103ac085d2b..8c0dfd73031e 100644 --- a/drivers/net/wireless/realtek/rtw89/core.h +++ b/drivers/net/wireless/realtek/rtw89/core.h @@ -2742,6 +2742,7 @@ enum rtw89_ra_report_mode { RTW89_RA_RPT_MODE_HT, RTW89_RA_RPT_MODE_VHT, RTW89_RA_RPT_MODE_HE, + RTW89_RA_RPT_MODE_EHT, }; enum rtw89_dig_noisy_level { diff --git a/drivers/net/wireless/realtek/rtw89/phy.c b/drivers/net/wireless/realtek/rtw89/phy.c index 2a3edf775668..8a306a86f1f0 100644 --- a/drivers/net/wireless/realtek/rtw89/phy.c +++ b/drivers/net/wireless/realtek/rtw89/phy.c @@ -2399,6 +2399,18 @@ static void rtw89_phy_c2h_ra_rpt_iter(void *data, struct ieee80211_sta *sta) ra_report->txrate.he_gi = NL80211_RATE_INFO_HE_GI_3_2; mcs = ra_report->txrate.mcs; break; + case RTW89_RA_RPT_MODE_EHT: + ra_report->txrate.flags |= RATE_INFO_FLAGS_EHT_MCS; + ra_report->txrate.mcs = u8_get_bits(rate, RTW89_RA_RATE_MASK_MCS_V1); + ra_report->txrate.nss = u8_get_bits(rate, RTW89_RA_RATE_MASK_NSS_V1) + 1; + if (giltf == RTW89_GILTF_2XHE08 || giltf == RTW89_GILTF_1XHE08) + ra_report->txrate.eht_gi = NL80211_RATE_INFO_EHT_GI_0_8; + else if (giltf == RTW89_GILTF_2XHE16 || giltf == RTW89_GILTF_1XHE16) + ra_report->txrate.eht_gi = NL80211_RATE_INFO_EHT_GI_1_6; + else + ra_report->txrate.eht_gi = NL80211_RATE_INFO_EHT_GI_3_2; + mcs = ra_report->txrate.mcs; + break; } ra_report->txrate.bw = rtw89_hw_to_rate_info_bw(bw); -- 2.25.1