Skip to content

Commit c2f73ea

Browse files
nbd168Kalle Valo
authored and
Kalle Valo
committed
wifi: mt76: mt7915: add back 160MHz channel width support for MT7915
A number of users reported that this support was working fine before it got removed. Add it back, but leave out the unsupported 80+80 mode. Fixes: ac922bd ("wifi: mt76: mt7915: remove BW160 and BW80+80 support") Signed-off-by: Felix Fietkau <[email protected]> Signed-off-by: Kalle Valo <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 41130c3 commit c2f73ea

File tree

1 file changed

+30
-10
lines changed
  • drivers/net/wireless/mediatek/mt76/mt7915

1 file changed

+30
-10
lines changed

drivers/net/wireless/mediatek/mt76/mt7915/init.c

Lines changed: 30 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,6 @@ mt7915_init_wiphy(struct mt7915_phy *phy)
383383
ieee80211_hw_set(hw, SUPPORTS_RX_DECAP_OFFLOAD);
384384
ieee80211_hw_set(hw, SUPPORTS_MULTI_BSSID);
385385
ieee80211_hw_set(hw, WANT_MONITOR_VIF);
386-
ieee80211_hw_set(hw, SUPPORTS_VHT_EXT_NSS_BW);
387386

388387
hw->max_tx_fragments = 4;
389388

@@ -396,26 +395,38 @@ mt7915_init_wiphy(struct mt7915_phy *phy)
396395
}
397396

398397
if (phy->mt76->cap.has_5ghz) {
398+
struct ieee80211_sta_vht_cap *vht_cap;
399+
400+
vht_cap = &phy->mt76->sband_5g.sband.vht_cap;
399401
phy->mt76->sband_5g.sband.ht_cap.cap |=
400402
IEEE80211_HT_CAP_LDPC_CODING |
401403
IEEE80211_HT_CAP_MAX_AMSDU;
402404
phy->mt76->sband_5g.sband.ht_cap.ampdu_density =
403405
IEEE80211_HT_MPDU_DENSITY_4;
404406

405407
if (is_mt7915(&dev->mt76)) {
406-
phy->mt76->sband_5g.sband.vht_cap.cap |=
408+
vht_cap->cap |=
407409
IEEE80211_VHT_CAP_MAX_MPDU_LENGTH_7991 |
408410
IEEE80211_VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_MASK;
411+
412+
if (!dev->dbdc_support)
413+
vht_cap->cap |=
414+
IEEE80211_VHT_CAP_SHORT_GI_160 |
415+
IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160MHZ |
416+
FIELD_PREP(IEEE80211_VHT_CAP_EXT_NSS_BW_MASK, 1);
409417
} else {
410-
phy->mt76->sband_5g.sband.vht_cap.cap |=
418+
vht_cap->cap |=
411419
IEEE80211_VHT_CAP_MAX_MPDU_LENGTH_11454 |
412420
IEEE80211_VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_MASK;
413421

414422
/* mt7916 dbdc with 2g 2x2 bw40 and 5g 2x2 bw160c */
415-
phy->mt76->sband_5g.sband.vht_cap.cap |=
423+
vht_cap->cap |=
416424
IEEE80211_VHT_CAP_SHORT_GI_160 |
417425
IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160MHZ;
418426
}
427+
428+
if (!is_mt7915(&dev->mt76) || !dev->dbdc_support)
429+
ieee80211_hw_set(hw, SUPPORTS_VHT_EXT_NSS_BW);
419430
}
420431

421432
mt76_set_stream_caps(phy->mt76, true);
@@ -841,9 +852,13 @@ mt7915_set_stream_he_txbf_caps(struct mt7915_phy *phy,
841852
int sts = hweight8(phy->mt76->chainmask);
842853
u8 c, sts_160 = sts;
843854

844-
/* mt7915 doesn't support bw160 */
845-
if (is_mt7915(&dev->mt76))
846-
sts_160 = 0;
855+
/* Can do 1/2 of STS in 160Mhz mode for mt7915 */
856+
if (is_mt7915(&dev->mt76)) {
857+
if (!dev->dbdc_support)
858+
sts_160 /= 2;
859+
else
860+
sts_160 = 0;
861+
}
847862

848863
#ifdef CONFIG_MAC80211_MESH
849864
if (vif == NL80211_IFTYPE_MESH_POINT)
@@ -944,10 +959,15 @@ mt7915_init_he_caps(struct mt7915_phy *phy, enum nl80211_band band,
944959
int i, idx = 0, nss = hweight8(phy->mt76->antenna_mask);
945960
u16 mcs_map = 0;
946961
u16 mcs_map_160 = 0;
947-
u8 nss_160 = nss;
962+
u8 nss_160;
948963

949-
/* Can't do 160MHz with mt7915 */
950-
if (is_mt7915(&dev->mt76))
964+
if (!is_mt7915(&dev->mt76))
965+
nss_160 = nss;
966+
else if (!dev->dbdc_support)
967+
/* Can do 1/2 of NSS streams in 160Mhz mode for mt7915 */
968+
nss_160 = nss / 2;
969+
else
970+
/* Can't do 160MHz with mt7915 dbdc */
951971
nss_160 = 0;
952972

953973
for (i = 0; i < 8; i++) {

0 commit comments

Comments
 (0)