Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp10738079pxu; Wed, 30 Dec 2020 10:11:46 -0800 (PST) X-Google-Smtp-Source: ABdhPJxsWWspVERDPM1tbwl+laRx2uZCU8JRnCZqyaBn3Xwpsf4vLJFjJsT/HGqWrinQKq63rwJu X-Received: by 2002:a17:906:3101:: with SMTP id 1mr38438911ejx.115.1609351906548; Wed, 30 Dec 2020 10:11:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609351906; cv=none; d=google.com; s=arc-20160816; b=pivHvlMJ4p3AAIito7eif9a2M18jWOo8aJrjK7GclCdPi3K4ngLmLSe517ClYz2qWp RzUhNSU0GgfFQoxsLb9r0hirrApj5z1EuC7zL41B34P6W3ZchLxUyta8JiSL+zBcJVZ1 LJ5nqWJHoqchSj/HsfqA1vMap1tyRw33jYsAmUOSpcL8c/pT009ac21Q2y2Noc6EG+GB 1d7RECZX1DemtzFPScISJRd2MHtxZ3KI/AGKN9tcmgLoB65UPwneIyeApFQIkOLWkdoX FJV7gsEHm3zRacK79Qo/tqo4JAIty7ITqqBJeUBb9ANQ9zhHQuwtxx7Z8AFpsu24WTcA oA9g== 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=byg/6TulQzz1lSdw+1OfJHZhwd84B3chUBxUIcYZNTE=; b=MU1YzcQo4SPlr0TG3kkKSeE9EK6za5pUdWwfW4Ha8aUJDAQf7b1XaaTndhK8qyoP5O BzXx6dyu0JYUYk30DA+UVn+Ubv0VtjhmJpioebqrW+Sj3uD0GCiV3fYtfyYhhMim2354 dtHfsJfHsOArNPIhx+eRMVMR7XYEBA4c4Siw6aoou0Eqygl9kFpN+g/3Cbtg9jV6Bvbq VXVjjes8pzHQ+qAVLRVuHUbYqnCf7OUljHhOCVzGgij1PiVrRwP5jPMD04YjdTm3NtE3 l5eEE4EhqEMUJpnhQKHQoxTVKvCnOFggUwkNQ6Ip4TstosbjgcgJHWIF+fzXAPuE89Ed KngQ== 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 bu24si24213547edb.378.2020.12.30.10.11.23; Wed, 30 Dec 2020 10:11:46 -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 S1726652AbgL3SHi (ORCPT + 99 others); Wed, 30 Dec 2020 13:07:38 -0500 Received: from mailgw02.mediatek.com ([210.61.82.184]:54827 "EHLO mailgw02.mediatek.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726642AbgL3SHi (ORCPT ); Wed, 30 Dec 2020 13:07:38 -0500 X-UUID: 6f8a8fadde1343f8a7c827eead565cba-20201231 X-UUID: 6f8a8fadde1343f8a7c827eead565cba-20201231 Received: from mtkcas11.mediatek.inc [(172.21.101.40)] 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 1073833957; Thu, 31 Dec 2020 02:06:33 +0800 Received: from MTKCAS06.mediatek.inc (172.21.101.30) by mtkmbs02n2.mediatek.inc (172.21.101.101) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Thu, 31 Dec 2020 02:06:32 +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, 31 Dec 2020 02:06:32 +0800 From: To: , CC: , , , , , , , , , , Lorenzo Bianconi Subject: [PATCH -next v4 11/13] mt76: mt7921: introduce support for hardware beacon filter Date: Thu, 31 Dec 2020 02:06:22 +0800 Message-ID: <8aece035e2bfb61b09bd49292c786b187506cba3.1609347310.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-TM-SNTS-SMTP: 4F6523CFE82393BC3B5DEC6A89BFE20EC683E763E3075E276B05A70E2B1A606B2000: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 edad763cf194..11550be87402 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7921/mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt7921/mcu.c @@ -2540,3 +2540,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 b8bd99894f11..879bf8172fb7 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7921/mt7921.h +++ b/drivers/net/wireless/mediatek/mt76/mt7921/mt7921.h @@ -360,4 +360,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