[PATCH 1/2] mt76: mt7921: fix mgmt frame using unexpected bitrate
Ryder Lee
ryder.lee at mediatek.com
Wed Jul 7 23:15:03 PDT 2021
On Thu, 2021-07-08 at 12:29 +0800, sean.wang at mediatek.com wrote:
> From: Sean Wang <sean.wang at mediatek.com>
>
> Fix the current driver mgmt frame is not respecting the basic rates
> field
> provided by the AP and then unconditionally is using the lowest (1 or
> 6
> Mbps) rate.
>
> For example, if the AP only supported basic rate {24, 36, 48, 54}
> Mbps,
> mt7921 cannot send mgmt frame with the rate not in the group. So,
> instead, we pick up the lowest basic rate the AP can support to send.
>
> The patch also fixed up the hw_value in ieee80211_rate for MT7921
> hardware.
>
> Fixes: 163f4d22c118 ("mt76: mt7921: add MAC support")
> Signed-off-by: Sean Wang <sean.wang at mediatek.com>
> ---
> .../net/wireless/mediatek/mt76/mt7921/init.c | 19 +++++++++++++++--
> .../net/wireless/mediatek/mt76/mt7921/mac.c | 21 +++++++++++++++
> ----
> .../wireless/mediatek/mt76/mt7921/mt7921.h | 14 +++++++++++++
> 3 files changed, 48 insertions(+), 6 deletions(-)
>
>
> + int i, offset = 0;
> +
> + if (mphy->chandef.chan->band == NL80211_BAND_5GHZ)
> + offset = 4;
> +
> + i = ffs(vif->bss_conf.basic_rates) - 1;
> + rate = &mt7921_rates[offset + i];
> +
> + return rate->hw_value;
> +}
> +
> void mt7921_mac_write_txwi(struct mt7921_dev *dev, __le32 *txwi,
> struct sk_buff *skb, struct mt76_wcid *wcid,
> struct ieee80211_key_conf *key, bool beacon)
> @@ -815,10 +831,7 @@ void mt7921_mac_write_txwi(struct mt7921_dev
> *dev, __le32 *txwi,
> /* hardware won't add HTC for mgmt/ctrl frame */
> txwi[2] |= cpu_to_le32(MT_TXD2_HTC_VLD);
>
> - if (mphy->chandef.chan->band == NL80211_BAND_5GHZ)
> - rate = MT7921_5G_RATE_DEFAULT;
> - else
> - rate = MT7921_2G_RATE_DEFAULT;
> + rate = mt7921_default_basic_rates(dev, vif);
....
>
> \
> + .bitrate = _rate, \
> + .flags = IEEE80211_RATE_SHORT_PREAMBLE, \
> + .hw_value = (MT_PHY_TYPE_CCK << 6) | (_idx), \
> + .hw_value_short = (MT_PHY_TYPE_CCK << 6) | (4 + _idx), \
> +}
> +
> +#define MT7921_OFDM_RATE(_idx, _rate) {
> \
> + .bitrate = _rate, \
> + .hw_value = (MT_PHY_TYPE_OFDM << 6) | (_idx), \
> + .hw_value_short = (MT_PHY_TYPE_OFDM << 6) | (_idx), \
> +}
> +
Nice catching. I shifted the wrong offset while bringing up mt7915, but
I used the correct offset in TxD resulting in this mt7921 issue. Can
you do me a favor to fix the offset of mt7915 as well?
Ryder
More information about the Linux-mediatek
mailing list