From patchwork Sun Jul 21 22:53:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bitterblue Smith X-Patchwork-Id: 813907 Received: from mail-lf1-f52.google.com (mail-lf1-f52.google.com [209.85.167.52]) (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 390EE10A0C for ; Sun, 21 Jul 2024 22:53:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.52 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721602404; cv=none; b=Whj35T8mzUx9SCVvRsizclketXql+UuuCgj0iD2VQyufu3Sgw7yKbHzFPcGRZLdOqkiexldh9DfHyTDQZoE5vEaCX5j0Fn5IzUa8hfXPyF6zOf0sr4hOuxYYJ7BuqZ3tWQ/szGrOGcNuNEpXo5w7EPHnWdn8NBwa9UTm8cht4uE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721602404; c=relaxed/simple; bh=a8/CH7E0F1qBkBvcuTfwGgxqGbkEZFFVmZ6ovn2BJpM=; h=Message-ID:Date:MIME-Version:To:Cc:From:Subject:Content-Type; b=TNvVowXEGpIKGfwXH88JcDupTRcuOM5YvzWPVhlkskQUIjwr/USEcqzIgiSgfMs9I1Pemg3jidaGNiGvFwOdGhFeNboh/WQv2a2gvGOYC552r8G3rh24Ugc/jynMomqYcvNtqeywO8xMS6iIpR1bnxtZDDyEvMbEWMl4frlVz1w= 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=FfdxyE7E; arc=none smtp.client-ip=209.85.167.52 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="FfdxyE7E" Received: by mail-lf1-f52.google.com with SMTP id 2adb3069b0e04-52efc60a6e6so1646617e87.1 for ; Sun, 21 Jul 2024 15:53:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1721602401; x=1722207201; darn=vger.kernel.org; h=content-transfer-encoding:subject:from:cc:to:content-language :user-agent:mime-version:date:message-id:from:to:cc:subject:date :message-id:reply-to; bh=osy+SwZ6MSI4gmfpeBc1jUk71RsqdL37/ZS44MISaxk=; b=FfdxyE7EIQfSlaI2bLHGRoukLwk4Sxo24oy1dizV809n0MeijdmJTcYd3AMy60bK7D qX+2DhgYjApO/zN4OS5XKPOj7rY02E7JOvnZ1J14L7dKxuLtFrUetrJ6Ck+ADX2HkXlE H4TQOztXfoGgeBxFxCYs9RH+edZU7dA2GP8NCPUT59sLyayDOyjwDmaubGWuMtdf/ZV9 yqea16sejEfiIQ0dSEJEegvfO2IEvZJTfvCPIIKRSt4SJohkSELSq6S6ysVy16m4D0qG pQtTkZSez/ifW7JRRcztXfFTvlxhFI6aVogOUdTQLW76oXZYD/PWIce4cHnrWjVLtiOa 2uXA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721602401; x=1722207201; h=content-transfer-encoding:subject:from:cc:to:content-language :user-agent:mime-version:date:message-id:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=osy+SwZ6MSI4gmfpeBc1jUk71RsqdL37/ZS44MISaxk=; b=f/OBRT05Udl24JmnadZV03hkItG2sdrXs+EGASsPiMMNRa2qL7O/hD646wPYQq4OeL NQYRgralPFW66VRgGvTfiX5uFNPqVKqjkL/rCOREgGTu1cHouBRs8hTgLZ31LkrrP6bY K1ESrfAVAcnpJQPqDWNrt7o8AlFlPstsh0kygspDwZugw8dKe+YLdhiX6urFW/DUmNYf gmuhGst5bGuotDkBA1ivPufeAYfkT5V+V1ECfF88fhjPUasWLV3KKM4mQ5nO1HJXnbHj Hn1gcekSNXYI7FNFiLh3b02bY+kCMN1RPdB0KihNeM9NGQp/9JE5xvOKRKKjS8np+fzI HRFg== X-Gm-Message-State: AOJu0YyNSxbIjedXBFki0CTHpO85sFNLVyw3iK+jZRI8cRD98ZhurITJ fvGV+sUUeCGE9KiForZyslmlxzAAsVEIOx70gTltWEev0Zm8+AyKOI+wNA== X-Google-Smtp-Source: AGHT+IFt4oD/MW1zvFkTZ+swxsRD8GfdSb4u1Mo888Rf+w4SWvpPahemgRjLXaHAix9hYLfNTwd9fw== X-Received: by 2002:a05:6512:10c2:b0:52c:e3ad:3fbf with SMTP id 2adb3069b0e04-52efb7c8891mr3325812e87.42.1721602401042; Sun, 21 Jul 2024 15:53:21 -0700 (PDT) Received: from [192.168.0.50] ([79.119.240.114]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a7a3c7b6622sm344209166b.50.2024.07.21.15.53.19 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 21 Jul 2024 15:53:20 -0700 (PDT) Message-ID: <2fbacb83-3e47-4f37-a70a-fb9f4719eb26@gmail.com> Date: Mon, 22 Jul 2024 01:53:18 +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 Content-Language: en-US To: "linux-wireless@vger.kernel.org" Cc: Ping-Ke Shih From: Bitterblue Smith Subject: [PATCH 1/2] wifi: rtw88: 8822c: Fix reported RX band width "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 Signed-off-by: Bitterblue Smith --- 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 Sun Jul 21 22:55:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bitterblue Smith X-Patchwork-Id: 813702 Received: from mail-ed1-f48.google.com (mail-ed1-f48.google.com [209.85.208.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 21743101DE for ; Sun, 21 Jul 2024 22:55:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.48 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721602523; cv=none; b=YZhaqm5p00hiSYHvdK9y9Dt3Qpwkvtb1kX9/VsD8Lql+qHwGOq5fxx6k79ODqxq1u7Akd5txjNACTGf4iGz0vrpfkdsS2oqa84umvwQFwRKeH+ASqRuIr/AjxQAO+XGyIzdcTm/Aluxr5CxqVRPRRBL7SmNeSz7hIHvLAJHEckE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721602523; c=relaxed/simple; bh=4kLCRihZfAZaNc/VAWav0zFBu/xv3FTXAeJTxsQ3d28=; h=Message-ID:Date:MIME-Version:Subject:From:To:Cc:References: In-Reply-To:Content-Type; b=qeoEJVz7XtixyNyY3oo6AJi/+ZFAenJhELSnMnx6HhzwrxVfgBMC4BI7VIlFDkbyybdOLgVSMz9LV59bja39GQMJDSTOrJvTk503IDKwKCphLnsAyJMzJjoCi1Q51TqNY7/paoNCteUqW/zJIeLl65yJSd76nlQvfcyTTBzekF4= 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=IXyq4jMV; arc=none smtp.client-ip=209.85.208.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="IXyq4jMV" Received: by mail-ed1-f48.google.com with SMTP id 4fb4d7f45d1cf-5a108354819so2879887a12.0 for ; Sun, 21 Jul 2024 15:55:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1721602520; x=1722207320; 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=V3uFIn772x/iA/Bfo6KBY14WxnbP+FlHltBawdJRh5s=; b=IXyq4jMVDYcTzir+17fidim0z+59XPQ+MUeenMM166aFvQccuWRtC2AoLzNPIY971T 8N4o53dOrwAapJKJQXzJ2Qz+o3qe4TwqRnWhRZnVOgqSWPVl5D3qYzx/RszEeS63Qtmw WYepXEYD1QAIc9PtG+LwsnKQDByuRTMyV2WOEHTQ1C1SiXCnraWXejTM3t+/RXs7dLAb NbBLiMSu6S6w4yIIMly4yUGem0OnfSR4lBfDdGPsma1IXCY5uIk2FD3nlRyUG192wgEF X4YOXky02T78x6M4OgDITK+sUbXszOFTDsnDoJqntaYVZUxj2nF54cU34piGwNRJ0B1/ aBcA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721602520; x=1722207320; 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=V3uFIn772x/iA/Bfo6KBY14WxnbP+FlHltBawdJRh5s=; b=sKzg26pCHuGZ8l8WPkki46uRzgPI8TLqfo+tBiDGyUkPoh4V+2aZmxCwa8SLNl4EiX NlP0BPUTD0QAteuWbh3OyLTha1MqzD6QEeIUQvbkIQLswhgG/R3/1VPKdD/p/eljud2z UDgp2T+1KVIPDBUG8Md779i0Fp+EVk3l9G1vCuseRH+EexBgGjpqIqzUz3GwW3CKrGRU VSDaHPVNHO+hCpA3az8CBskzBe83OdP2WO2Aeh07I0P3quWKWFKY0vse5EhmKcDbWuD7 8AJHURRcbnMSvNDrHD5JlteiXj+iTl4cOhLZEEdzkZezCVUDweEFHba4noRbFDx4I1OG gt8Q== X-Gm-Message-State: AOJu0YxIc2FH2o4IbBCMOOxRCZsBBZ5nweJCqCmqTL5jbEBvVECI6u3o 7ZRsQvUqvRxgD36aVHk++g00qh5zbgiWjE0rUyIJI1ywUpKfR2aNXBijFQ== X-Google-Smtp-Source: AGHT+IHFBvJABoB9JXzB+wZuGdwxASNwkH6SBNKvTioOIkks9F1+y3wVHqj4JjB4z+Df2VqJHwfiEg== X-Received: by 2002:a05:6402:3553:b0:5a3:f5c6:7cd5 with SMTP id 4fb4d7f45d1cf-5a47a91fd73mr3091514a12.26.1721602520275; Sun, 21 Jul 2024 15:55:20 -0700 (PDT) Received: from [192.168.0.50] ([79.119.240.114]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5a30af83177sm5172013a12.42.2024.07.21.15.55.19 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 21 Jul 2024 15:55:20 -0700 (PDT) Message-ID: <712d08e3-fc90-48ad-bb61-bb601b2cf953@gmail.com> Date: Mon, 22 Jul 2024 01:55:18 +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 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: <2fbacb83-3e47-4f37-a70a-fb9f4719eb26@gmail.com> Content-Language: en-US In-Reply-To: <2fbacb83-3e47-4f37-a70a-fb9f4719eb26@gmail.com> 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 Signed-off-by: Bitterblue Smith --- 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);