Skip to contentSkip to conversation

mt76: mt7921u: enable HW beacon filter

PATCH In review [email protected] 2 participants 3 messages Jun 16, 2022 – Jun 17, 2022

Subsystems (2)
lore
Share & tools
lore

[email protected]

author reviewer
#0 lore raw

PATCH 1/2 mt76: mt7921u: enable HW beacon filter

From: Sean Wang <[email protected]>

HW beacon filter and HW connection monitor can be supported on MT7921U as well so we enable them to be consistent with MT7921[E,S].

---
 drivers/net/wireless/mediatek/mt76/mt7921/main.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/net/wireless/mediatek/mt76/mt7921/main.c +1 -2
index acf6567368b7..d803a7dd5f83 100644
@@ -677,8 +677,7 @@ static void mt7921_bss_info_changed(struct ieee80211_hw *hw,
 	if (changed & BSS_CHANGED_ASSOC) {
 		mt7921_mcu_sta_update(dev, NULL, vif, true,
 				      MT76_STA_INFO_STATE_ASSOC);
-		if (dev->pm.enable)
-			mt7921_mcu_set_beacon_filter(dev, vif, info->assoc);
+		mt7921_mcu_set_beacon_filter(dev, vif, info->assoc);
 	}
 
 	if (changed & BSS_CHANGED_ARP_FILTER) {
Signature · 1 line
2.25.1
author reviewer
#1 lore raw

PATCH 2/2 mt76: mt7921: enable HW beacon filter in the initialization stage

From: Sean Wang <[email protected]>

The current driver has worked with HW beacon filter and connection monitor all the way, here we move the enablement into the initialization stage like other HW features being done to get rid of others are confused why these configurations would be changed at runtime.

We still leave a way to turn off these offload features in debugfs knobs but that is just for debugging purposes.

---
 drivers/net/wireless/mediatek/mt76/mt7921/init.c |  1 +
 drivers/net/wireless/mediatek/mt76/mt7921/main.c | 16 +++++++++++++++-
 drivers/net/wireless/mediatek/mt76/mt7921/mcu.c  |  5 -----
 3 files changed, 16 insertions(+), 6 deletions(-)
drivers/net/wireless/mediatek/mt76/mt7921/init.c +1 -0
index 48a10aaecc62..5f3e2507975c 100644
@@ -96,6 +96,7 @@ mt7921_init_wiphy(struct ieee80211_hw *hw)
 	ieee80211_hw_set(hw, WANT_MONITOR_VIF);
 	ieee80211_hw_set(hw, SUPPORTS_PS);
 	ieee80211_hw_set(hw, SUPPORTS_DYNAMIC_PS);
+	ieee80211_hw_set(hw, CONNECTION_MONITOR);
 
 	if (dev->pm.enable)
 		ieee80211_hw_set(hw, CONNECTION_MONITOR);
drivers/net/wireless/mediatek/mt76/mt7921/main.c +15 -1
index d803a7dd5f83..c7f95d83885a 100644
@@ -352,6 +352,7 @@ static int mt7921_add_interface(struct ieee80211_hw *hw,
 		mtxq->wcid = idx;
 	}
 
+	vif->driver_flags |= IEEE80211_VIF_BEACON_FILTER;
 out:
 	mt7921_mutex_release(dev);
 
@@ -495,8 +496,21 @@ static void
 mt7921_pm_interface_iter(void *priv, u8 *mac, struct ieee80211_vif *vif)
 {
 	struct mt7921_dev *dev = priv;
+	struct ieee80211_hw *hw = mt76_hw(dev);
+	bool pm_enable = dev->pm.enable;
+	int err;
 
-	mt7921_mcu_set_beacon_filter(dev, vif, dev->pm.enable);
+	err = mt7921_mcu_set_beacon_filter(dev, vif, pm_enable);
+	if (err < 0)
+		return;
+
+	if (pm_enable) {
+		vif->driver_flags |= IEEE80211_VIF_BEACON_FILTER;
+		ieee80211_hw_set(hw, CONNECTION_MONITOR);
+	} else {
+		vif->driver_flags &= ~IEEE80211_VIF_BEACON_FILTER;
+		__clear_bit(IEEE80211_HW_CONNECTION_MONITOR, hw->flags);
+	}
 }
 
 static void
drivers/net/wireless/mediatek/mt76/mt7921/mcu.c +0 -5
index d0a7c3128d5a..823019f9c2dc 100644
@@ -1134,7 +1134,6 @@ int mt7921_mcu_set_beacon_filter(struct mt7921_dev *dev,
 				 struct ieee80211_vif *vif,
 				 bool enable)
 {
-	struct ieee80211_hw *hw = mt76_hw(dev);
 	int err;
 
 	if (enable) {
@@ -1142,8 +1141,6 @@ int mt7921_mcu_set_beacon_filter(struct mt7921_dev *dev,
 		if (err)
 			return err;
 
-		vif->driver_flags |= IEEE80211_VIF_BEACON_FILTER;
-		ieee80211_hw_set(hw, CONNECTION_MONITOR);
 		mt76_set(dev, MT_WF_RFCR(0), MT_WF_RFCR_DROP_OTHER_BEACON);
 
 		return 0;
@@ -1153,8 +1150,6 @@ int mt7921_mcu_set_beacon_filter(struct mt7921_dev *dev,
 	if (err)
 		return err;
 
-	vif->driver_flags &= ~IEEE80211_VIF_BEACON_FILTER;
-	__clear_bit(IEEE80211_HW_CONNECTION_MONITOR, hw->flags);
 	mt76_clear(dev, MT_WF_RFCR(0), MT_WF_RFCR_DROP_OTHER_BEACON);
 
 	return 0;
Signature · 1 line
2.25.1
maintainer
#2 lore raw
In reply to [email protected]
Quoted 16 lines · On 16.06.22 03:10, [email protected] wrote:

From: Sean Wang <[email protected]>

HW beacon filter and HW connection monitor can be supported on MT7921U as well so we enable them to be consistent with MT7921[E,S].

---
  drivers/net/wireless/mediatek/mt76/mt7921/main.c | 3 +--
  1 file changed, 1 insertion(+), 2 deletions(-)
drivers/net/wireless/mediatek/mt76/mt7921/main.c +0 -0
index acf6567368b7..d803a7dd5f83 100644

drivers/net/wireless/mediatek/mt76/mt7921/main.c static void mt7921_bss_info_changed(struct ieee80211_hw *hw, · line 680

Quoted 6 lines
drivers/net/wireless/mediatek/mt76/mt7921/main.c +1 -2
@@ -677,8 +677,7 @@ static void mt7921_bss_info_changed(struct ieee80211_hw *hw,
  	if (changed & BSS_CHANGED_ASSOC) {
  		mt7921_mcu_sta_update(dev, NULL, vif, true,
  				      MT76_STA_INFO_STATE_ASSOC);
-		if (dev->pm.enable)
-			mt7921_mcu_set_beacon_filter(dev, vif, info->assoc);
+		mt7921_mcu_set_beacon_filter(dev, vif, info->assoc);

To me it looks like patch description and code change don't really match. Could you please explain why you change it so that the beacon filter is enabled even if PM isn't?

- Felix