Received: by 2002:a89:2c3:0:b0:1ed:23cc:44d1 with SMTP id d3csp98107lqs; Mon, 4 Mar 2024 16:46:16 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVz0NZCR95YD5oc0ma73K/NldwG+FKeLVc8ZXAZdyk0vvJhl7B/CpgMK3E8joNMuvXP/3eSsj0qHtDtl0NfKQR03bPxd/3LVsmPAr5U9g== X-Google-Smtp-Source: AGHT+IHUsTf0DlKYxDGiIHwnVQ5DtFnS8opx/xHTF5vgl+K/vyajYaD5QDiYx7PBN9LWLFOFLqM3 X-Received: by 2002:a17:906:d114:b0:a45:1787:aee1 with SMTP id b20-20020a170906d11400b00a451787aee1mr3975806ejz.14.1709599576203; Mon, 04 Mar 2024 16:46:16 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709599575; cv=pass; d=google.com; s=arc-20160816; b=qxPM9uyOxwnZ/vEFRmB5UepOAEXDGKc9hILKeY9jGESi8vwbiDxYH6mtCQUqv+GD/n fjKqO6Lro2jKo89mjkG284WItgtzXQ1uHqqDN69KYLsSP9ZqxLehd2A7++i3fubOwY9j fE4WQ+KLp4GDmy9dY3IQBuzFrBpiBC1pRjyvo8yMzTJgCfjvvJ1e04Y+d8B5EoOzUY3B 72ypzbyNAGDQUbAw+myCstdz2vVEtnTQXMDCrIHvWM8YdsOtOVOEdq1n6XHeXJ0m7VSN sIMHPhg652S6LtI8zHRhO2DZ0dFVervTJDS1FsZJfVK1gZXdKkI+4oq+M3HYWW9xJOop LIiQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from; bh=RjFxAFikpkLY0+uCqSE7Wo8lCISgNNehpg04d4KNsH4=; fh=2lJ7bXjq5PAJDCaOJ7Cr1wfsMXdWtdUTHUKHtm0YzGQ=; b=j7gYQaAA0gNW7dgudC2DWVlp52YZC02L+w0+bvbU3jp2O4bYMmPuZ1bcQmORwFmTN0 nrR+ssIrMeFaQbAPRoeeXegQAaXcaq/B3x9lpDQHIVzUVTJ5T01skYQflAXmg7jwMTjT Tk+Y5uJwrDYzbrIDIskkLSyZgwUztnKCHQ/ZfzXRwkILm0xuevZh/wfkIHdVP4HjHvTF NRxI3W5mWY/0VsYCv6HyQ2JO/ppZsOwe6K90TZKhGY0PuFQsIdl5uUSNo8fKtGp84hYV UP38gpF8oo0E728bLJs/eUxpGJmamFfJY5Wak5Tb6w/E9jxX7IxnNLk285C4gHL2TvKE +mQg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=realtek.com); spf=pass (google.com: domain of linux-wireless+bounces-4360-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-wireless+bounces-4360-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id f21-20020a1709067f9500b00a452d150025si1623282ejr.1015.2024.03.04.16.46.15 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Mar 2024 16:46:15 -0800 (PST) Received-SPF: pass (google.com: domain of linux-wireless+bounces-4360-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=realtek.com); spf=pass (google.com: domain of linux-wireless+bounces-4360-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-wireless+bounces-4360-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 2908E1F23A40 for ; Tue, 5 Mar 2024 00:46:15 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DBF8C5382; Tue, 5 Mar 2024 00:46:11 +0000 (UTC) X-Original-To: linux-wireless@vger.kernel.org Received: from rtits2.realtek.com.tw (rtits2.realtek.com [211.75.126.72]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7477E3210 for ; Tue, 5 Mar 2024 00:46:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=211.75.126.72 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709599571; cv=none; b=aCjUjVwQutKRsvdoctpP3EzJvgbSqECaXrEP0SdCxpF5pNgCw+lNUYe1fPk/xtZewq2EGn4fL1wOK5r4Bx1+eGdMJtvInLu/aP2Y73uqDVm+HFXgrEJshRNyzFNuAqIlAdaRreGZvrNGAajATa0Vi7mVc5IM6N/7JUyDnkxf3D8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709599571; c=relaxed/simple; bh=tc4AEy7B6Rc7D0EIqf8rS6hLAXDvBZgYg2BpiuuTMJE=; h=From:To:CC:Subject:Date:Message-ID:MIME-Version:Content-Type; b=iN8i2pfseyD5KKx0i7LnbrX8r/f63U0IrMne1EP+1rRZ4xxW44cQHk6l+ioJ3tMIACOzAkYYboUzFLQNeZnxt10JSZJcUGUpmgZk/YxL2Tz5ja6bKuUZU2PTGqp8cLwAwBwsYWFu4mO5nFsRJ1RLrxKB1G61l3xV1qp3dMjtWKk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=realtek.com; spf=pass smtp.mailfrom=realtek.com; arc=none smtp.client-ip=211.75.126.72 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=realtek.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=realtek.com X-SpamFilter-By: ArmorX SpamTrap 5.78 with qID 4250jsSfB3909755, This message is accepted by code: ctloc85258 Received: from mail.realtek.com (rtexh36506.realtek.com.tw[172.21.6.27]) by rtits2.realtek.com.tw (8.15.2/2.95/5.92) with ESMTPS id 4250jsSfB3909755 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 5 Mar 2024 08:45:54 +0800 Received: from RTEXMBS04.realtek.com.tw (172.21.6.97) by RTEXH36506.realtek.com.tw (172.21.6.27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.35; Tue, 5 Mar 2024 08:45:55 +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_256_GCM_SHA384) id 15.1.2507.35; Tue, 5 Mar 2024 08:45:54 +0800 From: Ping-Ke Shih To: CC: , Subject: [PATCH] wifi: rtw89: Correct EHT TX rate on 20MHz connection Date: Tue, 5 Mar 2024 08:45:02 +0800 Message-ID: <20240305004502.6655-1-pkshih@realtek.com> X-Mailer: git-send-email 2.25.1 Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: RTEXMBS02.realtek.com.tw (172.21.6.95) To RTEXMBS04.realtek.com.tw (172.21.6.97) From: Dian-Syuan Yang We used EHT capability of 20MHz-only as rate mask to RA (rate adaptive) H2C command when connecting with AP set EHT 20MHz. It would get the wrong rate mask and the MCS rate can only reach MCS11. According to the description of 802.11be spec, if all supported channel bandwidth field of HE PHY capabilities are zero, then the EHT capability of 20MHz-only is valid. As a result, we adjust the code to set correct rate mask based on HE PHY bandwidth capability. Signed-off-by: Dian-Syuan Yang Signed-off-by: Ping-Ke Shih --- drivers/net/wireless/realtek/rtw89/phy.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/drivers/net/wireless/realtek/rtw89/phy.c b/drivers/net/wireless/realtek/rtw89/phy.c index 12da63d64307..eaa18140d1a8 100644 --- a/drivers/net/wireless/realtek/rtw89/phy.c +++ b/drivers/net/wireless/realtek/rtw89/phy.c @@ -122,6 +122,7 @@ static u64 get_eht_ra_mask(struct ieee80211_sta *sta) struct ieee80211_sta_eht_cap *eht_cap = &sta->deflink.eht_cap; struct ieee80211_eht_mcs_nss_supp_20mhz_only *mcs_nss_20mhz; struct ieee80211_eht_mcs_nss_supp_bw *mcs_nss; + u8 *he_phy_cap = sta->deflink.he_cap.he_cap_elem.phy_cap_info; switch (sta->deflink.bandwidth) { case IEEE80211_STA_RX_BW_320: @@ -132,15 +133,19 @@ static u64 get_eht_ra_mask(struct ieee80211_sta *sta) mcs_nss = &eht_cap->eht_mcs_nss_supp.bw._160; /* MCS 9, 11, 13 */ return get_eht_mcs_ra_mask(mcs_nss->rx_tx_max_nss, 9, 3); + case IEEE80211_STA_RX_BW_20: + if (!(he_phy_cap[0] & + IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_MASK_ALL)) { + mcs_nss_20mhz = &eht_cap->eht_mcs_nss_supp.only_20mhz; + /* MCS 7, 9, 11, 13 */ + return get_eht_mcs_ra_mask(mcs_nss_20mhz->rx_tx_max_nss, 7, 4); + } + fallthrough; case IEEE80211_STA_RX_BW_80: default: mcs_nss = &eht_cap->eht_mcs_nss_supp.bw._80; /* MCS 9, 11, 13 */ return get_eht_mcs_ra_mask(mcs_nss->rx_tx_max_nss, 9, 3); - case IEEE80211_STA_RX_BW_20: - mcs_nss_20mhz = &eht_cap->eht_mcs_nss_supp.only_20mhz; - /* MCS 7, 9, 11, 13 */ - return get_eht_mcs_ra_mask(mcs_nss_20mhz->rx_tx_max_nss, 7, 4); } } -- 2.25.1