Skip to contentSkip to conversation

wifi: mt76: mt7927: set band index for sniffer mode

PATCH In review Sean Wang 2 participants 3 messages Jun 13 – Jun 24

Subsystems (2)
lore
Share & tools
lore

Sean Wang

author
#0 lore raw

PATCH 1/2 wifi: mt76: mt7927: set band index for sniffer mode

From: Sean Wang <[email protected]>

Use the active channel context to select the SNIFFER command band index on MT7927, and fall back to the PHY chandef when no channel context is available.

Also pass the same band index to the sniffer channel configuration. This keeps monitor setup on the correct band, especially when multiple PHY band contexts are present.

Fixes 35a5dcc71735 ("wifi: mt76: mt7925: add MT7927 PCIe support")
---
 drivers/net/wireless/mediatek/mt76/mt7925/mcu.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
drivers/net/wireless/mediatek/mt76/mt7925/mcu.c +14 -0
index e94fa544ff20..17bc7204f02a 100644
@@ -2174,6 +2174,8 @@ int mt7925_get_txpwr_info(struct mt792x_dev *dev, u8 band_idx, struct mt7925_txp
 int mt7925_mcu_set_sniffer(struct mt792x_dev *dev, struct ieee80211_vif *vif,
 			   bool enable)
 {
+	struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv;
+	struct ieee80211_chanctx_conf *ctx = mvif->bss_conf.mt76.ctx;
 	struct {
 		struct {
 			u8 band_idx;
@@ -2196,6 +2198,15 @@ int mt7925_mcu_set_sniffer(struct mt792x_dev *dev, struct ieee80211_vif *vif,
 		},
 	};
 
+	if (is_mt7927(&dev->mt76)) {
+		struct ieee80211_channel *chan;
+
+		chan = ctx ? ctx->def.chan : mvif->phy->mt76->chandef.chan;
+
+		if (chan)
+			req.hdr.band_idx = mt7927_band_idx(chan->band);
+	}
+
 	return mt76_mcu_send_msg(&dev->mt76, MCU_UNI_CMD(SNIFFER), &req, sizeof(req),
 				 true);
 }
@@ -2255,6 +2266,9 @@ int mt7925_mcu_config_sniffer(struct mt792x_vif *vif,
 		},
 	};
 
+	if (is_mt7927(mphy->dev))
+		req.hdr.band_idx = mt7927_band_idx(chandef->chan->band);
+
 	if (chandef->chan->band < ARRAY_SIZE(ch_band))
 		req.tlv.ch_band = ch_band[chandef->chan->band];
 	if (chandef->width < ARRAY_SIZE(ch_width))
Signature · 1 line
2.43.0
author
#1 lore raw

PATCH 2/2 wifi: mt76: mt7927: use real monitor vifs for dual-band monitors

From: Sean Wang <[email protected]>

MT7927 needs monitor interfaces to be passed to the driver as real vifs so each monitor interface can be configured with its own band context.

This is required to support concurrent 2 GHz and 5 GHz monitor operation on the same hw.

Keep the existing virtual monitor behavior for older chips.

---
 drivers/net/wireless/mediatek/mt76/mt792x_core.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/net/wireless/mediatek/mt76/mt792x_core.c +4 -1
index b50825eccdaf..16afc90b7422 100644
@@ -724,7 +724,10 @@ int mt792x_init_wiphy(struct ieee80211_hw *hw)
 	ieee80211_hw_set(hw, HAS_RATE_CONTROL);
 	ieee80211_hw_set(hw, SUPPORTS_TX_ENCAP_OFFLOAD);
 	ieee80211_hw_set(hw, SUPPORTS_RX_DECAP_OFFLOAD);
-	ieee80211_hw_set(hw, WANT_MONITOR_VIF);
+	if (is_mt7927(&dev->mt76))
+		ieee80211_hw_set(hw, NO_VIRTUAL_MONITOR);
+	else
+		ieee80211_hw_set(hw, WANT_MONITOR_VIF);
 	ieee80211_hw_set(hw, SUPPORTS_PS);
 	ieee80211_hw_set(hw, SUPPORTS_DYNAMIC_PS);
 	ieee80211_hw_set(hw, SUPPORTS_VHT_EXT_NSS_BW);
Signature · 1 line
2.43.0
Tested-by on v1 1/2
#2 lore raw
In reply to Sean Wang

Tested on a real MT7927 (Filogic 380, PCIe). Two monitors on different bands capture at the same time with the series, and drop back onto one band without it.

I tried each patch on its own too. [1/2] by itself still collapses both monitors onto one channel. With [2/2] they stay apart, but then one of them stops capturing, so it looks like both are needed.

Single-band monitor and a normal station connection were both fine.