Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp6502375rdb; Tue, 2 Jan 2024 04:22:17 -0800 (PST) X-Google-Smtp-Source: AGHT+IElJujGiq6fEhWdto7NjcflZC0UVREyYe1fr1/KduE7pVbaQbo/LORrEJECFwawyvAb98JG X-Received: by 2002:a17:90a:bf12:b0:28b:e2c1:8eaf with SMTP id c18-20020a17090abf1200b0028be2c18eafmr20604591pjs.2.1704198136921; Tue, 02 Jan 2024 04:22:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704198136; cv=none; d=google.com; s=arc-20160816; b=ik7nOcEkYjB44opqS06cGqIFSWOUNSCMc2GFSV2t6iDshENn4QhRanr8PL0CJFFSaz NPz8cg0VL1JO1ORXHW6YVQWbRw1ZL0cMCvYPxggRWuy4n6prhM1ao04HXwsx1uKtHjKz XQBvREqfwJ6JLsSSdPFF1RqVd3OmFAeEKpih9foduAXdzVV/7s/dKhjbDjDf0opDNF4F ph4HA8alXIVb49WrloFmTy02z1dg20pkPFwC6ZCRL5tJAiQIuXkpFlNnb7zSOXC3G2eY MTeEjPBYNkkbEVnNMwvdYpsB9H/B21rRQCn1DL/5OUQdVoqlJxz22vrbNITcA0k91szF bDJg== ARC-Message-Signature: i=1; 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=cdRUBGHkeAvM9Vhl1A+sKeCfwzy0kRsUFwxlcO6H+j8=; fh=X2HqYj0N4qifUfo82SABUFW8zWQK405pA3D49BDBOzQ=; b=Ym7C6NsxCvJB9vWlktbkt5SCAjezZlFTuvyb/vgAa6Z9x2uWCJvT4QFr4cXjVKtUto b8TIJsKSluNYAdokIisNVVSzdxEoRK9kYVJj4hz4Pm7DXI81ycnfWEtQTjS98B1kJHwz SfA0aS69eijg9h/G4syPaKZFtOc1SJ0jDs978XbzMQEOBKesdOl7PjNSpH2yLG1uRnx0 StTZhIr1l07oRUV6ljVKgGmDWgWl2+1LtZAWSBWT3VOmoFd+8+E5eOshzab43aiudvv1 xMkh0LrK3oSWsES0k6+Pqxwxh9evSAi6RQEsGkHjMR/WRzpIMotiWYFfAln3BzP/FbKK QHgA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=NIl1RFz3; spf=pass (google.com: domain of linux-wireless+bounces-1388-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-wireless+bounces-1388-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. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id gm2-20020a17090b100200b0028c1dab4badsi17168054pjb.152.2024.01.02.04.22.16 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jan 2024 04:22:16 -0800 (PST) Received-SPF: pass (google.com: domain of linux-wireless+bounces-1388-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=NIl1RFz3; spf=pass (google.com: domain of linux-wireless+bounces-1388-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-wireless+bounces-1388-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 319BF282BBF for ; Tue, 2 Jan 2024 12:22:16 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 00697FBE7; Tue, 2 Jan 2024 12:22:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="NIl1RFz3" X-Original-To: linux-wireless@vger.kernel.org Received: from mail-wm1-f48.google.com (mail-wm1-f48.google.com [209.85.128.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 67133FBE2 for ; Tue, 2 Jan 2024 12:22:12 +0000 (UTC) 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-f48.google.com with SMTP id 5b1f17b1804b1-40d87df95ddso15646555e9.0 for ; Tue, 02 Jan 2024 04:22:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1704198130; x=1704802930; 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=cdRUBGHkeAvM9Vhl1A+sKeCfwzy0kRsUFwxlcO6H+j8=; b=NIl1RFz3E+PK9tptttlga5JHFOeB8YDyBrxi3qYU1oQscBwBWjd0DF0ybEqOK9p1AY hfHIJK1u5J0C6eYW6OSfo7oAQtw5R4DnELoI2Ne0FoOpYvoscKxlLF5v9DCzqK8cD3jX d18/snEFXL8ZdxkthkJ9kBtA7Swm5uC528InGRvEQlKQx/8RAIdNBVyBVX/uNEk1oRwP 93LAVteXKbIATdKHtOsa9g0YLqtW6Dx2/0MOrZVkv5WI/4eICaTV3Q1c3T9+zsldVj7w 35o0m+ZSqg1WwmX3qPv5tVq21xJUdiYdbuE3z3/J0Sq4oEohUB4bLGDNgEse/qBNgZL8 PPbA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704198130; x=1704802930; 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=cdRUBGHkeAvM9Vhl1A+sKeCfwzy0kRsUFwxlcO6H+j8=; b=IDA6zxx6sLEy22x0nY1Ale5ElfxFCmN+x2Cf5kJKwPuWXyJJTLlMsffozk+vXRAHXQ NvE6L4ihrd/rOI0YoomlJK0s6jT4NSifsnAGL/1p9UIyF9oaUb5J8RVh6x9P/xpuND7n OLd6vARihbRTIY6VsdobNBv7aDVRcvofiDYPVYf34/cnC3RibJC/mj3p/YBdWWvPHH31 gerx501z2plq7kJrSJh3g7IupyXEgnWusKW9BOtjnKMuk+0FvDun0EHaM0WEhfxH/Q9d VQYqqqOkCSi/jGMrSiOGBD1HI3rZTox6EQFr4/hvKBAdfJMiCklJUJTOKfv5+T6N66gk f2SA== X-Gm-Message-State: AOJu0Yx7uEdd1N5p0/Ac57DUmATsmkkiEv/Iz9xdD26UIezD+AGrI7mH I2LKU0xIA9Il4GkZHtcFSk8= X-Received: by 2002:a05:600c:3f8b:b0:40d:88ef:dc07 with SMTP id fs11-20020a05600c3f8b00b0040d88efdc07mr735404wmb.81.1704198130303; Tue, 02 Jan 2024 04:22:10 -0800 (PST) Received: from [192.168.1.50] ([81.196.40.51]) by smtp.gmail.com with ESMTPSA id t10-20020a05600c198a00b0040d53588d94sm33506561wmq.46.2024.01.02.04.22.09 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 02 Jan 2024 04:22:09 -0800 (PST) Message-ID: Date: Tue, 2 Jan 2024 14:22:08 +0200 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 off by one initial RTS rate To: Ping-Ke Shih , "linux-wireless@vger.kernel.org" Cc: Jes Sorensen References: Content-Language: en-US From: Bitterblue Smith In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 02/01/2024 02:45, Ping-Ke Shih wrote: > > >> -----Original Message----- >> From: Bitterblue Smith >> Sent: Monday, January 1, 2024 6:19 AM >> To: linux-wireless@vger.kernel.org >> Cc: Jes Sorensen ; Ping-Ke Shih >> Subject: [PATCH] wifi: rtl8xxxu: Fix off by one initial RTS rate >> >> rtl8xxxu_set_basic_rates() sets the wrong initial RTS rate. It sets the >> next higher rate than the one it should set, e.g. 36M instead of 24M. >> >> The while loop is supposed to find the index of the most significant >> bit which is 1. >> >> Signed-off-by: Bitterblue Smith >> --- >> drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c >> b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c >> index 180907319e8c..b9f3382bd67c 100644 >> --- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c >> +++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c >> @@ -4839,7 +4839,7 @@ static void rtl8xxxu_set_basic_rates(struct rtl8xxxu_priv *priv, u32 rate_cfg) >> >> dev_dbg(&priv->udev->dev, "%s: rates %08x\n", __func__, rate_cfg); >> >> - while (rate_cfg) { >> + while (rate_cfg > 1) { >> rate_cfg = (rate_cfg >> 1); >> rate_idx++; >> } > > How about using __fls()? > > if (rate_cfg) > rate_idx = __fls(rate_cfg); > Yes, that's nicer.