Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp13997275pxu; Mon, 4 Jan 2021 10:03:23 -0800 (PST) X-Google-Smtp-Source: ABdhPJzupOVa6j9mRCLRt+0FWljV02X7c5CUpN6uGUJlUf70zslMEO3auK6zEHTvJa2LTc021hMx X-Received: by 2002:a17:906:354a:: with SMTP id s10mr67691581eja.335.1609783403509; Mon, 04 Jan 2021 10:03:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609783403; cv=none; d=google.com; s=arc-20160816; b=EAg3tngvGIR65LSRymXOKHu1jAN2R6oPLubxk9+Dyf2cDODINMd8jBnk7XmYBEV7En f43EZDQO12IQlyYI1qtX4Sb8xuWc719gxoi85fGIj0I3Ld+Lu3wo5sFjfCvOHv3dPJ9/ EkmgYTSbWhIb94U5I6834dP+AIz6y0H3ORiV4VNQubuh+CbGBwWx4U1dntCTXymklFQG +NmbNhw5rjdDVS1AJBBtbP9tBYlb2A9oj+UwLXxj+YbJO7zGrq2Iba0X0/oN9azmkQOg s+A2AuJ0CFYEoJCUJagQHoIRemFEqmP3rMNwqnxxM3pH1i1Es+vLv6FKVRdrMas0f99o 9sfQ== 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=rXY6X7E1zRVC6/cNA/ytghMwS582EJz1aLn10bzADYo=; b=phyn04t8kFIifzZdRNpjLorwfjX7BKI7v0Il+Smj71wc70Inbjnld1gF6Ys7ja+9n7 ZNllDonRb7wNQ2k9tCrYCpKxkz8XQ+Wf3PCodtkpTmZR4xqN69RF9gRZZa35eT3q53lB 7fyjv+Ad3pD96Jx237uvqQaEi61egnahpsUGImc947dCcawUFFbS+kF7ZweT4Isy9fZg LnWMQdOBkt9KvqRYy7vSxZf/l8EZX3U2rt+bzLl/qFG7YC2YZrz9PMqGyqSlq/cBGP2o dt4iCLz1CAheTzWGZnKZNQLrROkNAfFe8HnD/njtWqkOXOeBx/9L5QdmEP4HCor9Ydid /Yrg== 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 i18si24369814ejb.85.2021.01.04.10.03.00; Mon, 04 Jan 2021 10:03: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 S1727357AbhADSB2 (ORCPT + 99 others); Mon, 4 Jan 2021 13:01:28 -0500 Received: from mailgw01.mediatek.com ([210.61.82.183]:33101 "EHLO mailgw01.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1727275AbhADSB2 (ORCPT ); Mon, 4 Jan 2021 13:01:28 -0500 X-UUID: b2006cb6354e4e1294fe0434beb76e77-20210105 X-UUID: b2006cb6354e4e1294fe0434beb76e77-20210105 Received: from mtkexhb02.mediatek.inc [(172.21.101.103)] 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 1902472191; Tue, 05 Jan 2021 02:00:24 +0800 Received: from mtkcas07.mediatek.inc (172.21.101.84) by mtkmbs06n2.mediatek.inc (172.21.101.130) 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 13/15] mt76: mt7921: introduce support for hardware beacon filter Date: Tue, 5 Jan 2021 02:00:17 +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: 7023ADF14FC02051B5C95B6EB14B9910678001398CEBC45489DF465243F17F1B2000:8 X-MTK: N Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org From: Sean Wang Introduce support for hw beacon filter available in the mt7921 firmware. 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 | 40 +++++++++++++++++++ .../wireless/mediatek/mt76/mt7921/mt7921.h | 2 + 2 files changed, 42 insertions(+) diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7921/mcu.c index ab2630ca31ca..1ea209852ef9 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7921/mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt7921/mcu.c @@ -2548,3 +2548,43 @@ int mt7921_mcu_set_vif_ps(struct mt7921_dev *dev, struct ieee80211_vif *vif) return mt76_mcu_send_msg(&dev->mt76, MCU_CMD_SET_PS_PROFILE, &req, sizeof(req), false); } + +int mt7921_mcu_set_bss_pm(struct mt7921_dev *dev, struct ieee80211_vif *vif, + bool enable) +{ + struct mt7921_vif *mvif = (struct mt7921_vif *)vif->drv_priv; + struct { + u8 bss_idx; + u8 dtim_period; + __le16 aid; + __le16 bcn_interval; + __le16 atim_window; + u8 uapsd; + u8 bmc_delivered_ac; + u8 bmc_triggered_ac; + u8 pad; + } req = { + .bss_idx = mvif->idx, + .aid = cpu_to_le16(vif->bss_conf.aid), + .dtim_period = vif->bss_conf.dtim_period, + .bcn_interval = cpu_to_le16(vif->bss_conf.beacon_int), + }; + struct { + u8 bss_idx; + u8 pad[3]; + } req_hdr = { + .bss_idx = mvif->idx, + }; + int err; + + if (vif->type != NL80211_IFTYPE_STATION) + return 0; + + err = mt76_mcu_send_msg(&dev->mt76, MCU_CMD_SET_BSS_ABORT, &req_hdr, + sizeof(req_hdr), false); + if (err < 0 || !enable) + return err; + + return mt76_mcu_send_msg(&dev->mt76, MCU_CMD_SET_BSS_CONNECTED, &req, + sizeof(req), false); +} diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/mt7921.h b/drivers/net/wireless/mediatek/mt76/mt7921/mt7921.h index 80610fe22af4..54d3d21abf91 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7921/mt7921.h +++ b/drivers/net/wireless/mediatek/mt76/mt7921/mt7921.h @@ -363,4 +363,6 @@ int mt7921_mcu_cancel_hw_scan(struct mt7921_phy *phy, struct ieee80211_vif *vif); u32 mt7921_get_wtbl_info(struct mt7921_dev *dev, u16 wlan_idx); int mt7921_mcu_set_vif_ps(struct mt7921_dev *dev, struct ieee80211_vif *vif); +int mt7921_mcu_set_bss_pm(struct mt7921_dev *dev, struct ieee80211_vif *vif, + bool enable); #endif -- 2.25.1