Skip to content

Commit b88f5c6

Browse files
moore-brosnbd168
authored andcommitted
mt76: mt7921: introduce beacon_loss mcu event
If device has enabled beacon hw filter rx beacons are not reported to the host. Introduce beacon_loss mcu event to trigger mac80211 mlme connection state machine in this configuration. IEEE80211_VIF_BEACON_FILTER has not set in vif flags since hw beacon filter is not enabled yet Co-developed-by: Lorenzo Bianconi <[email protected]> Signed-off-by: Lorenzo Bianconi <[email protected]> Co-developed-by: Soul Huang <[email protected]> Signed-off-by: Soul Huang <[email protected]> Signed-off-by: Sean Wang <[email protected]> Signed-off-by: Felix Fietkau <[email protected]>
1 parent 4086ee2 commit b88f5c6

File tree

2 files changed

+41
-0
lines changed
  • drivers/net/wireless/mediatek/mt76/mt7921

2 files changed

+41
-0
lines changed

drivers/net/wireless/mediatek/mt76/mt7921/mcu.c

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -543,6 +543,40 @@ mt7921_mcu_scan_event(struct mt7921_dev *dev, struct sk_buff *skb)
543543
MT7921_HW_SCAN_TIMEOUT);
544544
}
545545

546+
static void
547+
mt7921_mcu_beacon_loss_iter(void *priv, u8 *mac, struct ieee80211_vif *vif)
548+
{
549+
struct mt7921_vif *mvif = (struct mt7921_vif *)vif->drv_priv;
550+
struct mt7921_beacon_loss_event *event = priv;
551+
552+
if (mvif->mt76.idx != event->bss_idx)
553+
return;
554+
555+
if (!(vif->driver_flags & IEEE80211_VIF_BEACON_FILTER))
556+
return;
557+
558+
ieee80211_beacon_loss(vif);
559+
}
560+
561+
static void
562+
mt7921_mcu_beacon_loss_event(struct mt7921_dev *dev, struct sk_buff *skb)
563+
{
564+
struct mt7921_beacon_loss_event *event;
565+
struct mt76_phy *mphy;
566+
u8 band_idx = 0; /* DBDC support */
567+
568+
skb_pull(skb, sizeof(struct mt7921_mcu_rxd));
569+
event = (struct mt7921_beacon_loss_event *)skb->data;
570+
if (band_idx && dev->mt76.phy2)
571+
mphy = dev->mt76.phy2;
572+
else
573+
mphy = &dev->mt76.phy;
574+
575+
ieee80211_iterate_active_interfaces_atomic(mphy->hw,
576+
IEEE80211_IFACE_ITER_RESUME_ALL,
577+
mt7921_mcu_beacon_loss_iter, event);
578+
}
579+
546580
static void
547581
mt7921_mcu_bss_event(struct mt7921_dev *dev, struct sk_buff *skb)
548582
{
@@ -593,6 +627,7 @@ mt7921_mcu_rx_unsolicited_event(struct mt7921_dev *dev, struct sk_buff *skb)
593627

594628
switch (rxd->eid) {
595629
case MCU_EVENT_BSS_BEACON_LOSS:
630+
mt7921_mcu_beacon_loss_event(dev, skb);
596631
break;
597632
case MCU_EVENT_SCHED_SCAN_DONE:
598633
case MCU_EVENT_SCAN_DONE:

drivers/net/wireless/mediatek/mt76/mt7921/mcu.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -784,6 +784,12 @@ struct mt7921_bss_qos_tlv {
784784
u8 pad[3];
785785
} __packed;
786786

787+
struct mt7921_beacon_loss_event {
788+
u8 bss_idx;
789+
u8 reason;
790+
u8 pad[2];
791+
} __packed;
792+
787793
struct mt7921_mcu_scan_ssid {
788794
__le32 ssid_len;
789795
u8 ssid[IEEE80211_MAX_SSID_LEN];

0 commit comments

Comments
 (0)