Received: by 2002:ab2:6203:0:b0:1f5:f2ab:c469 with SMTP id o3csp652041lqt; Fri, 19 Apr 2024 06:46:18 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVlyBXStHoPwF2xi8xdmi6CHhPYEiyxH8EHHYnFOEZr5g5nKDz9WTh7UhD2ssadGKkWpgeQ8ZzQlmbzBB2LVIOefIO2AJSDqgtEf594XA== X-Google-Smtp-Source: AGHT+IGmySrKI4ENS54lfX6Wa1Q2uyGOx/skQg1PIcESHWXHqx62TjRvWaogVEpthw4ixxIvr6PA X-Received: by 2002:a17:90a:4886:b0:2a2:a889:c2d8 with SMTP id b6-20020a17090a488600b002a2a889c2d8mr2278856pjh.32.1713534378631; Fri, 19 Apr 2024 06:46:18 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713534378; cv=pass; d=google.com; s=arc-20160816; b=tdW52aE4O0lg3m+9rgzha8shb5cauaxhwUCKMinAMlE4tAl2W/c1HAFX7FURIeDuoo qf+JBG9t5fDsGkuGfSKdhBv/FQ0oaOF46HuWQMOmQB9+7+XyZeLcoyuCWG63fxH7WcGj P8UO131pijKUYJXB3AFrPBD3hYplqLJ3QI4l0rtxOSTmM16DqTrElIqf5vOZhJrKQg8G lL//vK6UlAGrneoSu2b025/biV7tde22xeaIY4u/Ex7kWBOpOwnqH4G7xhTz+e9sdg8c 91Svkgyk+H1auF+7T1DyeGlo9/TgzstxFIEUYLAMmFqPiv35MtF6UbNkADADgNKo0dSb cllQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:content-language:references :cc:to:from:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=yDN1u1MTA7i+7tP+k9O28kzd/+AN89B3ZIXa0MvQiJ0=; fh=GVnelbfE/v+aJ1A3hiU26TlnzEfbdVxjje3TgjMIPHs=; b=fxedX3tXxEd0tjm6Jqt5z2rLCRStQDI5A9NtrHTJbG+0XiKkRfWS87PSnQ9yZUewt9 o1BWrDpyi4aTxn+mE4aChysRUMKSMZd0j6ztu09ztKq2i2b4Bwl/iWdeQy2eNtCjVl1d GrN60XfdfRC0ThlGsOH7KSgRJjiVglWHKNTHm59xyOSKkT77vdDVC5bIwR0wCt85/CCa 6Hvm1AGrNz4Cft4ZdE8CydDEy8wYV4ZoBaW+0vwTYWrG86GWQ+tm4S6k2D5H2t9iIH+Q D/QnTw+vqoncgrDE0hZCytqfCS59Boa+SwcSfbv8v8Ga6a5A26yVbvuRyhKCVSENmDdh Pu5A==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=LQTgmdox; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-wireless+bounces-6571-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-wireless+bounces-6571-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id d10-20020a17090a498a00b002a4f0f7a137si5017466pjh.102.2024.04.19.06.46.18 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Apr 2024 06:46:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless+bounces-6571-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=LQTgmdox; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-wireless+bounces-6571-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-wireless+bounces-6571-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com 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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 39CC0B22A00 for ; Fri, 19 Apr 2024 13:36:25 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 969FB86278; Fri, 19 Apr 2024 13:36:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="LQTgmdox" X-Original-To: linux-wireless@vger.kernel.org Received: from mail-ed1-f43.google.com (mail-ed1-f43.google.com [209.85.208.43]) (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 E39EB1E867 for ; Fri, 19 Apr 2024 13:36:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.43 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713533781; cv=none; b=P7DWheEJepTOg5mpgYn0dkahFevsFMrOAAWIxpqvw+Ua8iSWACGvueT7GGLuTFVdPkdJVkCuo/82AflMbNQlm1C/MdygPo0SyVUJTfQTzac9/qfZ6J2EU0Q/Nm8v9t+X0544mfdLEGlxCRT1hP8bZPXlf7rKzZtW1Bpgr1cx+PM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713533781; c=relaxed/simple; bh=H/fDmkuWcGZE398ZUR+nuzSFjRcaUj0e7ji2syCM3XU=; h=Message-ID:Date:MIME-Version:Subject:From:To:Cc:References: In-Reply-To:Content-Type; b=ltv43G71z0oEJ6lU9k8agaEY+0zas5KcKJaDXmGEsVPuFNA/lfYCrseGJo4mfjmT7wFhSBmK/PLMDbldF5twlnujepPnreRsb9SsCZC28fzuhq6MJdOKm+doUO6KaKAdjvyMMowfuhlR8OkNTWGqkEM9HoZaMGAY+mr6xxaCpN0= 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=LQTgmdox; arc=none smtp.client-ip=209.85.208.43 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 Received: by mail-ed1-f43.google.com with SMTP id 4fb4d7f45d1cf-571ba432477so2080913a12.1 for ; Fri, 19 Apr 2024 06:36:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1713533778; x=1714138578; 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=yDN1u1MTA7i+7tP+k9O28kzd/+AN89B3ZIXa0MvQiJ0=; b=LQTgmdoxG6455TVf0AqTXp+MdEM9MoMHIvUeC78DLuWtecQT16PTnx/9+lRk6nRl1t so/bTsZtLUlPq2Adt/qs6uroQrcTCy0UD0uFfnCVaABS6DwmeoZ9Eztr3v7w9I/zZS51 FpvIadM2g7r/c31bnF25zKjq1nYBskSIiGWiP2COgN/Rhr3Lg+WIO7/EzHiWV5wCIcg7 NIzVCUmnm81sY/XJuEMGsXR210dqqqUnkyhm5AncHThZkA2J89pHdWxlXI5DjKgXdEgk 7cSpQBZwIbq9wsqVu9Jx8CFgKPIYThEcGzH66zc8aVbZEljNkerpPTe3+CGdqWhWdC1y FfuQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713533778; x=1714138578; 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=yDN1u1MTA7i+7tP+k9O28kzd/+AN89B3ZIXa0MvQiJ0=; b=mtqNdqLvfSck7iebM8+KTZ1exxwJ3Qp/eyGOI+p3xdQntRwt/9zzePyZ2MS6tLEXUw HFnZFe+jrtz+A4imfVTfNHE7/bRWLXr9zN4Q0fhN5xZEXPUJ04QkYyM2zxoLf3m7291f p/PtuzMG0g3ICX/+ZNnNChlPEhSgO2h74z5fzKR+IpJ7hBpmrhv7+lXmll5PDfnvf+yB 3UCkfM+xeLIr0Au8Mct5E9bf3m1UznRaU+el2YK7sAv7vqYTPJWn7XSw6bu7Bb4SmNyw ZLn9Teie73wzX2GzD6SkJX/ZkKMP7P6tNaGQ5xmohambrse2dZWesrngFxrOpU2YRNZp LcXg== X-Gm-Message-State: AOJu0YyNGBF7tKNB5AHBvZhDGky5yYNn9v6ful1YFmSwgBPfJTABNTKg eynq5XsY21cKeek8I2gad5y9zf5z4Z9jtY8izNtUsV6aFDEhVGaqmXMrLBdl X-Received: by 2002:a50:ab56:0:b0:565:dfac:a686 with SMTP id t22-20020a50ab56000000b00565dfaca686mr1389459edc.38.1713533778104; Fri, 19 Apr 2024 06:36:18 -0700 (PDT) Received: from [192.168.1.50] ([79.113.154.240]) by smtp.gmail.com with ESMTPSA id d6-20020a50fb06000000b005705e7ee65esm2142843edq.56.2024.04.19.06.36.17 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 19 Apr 2024 06:36:17 -0700 (PDT) Message-ID: <86487e41-bed9-42e0-8ac1-ecc75f1a1f84@gmail.com> Date: Fri, 19 Apr 2024 16:36:17 +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 v6 2/6] wifi: rtlwifi: rtl8192de: Fix low speed with WPA3-SAE From: Bitterblue Smith To: "linux-wireless@vger.kernel.org" Cc: Ping-Ke Shih , Larry Finger , Stefan Lippers-Hollmann , Christian Hewitt References: <9d54a192-d389-4a56-9286-2e7721cbbc27@gmail.com> Content-Language: en-US In-Reply-To: <9d54a192-d389-4a56-9286-2e7721cbbc27@gmail.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Some (all?) management frames are incorrectly reported to mac80211 as decrypted when actually the hardware did not decrypt them. This results in speeds 3-5 times lower than expected, 20-30 Mbps instead of 100 Mbps. Fix this by checking the encryption type field of the RX descriptor. rtw88 does the same thing. This fix was tested only with rtl8192du, which will use the same code. Cc: stable@vger.kernel.org Signed-off-by: Bitterblue Smith --- v6: - No change. v5: - No change. v4: - Patch is new in v4. --- .../net/wireless/realtek/rtlwifi/rtl8192de/trx.c | 5 ++--- .../net/wireless/realtek/rtlwifi/rtl8192de/trx.h | 14 ++++++++++++++ 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192de/trx.c b/drivers/net/wireless/realtek/rtlwifi/rtl8192de/trx.c index 192982ec8152..30b262c3f6d0 100644 --- a/drivers/net/wireless/realtek/rtlwifi/rtl8192de/trx.c +++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192de/trx.c @@ -413,7 +413,8 @@ bool rtl92de_rx_query_desc(struct ieee80211_hw *hw, struct rtl_stats *stats, stats->icv = (u16)get_rx_desc_icv(pdesc); stats->crc = (u16)get_rx_desc_crc32(pdesc); stats->hwerror = (stats->crc | stats->icv); - stats->decrypted = !get_rx_desc_swdec(pdesc); + stats->decrypted = !get_rx_desc_swdec(pdesc) && + get_rx_desc_enc_type(pdesc) != RX_DESC_ENC_NONE; stats->rate = (u8)get_rx_desc_rxmcs(pdesc); stats->shortpreamble = (u16)get_rx_desc_splcp(pdesc); stats->isampdu = (bool)(get_rx_desc_paggr(pdesc) == 1); @@ -426,8 +427,6 @@ bool rtl92de_rx_query_desc(struct ieee80211_hw *hw, struct rtl_stats *stats, rx_status->band = hw->conf.chandef.chan->band; if (get_rx_desc_crc32(pdesc)) rx_status->flag |= RX_FLAG_FAILED_FCS_CRC; - if (!get_rx_desc_swdec(pdesc)) - rx_status->flag |= RX_FLAG_DECRYPTED; if (get_rx_desc_bw(pdesc)) rx_status->bw = RATE_INFO_BW_40; if (get_rx_desc_rxht(pdesc)) diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192de/trx.h b/drivers/net/wireless/realtek/rtlwifi/rtl8192de/trx.h index 2992668c156c..f189ee2d9be2 100644 --- a/drivers/net/wireless/realtek/rtlwifi/rtl8192de/trx.h +++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192de/trx.h @@ -14,6 +14,15 @@ #define USB_HWDESC_HEADER_LEN 32 #define CRCLENGTH 4 +enum rtl92d_rx_desc_enc { + RX_DESC_ENC_NONE = 0, + RX_DESC_ENC_WEP40 = 1, + RX_DESC_ENC_TKIP_WO_MIC = 2, + RX_DESC_ENC_TKIP_MIC = 3, + RX_DESC_ENC_AES = 4, + RX_DESC_ENC_WEP104 = 5, +}; + /* macros to read/write various fields in RX or TX descriptors */ static inline void set_tx_desc_pkt_size(__le32 *__pdesc, u32 __val) @@ -246,6 +255,11 @@ static inline u32 get_rx_desc_drv_info_size(__le32 *__pdesc) return le32_get_bits(*__pdesc, GENMASK(19, 16)); } +static inline u32 get_rx_desc_enc_type(__le32 *__pdesc) +{ + return le32_get_bits(*__pdesc, GENMASK(22, 20)); +} + static inline u32 get_rx_desc_shift(__le32 *__pdesc) { return le32_get_bits(*__pdesc, GENMASK(25, 24)); -- 2.44.0