From patchwork Wed Oct 19 08:26:16 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 5040 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp247065wrs; Wed, 19 Oct 2022 03:39:49 -0700 (PDT) X-Google-Smtp-Source: AMsMyM46zCUj7kUju2b88or1fg6n/l50rSZkq+x92I5zhHaFnuwHP0Idg7siM5vgQlwAm3cRnqeu X-Received: by 2002:a05:6402:51d0:b0:45d:5ba4:c3d2 with SMTP id r16-20020a05640251d000b0045d5ba4c3d2mr6812341edd.132.1666175989741; Wed, 19 Oct 2022 03:39:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666175989; cv=none; d=google.com; s=arc-20160816; b=oaJVnPpfoeZEOUolB/LNvaIdni2MgJ854/QBDb/cBJ2yV+gkP8KJSVzyMJe+W0ycYT +vRwpdKhNbIApDXgRxyYxBz+g4I2i6/DcWIt69fuiR+DpeFttASDxGeet5G3DE4thclc Esk7+QubCjkaTii9Xvo41kmJcR22sdwF6Z1lL6YljV5eVKG0SdsPgABKkKNA53u+Edel Ok0QqCfRKFkAupl3bhihUg4DSEISo5+bid5f/oOr/ZOqn0mxnbm98Y4IJtv/Fyc7O5IE B3vlYxZ2adwhHtmVwkDHzzP/wC7KvBz1M4sF+W+MUh34L9DeSElEYCG48KeXbX+RIYiG 9Pgg== 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=94xTN4WNCd8MNrAB6s29Yrvauv9Ty1cLCPtxGcd/mdE=; b=DhXgeZkh1kf5Hzm54FBbTvS5OaIn29uGdiwQwrjvQAGZREvFbs2LfnFgp54lh7PaoA cZbBh/ym4dwWy7eUv/93HXqtMT/sWg2YM+mhEQ+44aBLLkW8ebO29xPxgkTS3TEvaZmr r6XDZJF5QtZD0zLL/o3dANHrxHc6KF1E5OCT8YsHUDnI97ek6mNru2ogwsi/eelH+DqD NZSTfgOpPQ2R1ia6ikrDpwzodFkdQIe/maWQ3Z22zkzcC3H0oYVB/OO/am+qj8BvhoFJ By7DUUAwxRXfSnkdN5ZVhkjYrAeHKKy3+9iB3nmRWlu7Lb2CzOMkzQyrIL1W3j3oxOMV a22A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=sew4FdAM; 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 hw8-20020a170907a0c800b00780e89aecd1si13518723ejc.849.2022.10.19.03.39.24; Wed, 19 Oct 2022 03:39:49 -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=sew4FdAM; 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 S232004AbiJSKic (ORCPT + 99 others); Wed, 19 Oct 2022 06:38:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37436 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230210AbiJSKiE (ORCPT ); Wed, 19 Oct 2022 06:38:04 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8DA65152C68; Wed, 19 Oct 2022 03:17:05 -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 BF2CFB822EA; Wed, 19 Oct 2022 08:51:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 226A8C433B5; Wed, 19 Oct 2022 08:51:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169472; bh=C8mJs/DW0I+lDN5k5E9k6cEFjftALrJf9Lm2fiFCk6w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sew4FdAMXlO+w7FrWEvy5ZI2Q4pRE5WzS7+Ao7p4qQb2hyd7x9BCozKw57jkbQFfA 8EMtPDKKBOb1JNd73t5T4TBCrAE4RwqBgnKQgrl33/n1rQDsxNCqho0bqhQbOOJYUt nEywpRbPEfCWe1fhi01bxL5dQ3hssbiDIS78kRls= 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 6.0 289/862] wifi: mt76: mt7915: fix mcs value in ht mode Date: Wed, 19 Oct 2022 10:26:16 +0200 Message-Id: <20221019083302.780637133@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 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?1747112154134438932?= X-GMAIL-MSGID: =?utf-8?q?1747112154134438932?= 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 f83067961945..e99fdacc11ce 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c @@ -1360,7 +1360,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; \ @@ -1373,15 +1373,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;