2023-01-04 09:08:44

by MeiChia Chiu

[permalink] [raw]
Subject: [PATCH v2] wifi: mt76: mt7915: remove BW160 and BW80+80 support

Remove BW160 and BW80+80 capability in mt7915.

Tested-by: AngeloGioacchino Del Regno <[email protected]>
Reviewed-by: Ryder Lee <[email protected]>
Reviewed-by: Shayne Chen <[email protected]>
Signed-off-by: Money Wang<[email protected]>
Signed-off-by: MeiChia Chiu <[email protected]>
---
v2: update commit message and title
---
.../net/wireless/mediatek/mt76/mt7915/init.c | 38 +++++--------------
1 file changed, 9 insertions(+), 29 deletions(-)

diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/init.c b/drivers/net/wireless/mediatek/mt76/mt7915/init.c
index 571c94835942..c72d673f02dd 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7915/init.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7915/init.c
@@ -38,8 +38,7 @@ static const struct ieee80211_iface_combination if_comb[] = {
BIT(NL80211_CHAN_WIDTH_20) |
BIT(NL80211_CHAN_WIDTH_40) |
BIT(NL80211_CHAN_WIDTH_80) |
- BIT(NL80211_CHAN_WIDTH_160) |
- BIT(NL80211_CHAN_WIDTH_80P80),
+ BIT(NL80211_CHAN_WIDTH_160),
}
};

