Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp477620pxb; Wed, 20 Jan 2021 11:39:13 -0800 (PST) X-Google-Smtp-Source: ABdhPJzvV9EBkAVcKI0j5EAsSLrPrj2t3qCXAjOrloJlNwPPwNLOp37e89NreVoYG6qOamJnU5BX X-Received: by 2002:a17:906:51d0:: with SMTP id v16mr5081063ejk.510.1611171553041; Wed, 20 Jan 2021 11:39:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611171553; cv=none; d=google.com; s=arc-20160816; b=LggNhUukWiPfoyDkTLhf/uznhUcN/TN46Bl0oT0cxXy8RBFP5DUfC8Y4S/NYHUozQE qzz7kwaArUPyYOJ+xzzeHH0nPuPDIAfTlcmJPlPIlGlQ8qokg/5SBICAxz86GXG01n7M e03LsGQK4PfO9DmhLN7c3S249Pgy3lG+V8rrGLWBhMlkyt9iNbpSmdCGoAFvpqQyU+bX agLakyDBJF5iv5NiTCXB8b+3jqIqRqi+Br4cItfpdydU3k5HdrJe73L/Kei8JRzNNQFq 607meFq67YVQuZO44DqVVVWj2UZPOsWbu9EZWsxm22ODrGLuCopqGlZnGURbZLP7WO0S nDZQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from; bh=Jc9yZ72tX1IKEyXgdUYq0kCD9tympzVnQWkfl5F8uts=; b=A3+mjIo1a9rUwIuZomyAcnwa10a1NZxB4H29AtxRjTCEwIS41P010l07Prkdf5YxEk 9OMcl8pgPB0Ze8eAEVl7YF3e8sEWQ3i8gxtQaSRBAOg77AroL0Gy6mBFGYtkYBJIuAsW /Ftmu5/Wj9gC8TOynWdhnG17gyOV38P2/7keR6anDrdckLZgCSyQu7RYLIHJX08MHdl+ xk94RzJ7rKe9Fw/UCPJGv20HbVMoT+McR9qFCFD28q9lXbtIkrvKB7sgb33RRXfHUftH XzqO4T71ZKCJD9YGkdruDgPKU5g6ujYSwFJMTseAzTzg7FDMYTOZS1VTXyQWPJ6QOhIx 1Npg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mediatek.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j2si958780ejb.229.2021.01.20.11.38.49; Wed, 20 Jan 2021 11:39:13 -0800 (PST) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mediatek.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2392700AbhATTiU (ORCPT + 99 others); Wed, 20 Jan 2021 14:38:20 -0500 Received: from mailgw02.mediatek.com ([210.61.82.184]:43152 "EHLO mailgw02.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S2392223AbhATTgk (ORCPT ); Wed, 20 Jan 2021 14:36:40 -0500 X-UUID: 0d9b9f9d05744ce68e39591b4913a047-20210121 X-UUID: 0d9b9f9d05744ce68e39591b4913a047-20210121 Received: from mtkexhb01.mediatek.inc [(172.21.101.102)] by mailgw02.mediatek.com (envelope-from ) (Cellopoint E-mail Firewall v4.1.14 Build 0819 with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 1571834975; Thu, 21 Jan 2021 03:34:17 +0800 Received: from MTKCAS06.mediatek.inc (172.21.101.30) by mtkmbs06n2.mediatek.inc (172.21.101.130) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Thu, 21 Jan 2021 03:33:56 +0800 Received: from mtkswgap22.mediatek.inc (172.21.77.33) by MTKCAS06.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Thu, 21 Jan 2021 03:33:55 +0800 From: To: , CC: , , , , , , , , , , Lorenzo Bianconi Subject: [PATCH -next v6 14/15] mt76: mt7921: introduce beacon_loss mcu event Date: Thu, 21 Jan 2021 03:33:50 +0800 Message-ID: X-Mailer: git-send-email 1.7.9.5 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain X-TM-SNTS-SMTP: D60B84684953E799F7B4BE3FCB33B78F1D238696F60F0727DB4D86145A4D2BE42000:8 X-MTK: N Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org From: Sean Wang 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 Signed-off-by: Lorenzo Bianconi Co-developed-by: Soul Huang Signed-off-by: Soul Huang Signed-off-by: Sean Wang --- .../net/wireless/mediatek/mt76/mt7921/mcu.c | 35 +++++++++++++++++++ .../net/wireless/mediatek/mt76/mt7921/mcu.h | 6 ++++ 2 files changed, 41 insertions(+) diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7921/mcu.c index 945d0e44ae71..3b8e5de63db8 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7921/mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt7921/mcu.c @@ -543,6 +543,40 @@ mt7921_mcu_scan_event(struct mt7921_dev *dev, struct sk_buff *skb) MT7921_HW_SCAN_TIMEOUT); } +static void +mt7921_mcu_beacon_loss_iter(void *priv, u8 *mac, struct ieee80211_vif *vif) +{ + struct mt7921_vif *mvif = (struct mt7921_vif *)vif->drv_priv; + struct mt7921_beacon_loss_event *event = priv; + + if (mvif->idx != event->bss_idx) + return; + + if (!(vif->driver_flags & IEEE80211_VIF_BEACON_FILTER)) + return; + + ieee80211_beacon_loss(vif); +} + +static void +mt7921_mcu_beacon_loss_event(struct mt7921_dev *dev, struct sk_buff *skb) +{ + struct mt7921_beacon_loss_event *event; + struct mt76_phy *mphy; + u8 band_idx = 0; /* DBDC support */ + + skb_pull(skb, sizeof(struct mt7921_mcu_rxd)); + event = (struct mt7921_beacon_loss_event *)skb->data; + if (band_idx && dev->mt76.phy2) + mphy = dev->mt76.phy2; + else + mphy = &dev->mt76.phy; + + ieee80211_iterate_active_interfaces_atomic(mphy->hw, + IEEE80211_IFACE_ITER_RESUME_ALL, + mt7921_mcu_beacon_loss_iter, event); +} + static void mt7921_mcu_bss_event(struct mt7921_dev *dev, struct sk_buff *skb) { @@ -593,6 +627,7 @@ mt7921_mcu_rx_unsolicited_event(struct mt7921_dev *dev, struct sk_buff *skb) switch (rxd->eid) { case MCU_EVENT_BSS_BEACON_LOSS: + mt7921_mcu_beacon_loss_event(dev, skb); break; case MCU_EVENT_SCHED_SCAN_DONE: case MCU_EVENT_SCAN_DONE: diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/mcu.h b/drivers/net/wireless/mediatek/mt76/mt7921/mcu.h index de3a9aabec04..bf2e643cd870 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7921/mcu.h +++ b/drivers/net/wireless/mediatek/mt76/mt7921/mcu.h @@ -784,6 +784,12 @@ struct mt7921_bss_qos_tlv { u8 pad[3]; } __packed; +struct mt7921_beacon_loss_event { + u8 bss_idx; + u8 reason; + u8 pad[2]; +} __packed; + struct mt7921_mcu_scan_ssid { __le32 ssid_len; u8 ssid[IEEE80211_MAX_SSID_LEN]; -- 2.25.1