From patchwork Tue Jul 23 19:31:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bitterblue Smith X-Patchwork-Id: 13740312 X-Patchwork-Delegate: pkshih@realtek.com Received: from mail-lf1-f48.google.com (mail-lf1-f48.google.com [209.85.167.48]) (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 B2A7913D628 for ; Tue, 23 Jul 2024 19:31:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.48 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721763102; cv=none; b=iANJkGPn/0uP3iTVRXbVnJ7IWfHzv7xmyTy67zUb5KWOgQ1fxFCWG4ms1e+kXXNSDqssA/cVEzSaNb6rQPktlaMSDwxFfDXzRaEQqLQ7pEwc8G2u6UrdM8cPoqJwUetIkgaA7Njcapv1IV5fRaF41lgK+eDRgjiKymLx9813hfY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721763102; c=relaxed/simple; bh=IFcDO3OnmF1L8H9nGyq7//G9FVKR9Z7NEIM7M9UtW+M=; h=Message-ID:Date:MIME-Version:From:Subject:To:Cc:Content-Type; b=tzG6WWPzxq+9NpNWiDVPx5+MNMMXhUU1PJN/2YV3hhOHVP6ia8st7aXfwEdFTNvgxrs70NQhTkYWDmpKXbuuRlXXDobAst1N8F8oiI1aAJyTtQYHPRFBkaGz8L2weUvY0GHwJsyJlIDtBAQFKDgzF8xNfjewW4E+1QtcSw4vo7A= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=mnwliqo2; arc=none smtp.client-ip=209.85.167.48 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="mnwliqo2" Received: by mail-lf1-f48.google.com with SMTP id 2adb3069b0e04-52efbc57456so1953943e87.1 for ; Tue, 23 Jul 2024 12:31:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1721763099; x=1722367899; darn=vger.kernel.org; h=content-transfer-encoding:content-language:cc:to:subject:from :user-agent:mime-version:date:message-id:from:to:cc:subject:date :message-id:reply-to; bh=jO4AhVxi4WtXemFwnuLtIBl3GHY32vzR7+rWPtVY4W8=; b=mnwliqo2n4L903cgzpmhKWeUuhpq97MytEKn93i+ltS5xMYtrT/xOxLvpo8jCFPA/L XldLbrUVHQ+fZkAhYQCvb5GZ8DMg3YuqxUD/UTIguedutuPzxztiXt3IZmHuDxSJc6Yx hObhGzcI+wvmkiZsAGLXpovkLSi6KEn01ow1QELKZlyAvKH5e0JZI7cJ0g5K/Q7oDTjf I+CufsusCNBKET3N7liJ9X6geebs8MiFUEsRLIsary21pwfnvzDgLUwpqXLWKMR8umFE w/xphwisw2bkyAhmznfeoliD2kfcCbRP/+tGz1g1gznW9StI/44rBhTiS1zOzbxelhjr CWGg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721763099; x=1722367899; h=content-transfer-encoding:content-language:cc:to:subject:from :user-agent:mime-version:date:message-id:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=jO4AhVxi4WtXemFwnuLtIBl3GHY32vzR7+rWPtVY4W8=; b=PWv64qgXZRLpOGwoWIBuEMOvhu1Vw2idBbO4ulsej38n5Uot1AYMU3nuAbGQzD//TW ij+lbpAJS6LNFlrz/3KkhaosmUtbM4Jl0+iRkcpgMA2sZ0hejcOxXpwZslIU4gpcf1jt G6GzlUFwRCj4KaVURC9kwO9jP4LsqnJDzqM9NUqqCskKDCiR8f2m8w2xmvmemThSEWDw UdpzKrdgV9tyK7AJIwCVSwP5AF2YEreEFCqUE63AiaYMdhnYz9uNy9Z+mxqtp0xUcrBU 63S8REaJIe63vHtMN7+OmKqCTGnocUrcJOnL291J4CBjh7XCvtQpioCNBAX+IjX/co0o w41Q== X-Gm-Message-State: AOJu0Yy8Debq4hrEXhrg835JJaVzXoGjCP2Ngwh37yiUAPaf74v1Jbxm q5gWY4y8WWxlKEJxuULmB0lc1So1+3TSDqk/W/txF7jpnZ1Em8ykZi2wgg== X-Google-Smtp-Source: AGHT+IHIsFNEKsFDKptsZu49H7jDMEqHQHEL+pQmWeadX0OL3bUoZAdz8DkyGQVNRFCm4l2uKL5kmA== X-Received: by 2002:a05:6512:234b:b0:52c:e17c:3753 with SMTP id 2adb3069b0e04-52fcda18469mr486183e87.5.1721763098532; Tue, 23 Jul 2024 12:31:38 -0700 (PDT) Received: from [192.168.0.50] ([79.119.240.114]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a7a93c62343sm112902166b.201.2024.07.23.12.31.37 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 23 Jul 2024 12:31:38 -0700 (PDT) Message-ID: Date: Tue, 23 Jul 2024 22:31:36 +0300 Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird From: Bitterblue Smith Subject: [PATCH v3 1/2] wifi: rtw88: 8822c: Fix reported RX band width To: "linux-wireless@vger.kernel.org" Cc: Ping-Ke Shih Content-Language: en-US "iw dev wlp2s0 station dump" shows incorrect rx bitrate: tx bitrate: 866.7 MBit/s VHT-MCS 9 80MHz short GI VHT-NSS 2 rx bitrate: 86.7 MBit/s VHT-MCS 9 VHT-NSS 1 This is because the RX band width is calculated incorrectly. Fix the calculation according to the phydm_rxsc_2_bw() function from the official drivers. After: tx bitrate: 866.7 MBit/s VHT-MCS 9 80MHz short GI VHT-NSS 2 rx bitrate: 390.0 MBit/s VHT-MCS 9 80MHz VHT-NSS 1 It also works correctly with the AP configured for 20 MHz and 40 MHz. Tested with RTL8822CE. Cc: stable@vger.kernel.org Fixes: e3037485c68e ("rtw88: new Realtek 802.11ac driver") Signed-off-by: Bitterblue Smith --- v3: - Use Fixes and Cc: stable. v2: - Use Fixes instead of Cc: stable. --- drivers/net/wireless/realtek/rtw88/rtw8822c.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/net/wireless/realtek/rtw88/rtw8822c.c b/drivers/net/wireless/realtek/rtw88/rtw8822c.c index bc807b13e9ce..e265a35184ab 100644 --- a/drivers/net/wireless/realtek/rtw88/rtw8822c.c +++ b/drivers/net/wireless/realtek/rtw88/rtw8822c.c @@ -2612,12 +2612,14 @@ static void query_phy_status_page1(struct rtw_dev *rtwdev, u8 *phy_status, else rxsc = GET_PHY_STAT_P1_HT_RXSC(phy_status); - if (rxsc >= 9 && rxsc <= 12) + if (rxsc == 0) + bw = rtwdev->hal.current_band_width; + else if (rxsc >= 1 && rxsc <= 8) + bw = RTW_CHANNEL_WIDTH_20; + else if (rxsc >= 9 && rxsc <= 12) bw = RTW_CHANNEL_WIDTH_40; - else if (rxsc >= 13) - bw = RTW_CHANNEL_WIDTH_80; else - bw = RTW_CHANNEL_WIDTH_20; + bw = RTW_CHANNEL_WIDTH_80; channel = GET_PHY_STAT_P1_CHANNEL(phy_status); rtw_set_rx_freq_band(pkt_stat, channel); From patchwork Tue Jul 23 19:32:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bitterblue Smith X-Patchwork-Id: 13740313 X-Patchwork-Delegate: pkshih@realtek.com Received: from mail-ej1-f53.google.com (mail-ej1-f53.google.com [209.85.218.53]) (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 35E5913D628 for ; Tue, 23 Jul 2024 19:33:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.53 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721763185; cv=none; b=S3Q3ZqH7eZjosbBqBqM1CG7gaFgbjGq8HiK/BhVRw5NA1HFSW4XyQbmZ3G2sukIhG1tfhWIhV/96fRwWcgqY3Bfx/RsDC21hRns19occJPmWMgDgnuJ4kNQXJs66s3Uz2FhbxxS3A0XvTZuugBhrfUPsAkKuVJ3MgkWK1X0ochs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721763185; c=relaxed/simple; bh=o+LUEWGgqTWSkGQc0DOmL+ipLzeABxAqv0+nb/tr6t0=; h=Message-ID:Date:MIME-Version:Subject:From:To:Cc:References: In-Reply-To:Content-Type; b=tayi8XH4cuQeprt6QnM77VotLlvv+DnXqmk749d6s8ECQ0lP1LN257ZHUU0v3oiAR6CU3LNPMApk3PRvR4kFxcNwBX2jHSeYqusob1/gq7k/erjFIxsB60o7p1bZsKR6lfklCCbuZLHTKs7BSWoylCgO9aJm7i36PsRbiRFYjzI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=jd31vPlJ; arc=none smtp.client-ip=209.85.218.53 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="jd31vPlJ" Received: by mail-ej1-f53.google.com with SMTP id a640c23a62f3a-a7aabb71bb2so26190566b.2 for ; Tue, 23 Jul 2024 12:33:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1721763182; x=1722367982; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:content-language:references :cc:to:from:subject:user-agent:mime-version:date:message-id:from:to :cc:subject:date:message-id:reply-to; bh=JIy4ls7s6fD/h2R9RtjPtacTlpHzU/ybjCNwz9UsVc8=; b=jd31vPlJsWkbxIKjHJ5PZ14E3+TG4rgl4VCIACQF59UQFPOI99oeHxHuT+rEldTkSB WBmpfn7CroIUN8hPJzQhzkH0CLQ1AfE6KiHSZXrLt54tR2WwDnYN3/ITXnNCrPd/X4OM UxshjRmBIjoMSE5LjIVWKpq96TbReZzwXqfbCaBRj+OyRRqysSbLQW0xzQJ/QAc8tMBq iOm5Moanq74C8Qqtft/kmafl1QOZcRWfr4tLVRbzWNmLfSLB2G5/Igcbqi7lUTJ+JpX6 mVpNTxX/Z5e7QcTr10uUHWExsxuq5DKPgeZDFzHxU8vgdJwUe8ItsLr8CboT4CotT0nc +xBA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721763182; x=1722367982; h=content-transfer-encoding:in-reply-to:content-language:references :cc:to:from:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=JIy4ls7s6fD/h2R9RtjPtacTlpHzU/ybjCNwz9UsVc8=; b=KQYlCLpcWJZ4uADrQVW5UI0KRNefzKGo7gH/DyDOIH3zpWuYJ2IwUUM+5MWfdGZ7tO 5lSaiuAXYTkx8l8qByziQfeY9gCkBmdXUcYLJ0I8M8zs/uaheq5Pv32u+df11RdcBJf7 nKi1OcCk5P8xTd8hEgrKGnx8rsQwO8QdUQSLV7RV2juhrAWAuz5nK4fCtxmL+NSkemtZ AKLNzJEgA1eZ2gVIM9vRjKBkqvEa/R0ds+gUAj0SyfBnrHwtlbrSv9+VfNmM4RBrseX2 098Jmnf1Y5UooIPehQBZ62JoCqmWDT93HxiQ7ETlhhKALMwqeJlexYl+l3wams5pWjvK 3XvQ== X-Gm-Message-State: AOJu0Yxs9jm4F2C6fKPvN+0yW1o4JnwUamvirJSYzJ8TdfrSDephlIMz cwt2gY0oGrpM6itLxuomHalq4lF0aDP8XQ0gOwn7XfHyFOcQxieHzJ3ZKg== X-Google-Smtp-Source: AGHT+IFTLmexyzNvyyING5U6avcp22/tk6yjv8BjvRE+S8Qd7zNBzPS3Gf5r+acR+BoAWC1OC5j28A== X-Received: by 2002:a17:907:1b22:b0:a7a:9f0f:ab2b with SMTP id a640c23a62f3a-a7a9f0fb5e5mr192408066b.32.1721763182211; Tue, 23 Jul 2024 12:33:02 -0700 (PDT) Received: from [192.168.0.50] ([79.119.240.114]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a7a3c950817sm572169066b.211.2024.07.23.12.33.01 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 23 Jul 2024 12:33:01 -0700 (PDT) Message-ID: <1cfed9d5-4304-4b96-84c5-c347f59fedb9@gmail.com> Date: Tue, 23 Jul 2024 22:32:59 +0300 Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: [PATCH v3 2/2] wifi: rtw88: 8703b: Fix reported RX band width From: Bitterblue Smith To: "linux-wireless@vger.kernel.org" Cc: Ping-Ke Shih , Fiona Klute References: Content-Language: en-US In-Reply-To: The definition of GET_RX_DESC_BW is incorrect. Fix it according to the GET_RX_STATUS_DESC_BW_8703B macro from the official driver. Tested only with RTL8812AU, which uses the same bits. Cc: stable@vger.kernel.org Fixes: 9bb762b3a957 ("wifi: rtw88: Add definitions for 8703b chip") Signed-off-by: Bitterblue Smith Tested-by: Fiona Klute --- v3: - Use Fixes and Cc: stable. v2: - Use Fixes instead of Cc: stable. --- drivers/net/wireless/realtek/rtw88/rx.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/wireless/realtek/rtw88/rx.h b/drivers/net/wireless/realtek/rtw88/rx.h index d3668c4efc24..8a072dd3d73c 100644 --- a/drivers/net/wireless/realtek/rtw88/rx.h +++ b/drivers/net/wireless/realtek/rtw88/rx.h @@ -41,7 +41,7 @@ enum rtw_rx_desc_enc { #define GET_RX_DESC_TSFL(rxdesc) \ le32_get_bits(*((__le32 *)(rxdesc) + 0x05), GENMASK(31, 0)) #define GET_RX_DESC_BW(rxdesc) \ - (le32_get_bits(*((__le32 *)(rxdesc) + 0x04), GENMASK(31, 24))) + (le32_get_bits(*((__le32 *)(rxdesc) + 0x04), GENMASK(5, 4))) void rtw_rx_stats(struct rtw_dev *rtwdev, struct ieee80211_vif *vif, struct sk_buff *skb);