From patchwork Sat Oct 22 07:22:07 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 7276 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1092065wrr; Sat, 22 Oct 2022 00:52:51 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7c26HhFww9Qu/Ou+j/gKWx26ZGSlRGzyOEJyWNDSk+AqqmqYTkjL2BWtdHj0vyouLgtmYm X-Received: by 2002:a65:5ac8:0:b0:463:9c77:285a with SMTP id d8-20020a655ac8000000b004639c77285amr19433053pgt.517.1666425171215; Sat, 22 Oct 2022 00:52:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666425171; cv=none; d=google.com; s=arc-20160816; b=z7NpllMp9O+9RZWPWeFdEI8ufTZmB4fyBdVCHCqyBbThrk0rxI1K+mfaSacDZdK/Ta 354O687MRr55sT1r5VuTd+hIrxkcEF6XPwrCP8jhzNiYQ9K7GYFzQdDOYj0tu3sXTHUp 2ptkaDGhsBly/EW8pLZdVW3d9nvPDS59ezgB352OwhM0i/GNUbmMXIByimwJ7dVCw/8l UAmQyhkRkpi1c9vUwNzeoli1AwRd1PXvVHQ7d+Q4mG8po3pe4MsssEEVpuZKNj9NCLte J0ClS3EG/xbVXsJY0RgA4ld8huCfQuE55/Qtb+xvw0P6+gIk3lezauc02cJlRKnyAMmE 6eBQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=REx2iPNeQTmjpf4qATudROU2qHClEHheNGCtNyS6AFw=; b=hGf70CHBu+ub+YOvWm1WKck3K4uedDAFj3AMjH5cxs8dzmdUlWoWUwDSLE/Utc1Qbq gkXSvX7GX7Q/a06FlTSM7agmf4pghAKmY+P8h6YCvjiTyqAE2o0gQJkRBNqeWBGYhG7I yqNauEyeCrDzVgI1n4YTtPw+cQxWqbzJ72AHRr9ckLHlGOExGsWoFDnS7IU23BNzq/fa 1w4cCmMUboUTeRNI7HDbPRxctjBqh5PJ4NTiUnH5V2j3EYvSqRBAqkRaoRcRN18ombnI 6i9x0oiKroDTHiebmFziUJphkCm9V0hMQj5CKcqCPkrztTuFJRiri0raoliZG0xsiC2F TZlw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="Nv/G7kYX"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id pv14-20020a17090b3c8e00b0020a774637a6si2077762pjb.67.2022.10.22.00.52.38; Sat, 22 Oct 2022 00:52:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="Nv/G7kYX"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231681AbiJVHwT (ORCPT + 99 others); Sat, 22 Oct 2022 03:52:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50278 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231912AbiJVHth (ORCPT ); Sat, 22 Oct 2022 03:49:37 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 98F318A6ED; Sat, 22 Oct 2022 00:46:16 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id EC993B82E1F; Sat, 22 Oct 2022 07:45:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3D2D1C433C1; Sat, 22 Oct 2022 07:45:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424713; bh=U3Vw3D6HP5pNxYddemRgXmagrQL9/QTUYvo5batzupQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Nv/G7kYX6td22lczASPYB0cioo5OG5Jklu4AVc0szDAXH4IMXxuzXHIYHHokUl62F 3sg8jHnXZeDlm+4rfIXp7/v4ECPqJD1FLl4fh099Nu6gYao8jY4nvdZahr25e312k7 jn+UF+7EPxtFFefk0ibuYlFzLZ+c/cF2+5G1EufA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Howard Hsu , Felix Fietkau , Sasha Levin Subject: [PATCH 5.19 248/717] wifi: mt76: mt7915: fix mcs value in ht mode Date: Sat, 22 Oct 2022 09:22:07 +0200 Message-Id: <20221022072458.768674217@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747373440136033836?= X-GMAIL-MSGID: =?utf-8?q?1747373440136033836?= From: Howard Hsu [ Upstream commit c6d3e16ad4362502e804a6ca01e955612f3b8222 ] Fix the error that mcs will be reduced to a range of 0 to 7 in ht mode. Fixes: 70fd1333cd32 ("mt76: mt7915: rework .set_bitrate_mask() to support more options") Signed-off-by: Howard Hsu Signed-off-by: Felix Fietkau Signed-off-by: Sasha Levin --- drivers/net/wireless/mediatek/mt76/mt7915/mcu.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c index 17fa2acc0d07..ec8a5083466f 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c @@ -1460,7 +1460,7 @@ mt7915_mcu_add_rate_ctrl_fixed(struct mt7915_dev *dev, struct sta_phy phy = {}; int ret, nrates = 0; -#define __sta_phy_bitrate_mask_check(_mcs, _gi, _he) \ +#define __sta_phy_bitrate_mask_check(_mcs, _gi, _ht, _he) \ do { \ u8 i, gi = mask->control[band]._gi; \ gi = (_he) ? gi : gi == NL80211_TXRATE_FORCE_SGI; \ @@ -1473,15 +1473,17 @@ mt7915_mcu_add_rate_ctrl_fixed(struct mt7915_dev *dev, continue; \ nrates += hweight16(mask->control[band]._mcs[i]); \ phy.mcs = ffs(mask->control[band]._mcs[i]) - 1; \ + if (_ht) \ + phy.mcs += 8 * i; \ } \ } while (0) if (sta->deflink.he_cap.has_he) { - __sta_phy_bitrate_mask_check(he_mcs, he_gi, 1); + __sta_phy_bitrate_mask_check(he_mcs, he_gi, 0, 1); } else if (sta->deflink.vht_cap.vht_supported) { - __sta_phy_bitrate_mask_check(vht_mcs, gi, 0); + __sta_phy_bitrate_mask_check(vht_mcs, gi, 0, 0); } else if (sta->deflink.ht_cap.ht_supported) { - __sta_phy_bitrate_mask_check(ht_mcs, gi, 0); + __sta_phy_bitrate_mask_check(ht_mcs, gi, 1, 0); } else { nrates = hweight32(mask->control[band].legacy); phy.mcs = ffs(mask->control[band].legacy) - 1;