@@ -394,11 +393,6 @@ mt7915_init_wiphy(struct mt7915_phy *phy)
phy->mt76->sband_5g.sband.vht_cap.cap |=
IEEE80211_VHT_CAP_MAX_MPDU_LENGTH_7991 |
IEEE80211_VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_MASK;
-
- if (!dev->dbdc_support)
- phy->mt76->sband_5g.sband.vht_cap.cap |=
- IEEE80211_VHT_CAP_SHORT_GI_160 |
- IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160_80PLUS80MHZ;
} else {
phy->mt76->sband_5g.sband.vht_cap.cap |=
IEEE80211_VHT_CAP_MAX_MPDU_LENGTH_11454 |
@@ -834,13 +828,9 @@ mt7915_set_stream_he_txbf_caps(struct mt7915_phy *phy,
int sts = hweight8(phy->mt76->chainmask);
u8 c, sts_160 = sts;

- /* Can do 1/2 of STS in 160Mhz mode for mt7915 */
- if (is_mt7915(&dev->mt76)) {
- if (!dev->dbdc_support)
- sts_160 /= 2;
- else
- sts_160 = 0;
- }
+ /* mt7915 doesn't support bw160 */
+ if (is_mt7915(&dev->mt76))
+ sts_160 = 0;

#ifdef CONFIG_MAC80211_MESH
if (vif == NL80211_IFTYPE_MESH_POINT)
@@ -894,9 +884,6 @@ mt7915_set_stream_he_txbf_caps(struct mt7915_phy *phy,
elem->phy_cap_info[3] |= IEEE80211_HE_PHY_CAP3_SU_BEAMFORMER;
elem->phy_cap_info[4] |= IEEE80211_HE_PHY_CAP4_MU_BEAMFORMER;

- /* num_snd_dim
- * for mt7915, max supported sts is 2 for bw > 80MHz and 0 if dbdc
- */
c = FIELD_PREP(IEEE80211_HE_PHY_CAP5_BEAMFORMEE_NUM_SND_DIM_UNDER_80MHZ_MASK,
sts - 1);
if (sts_160)
@@ -944,15 +931,10 @@ mt7915_init_he_caps(struct mt7915_phy *phy, enum nl80211_band band,
int i, idx = 0, nss = hweight8(phy->mt76->antenna_mask);
u16 mcs_map = 0;
u16 mcs_map_160 = 0;
- u8 nss_160;
+ u8 nss_160 = nss;

- if (!is_mt7915(&dev->mt76))
- nss_160 = nss;
- else if (!dev->dbdc_support)
- /* Can do 1/2 of NSS streams in 160Mhz mode for mt7915 */
- nss_160 = nss / 2;
- else
- /* Can't do 160MHz with mt7915 dbdc */
+ /* Can't do 160MHz with mt7915 */
+ if (is_mt7915(&dev->mt76))
nss_160 = 0;

for (i = 0; i < 8; i++) {
@@ -1002,8 +984,7 @@ mt7915_init_he_caps(struct mt7915_phy *phy, enum nl80211_band band,
else if (nss_160)
he_cap_elem->phy_cap_info[0] =
IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_40MHZ_80MHZ_IN_5G |
- IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_160MHZ_IN_5G |
- IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_80PLUS80_MHZ_IN_5G;
+ IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_160MHZ_IN_5G;
else
he_cap_elem->phy_cap_info[0] =
IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_40MHZ_80MHZ_IN_5G;
@@ -1075,12 +1056,11 @@ mt7915_init_he_caps(struct mt7915_phy *phy, enum nl80211_band band,
break;
}

+ memset(he_mcs, 0, sizeof(*he_mcs));
he_mcs->rx_mcs_80 = cpu_to_le16(mcs_map);
he_mcs->tx_mcs_80 = cpu_to_le16(mcs_map);
he_mcs->rx_mcs_160 = cpu_to_le16(mcs_map_160);
he_mcs->tx_mcs_160 = cpu_to_le16(mcs_map_160);
- 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(phy, he_cap, i);

--
2.18.0


2023-02-13 12:44:26

by Kalle Valo

[permalink] [raw]
Subject: Re: [PATCH v2] wifi: mt76: mt7915: remove BW160 and BW80+80 support

MeiChia Chiu <[email protected]> writes:

> Remove BW160 and BW80+80 capability in mt7915.

This patch is already applied, so too late to change it, but I comment
anyway as this is important:

The commit log should _always_ answer to the question "why?" and explain
the reason behind the patch. For example, I have no clue why you are
removing these features from mt7915.

--
https://patchwork.kernel.org/project/linux-wireless/list/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches

2023-04-29 11:37:16

by Oleksandr Natalenko

[permalink] [raw]
Subject: Re: [PATCH v2] wifi: mt76: mt7915: remove BW160 and BW80+80 support

Hello.

On středa 4. ledna 2023 10:03:52 CEST MeiChia Chiu wrote:
> Remove BW160 and BW80+80 capability in mt7915.
>
> Tested-by: AngeloGioacchino Del Regno <[email protected]>
> Reviewed-by: Ryder Lee <[email protected]>
> Reviewed-by: Shayne Chen <[email protected]>
> Signed-off-by: Money Wang<[email protected]>
> Signed-off-by: MeiChia Chiu <[email protected]>
> ---
> v2: update commit message and title
> ---
> .../net/wireless/mediatek/mt76/mt7915/init.c | 38 +++++--------------
> 1 file changed, 9 insertions(+), 29 deletions(-)
>
> diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/init.c b/drivers/net/wireless/mediatek/mt76/mt7915/init.c
> index 571c94835942..c72d673f02dd 100644
> --- a/drivers/net/wireless/mediatek/mt76/mt7915/init.c
> +++ b/drivers/net/wireless/mediatek/mt76/mt7915/init.c
> @@ -38,8 +38,7 @@ static const struct ieee80211_iface_combination if_comb[] = {
> BIT(NL80211_CHAN_WIDTH_20) |
> BIT(NL80211_CHAN_WIDTH_40) |
> BIT(NL80211_CHAN_WIDTH_80) |
> - BIT(NL80211_CHAN_WIDTH_160) |
> - BIT(NL80211_CHAN_WIDTH_80P80),
> + BIT(NL80211_CHAN_WIDTH_160),
> }
> };
>
> @@ -394,11 +393,6 @@ mt7915_init_wiphy(struct mt7915_phy *phy)
> phy->mt76->sband_5g.sband.vht_cap.cap |=
> IEEE80211_VHT_CAP_MAX_MPDU_LENGTH_7991 |
> IEEE80211_VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_MASK;
> -
> - if (!dev->dbdc_support)
> - phy->mt76->sband_5g.sband.vht_cap.cap |=
> - IEEE80211_VHT_CAP_SHORT_GI_160 |
> - IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160_80PLUS80MHZ;
> } else {
> phy->mt76->sband_5g.sband.vht_cap.cap |=
> IEEE80211_VHT_CAP_MAX_MPDU_LENGTH_11454 |
> @@ -834,13 +828,9 @@ mt7915_set_stream_he_txbf_caps(struct mt7915_phy *phy,
> int sts = hweight8(phy->mt76->chainmask);
> u8 c, sts_160 = sts;
>
> - /* Can do 1/2 of STS in 160Mhz mode for mt7915 */
> - if (is_mt7915(&dev->mt76)) {
> - if (!dev->dbdc_support)
> - sts_160 /= 2;
> - else
> - sts_160 = 0;
> - }
> + /* mt7915 doesn't support bw160 */
> + if (is_mt7915(&dev->mt76))
> + sts_160 = 0;
>
> #ifdef CONFIG_MAC80211_MESH
> if (vif == NL80211_IFTYPE_MESH_POINT)
> @@ -894,9 +884,6 @@ mt7915_set_stream_he_txbf_caps(struct mt7915_phy *phy,
> elem->phy_cap_info[3] |= IEEE80211_HE_PHY_CAP3_SU_BEAMFORMER;
> elem->phy_cap_info[4] |= IEEE80211_HE_PHY_CAP4_MU_BEAMFORMER;
>
> - /* num_snd_dim
> - * for mt7915, max supported sts is 2 for bw > 80MHz and 0 if dbdc
> - */
> c = FIELD_PREP(IEEE80211_HE_PHY_CAP5_BEAMFORMEE_NUM_SND_DIM_UNDER_80MHZ_MASK,
> sts - 1);
> if (sts_160)
> @@ -944,15 +931,10 @@ mt7915_init_he_caps(struct mt7915_phy *phy, enum nl80211_band band,
> int i, idx = 0, nss = hweight8(phy->mt76->antenna_mask);
> u16 mcs_map = 0;
> u16 mcs_map_160 = 0;
> - u8 nss_160;
> + u8 nss_160 = nss;
>
> - if (!is_mt7915(&dev->mt76))
> - nss_160 = nss;
> - else if (!dev->dbdc_support)
> - /* Can do 1/2 of NSS streams in 160Mhz mode for mt7915 */
> - nss_160 = nss / 2;
> - else
> - /* Can't do 160MHz with mt7915 dbdc */
> + /* Can't do 160MHz with mt7915 */
> + if (is_mt7915(&dev->mt76))
> nss_160 = 0;
>
> for (i = 0; i < 8; i++) {
> @@ -1002,8 +984,7 @@ mt7915_init_he_caps(struct mt7915_phy *phy, enum nl80211_band band,
> else if (nss_160)
> he_cap_elem->phy_cap_info[0] =
> IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_40MHZ_80MHZ_IN_5G |
> - IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_160MHZ_IN_5G |
> - IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_80PLUS80_MHZ_IN_5G;
> + IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_160MHZ_IN_5G;
> else
> he_cap_elem->phy_cap_info[0] =
> IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_40MHZ_80MHZ_IN_5G;
> @@ -1075,12 +1056,11 @@ mt7915_init_he_caps(struct mt7915_phy *phy, enum nl80211_band band,
> break;
> }
>
> + memset(he_mcs, 0, sizeof(*he_mcs));
> he_mcs->rx_mcs_80 = cpu_to_le16(mcs_map);
> he_mcs->tx_mcs_80 = cpu_to_le16(mcs_map);
> he_mcs->rx_mcs_160 = cpu_to_le16(mcs_map_160);
> he_mcs->tx_mcs_160 = cpu_to_le16(mcs_map_160);
> - 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(phy, he_cap, i);

I was negatively surprised by this as I had `VHT160-80PLUS80` in my hostapd config file, and the AP worked just fine, and stopped working after upgrading the machine to v6.3.

I do understand that the chip doesn't support 80+80, and my AP just works in VHT160 mode, so replacing `VHT160-80PLUS80` with `VHT160` in the config fixed the issue for me. Thanks for bringing BW160 back later in c2f73eacee3b.

But I do want to point out that the commit message should explain the reason for removal. Also, I'm one of those users of:

```
01:00.0 Unclassified device [0002]: MEDIATEK Corp. MT7915E 802.11ax PCI Express Wireless Network Adapter
```

for whom BW160 works just fine.

Thanks.

--
Oleksandr Natalenko (post-factum)