Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1791419pxb; Fri, 26 Feb 2021 23:47:57 -0800 (PST) X-Google-Smtp-Source: ABdhPJzY7map+jcNaV7JBguvLcPssc2ICjwwTHXt/6ygcxNDj4GMo0KEtks1FBnYDLc5+cnW/VOG X-Received: by 2002:a17:906:7c57:: with SMTP id g23mr6840108ejp.195.1614412077622; Fri, 26 Feb 2021 23:47:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614412077; cv=none; d=google.com; s=arc-20160816; b=AtXkU2kFaoOx2cqeHUm7yOQYA1TJP3kz3nvNVkzxz08IHDxFTcZNvCIRsTNjp7LE1/ Lb0eswGRf0EPZ7RptUDxv008aO/+oP7nr/dExqX4sq0awRoFbCRJY4CtnUSA0HLgnDU2 pNtHjY/3kXz80BRNQ2YEjSQJ6W1UCTDbLzADt2InJ/NYX9PIjMoXdfH+SZsvmZMnYmCF q8y8NA+fW9MBu7jlARYUkzARl9DZDcV32SH/CV5Ao0TOMmORY5KteJtoliQjYob2uWKV gNzIhbAwV0loODc2X78xewZGHE7eTeYQm/eVnq98xjQgTh3BnIM7AwkTTDWmnL4o8js/ j9Fg== 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=fNxm+GEUF5XT7QriIvLbNWHiHtk2M6H6Ll2cFlYDf78=; b=vJEARa7y03xuQdoqsgP7FNLs7KcyQHiBLLAMMzDLulul2t8E3330HTUU5PCvi391Iy vBJ9zcxFOHFhj+GmCoZA7FBLE8zG5JGDv0jb+FEcWQGOOeJ9l9jTD1w4O4AdRVmlEEhG of0lRgFl1rX6Nh5rofR+YhBne4CrU5WCj6x34ZexE6VHKeY0aygpgtknn2mkSdlKaELI YxpoeSDHccbfSRJszKia6EGIhkpzDu4fC57BFuvAJqhK96sPtuHk6/zKO8JWXJeB1C3n vh7Kp7oS+4kswSmBnUz1Y+LC5wFvepLLoCXYIifRvykiiiB2J7McWkigqVYjdQsHhyi5 vJTg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mediatek.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u21si5452448ejt.396.2021.02.26.23.47.34; Fri, 26 Feb 2021 23:47:57 -0800 (PST) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mediatek.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229990AbhB0HlP (ORCPT + 99 others); Sat, 27 Feb 2021 02:41:15 -0500 Received: from mailgw02.mediatek.com ([210.61.82.184]:58991 "EHLO mailgw02.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S229835AbhB0HlO (ORCPT ); Sat, 27 Feb 2021 02:41:14 -0500 X-UUID: ffe19a9dd6f1403b847c633712059e09-20210227 X-UUID: ffe19a9dd6f1403b847c633712059e09-20210227 Received: from mtkcas10.mediatek.inc [(172.21.101.39)] by mailgw02.mediatek.com (envelope-from ) (Cellopoint E-mail Firewall v4.1.14 Build 0819 with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 2118187591; Sat, 27 Feb 2021 15:40:27 +0800 Received: from MTKCAS06.mediatek.inc (172.21.101.30) by mtkmbs06n2.mediatek.inc (172.21.101.130) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Sat, 27 Feb 2021 15:40:25 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by MTKCAS06.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Sat, 27 Feb 2021 15:40:25 +0800 From: Ryder Lee To: Felix Fietkau , Lorenzo Bianconi CC: Shayne Chen , , , Ryder Lee Subject: [PATCH 5/5] mt76: mt7915: fix PHY mode for DBDC Date: Sat, 27 Feb 2021 15:39:46 +0800 Message-ID: <131cd1018ac752d4250a8e6abb8b841707275424.1614411256.git.ryder.lee@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain X-TM-SNTS-SMTP: C580781EF9BD32FA0D43A1F34BA3C0A4545597197217040140EA547A0C68B3492000:8 X-MTK: N Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Fix PHY mode configuration for DBDC. Signed-off-by: Ryder Lee --- .../net/wireless/mediatek/mt76/mt7915/mcu.c | 40 +++++++++---------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c index 4abe32357edc..e0c03b7f278d 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c @@ -147,9 +147,10 @@ mt7915_get_he_phy_cap(struct mt7915_phy *phy, struct ieee80211_vif *vif) } static u8 -mt7915_get_phy_mode(struct mt7915_dev *dev, struct ieee80211_vif *vif, - enum nl80211_band band, struct ieee80211_sta *sta) +mt7915_get_phy_mode(struct mt76_phy *mphy, struct ieee80211_vif *vif, + struct ieee80211_sta *sta) { + enum nl80211_band band = mphy->chandef.chan->band; struct ieee80211_sta_ht_cap *ht_cap; struct ieee80211_sta_vht_cap *vht_cap; const struct ieee80211_sta_he_cap *he_cap; @@ -161,12 +162,8 @@ mt7915_get_phy_mode(struct mt7915_dev *dev, struct ieee80211_vif *vif, he_cap = &sta->he_cap; } else { struct ieee80211_supported_band *sband; - struct mt7915_phy *phy; - struct mt7915_vif *mvif; - mvif = (struct mt7915_vif *)vif->drv_priv; - phy = mvif->band_idx ? mt7915_ext_phy(dev) : &dev->phy; - sband = phy->mt76->hw->wiphy->bands[band]; + sband = mphy->hw->wiphy->bands[band]; ht_cap = &sband->ht_cap; vht_cap = &sband->vht_cap; @@ -676,8 +673,6 @@ mt7915_mcu_bss_basic_tlv(struct sk_buff *skb, struct ieee80211_vif *vif, struct mt7915_phy *phy, bool enable) { struct mt7915_vif *mvif = (struct mt7915_vif *)vif->drv_priv; - struct cfg80211_chan_def *chandef = &phy->mt76->chandef; - enum nl80211_band band = chandef->chan->band; struct bss_info_basic *bss; u16 wlan_idx = mvif->sta.wcid.idx; u32 type = NETWORK_INFRA; @@ -727,7 +722,7 @@ mt7915_mcu_bss_basic_tlv(struct sk_buff *skb, struct ieee80211_vif *vif, memcpy(bss->bssid, vif->bss_conf.bssid, ETH_ALEN); bss->bcn_interval = cpu_to_le16(vif->bss_conf.beacon_int); bss->dtim_period = vif->bss_conf.dtim_period; - bss->phy_mode = mt7915_get_phy_mode(phy->dev, vif, band, NULL); + bss->phy_mode = mt7915_get_phy_mode(phy->mt76, vif, NULL); } else { memcpy(bss->bssid, phy->mt76->macaddr, ETH_ALEN); } @@ -2069,25 +2064,30 @@ mt7915_mcu_add_txbf(struct mt7915_dev *dev, struct ieee80211_vif *vif, static void mt7915_mcu_sta_rate_ctrl_tlv(struct sk_buff *skb, struct mt7915_dev *dev, - struct ieee80211_vif *vif, - struct ieee80211_sta *sta) + struct ieee80211_vif *vif, struct ieee80211_sta *sta) { - struct cfg80211_chan_def *chandef = &dev->mphy.chandef; + struct mt7915_sta *msta = (struct mt7915_sta *)sta->drv_priv; + struct mt76_phy *mphy = &dev->mphy; + enum nl80211_band band; struct sta_rec_ra *ra; struct tlv *tlv; - enum nl80211_band band = chandef->chan->band; - u32 supp_rate = sta->supp_rates[band]; - int n_rates = hweight32(supp_rate); - u32 cap = sta->wme ? STA_CAP_WMM : 0; + u32 supp_rate, n_rates, cap = sta->wme ? STA_CAP_WMM : 0; u8 i, nss = sta->rx_nss, mcs = 0; tlv = mt7915_mcu_add_tlv(skb, STA_REC_RA, sizeof(*ra)); - ra = (struct sta_rec_ra *)tlv; + + if (msta->wcid.ext_phy && dev->mt76.phy2) + mphy = dev->mt76.phy2; + + band = mphy->chandef.chan->band; + supp_rate = sta->supp_rates[band]; + n_rates = hweight32(supp_rate); + ra->valid = true; ra->auto_rate = true; - ra->phy_mode = mt7915_get_phy_mode(dev, vif, band, sta); - ra->channel = chandef->chan->hw_value; + ra->phy_mode = mt7915_get_phy_mode(mphy, vif, sta); + ra->channel = mphy->chandef.chan->hw_value; ra->bw = sta->bandwidth; ra->rate_len = n_rates; ra->phy.bw = sta->bandwidth; -- 2.18.0