Skip to contentSkip to conversation

wifi: mt76: mt7925: honour mac80211's FIF_FCSFAIL instead of hardcoding drop_err

PATCH New Mark Anthony Agarro 1 participant 1 message Aug 26

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 wifi: mt76: mt7925: honour mac80211's FIF_FCSFAIL instead of hardcoding drop_err

mt7925_mcu_config_sniffer() hardcodes drop_err = 1, ignoring what mac80211 actually requested via configure_filter(). FIF_FCSFAIL is computed there but discarded instead of persisted.

Persist the FCSFAIL bit on the phy in mt7925_configure_filter() and read it back in mt7925_mcu_config_sniffer() to derive drop_err, so the firmware sniffer only passes through unfiltered/marginal frames when a monitor listener actually requested them.

mt7925_mcu_config_sniffer() is only reached from mt7925_change_chanctx(), which is itself only exercised on a monitor-mode chanctx, so this stays scoped to monitor mode.

Fixes c948b5da6bbe ("wifi: mt76: mt7925: add Mediatek Wi-Fi7 driver for mt7925 chips")
---
 drivers/net/wireless/mediatek/mt76/mt7925/main.c   | 7 +++----
 drivers/net/wireless/mediatek/mt76/mt7925/mcu.c    | 2 +-
 drivers/net/wireless/mediatek/mt76/mt7925/mt7925.h | 5 +++++
 drivers/net/wireless/mediatek/mt76/mt792x.h        | 1 +
 4 files changed, 10 insertions(+), 5 deletions(-)
drivers/net/wireless/mediatek/mt76/mt7925/main.c +3 -4
index a9059866b..cfbfd77e8 100644
@@ -832,11 +832,8 @@ static void mt7925_configure_filter(struct ieee80211_hw *hw,
 				    unsigned int *total_flags,
 				    u64 multicast)
 {
-#define MT7925_FILTER_FCSFAIL    BIT(2)
-#define MT7925_FILTER_CONTROL    BIT(5)
-#define MT7925_FILTER_OTHER_BSS  BIT(6)
-#define MT7925_FILTER_ENABLE     BIT(31)
 	struct mt792x_dev *dev = mt792x_hw_dev(hw);
+	struct mt792x_phy *phy = mt792x_hw_phy(hw);
 	u32 flags = MT7925_FILTER_ENABLE;
 
 #define MT7925_FILTER(_fif, _type) do {			\
@@ -848,6 +845,8 @@ static void mt7925_configure_filter(struct ieee80211_hw *hw,
 	MT7925_FILTER(FIF_CONTROL, CONTROL);
 	MT7925_FILTER(FIF_OTHER_BSS, OTHER_BSS);
 
+	phy->rxfilter = flags;
+
 	mt792x_mutex_acquire(dev);
 	mt7925_mcu_set_rxfilter(dev, flags, 0, 0);
 	mt792x_mutex_release(dev);
drivers/net/wireless/mediatek/mt76/mt7925/mcu.c +1 -1
index e94fa544f..adc137a0e 100644
@@ -2251,7 +2251,7 @@ int mt7925_mcu_config_sniffer(struct mt792x_vif *vif,
 			.len = cpu_to_le16(sizeof(req.tlv)),
 			.control_ch = chandef->chan->hw_value,
 			.center_ch = ieee80211_frequency_to_channel(freq1),
-			.drop_err = 1,
+			.drop_err = !(vif->phy->rxfilter & MT7925_FILTER_FCSFAIL),
 		},
 	};
 
drivers/net/wireless/mediatek/mt76/mt7925/mt7925.h +5 -0
index 4cc259418..8fb8a4c13 100644
@@ -7,6 +7,11 @@
 #include "../mt792x.h"
 #include "regs.h"
 
+#define MT7925_FILTER_FCSFAIL		BIT(2)
+#define MT7925_FILTER_CONTROL		BIT(5)
+#define MT7925_FILTER_OTHER_BSS	BIT(6)
+#define MT7925_FILTER_ENABLE		BIT(31)
+
 #define MT7925_BEACON_RATES_TBL		25
 
 #define MT7925_TX_RING_SIZE		2048
drivers/net/wireless/mediatek/mt76/mt792x.h +1 -0
index 70073b43a..75d32a4ad 100644
@@ -168,6 +168,7 @@ struct mt792x_phy {
 	s16 coverage_class;
 	u8 slottime;
 
+	u32 rxfilter;
 	u32 rx_ampdu_ts;
 	u32 ampdu_ref;
 
Signature · 1 line
2.47.3