From 68aea87223b49dc3b7cdaede8e72b1bdfd539bf3 Mon Sep 17 00:00:00 2001 From: Thomas Rohloff Date: Sat, 13 May 2023 03:03:40 +0200 Subject: [PATCH] Implement PR #333 Signed-off-by: Thomas Rohloff --- mac80211.c | 10 +++++----- mt7615/init.c | 8 ++++++++ mt7915/init.c | 25 +++++++++++++++++++++++++ mt7921/init.c | 13 ++++++++++++- mt7996/init.c | 6 ++++++ 5 files changed, 56 insertions(+), 6 deletions(-) diff --git a/mac80211.c b/mac80211.c index 2c4a52900..df3fbd354 100644 --- a/mac80211.c +++ b/mac80211.c @@ -282,7 +282,7 @@ static void mt76_init_stream_cap(struct mt76_phy *phy, void mt76_set_stream_caps(struct mt76_phy *phy, bool vht) { if (phy->cap.has_2ghz) - mt76_init_stream_cap(phy, &phy->sband_2g.sband, false); + mt76_init_stream_cap(phy, &phy->sband_2g.sband, vht); if (phy->cap.has_5ghz) mt76_init_stream_cap(phy, &phy->sband_5g.sband, vht); if (phy->cap.has_6ghz) @@ -349,13 +349,13 @@ mt76_init_sband(struct mt76_phy *phy, struct mt76_sband *msband, static int mt76_init_sband_2g(struct mt76_phy *phy, struct ieee80211_rate *rates, - int n_rates) + int n_rates, bool vht) { phy->hw->wiphy->bands[NL80211_BAND_2GHZ] = &phy->sband_2g.sband; return mt76_init_sband(phy, &phy->sband_2g, mt76_channels_2ghz, ARRAY_SIZE(mt76_channels_2ghz), rates, - n_rates, true, false); + n_rates, true, vht); } static int @@ -508,7 +508,7 @@ int mt76_register_phy(struct mt76_phy *phy, bool vht, return ret; if (phy->cap.has_2ghz) { - ret = mt76_init_sband_2g(phy, rates, n_rates); + ret = mt76_init_sband_2g(phy, rates, n_rates, vht); if (ret) return ret; } @@ -691,7 +691,7 @@ int mt76_register_device(struct mt76_dev *dev, bool vht, return ret; if (phy->cap.has_2ghz) { - ret = mt76_init_sband_2g(phy, rates, n_rates); + ret = mt76_init_sband_2g(phy, rates, n_rates, vht); if (ret) return ret; } diff --git a/mt7615/init.c b/mt7615/init.c index 621e69f07..7e89c6613 100644 --- a/mt7615/init.c +++ b/mt7615/init.c @@ -410,6 +410,8 @@ mt7615_init_wiphy(struct ieee80211_hw *hw) hw->max_tx_fragments = MT_HW_TXP_MAX_BUF_NUM; phy->mt76->sband_2g.sband.ht_cap.cap |= IEEE80211_HT_CAP_LDPC_CODING; + phy->mt76->sband_2g.sband.vht_cap.cap |= + IEEE80211_VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_MASK; phy->mt76->sband_5g.sband.ht_cap.cap |= IEEE80211_HT_CAP_LDPC_CODING; phy->mt76->sband_5g.sband.vht_cap.cap |= IEEE80211_VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_MASK; @@ -418,6 +420,9 @@ mt7615_init_wiphy(struct ieee80211_hw *hw) static void mt7615_cap_dbdc_enable(struct mt7615_dev *dev) { + dev->mphy.sband_2g.sband.vht_cap.cap &= + ~(IEEE80211_VHT_CAP_SHORT_GI_160 | + IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160_80PLUS80MHZ); dev->mphy.sband_5g.sband.vht_cap.cap &= ~(IEEE80211_VHT_CAP_SHORT_GI_160 | IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160_80PLUS80MHZ); @@ -434,6 +439,9 @@ mt7615_cap_dbdc_enable(struct mt7615_dev *dev) static void mt7615_cap_dbdc_disable(struct mt7615_dev *dev) { + dev->mphy.sband_2g.sband.vht_cap.cap |= + IEEE80211_VHT_CAP_SHORT_GI_160 | + IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160_80PLUS80MHZ; dev->mphy.sband_5g.sband.vht_cap.cap |= IEEE80211_VHT_CAP_SHORT_GI_160 | IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160_80PLUS80MHZ; diff --git a/mt7915/init.c b/mt7915/init.c index f85f7d396..a3646ce00 100644 --- a/mt7915/init.c +++ b/mt7915/init.c @@ -395,11 +395,36 @@ mt7915_init_wiphy(struct mt7915_phy *phy) wiphy->txq_memory_limit = 32 << 20; /* 32 MiB */ if (phy->mt76->cap.has_2ghz) { + struct ieee80211_sta_vht_cap *vht_cap; + + vht_cap = &phy->mt76->sband_2g.sband.vht_cap; phy->mt76->sband_2g.sband.ht_cap.cap |= IEEE80211_HT_CAP_LDPC_CODING | IEEE80211_HT_CAP_MAX_AMSDU; phy->mt76->sband_2g.sband.ht_cap.ampdu_density = IEEE80211_HT_MPDU_DENSITY_4; + + if (is_mt7915(&dev->mt76)) { + vht_cap->cap |= + IEEE80211_VHT_CAP_MAX_MPDU_LENGTH_7991 | + IEEE80211_VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_MASK; + + if (!dev->dbdc_support) + vht_cap->cap |= + IEEE80211_VHT_CAP_SHORT_GI_160 | + IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160MHZ | + FIELD_PREP(IEEE80211_VHT_CAP_EXT_NSS_BW_MASK, 1); + } else { + vht_cap->cap |= + IEEE80211_VHT_CAP_MAX_MPDU_LENGTH_11454 | + IEEE80211_VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_MASK; + + /* mt7916 dbdc with 2g 2x2 bw40 and 5g 2x2 bw160c */ + vht_cap->cap |= + IEEE80211_VHT_CAP_SHORT_GI_160 | + IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160MHZ; + } + } if (phy->mt76->cap.has_5ghz) { diff --git a/mt7921/init.c b/mt7921/init.c index e929f6eb6..0c652a433 100644 --- a/mt7921/init.c +++ b/mt7921/init.c @@ -428,6 +428,12 @@ int mt7921_register_device(struct mt7921_dev *dev) dev->mphy.sband_2g.sband.ht_cap.cap |= IEEE80211_HT_CAP_LDPC_CODING | IEEE80211_HT_CAP_MAX_AMSDU; + dev->mphy.sband_2g.sband.vht_cap.cap |= + IEEE80211_VHT_CAP_MAX_MPDU_LENGTH_11454 | + IEEE80211_VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_MASK | + IEEE80211_VHT_CAP_SU_BEAMFORMEE_CAPABLE | + IEEE80211_VHT_CAP_MU_BEAMFORMEE_CAPABLE | + (3 << IEEE80211_VHT_CAP_BEAMFORMEE_STS_SHIFT); dev->mphy.sband_5g.sband.ht_cap.cap |= IEEE80211_HT_CAP_LDPC_CODING | IEEE80211_HT_CAP_MAX_AMSDU; @@ -437,10 +443,15 @@ int mt7921_register_device(struct mt7921_dev *dev) IEEE80211_VHT_CAP_SU_BEAMFORMEE_CAPABLE | IEEE80211_VHT_CAP_MU_BEAMFORMEE_CAPABLE | (3 << IEEE80211_VHT_CAP_BEAMFORMEE_STS_SHIFT); - if (is_mt7922(&dev->mt76)) + if (is_mt7922(&dev->mt76)) { + dev->mphy.sband_2g.sband.vht_cap.cap |= + IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160MHZ | + IEEE80211_VHT_CAP_SHORT_GI_160; + dev->mphy.sband_5g.sband.vht_cap.cap |= IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160MHZ | IEEE80211_VHT_CAP_SHORT_GI_160; + } dev->mphy.hw->wiphy->available_antennas_rx = dev->mphy.chainmask; dev->mphy.hw->wiphy->available_antennas_tx = dev->mphy.chainmask; diff --git a/mt7996/init.c b/mt7996/init.c index f1b48cdda..7386b90c0 100644 --- a/mt7996/init.c +++ b/mt7996/init.c @@ -201,6 +201,12 @@ mt7996_init_wiphy(struct ieee80211_hw *hw) phy->mt76->sband_2g.sband.ht_cap.cap |= IEEE80211_HT_CAP_LDPC_CODING | IEEE80211_HT_CAP_MAX_AMSDU; + + phy->mt76->sband_2g.sband.vht_cap.cap |= + IEEE80211_VHT_CAP_MAX_MPDU_LENGTH_11454 | + IEEE80211_VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_MASK | + IEEE80211_VHT_CAP_SHORT_GI_160 | + IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160MHZ; phy->mt76->sband_2g.sband.ht_cap.ampdu_density = IEEE80211_HT_MPDU_DENSITY_2; }