Received: by 2002:ab2:69cc:0:b0:1f4:be93:e15a with SMTP id n12csp2006409lqp; Tue, 16 Apr 2024 04:58:17 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCW1pt+2U8NuiqoiHFtUbyKhOxox7UlJaZyHlrVy1O4Xhi3q5WviEZMi1GZZSpG98pRFO2D1L7y+YthzEMfVQ1Yp/+YytWriAOOWgcewgw== X-Google-Smtp-Source: AGHT+IGh7yDst5lShNGkmaaAFCJYZHNKWjVV4CPFvva2UHeon7hsEhffUxkscrhSacxBYa12wLRL X-Received: by 2002:a17:903:24d:b0:1e2:7094:473c with SMTP id j13-20020a170903024d00b001e27094473cmr13444483plh.54.1713268696908; Tue, 16 Apr 2024 04:58:16 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713268696; cv=pass; d=google.com; s=arc-20160816; b=cVXPl2tpE6jCLRfZ2V4Au8sfFGMefmUFcY5NZpat/cQQNvZPAWCMnGkjXL2O4+1Ei/ LJNisXfUfJ1SGUfhAo4iGeEYcvBLdUJ+k+wrbRwRkynmAR8MDq7WYz+016Nz/Abn3lkh zHij7kL9fQYkk1WO6ka3fVr3sl7X8ERfPRla9V9IFiLWiNR0ts1T1F8RON9ETO5U4oCA 9A0ZV0mM5BfH3Aj69+nLWuHNfOdT+XWA8NMCdKV22o2LAQpWII0Ytcq8XQDSzA7zkfqK 2CZ9fRxIZcN4DmIW/oKZ+8WDRpwTdmEQ38NV53DMSDqy7wX4MMCrbeXbovQjKcHs6c9w yx2Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=LKhStIM1l5ZF5ewGFOL15TR0r7oTKTp2UvmXNBROPuc=; fh=sZ67LUL3OCjPLPRY9UNyK7cP7GjkCb93Mh210kFW858=; b=kbJgZzJWFmCWhFwUIcbB8cCzMA6r/w6Ib1Q0lqepQVRg1CQlEq1SS7tPomMOW4Ick1 QTsrhs6yblgXE9iM0NbyxlW7+t9rC9V2q75Ep5f9t71T6cgsvuf9rUp+upV+f5gUifjZ WRjfHjJ+bmlH1wmMSLch6xOYfps1IWNyMy6px0FMpK/feBKnnWKwMUYuJ3olwi6gxCph 5kCP0zTG2ZlH2vUcdvtc7srsUyuS+jkJ55GrMSWlipJmzFR6Rc9LkoXkUeDYGkYNILZE pnuX9W1kapZfTEG0dxqmD8EOHZAz8obqlIAHAlYAKtaaKbj8uju6F9qDg1KW80ISLROY bxRQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=UOweeuly; 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-6394-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-wireless+bounces-6394-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id k2-20020a170902d58200b001e78d33b705si2694117plh.321.2024.04.16.04.58.16 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Apr 2024 04:58:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless+bounces-6394-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=UOweeuly; 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-6394-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-wireless+bounces-6394-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 327B32821EB for ; Tue, 16 Apr 2024 11:58:16 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 91314129A8D; Tue, 16 Apr 2024 11:58:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="UOweeuly" X-Original-To: linux-wireless@vger.kernel.org Received: from mail-wm1-f52.google.com (mail-wm1-f52.google.com [209.85.128.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 D8B43129A67 for ; Tue, 16 Apr 2024 11:58:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.52 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713268693; cv=none; b=RZxftKYV+Gppm/zHGPYJNpaFG/k23X7sbJH9dK3szpe7cmjmU5V+O3825qUZcfUXjjZa0L1nireUJtcAi1Lld3GfK+WxAkImhbIjLJXacE2uXP4XYygvVMv19PBTo/SancGEqcEPzTAapzyR84Yqf5VefelDnJvnQ1ve1shug9c= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713268693; c=relaxed/simple; bh=C3XT9eXRV1Z6J7fMbS/qxvbNmWLGfupP5GGV4KW0k8A=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=lhExmm9mUpX/f07yay21T3okhQYkJwFFtZ5FOf7M/k9g1DQYy5CttlXOPnRfFtppQ2ptEDK4RaXt2txTpQR1DOztOYmnM/m/hIvvJzkj9aQqMRLpkuEBmIxMIQjN3vFmeaO4FksT2AEzTKK941M1XgbwN9ZW2hJ/r2Qd26uAt70= 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=UOweeuly; arc=none smtp.client-ip=209.85.128.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 Received: by mail-wm1-f52.google.com with SMTP id 5b1f17b1804b1-4155819f710so29531275e9.2 for ; Tue, 16 Apr 2024 04:58:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1713268690; x=1713873490; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=LKhStIM1l5ZF5ewGFOL15TR0r7oTKTp2UvmXNBROPuc=; b=UOweeulyZpB7JZBstHnCgCYVJeWWeFvvKQOJEX1eLgiGzV8/Cy0ExPIMIUpwuCqxjU o6rkkdkIHEuCmDYjYbBM1F/FOr31qSpMGPWIuhyAnm0ZpOD/Bd5tMvjx0AbqYrLQHzLH wFkmvjCyawcSbgrE49jvl+WoAsIqO8IIdImAusT69l86JxrC9U9gwVHjEIkV1SjAr0O5 RvoaIu5ucUiDzPbCibOQOupkDxmVMEkEONgCVy2bXtUlg7QTNnD7L2OsMbheUxFqRM02 cN5zmxLk/1Ji6ySljKg11yp5l0qlGuJkMrWyucVGZb2UnDo4f9NgReRVzijY573d5Hmd SSWA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713268690; x=1713873490; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=LKhStIM1l5ZF5ewGFOL15TR0r7oTKTp2UvmXNBROPuc=; b=cwyBVMcBjJJ0FB+khjJ2gvpkF7b8GuyMvXSzVjxDVJZTZpq4y+7LiAR21XtsbPm4lo zqwx6DZixoSWhgaz8uRXbViNZt5rUDNDsAEKU5LHak1Kcnl+J44vqoESoDMi88wXjy34 VXc8BhgTSc1RcrIMux5IUSPY+LNrMbfUeaodM6pt3x8PWFY8uaYhQDcecxkAZxOovqdQ Ws/9bFoXKguGnsZR8oJXX314rFqwaKTa7bxZv+IvZuWPmHqZrv9jiqy2u4BmsIjrFkla Sodz5Ikp1JMAPYMvvSJvmbMR7uY6BXkkVgs+humF/nFDmwpB30BgM+EDokUw26bRPOsy De5Q== X-Forwarded-Encrypted: i=1; AJvYcCVIKPHxrVHyrNtBZ1co4+j9pN64V7gLIWyUj+qjADKmMem+jw/TIov8MMwGjwirIMu49a2UXJUktfkE2oqk/j9yXOCzMWcgFXH6KYNQNw4= X-Gm-Message-State: AOJu0YyKqQFLrqJ3+y/ZVOF76FHnTW84nuHlPFJixu1+GgsQ9K20ZiGj YqudbUPf0Wgl5gYgyDWibYWiOL/w1FH25GjlqPzTpOdxJltZST7yRWpyzZon X-Received: by 2002:a05:600c:46cd:b0:416:9cf8:f901 with SMTP id q13-20020a05600c46cd00b004169cf8f901mr8906714wmo.17.1713268689912; Tue, 16 Apr 2024 04:58:09 -0700 (PDT) Received: from [192.168.1.50] ([79.113.154.240]) by smtp.gmail.com with ESMTPSA id ay8-20020a05600c1e0800b004181c91d1dcsm13843601wmb.18.2024.04.16.04.58.09 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 16 Apr 2024 04:58:09 -0700 (PDT) Message-ID: Date: Tue, 16 Apr 2024 14:58:08 +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: Re: [PATCH] wifi: rtl8xxxu: Fix gen1 rate mask command To: Ping-Ke Shih , "linux-wireless@vger.kernel.org" Cc: Jes Sorensen References: <3068a7f8-0178-4ea7-bd18-4e377db07e76@gmail.com> <12bae50933084d9f8646a33daad036a7@realtek.com> Content-Language: en-US From: Bitterblue Smith In-Reply-To: <12bae50933084d9f8646a33daad036a7@realtek.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 16/04/2024 07:01, Ping-Ke Shih wrote: > Bitterblue Smith wrote: >> >> The H2C (host to card) command which tells the firmware which TX rates >> it can use is slightly wrong. Fix the order of the bytes. >> >> Also put the macid in the command (relevant for AP mode). >> >> This was tested with RTL8192CU. It also affects the RTL8723AU. > > Can you add test results before/after this patch? > > I wonder if RTL8192CU and RTL8723AU use different command format, because > vendor driver of RTL8192CU seems use different command ID (w/o BIT(7)), see below. > They use the same format, the vendor drivers just add BIT(7) in rtl8192c_FillH2CCmd function: https://github.com/lwfinger/rtl8192cu/blob/52b20929a8f68d5fbae38e6e253f75b713258487/hal/rtl8192c_cmd.c#L114 Please ignore this patch. I made a mistake: the order of the bytes in the struct is weird, but it is correct for rtl8xxxu. rtl8xxxu_gen1_h2c_cmd is aware of the changed order. >> >> Cc: stable@vger.kernel.org >> Signed-off-by: Bitterblue Smith >> --- >> .../net/wireless/realtek/rtl8xxxu/rtl8xxxu.h | 10 +++++++--- >> .../wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 18 +++++++++++------- >> 2 files changed, 18 insertions(+), 10 deletions(-) >> >> diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h >> b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h >> index fd92d23c43d9..ca44d82cb5aa 100644 >> --- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h >> +++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h >> @@ -1430,10 +1430,14 @@ struct h2c_cmd { >> u8 data; >> } __packed joinbss; >> struct { >> +#define RAID_MASK GENMASK(31, 28) >> +#define RATE_MASK_MASK GENMASK(27, 0) >> +#define MACID_MASK GENMASK(4, 0) >> +#define SHORT_GI_MASK BIT(5) >> + >> u8 cmd; >> - __le16 mask_hi; >> - u8 arg; >> - __le16 mask_lo; >> + __le32 rate_mask_and_raid; >> + u8 macid_and_short_gi; >> } __packed ramask; >> struct { >> u8 cmd; >> diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c >> b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c >> index fac7824ae727..acbafc25c6e0 100644 >> --- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c >> +++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c >> @@ -4641,15 +4641,19 @@ void rtl8xxxu_update_rate_mask(struct rtl8xxxu_priv *priv, >> memset(&h2c, 0, sizeof(struct h2c_cmd)); >> >> h2c.ramask.cmd = H2C_SET_RATE_MASK; > > rtl8xxxu: H2C_SET_RATE_MASK = (6 | H2C_EXT) > vendor driver of 8192cu: MACID_CONFIG_EID=6 > > Can you confirm if command "(6 | BIT(7))" works on 8192cu? > Maybe, it only works on 8723au? (this chip is too old, I don't have more info about it) > > >> - h2c.ramask.mask_lo = cpu_to_le16(ramask & 0xffff); >> - h2c.ramask.mask_hi = cpu_to_le16(ramask >> 16); >> >> - h2c.ramask.arg = 0x80; >> - if (sgi) >> - h2c.ramask.arg |= 0x20; >> + le32p_replace_bits(&h2c.ramask.rate_mask_and_raid, rateid, RAID_MASK); >> + le32p_replace_bits(&h2c.ramask.rate_mask_and_raid, ramask, RATE_MASK_MASK); >> + >> + u8p_replace_bits(&h2c.ramask.macid_and_short_gi, macid, MACID_MASK); >> + u8p_replace_bits(&h2c.ramask.macid_and_short_gi, sgi, SHORT_GI_MASK); >> + u8p_replace_bits(&h2c.ramask.macid_and_short_gi, 1, BIT(7)); >> + >> + dev_dbg(&priv->udev->dev, >> + "%s: rate mask %08x, rate id %02x, arg %02x, size %zi\n", >> + __func__, ramask, rateid, h2c.ramask.macid_and_short_gi, >> + sizeof(h2c.ramask)); >> >> - dev_dbg(&priv->udev->dev, "%s: rate mask %08x, arg %02x, size %zi\n", >> - __func__, ramask, h2c.ramask.arg, sizeof(h2c.ramask)); >> rtl8xxxu_gen1_h2c_cmd(priv, &h2c, sizeof(h2c.ramask)); >> } >> >> -- >> 2.44.0 >