Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp742147pxp; Fri, 11 Mar 2022 13:56:49 -0800 (PST) X-Google-Smtp-Source: ABdhPJzJhjJWidLD+2eLC5s9DJIr89AZ3Q6O1/uonEf1goY8J4SvRJj53k9JXjSzF+9PqYGF8RYQ X-Received: by 2002:aa7:805a:0:b0:4f6:f223:a459 with SMTP id y26-20020aa7805a000000b004f6f223a459mr12055503pfm.4.1647035809266; Fri, 11 Mar 2022 13:56:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1647035809; cv=none; d=google.com; s=arc-20160816; b=yhBr7M8PZ3arOoZxqxfDscmsS0/9255YFmCStoKHolfkF1gCpp6WxqTqECdjMo4a3s 8Bu87VNL1SKyzGsSYICa8n09WwGIc5iEP+M1bRE/8NznRlPL5zMQafutsZEj/mgJvpmY +laNPLIt8kfNM1txr+BcLqwlQbEzOWLn3EehJd+dl/u2NAgjYrYxxrCySa1IsrXPl30q 8Orv95WqaDUmYIBz46ujpIfE01YISg6fGMpKQxuFotU1QkSKAceLh0PyCp66HuXe9Uvg WBhGctcJ/j3FNK61u09K3FPpm5Bb/SPqZeeLuyWlX3HSyVBDAM2ywx0KOgdmyd+CyM8R mjaw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from; bh=xNw3nkmbRRRCmtGzOcNRmU9GI55TDDRFyQ5GkgKtaYE=; b=FTWCjvGFcpSXlZJn0sfxd3u9PYWvoWVbQDw2Ws7jXghY16ZvT/60iK9emk00PsErVD B67l10cXFrMWl9SvXN+hYRC/+OUFHuYZBA+USClYks7OQSoDFG0Oov/9nZvrN+9k4W/8 byP28sw50VRtLoatyYn78JIwllnnKwh84szQ4uLNE91UZ3W2gBTHeY2ToDQ8KRdf1RMr enL61My1QsDNefpQkxpPDTdFOBcSao7rqvGGy6K03dtEJoS1zKtbSbQCGwJkfaWIEKzn MP9TCIPyOO1DzuvryRYyaf5TRUtxFRcyG4v5e2V7VyatytdUij5nLfRDNGRns9Wvna2r dObQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=mediatek.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id y14-20020a62f24e000000b004f7109da1fesi8941044pfl.206.2022.03.11.13.56.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Mar 2022 13:56:49 -0800 (PST) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=mediatek.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id A6D6C2EABEA; Fri, 11 Mar 2022 13:15:01 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349661AbiCKOrO (ORCPT + 70 others); Fri, 11 Mar 2022 09:47:14 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34088 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241166AbiCKOrJ (ORCPT ); Fri, 11 Mar 2022 09:47:09 -0500 Received: from mailgw01.mediatek.com (unknown [60.244.123.138]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D2867198EE7 for ; Fri, 11 Mar 2022 06:46:01 -0800 (PST) X-UUID: 0d599c72777b41639b65f3f59129244a-20220311 X-UUID: 0d599c72777b41639b65f3f59129244a-20220311 Received: from mtkexhb02.mediatek.inc [(172.21.101.103)] by mailgw01.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 1904641060; Fri, 11 Mar 2022 22:45:57 +0800 Received: from mtkexhb01.mediatek.inc (172.21.101.102) by mtkmbs07n2.mediatek.inc (172.21.101.141) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Fri, 11 Mar 2022 22:45:55 +0800 Received: from mtkcas11.mediatek.inc (172.21.101.40) by mtkexhb01.mediatek.inc (172.21.101.102) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Fri, 11 Mar 2022 22:45:55 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkcas11.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Fri, 11 Mar 2022 22:45:55 +0800 From: Shayne Chen To: Felix Fietkau CC: linux-wireless , Lorenzo Bianconi , Ryder Lee , Evelyn Tsai , Bo Jiao , linux-mediatek , Peter Chiu , Shayne Chen Subject: [PATCH v2 3/3] mt76: mt7915: fix phy cap in mt7915_set_stream_he_txbf_caps() Date: Fri, 11 Mar 2022 22:44:27 +0800 Message-ID: <20220311144427.16018-3-shayne.chen@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20220311144427.16018-1-shayne.chen@mediatek.com> References: <20220311144427.16018-1-shayne.chen@mediatek.com> MIME-Version: 1.0 Content-Type: text/plain X-MTK: N X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE,UNPARSEABLE_RELAY autolearn=no 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-wireless@vger.kernel.org From: Peter Chiu This patch fixes performance issue of beamforming tx on bandwidth 160MHz. Fixes: 99ad32a4ca3a ("mt76: mt7915: add support for MT7986") Signed-off-by: Peter Chiu Signed-off-by: Shayne Chen --- .../net/wireless/mediatek/mt76/mt7915/init.c | 25 +++++++++++++++---- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/init.c b/drivers/net/wireless/mediatek/mt76/mt7915/init.c index 553d1f5..94a5ea6 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7915/init.c +++ b/drivers/net/wireless/mediatek/mt76/mt7915/init.c @@ -727,11 +727,18 @@ void mt7915_set_stream_vht_txbf_caps(struct mt7915_phy *phy) } static void -mt7915_set_stream_he_txbf_caps(struct ieee80211_sta_he_cap *he_cap, +mt7915_set_stream_he_txbf_caps(struct mt7915_dev *dev, + struct ieee80211_sta_he_cap *he_cap, int vif, int nss) { struct ieee80211_he_cap_elem *elem = &he_cap->he_cap_elem; - u8 c; + u8 c, nss_160; + + /* Can do 1/2 of NSS streams in 160Mhz mode for mt7915 */ + if (is_mt7915(&dev->mt76) && !dev->dbdc_support) + nss_160 = nss / 2; + else + nss_160 = nss; #ifdef CONFIG_MAC80211_MESH if (vif == NL80211_IFTYPE_MESH_POINT) @@ -785,13 +792,21 @@ mt7915_set_stream_he_txbf_caps(struct ieee80211_sta_he_cap *he_cap, /* num_snd_dim * for mt7915, max supported nss is 2 for bw > 80MHz */ - c = (nss - 1) | - IEEE80211_HE_PHY_CAP5_BEAMFORMEE_NUM_SND_DIM_ABOVE_80MHZ_2; + c = FIELD_PREP(IEEE80211_HE_PHY_CAP5_BEAMFORMEE_NUM_SND_DIM_UNDER_80MHZ_MASK, + nss - 1) | + FIELD_PREP(IEEE80211_HE_PHY_CAP5_BEAMFORMEE_NUM_SND_DIM_ABOVE_80MHZ_MASK, + nss_160 - 1); elem->phy_cap_info[5] |= c; c = IEEE80211_HE_PHY_CAP6_TRIG_SU_BEAMFORMING_FB | IEEE80211_HE_PHY_CAP6_TRIG_MU_BEAMFORMING_PARTIAL_BW_FB; elem->phy_cap_info[6] |= c; + + if (!is_mt7915(&dev->mt76)) { + c = IEEE80211_HE_PHY_CAP7_STBC_TX_ABOVE_80MHZ | + IEEE80211_HE_PHY_CAP7_STBC_RX_ABOVE_80MHZ; + elem->phy_cap_info[7] |= c; + } } static void @@ -953,7 +968,7 @@ mt7915_init_he_caps(struct mt7915_phy *phy, enum nl80211_band band, he_mcs->rx_mcs_80p80 = cpu_to_le16(mcs_map_160); he_mcs->tx_mcs_80p80 = cpu_to_le16(mcs_map_160); - mt7915_set_stream_he_txbf_caps(he_cap, i, nss); + mt7915_set_stream_he_txbf_caps(dev, he_cap, i, nss); memset(he_cap->ppe_thres, 0, sizeof(he_cap->ppe_thres)); if (he_cap_elem->phy_cap_info[6] & -- 2.25.1