From patchwork Mon Jul 22 10:50:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bitterblue Smith X-Patchwork-Id: 814117 Received: from mail-ed1-f45.google.com (mail-ed1-f45.google.com [209.85.208.45]) (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 5049F1B977 for ; Mon, 22 Jul 2024 10:50:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.45 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721645440; cv=none; b=e0gAUCUg2gBhsYsypEijZXpb+RZNQiRFi3ZJ0rgisWXk/tsQkRF4noPzTeU2o55FBG4vvUZI/jkVHcUua4mp3+g8Z/vmwTwXaXFNGnOpl3jGggAS69oLLpmHUvnxhY5XW01JX27cGDOthC5dVZIx1dkMO2KEHi9XkURAFNbu1Jk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721645440; c=relaxed/simple; bh=aLvRISfHWsDXunOrxRg0QPym1BW+dnjPb6b2oyGKJIQ=; h=Message-ID:Date:MIME-Version:From:Subject:To:Cc:Content-Type; b=nyRBQa7uREh3A7UoIKeFZNifuE1JQgtU6VRbs+LJIHiPkji4zqC+gqId5k3vJj73wuKpmAl5szUOI4uPecEyg7Mf+jlzwhAkrpsiH66BXHh8bTgINEMOHXBFSlqkvCOsOPGkfD1tBaK8UaqmQ0rb9rhQRT25PEDrPzFV4bfQSms= 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=P3rt3AWU; arc=none smtp.client-ip=209.85.208.45 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="P3rt3AWU" Received: by mail-ed1-f45.google.com with SMTP id 4fb4d7f45d1cf-5a15692b6f6so3377132a12.0 for ; Mon, 22 Jul 2024 03:50:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1721645437; x=1722250237; 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=2XdYOM+yhonSxVm3KG6txmu/CkLzvekzG+71K/RcgCw=; b=P3rt3AWUVnRmB3tYM82j/SMrA+yYc4slGKe5EEjNTXi6d4odSu4StDVUE0uCtlzK9Z McrGIk9IIcmiwJg7+YsD/rZzblnzJE85LGgi869GyeRR/Gb1uIhwe7mk7u/9QpOcHpvX HLJ6d4a6huGeb1cgasKG5WT2st598oXz2IdGJTjicQSMZ34REOuEIYlRyeK7rvR/Ke4I gutb7IHbPVHMZLhFclN6jbnTLWokjD/8jVBhMgQYMLwup8CHk3OHSXsc7qu7ooIcwBfz L0DtckWm8BzPMu0eRm/TAJj3ow/V58pwG+yIKM+Huokcmy+FVVWMwt1Z8THNKARDZ00J SOFQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721645437; x=1722250237; 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=2XdYOM+yhonSxVm3KG6txmu/CkLzvekzG+71K/RcgCw=; b=KO+3p3wL/D3wpuq3gsbsx6o//q1Di93GcJLnI74FqJwMgt70siZqEZ3B4D7ctNwZ+c ErxjhlArKPyc6CV5r+GIo0SQqQFRRZFzT9YA+gEU/1474UFeUc11yeGlyFWKBG+IhpUg RsUroXPNjzSWg/20scCjw07DOq+5Ip4xElhooWr8cl4f7xYJs5IYCHP8VzD2/k0mVDgg b4CJ5JgjNLAjOHor53t+gp7V0p3VtbpAeI03bWuBU62a2LsJsv5ZC8+eLlvYN8QvP3oO qw8UaHBKqeEdYstGYg7O4XRL/W/4iSZ9dG4lzA1VDyPTeqvaPMqUy0n2j27CbVieH/Z9 BPzQ== X-Gm-Message-State: AOJu0YyQjg0iPSr39rFPQ+57KpSPz73WZLMXSZ+NgJxWxoN2FKZVSuNz vJq90bwcQZBFa9uGFOtHNGUlJMAuIax1cmOUnwrz8H0txMqYXEJQMIGB9g== X-Google-Smtp-Source: AGHT+IGqL4bRLYBZfy+wE/Kwq3KsEtHwQYze83XQD+cP5bHj1vYxskMBYFXhvvFl+3X/1pBjNKNewA== X-Received: by 2002:a05:6402:4405:b0:5a2:b867:3bcc with SMTP id 4fb4d7f45d1cf-5a47bb8e893mr4011135a12.38.1721645407384; Mon, 22 Jul 2024 03:50:07 -0700 (PDT) Received: from [192.168.0.50] ([79.119.240.114]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5a3e642b647sm4816502a12.55.2024.07.22.03.50.06 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 22 Jul 2024 03:50:07 -0700 (PDT) Message-ID: Date: Mon, 22 Jul 2024 13:50:02 +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 v2 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. Fixes: e3037485c68e ("rtw88: new Realtek 802.11ac driver") Signed-off-by: Bitterblue Smith --- 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 Mon Jul 22 11:01:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bitterblue Smith X-Patchwork-Id: 813904 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 C4C7316CD27 for ; Mon, 22 Jul 2024 11:01:31 +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=1721646093; cv=none; b=jok7wa6S5Ii+ES8V0T5FIAghlyl6RikxuayP5w3bX+OKse+Pv+CFOSaaFYJ9WVE4ctVocM7utxKbSR6kMVs5n0jaLrKdqSwZ1X4+lwF5/AI+V3TLBOvJtMFirRcOspTMnH83rrL5jYoYBFYhspbPJkldzbFk+PCN193kwRfq3y8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721646093; c=relaxed/simple; bh=JQWQzL0an6wMM6TwvRnl2dt9VXu2SHogJ0MaZ7ysE3Y=; h=Message-ID:Date:MIME-Version:Subject:From:To:Cc:References: In-Reply-To:Content-Type; b=ltpRIE0oH738VerJ+m3aORyyAZn+9IuJEdKGpWr+ohlYPuroHw9qVQLuQ+KMw/zP3tkuZMEzEFpeI9mD2tYwSyCrl3pY76UUkbvZVRuoI1gBBjQHGAeHX76ecAaYza3V0ofI5Lpc1H3lMIrT+m3xCRWihelG1st7DFGTOgHtasU= 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=VSH16cpE; 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="VSH16cpE" Received: by mail-ej1-f53.google.com with SMTP id a640c23a62f3a-a77cbb5e987so371037566b.3 for ; Mon, 22 Jul 2024 04:01:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1721646090; x=1722250890; 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=10sTknDccu1nqfFEH4N3znXKbDcCDxyriSJwrZpBRpk=; b=VSH16cpExpQvmOR8khKQL9D+MsUALk05cyYyYPVc1E+ysyXEFBCYAFCcZB8Q6698UT L3af//QuJgOuOleLGRyeCi86TFppYjGOehZXhd0salm9SlxFqOL8ybq8XPEYbdTgcwqv ttQVXH3aEyjn1HR/b8m7ZIfrBC2MvHn3YGjWucxQUKHYqO/vfa9MyCAszuq3MyTFTMyF ppTJ89oCU5mVR+Q3BUjiTTN2BcP9jHG8PB4iOX8sEtq40hIEN1m/uZKjdGknLXLPX5gw ISxz/j+/aEhwNChq1YrisyMp+rdj1Vr5MCbzETfm4DrjhTn0NNZs78wzcqhmc8sV5qa5 IpqA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721646090; x=1722250890; 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=10sTknDccu1nqfFEH4N3znXKbDcCDxyriSJwrZpBRpk=; b=HkTLC0H+1oEobtYqee5Xsvpan1WBbO4Haaa7Zgrm9m+RQrw9CkPo+jGFgQonbYTvpT V2TXN+pEVzS0BRZVwdwtHlnG2X6rPeroIcIhuFQdnlaK5CcNT1J05Blmzz+1fHtIlqo6 HTdW1V6QeOYeH6O6kFIP8hCLCP3ctwiuaEZJKDIsT1STcyXcHhJO5haAs6tBWJqk3ypx iHP79Z6X8WXsFN5geuq9Hjfr5Rgu1MPzn07cJ5SBAjk+N2tKcI6ueU7fYKxdN9dHwxtd hDdVB2quUhuMxDSDwtWcMdBd47MKAJ7P77QOgScXz+PNqjyLnr4RZ73/0Ggg5qi8n5b0 2RxQ== X-Gm-Message-State: AOJu0YxADhwEcdIyQ+ySCNmw5Ria5VwRqaHl7mSC4ZQ+K7loXsMoJaAr Ae4Z5SblJx/KzzuDyXlr3d8gXDi3zuvtG6hGXk/ECNCXU4w58DTMG2CIEA== X-Google-Smtp-Source: AGHT+IF0t4kIq6Da7FhPfhSJUu74JMGcQo03Eu9TO6SZOUF9hedz6WxaTuXsfD9QCCXqhM+AZIoJbg== X-Received: by 2002:a17:907:2d8e:b0:a6f:4f2c:1936 with SMTP id a640c23a62f3a-a7a4c4147e1mr460327666b.44.1721646089786; Mon, 22 Jul 2024 04:01:29 -0700 (PDT) Received: from [192.168.0.50] ([79.119.240.114]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a7a3c785ea4sm407346866b.37.2024.07.22.04.01.28 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 22 Jul 2024 04:01:29 -0700 (PDT) Message-ID: <432bf0ce-e3b1-4fe7-ac17-51401c029203@gmail.com> Date: Mon, 22 Jul 2024 14:01:27 +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 v2 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. Fixes: 9bb762b3a957 ("wifi: rtw88: Add definitions for 8703b chip") Signed-off-by: Bitterblue Smith --- 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);