Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/openwrt/mt76.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRyder Lee <ryder.lee@mediatek.com>2022-10-25 03:31:01 +0300
committerFelix Fietkau <nbd@nbd.name>2022-11-11 13:38:25 +0300
commitad9bd2ba361e72cbb0824dea23253847d480bae0 (patch)
treee364e13e3f5cede45f196c4cacc059510656f3db
parent3365c129f73c5b9ca6ef5f5981a43e86ea7c9d6e (diff)
wifi: mt76: mt7615: enable use_cts_prot support
This adds selectable RTC/CTS enablement for each interface. Signed-off-by: Ryder Lee <ryder.lee@mediatek.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
-rw-r--r--mt7615/mac.c15
-rw-r--r--mt7615/main.c3
-rw-r--r--mt7615/mt7615.h2
-rw-r--r--mt7615/regs.h2
4 files changed, 22 insertions, 0 deletions
diff --git a/mt7615/mac.c b/mt7615/mac.c
index 2ce1705c..45cad911 100644
--- a/mt7615/mac.c
+++ b/mt7615/mac.c
@@ -1177,6 +1177,21 @@ void mt7615_mac_set_rates(struct mt7615_phy *phy, struct mt7615_sta *sta,
}
EXPORT_SYMBOL_GPL(mt7615_mac_set_rates);
+void mt7615_mac_enable_rtscts(struct mt7615_dev *dev,
+ struct ieee80211_vif *vif, bool enable)
+{
+ struct mt7615_vif *mvif = (struct mt7615_vif *)vif->drv_priv;
+ u32 addr;
+
+ addr = mt7615_mac_wtbl_addr(dev, mvif->sta.wcid.idx) + 3 * 4;
+
+ if (enable)
+ mt76_set(dev, addr, MT_WTBL_W3_RTS);
+ else
+ mt76_clear(dev, addr, MT_WTBL_W3_RTS);
+}
+EXPORT_SYMBOL_GPL(mt7615_mac_enable_rtscts);
+
static int
mt7615_mac_wtbl_update_key(struct mt7615_dev *dev, struct mt76_wcid *wcid,
struct ieee80211_key_conf *key,
diff --git a/mt7615/main.c b/mt7615/main.c
index 22e6bda0..3b76a03e 100644
--- a/mt7615/main.c
+++ b/mt7615/main.c
@@ -571,6 +571,9 @@ static void mt7615_bss_info_changed(struct ieee80211_hw *hw,
}
}
+ if (changed & BSS_CHANGED_ERP_CTS_PROT)
+ mt7615_mac_enable_rtscts(dev, vif, info->use_cts_prot);
+
if (changed & BSS_CHANGED_BEACON_ENABLED && info->enable_beacon) {
mt7615_mcu_add_bss_info(phy, vif, NULL, true);
mt7615_mcu_sta_add(phy, vif, NULL, true);
diff --git a/mt7615/mt7615.h b/mt7615/mt7615.h
index 060d52c8..f632e6a9 100644
--- a/mt7615/mt7615.h
+++ b/mt7615/mt7615.h
@@ -473,6 +473,8 @@ void mt7615_mac_reset_counters(struct mt7615_dev *dev);
void mt7615_mac_cca_stats_reset(struct mt7615_phy *phy);
void mt7615_mac_set_scs(struct mt7615_phy *phy, bool enable);
void mt7615_mac_enable_nf(struct mt7615_dev *dev, bool ext_phy);
+void mt7615_mac_enable_rtscts(struct mt7615_dev *dev,
+ struct ieee80211_vif *vif, bool enable);
void mt7615_mac_sta_poll(struct mt7615_dev *dev);
int mt7615_mac_write_txwi(struct mt7615_dev *dev, __le32 *txwi,
struct sk_buff *skb, struct mt76_wcid *wcid,
diff --git a/mt7615/regs.h b/mt7615/regs.h
index 6712ad9f..fa1b9b26 100644
--- a/mt7615/regs.h
+++ b/mt7615/regs.h
@@ -446,6 +446,8 @@ enum mt7615_reg_base {
#define MT_WTBL_RIUCR3_RATE6 GENMASK(19, 8)
#define MT_WTBL_RIUCR3_RATE7 GENMASK(31, 20)
+#define MT_WTBL_W3_RTS BIT(22)
+
#define MT_WTBL_W5_CHANGE_BW_RATE GENMASK(7, 5)
#define MT_WTBL_W5_SHORT_GI_20 BIT(8)
#define MT_WTBL_W5_SHORT_GI_40 BIT(9)