Skip to content

Commit

Permalink
wifi: mt76: mt7615: enable use_cts_prot support
Browse files Browse the repository at this point in the history
This adds selectable RTC/CTS enablement for each interface.

Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
  • Loading branch information
ryderlee1110 authored and nbd168 committed Nov 11, 2022
1 parent 3365c12 commit ad9bd2b
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 0 deletions.
15 changes: 15 additions & 0 deletions mt7615/mac.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
3 changes: 3 additions & 0 deletions mt7615/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 2 additions & 0 deletions mt7615/mt7615.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 2 additions & 0 deletions mt7615/regs.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit ad9bd2b

Please sign in to comment.