Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp2374004lqp; Sun, 24 Mar 2024 16:28:02 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWcgeYYlnf8tf/E3gv22me4wOxQL14lc6pfratM3dM5hdw2+QiKvgtFzS/zK3hZVJNLR5keTPd74kQzkug9q5npW7MgapgSvdxD6Kvjbw== X-Google-Smtp-Source: AGHT+IGJgexlDQHW35KVSQPjtQSAGt5Sb/xXZVRP/iI9lY7JnGfYiQTcTcXauFww4/tk9mbXOkkt X-Received: by 2002:a05:6214:c83:b0:696:8f36:6b73 with SMTP id r3-20020a0562140c8300b006968f366b73mr1085123qvr.26.1711322882252; Sun, 24 Mar 2024 16:28:02 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711322882; cv=pass; d=google.com; s=arc-20160816; b=R+IeKVPdVXHu5lf6+KWyvxq8Kf5H/see6rn1JKyEXL3sT/naLEpaT2ex6IILFslX7d C5N4PrfMRuxWR5473L8sZXemJTw1AYVWHu4xn+JpHmBEqYRm+qFJ1tbkqm+HdLQVTFhs r+sJaZZOJRluKC8NGb+OhoWunc56CtvsE4nKpnRSXKQkHGTFxCNrWPnhpo5AXIe6dqh0 A2SRjpbWUS3hDasNoSHtYTezxMkIgCeuMv6Ns+1RL2NK1dPVoWLNeXuWJ2x51bOksnOg LlM0DOfXh6F/Wq1ZhCmY+XY+zjil5epMDVjfDCPm63M0CNDLXrFRDmLGaZ3Jh0E0MVT7 5vzA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=cTlyI7KG7sGXjFcmYDHOwuKCE1qQklFcY/1x8PsfXyA=; fh=dOsCIkAJAGKaOYA/sT19rwyoMGMAZObqFLfGWb9/7jY=; b=ThdkyTbZ9Atzp4ic/BNUgRR5KWbxmZM2IrJ9jc1z1cry4jz7rA1P67/npTCtiItpME hs1voOTc5i5Gnx+/+sQHqHDDNzdDOFeZmQ3gJCxgTz+8RHGcOuGxXQZoScj16jGQLG7j uS+/Ds1XwfOWBep+FUHWJmXWd816nSOoX9acvZBP3pV1FWsH0Gk0jANUMo9TJoNEIFCg 1/WudMDiKcbLyFST76n8jGvZr2DslP8+8TrG12+zPbbH5Ox9bw/z4nG0mYopPXuh2EBc kvrR9G2g6M0yYrBm4LndqsUFOBsJuypmOsS1qxHg2vHjfTFCOrYI5aVbpM7tBwa4uqjs KLyQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=BRetIItA; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-113133-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-113133-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id hf6-20020a0562140e8600b006968566f8a2si2518623qvb.542.2024.03.24.16.28.02 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 24 Mar 2024 16:28:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-113133-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=BRetIItA; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-113133-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-113133-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org 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 ny.mirrors.kernel.org (Postfix) with ESMTPS id E23341C21DCD for ; Sun, 24 Mar 2024 23:28:01 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6C81916FF36; Sun, 24 Mar 2024 22:39:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="BRetIItA" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8D14A1649CE; Sun, 24 Mar 2024 22:39:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711319940; cv=none; b=PZOWWQNGgnmG7EyQl48y8g2UYNxIxWrQ2ws2Fqs24dMcKag71KEFYcij+BbAvbvpyizAFupNMmbDqr2Yy3PLfHXsK2cmaieAVpB/sNnf834OOIADXHS1d6G2Gb806TspiuP3mFwW0Y+yWZWVp+cnAl/YToTsBBR3lT4PB32Z2gA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711319940; c=relaxed/simple; bh=WixLlg00liAoc2SVnyGhXix2+bX3u5K/kKyo2dFe7cM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=L2wtwJ9trA2x6YPzmOAEYYNnXp0ZLGH1bmB9vREx5jWOwmHpAsDdxhr9T0bxhpARfxgec1gnxA141LsPeLFZ8/Eyew4j86jSLDW3R/KDomdpmtNmE8a2qwxpHEbi32rTJngHUZeGw15pXpUBcb0FNy5W+QywWy5HS9Nvpj3yoww= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=BRetIItA; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id AE2C6C433F1; Sun, 24 Mar 2024 22:38:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711319940; bh=WixLlg00liAoc2SVnyGhXix2+bX3u5K/kKyo2dFe7cM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BRetIItAbV+mU2vvK26YqFJZO+z6MjDb5cxr5TU6deanAucPI6ZJkeMye0a5E/z+6 91Wd4kUGCjxgYJYIx/Y7X+5dJTnL7J4K6G4+DP84uuWLuVP8RdZWuTtQoeWQ4Tu+t5 O3d8lozbL+e9opvRCllNPkreu7Rg9/TCMtiYCFI7UqY301hA9MwFo7yykzRBBBLOwK qA6JdBet5K8QV2MKRolp5ZDlmvRFYc2VyeWEV/i32HUuMl5KF7t9G25ZxxG7Si1n9N kJvoqq9+fTe9wDrErE5SiYTgUn9RUEQ88M2SjMtU5xgJoFzdTDAEdlK1rHwCrYBaf/ xqc8R5Fao+THA== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Benjamin Lin , Shayne Chen , Felix Fietkau , Sasha Levin Subject: [PATCH 6.8 246/715] wifi: mt76: mt7996: fix incorrect interpretation of EHT MCS caps Date: Sun, 24 Mar 2024 18:27:05 -0400 Message-ID: <20240324223455.1342824-247-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324223455.1342824-1-sashal@kernel.org> References: <20240324223455.1342824-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit From: Benjamin Lin [ Upstream commit d52c97592f06552a4289008602b5d5b724084ba7 ] The EHT MCS map subfield of 20 MHz-Only is not present in the EHT capability of AP, so STA does not need to parse the subfield. Moreover, AP should parse the subfield only if STA is 20 MHz-Only, which can be confirmed by checking supported channel width in HE capability. Fixes: 92aa2da9fa49 ("wifi: mt76: mt7996: enable EHT support in firmware") Co-developed-by: Shayne Chen Signed-off-by: Shayne Chen Signed-off-by: Benjamin Lin Signed-off-by: Felix Fietkau Signed-off-by: Sasha Levin --- drivers/net/wireless/mediatek/mt76/mt7996/mcu.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7996/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7996/mcu.c index 699be57309c2e..66351c19dbe41 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7996/mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt7996/mcu.c @@ -1240,6 +1240,9 @@ mt7996_mcu_sta_he_6g_tlv(struct sk_buff *skb, struct ieee80211_sta *sta) static void mt7996_mcu_sta_eht_tlv(struct sk_buff *skb, struct ieee80211_sta *sta) { + struct mt7996_sta *msta = (struct mt7996_sta *)sta->drv_priv; + struct ieee80211_vif *vif = container_of((void *)msta->vif, + struct ieee80211_vif, drv_priv); struct ieee80211_eht_mcs_nss_supp *mcs_map; struct ieee80211_eht_cap_elem_fixed *elem; struct sta_rec_eht *eht; @@ -1259,8 +1262,17 @@ mt7996_mcu_sta_eht_tlv(struct sk_buff *skb, struct ieee80211_sta *sta) eht->phy_cap = cpu_to_le64(*(u64 *)elem->phy_cap_info); eht->phy_cap_ext = cpu_to_le64(elem->phy_cap_info[8]); - if (sta->deflink.bandwidth == IEEE80211_STA_RX_BW_20) - memcpy(eht->mcs_map_bw20, &mcs_map->only_20mhz, sizeof(eht->mcs_map_bw20)); + if (vif->type != NL80211_IFTYPE_STATION && + (sta->deflink.he_cap.he_cap_elem.phy_cap_info[0] & + (IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_40MHZ_IN_2G | + IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_40MHZ_80MHZ_IN_5G | + IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_160MHZ_IN_5G | + IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_80PLUS80_MHZ_IN_5G)) == 0) { + memcpy(eht->mcs_map_bw20, &mcs_map->only_20mhz, + sizeof(eht->mcs_map_bw20)); + return; + } + memcpy(eht->mcs_map_bw80, &mcs_map->bw._80, sizeof(eht->mcs_map_bw80)); memcpy(eht->mcs_map_bw160, &mcs_map->bw._160, sizeof(eht->mcs_map_bw160)); memcpy(eht->mcs_map_bw320, &mcs_map->bw._320, sizeof(eht->mcs_map_bw320)); -- 2.43.0