Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp13997149pxu; Mon, 4 Jan 2021 10:03:09 -0800 (PST) X-Google-Smtp-Source: ABdhPJxpuka/5M3g4pEFR8KqRfmfUbwuaQ9tScrePk0FIv0Fw6AayD6JsjiNoTKfcQV+yC+jMEr+ X-Received: by 2002:a17:906:3d4a:: with SMTP id q10mr42514147ejf.85.1609783389421; Mon, 04 Jan 2021 10:03:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609783389; cv=none; d=google.com; s=arc-20160816; b=xIxx3aybVqThKRrbU+eBVsEwm6Wq3pts1xylhVwccS4YH4afyBIglNN5xSiYz2sPiW Z7ltROQsRZ2ujqs1hRu6sVtjkZreFjSPVQtRmWbRtPcUAO7jEfgnsH4xdQlHCuB5XtCU Oa6+a7xfVEZCXjkxq2cfNJxjK0sS7hhbJOoPo0cL++NPT5y4XHjTSOZCL2o2qZeOStzw rtglwlmR5hqO0sx9QOe/m1y+gfKkcIE+dzdv0rf8TKQpd9JilX+F9BVEh9i7Rvfr7uJI g5kznaJ03J1yLeP7Wmkl9zzQxu+RsckUeQH5e8nd/kmHgt4SeJRWvG3K0mONiey45xdE 9OnQ== 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=/cBi/k/544EsP0cEcsbYXftj5d1kUjkLI7ys4NT/exQ=; b=P48loE3TsWVpxYhjqsls8M5iFsQyWuMdYObv2fyApPGpZtP1E328ygo7BK99DqeR47 hN+5WDCCmpTZBHH+ZSeXhppkEZZsevCjx8rZgUkdMSZVKMuL4ZuJTw6bCU1dBXocZxoX hHW5WtODCP4jIn6iws1JyYhTAjTVC39Ub2orrgpw3HpNNKrkGgp3LKhLpUBUo4+QZQHV puV5FIot7+D4U0/KqDirvZXVW7cM2jpeVISnNRbkcZ6Cly1MdXYdRNvq58OfZ+cXqoGx tdASV6MQgXPAT4jz1aFqTCBV+tHLK2Jpo9mdJXNx9v7JRPrTM3JW9ks75lZKcNbN/EuU dNkg== 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 b13si30143757edw.300.2021.01.04.10.02.46; Mon, 04 Jan 2021 10:03:09 -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 S1727525AbhADSBq (ORCPT + 99 others); Mon, 4 Jan 2021 13:01:46 -0500 Received: from mailgw01.mediatek.com ([210.61.82.183]:33089 "EHLO mailgw01.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1726072AbhADSBp (ORCPT ); Mon, 4 Jan 2021 13:01:45 -0500 X-UUID: df5aeea80d4f4c41956b54b09249d9b8-20210105 X-UUID: df5aeea80d4f4c41956b54b09249d9b8-20210105 Received: from mtkcas11.mediatek.inc [(172.21.101.40)] 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 1132478707; Tue, 05 Jan 2021 02:00:23 +0800 Received: from mtkcas07.mediatek.inc (172.21.101.84) by mtkmbs02n1.mediatek.inc (172.21.101.77) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Tue, 5 Jan 2021 02:00:22 +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; Tue, 5 Jan 2021 02:00:22 +0800 From: To: , CC: , , , , , , , , , , Lorenzo Bianconi Subject: [PATCH -next v5 14/15] mt76: mt7921: introduce beacon_loss mcu event Date: Tue, 5 Jan 2021 02:00:18 +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-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 1ea209852ef9..57f8b7b770dc 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 6894b44ff62d..d6cb062619db 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7921/mcu.h +++ b/drivers/net/wireless/mediatek/mt76/mt7921/mcu.h @@ -783,6 +783,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