Received: by 2002:a05:7412:ba23:b0:fa:4c10:6cad with SMTP id jp35csp867787rdb; Fri, 19 Jan 2024 00:58:08 -0800 (PST) X-Google-Smtp-Source: AGHT+IFNIGKhV73APPQA20HtTLP3V+JA6fMAO1XAwHVwmtqujPqRFcclQrJyW2tJDGc+6pLKTCWv X-Received: by 2002:a92:d7c7:0:b0:35f:f7f3:4c21 with SMTP id g7-20020a92d7c7000000b0035ff7f34c21mr2121988ilq.68.1705654688586; Fri, 19 Jan 2024 00:58:08 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705654688; cv=pass; d=google.com; s=arc-20160816; b=H+6Nj0evxL05Af5mpHY7JsqjuvfKqm2gJpNsrei54v2Kjl6smrrj1wSIpDlbMHEOOB mDjta96RaVRLxbzwUs8DToDFHGcvYLSNhw9pGXwT3h+LphGeaawnXMmvBUO1zhzXlKa8 lKAUrM2HnAWUbrpP281c+OxpPI1IV+BYmvFL/lmAC7KS8E01ypTL2x0ePse9I/VgqrS6 pw0ScNeMgeI3UmVlbxLMH27cz7c/GOAqdefsOd0j9OXSygw0g/VovwryYZjKOis1Ja3v DHw7XybA7WBkHsB/TNDEhSF64/UAymV/JyVO7Jb4EMEI1+EC3sbRnO/M6+KGsI74LF6h owag== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=epN7KJjCMnYrcOaasseqP03+HRXsNVjKd4ndmSsQ1BM=; fh=V8G9JPihRFi0nnXMuxZIV+rRq1BkrZslNiWM9Hq+m4s=; b=aCrXW8vTOfxTcXp77C3pfxpBZlUcmH9rrFVrCiT9BtmJyioAYov9m6U5a3PSInV6bU oi8m0GNGtkM71qN0LQk2g3UtMhQqH1igq4Jl+Zb771jX2nM7vq/5EKNEhM1XrkM4DIkY cOEjnwYYYcAMIhdunwbWT6ZJ6EHvAUPDDRnskdFNZtx7OtF8ZhLCkr6YJY3r2ZObEFo+ 0OTMea/DXQ+PwMWYjB4eznneJTGbH2tJYm1SLTRMuFOx7rFxTT70ALbCXR4EEA70I8xX HlnRZCgCvTQo9DKoAdkztJ3QLTs/ZyjktS8wYaX2xOXYY/Eq7RojlTrPJ+/Okwa2YEiS ioPQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=XXTsTOKT; arc=pass (i=1 spf=pass spfdomain=mediatek.com dkim=pass dkdomain=mediatek.com dmarc=pass fromdomain=mediatek.com); spf=pass (google.com: domain of linux-wireless+bounces-2238-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-wireless+bounces-2238-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=mediatek.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id c35-20020a630d23000000b005cec9fd8061si2857594pgl.511.2024.01.19.00.58.08 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Jan 2024 00:58:08 -0800 (PST) Received-SPF: pass (google.com: domain of linux-wireless+bounces-2238-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=@mediatek.com header.s=dk header.b=XXTsTOKT; arc=pass (i=1 spf=pass spfdomain=mediatek.com dkim=pass dkdomain=mediatek.com dmarc=pass fromdomain=mediatek.com); spf=pass (google.com: domain of linux-wireless+bounces-2238-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-wireless+bounces-2238-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=mediatek.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 2DBB22857FB for ; Fri, 19 Jan 2024 08:58:08 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DC53C286B0; Fri, 19 Jan 2024 08:57:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=mediatek.com header.i=@mediatek.com header.b="XXTsTOKT" X-Original-To: linux-wireless@vger.kernel.org Received: from mailgw02.mediatek.com (unknown [210.61.82.184]) (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 2FFEE208CB for ; Fri, 19 Jan 2024 08:57:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=210.61.82.184 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705654666; cv=none; b=IGnfCXTgI/xNpBe6GAlilfExyoUUcVLFrPvW+QxyA5mHafgicOLzNe+JUjt33wBBSkG0aqTGGnfDl9k0Z5lUOtqUrZpR7sNgIsA4xL2xOyusMnLeFQsq/HDloPAqxwFQAfweA7iGBlJ0uTFGu1NBKUewXZJMqLoLacl8Qj8qTrE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705654666; c=relaxed/simple; bh=S1E86e9R/FG8ivTm60MAPno1ouTEm7Qe1nU0O2dRoSs=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=V927pDc/wAKJkJMKZhfDKUoFjcNcmVk9wJuBUOfC3Cr4ns8GY0Nyji1QgmwCofVQi8RPd3Q4P4AH7mm2tYzuArGZq+LUTVtIK7PptXlF8P7605NbflvpLPUPqQ9RP24zFVU9MKqAOjPn7vQqSfOQZtftm6hVo3D6hzCifFr5gnE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=mediatek.com; spf=pass smtp.mailfrom=mediatek.com; dkim=pass (1024-bit key) header.d=mediatek.com header.i=@mediatek.com header.b=XXTsTOKT; arc=none smtp.client-ip=210.61.82.184 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=mediatek.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=mediatek.com X-UUID: cb576d5cb6a811eea2298b7352fd921d-20240119 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; bh=epN7KJjCMnYrcOaasseqP03+HRXsNVjKd4ndmSsQ1BM=; b=XXTsTOKT5vW8XZE26oU9qKwA6L126NHPCHmzSSIcutBG6HfDQWT0vabmMGGSONSBJZ/kqn52aF7YkSXftbN7eqSSFOyq1dkBL74Crl7ysI2t9/twmfl3n9Y8MICJu34dAvuFQ7puxySpxq1f5i1U6Hh+cbjO6ZydPRqhqQ9MDOo=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.36,REQID:838a4037-aa55-4982-bba7-2da512cb866b,IP:0,U RL:0,TC:0,Content:0,EDM:0,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTION: release,TS:0 X-CID-META: VersionHash:6e16cf4,CLOUDID:506b0783-8d4f-477b-89d2-1e3bdbef96d1,B ulkID:nil,BulkQuantity:0,Recheck:0,SF:102,TC:nil,Content:0,EDM:-3,IP:nil,U RL:0,File:nil,RT:nil,Bulk:nil,QS:nil,BEC:nil,COL:0,OSI:0,OSA:0,AV:0,LES:1, SPR:NO,DKR:0,DKP:0,BRR:0,BRE:0 X-CID-BVR: 0 X-CID-BAS: 0,_,0,_ X-CID-FACTOR: TF_CID_SPAM_SNR X-UUID: cb576d5cb6a811eea2298b7352fd921d-20240119 Received: from mtkmbs13n1.mediatek.inc [(172.21.101.193)] by mailgw02.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 1531838297; Fri, 19 Jan 2024 16:57:37 +0800 Received: from mtkmbs11n1.mediatek.inc (172.21.101.185) by MTKMBS14N1.mediatek.inc (172.21.101.75) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.26; Fri, 19 Jan 2024 16:57:35 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkmbs11n1.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.1118.26 via Frontend Transport; Fri, 19 Jan 2024 16:57:35 +0800 From: Shayne Chen To: Felix Fietkau CC: linux-wireless , Lorenzo Bianconi , Ryder Lee , Evelyn Tsai , Bo Jiao , linux-mediatek , Benjamin Lin , Shayne Chen Subject: [PATCH 04/12] wifi: mt76: mt7996: fix incorrect interpretation of EHT MCS caps Date: Fri, 19 Jan 2024 16:57:00 +0800 Message-ID: <20240119085708.23592-4-shayne.chen@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20240119085708.23592-1-shayne.chen@mediatek.com> References: <20240119085708.23592-1-shayne.chen@mediatek.com> Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain X-TM-AS-Product-Ver: SMEX-14.0.0.3152-9.1.1006-23728.005 X-TM-AS-Result: No-10-1.739900-8.000000 X-TMASE-MatchedRID: /RWZlr+4p74zTh1BHqxnVY3NgkEqAN0Rsf4f4CxxueRz/u+TcH1U7P9T oIqmlx19ThbvLLI8RvOWLz7gHk2taUHQ/pYAwhs6R/j040fRFpJ9LQinZ4QefPcjNeVeWlqY+gt Hj7OwNO0A7WI2V4bLAuuk854hvA8+V+SwhFPhEoCx9buuJcLWGIg2O6s7GegS+cdfgsVbKhBSNA OKzF0tk5keeltQbbqsVMMzQNLWGsoHo6Gh2L5tQUma3zYT97IFAYfQIAUhBayZvmCbKVb49sZL6 x5U/HriIk9sIzm5o6zAvpLE+mvX8g== X-TM-AS-User-Approved-Sender: No X-TM-AS-User-Blocked-Sender: No X-TMASE-Result: 10-1.739900-8.000000 X-TMASE-Version: SMEX-14.0.0.3152-9.1.1006-23728.005 X-TM-SNTS-SMTP: A8EE4D743659859585BCB5302B51DA086E7514AD8E9A87E29D00C6623711E8842000:8 X-MTK: N From: Benjamin Lin 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 --- 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 3c729b563edc..02d858fdc9fe 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.39.2