Skip to content

Commit

Permalink
Implement PR openwrt#333
Browse files Browse the repository at this point in the history
Signed-off-by: Thomas Rohloff <v10lator@myway.de>
  • Loading branch information
V10lator committed May 13, 2023
1 parent f976328 commit 68aea87
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 6 deletions.
10 changes: 5 additions & 5 deletions mac80211.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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;
}
Expand Down
8 changes: 8 additions & 0 deletions mt7615/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);
Expand All @@ -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;
Expand Down
25 changes: 25 additions & 0 deletions mt7915/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
13 changes: 12 additions & 1 deletion mt7921/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down
6 changes: 6 additions & 0 deletions mt7996/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 68aea87

Please sign in to comment.