Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1645690pxb; Sat, 23 Jan 2021 00:40:23 -0800 (PST) X-Google-Smtp-Source: ABdhPJzIPZupkjnYA2c871Bvub+qE5mjBktBR8RqvfNdn4xG2S1LPhafUud3C+upbkCJ5jkcmCRw X-Received: by 2002:aa7:db85:: with SMTP id u5mr1298312edt.107.1611391223602; Sat, 23 Jan 2021 00:40:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611391223; cv=none; d=google.com; s=arc-20160816; b=dinm01LJIK838FFb6ytx1UJ9ZVAFWpbGxP/FAzMMQv2joSUmB/abOBfcnzEi9QSgSJ EQKNWEzJaKqOH3VgpuhSqkHLPRbsNKidCOHpXS6A4lq5zkMg7w28vNcX/UZ9g3Z0Gcqu cgsHoKlMSwGy9F5S/HK6RM3H+H6rfMQ9PtlT0lGaCzKAb/+j4Qb2pXLI3PTt6kRFnJvl TF6/Fg5pD75euec2LhRfQtdDt8r23urAPIgvIrisiOkVEQZ89JGEB6udZLslTjBl7Qnl 5LmAx4vEtAKsCUYlKATGIjgGXoovnFqs1qMOE02WJ9Qi41nxzbsnV4bu/dCoxVMNulbf oVrw== 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=5PvJhNC0NNC724F3opyZEzEEAB0Q4CACrrX7bGuLo5c=; b=zcm2/wBa9Q7TPBjtWL5URN4Rus9yCgA4Evsqti08eT7e9Yb61+eJwEqR4ypQdFybsf mkfN4HB3TMvRIi6WxBxHmIytHoFDECr9xFusO4w1hO7mN+E/pPr/USzirC1tnxjx5k9s kKPtljbaJ/nW7BGECsM9QDUv0G5gCpBoJJ7juq/4dshGOxY5FCmBCFT/izNpEPsRr8PU Iiq6xV8jNfkiTBNYYtVMXPY8qkHqZ+qDB7IXfPBzQQL/IERYL4saxHjRPndslIKEl/2o LXWlqUJ/+szj27GzzoGcn9jlk6WzUdoO9MoPeN58G2pO8OM2cX0WL5bOYPnT+hKsomG7 lAdA== 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 n18si3566831edw.174.2021.01.23.00.40.01; Sat, 23 Jan 2021 00:40:23 -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 S1726931AbhAWIhV (ORCPT + 99 others); Sat, 23 Jan 2021 03:37:21 -0500 Received: from mailgw01.mediatek.com ([210.61.82.183]:54837 "EHLO mailgw01.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1726913AbhAWIhN (ORCPT ); Sat, 23 Jan 2021 03:37:13 -0500 X-UUID: 48beb95f5b324c459a837a4aac08739e-20210123 X-UUID: 48beb95f5b324c459a837a4aac08739e-20210123 Received: from mtkcas07.mediatek.inc [(172.21.101.84)] by mailgw01.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 832853991; Sat, 23 Jan 2021 16:35:22 +0800 Received: from mtkcas07.mediatek.inc (172.21.101.84) by mtkmbs08n1.mediatek.inc (172.21.101.55) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Sat, 23 Jan 2021 16:35:16 +0800 Received: from mtkswgap22.mediatek.inc (172.21.77.33) by mtkcas07.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Sat, 23 Jan 2021 16:35:16 +0800 From: To: , CC: , , , , , , , , , , Lorenzo Bianconi Subject: [PATCH -next v7 12/22] mt76: mt7921: introduce beacon_loss mcu event Date: Sat, 23 Jan 2021 16:35:03 +0800 Message-ID: <485042b4c1c2cce9bf0b0c2fc2c75766d644cd0b.1611389300.git.objelf@gmail.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain 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 768456c7aa7f..02fde1c63ecf 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->mt76.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