OSDN Git Service

mt76: add mt76_default_basic_rate more devices can rely on
authorSean Wang <sean.wang@mediatek.com>
Tue, 13 Jul 2021 20:15:59 +0000 (04:15 +0800)
committerFelix Fietkau <nbd@nbd.name>
Wed, 20 Oct 2021 08:36:28 +0000 (10:36 +0200)
add mt76_default_basic_rate to mt76 core more devices can rely on
to send frames which require the rate in the basic rates.

Suggested-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
drivers/net/wireless/mediatek/mt76/mac80211.c
drivers/net/wireless/mediatek/mt76/mt76.h

index ee3a5b8..7403a01 100644 (file)
@@ -1351,3 +1351,17 @@ mt76_init_queue(struct mt76_dev *dev, int qid, int idx, int n_desc,
        return hwq;
 }
 EXPORT_SYMBOL_GPL(mt76_init_queue);
+
+u16 mt76_default_basic_rate(struct mt76_phy *phy, struct ieee80211_vif *vif)
+{
+       int i = ffs(vif->bss_conf.basic_rates) - 1, offset = 0;
+       struct ieee80211_rate *rate;
+
+       if (phy->chandef.chan->band == NL80211_BAND_5GHZ)
+               offset = 4;
+
+       rate = &mt76_rates[offset + i];
+
+       return rate->hw_value;
+}
+EXPORT_SYMBOL_GPL(mt76_default_basic_rate);
index 0516d3a..bf36f92 100644 (file)
@@ -891,6 +891,7 @@ int mt76_get_of_eeprom(struct mt76_dev *dev, void *data, int offset, int len);
 struct mt76_queue *
 mt76_init_queue(struct mt76_dev *dev, int qid, int idx, int n_desc,
                int ring_base);
+u16 mt76_default_basic_rate(struct mt76_phy *phy, struct ieee80211_vif *vif);
 static inline int mt76_init_tx_queue(struct mt76_phy *phy, int qid, int idx,
                                     int n_desc, int ring_base)
 {