2021-02-19 17:30:53

by Lorenzo Bianconi

[permalink] [raw]
Subject: [PATCH v2 3/8] mt76: mt7921: switch to new api for hardware beacon filter

From: Sean Wang <[email protected]>

Current firmware only supports new api for enabling hardware beacon filter.

Fixes: 1d8efc741df80 ("mt76: mt7921: introduce Runtime PM support")
Beacon filter cmd have to rely on the associatied access point's beacon
interval and DTIM information.

Signed-off-by: Sean Wang <[email protected]>
Signed-off-by: Lorenzo Bianconi <[email protected]>
---
.../net/wireless/mediatek/mt76/mt7921/main.c | 49 +++++++++++++------
.../net/wireless/mediatek/mt76/mt7921/mcu.c | 8 ++-
2 files changed, 40 insertions(+), 17 deletions(-)

diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/main.c b/drivers/net/wireless/mediatek/mt76/mt7921/main.c
index 729f6c42cdde..11d85cf9cfb8 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7921/main.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7921/main.c
@@ -295,15 +295,6 @@ static int mt7921_add_interface(struct ieee80211_hw *hw,
if (ret)
goto out;

- if (dev->pm.enable) {
- ret = mt7921_mcu_set_bss_pm(dev, vif, true);
- if (ret)
- goto out;
-
- vif->driver_flags |= IEEE80211_VIF_BEACON_FILTER;
- mt76_set(dev, MT_WF_RFCR(0), MT_WF_RFCR_DROP_OTHER_BEACON);
- }
-
dev->mt76.vif_mask |= BIT(mvif->mt76.idx);
phy->omac_mask |= BIT_ULL(mvif->mt76.omac_idx);

@@ -349,13 +340,6 @@ static void mt7921_remove_interface(struct ieee80211_hw *hw,
phy->monitor_vif = NULL;

mt76_connac_free_pending_tx_skbs(&dev->pm, &msta->wcid);
-
- if (dev->pm.enable) {
- mt7921_mcu_set_bss_pm(dev, vif, false);
- mt76_clear(dev, MT_WF_RFCR(0),
- MT_WF_RFCR_DROP_OTHER_BEACON);
- }
-
mt76_connac_mcu_uni_add_dev(&dev->mphy, vif, &mvif->sta.wcid, false);

rcu_assign_pointer(dev->mt76.wcid[idx], NULL);
@@ -561,6 +545,36 @@ static void mt7921_configure_filter(struct ieee80211_hw *hw,
mt7921_mutex_release(dev);
}

+static int
+mt7921_bss_bcnft_apply(struct mt7921_dev *dev, struct ieee80211_vif *vif,
+ bool assoc)
+{
+ int ret;
+
+ if (!dev->pm.enable)
+ return 0;
+
+ if (assoc) {
+ ret = mt7921_mcu_uni_bss_bcnft(dev, vif, true);
+ if (ret)
+ return ret;
+
+ vif->driver_flags |= IEEE80211_VIF_BEACON_FILTER;
+ mt76_set(dev, MT_WF_RFCR(0), MT_WF_RFCR_DROP_OTHER_BEACON);
+
+ return 0;
+ }
+
+ ret = mt7921_mcu_set_bss_pm(dev, vif, false);
+ if (ret)
+ return ret;
+
+ vif->driver_flags &= ~IEEE80211_VIF_BEACON_FILTER;
+ mt76_clear(dev, MT_WF_RFCR(0), MT_WF_RFCR_DROP_OTHER_BEACON);
+
+ return 0;
+}
+
static void mt7921_bss_info_changed(struct ieee80211_hw *hw,
struct ieee80211_vif *vif,
struct ieee80211_bss_conf *info,
@@ -587,6 +601,9 @@ static void mt7921_bss_info_changed(struct ieee80211_hw *hw,
if (changed & BSS_CHANGED_PS)
mt7921_mcu_uni_bss_ps(dev, vif);

+ if (changed & BSS_CHANGED_ASSOC)
+ mt7921_bss_bcnft_apply(dev, vif, info->assoc);
+
mt7921_mutex_release(dev);
}

diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7921/mcu.c
index db125cd22b91..d784c75d47bf 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7921/mcu.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7921/mcu.c
@@ -1294,8 +1294,14 @@ mt7921_pm_interface_iter(void *priv, u8 *mac, struct ieee80211_vif *vif)
{
struct mt7921_phy *phy = priv;
struct mt7921_dev *dev = phy->dev;
+ int ret;
+
+ if (dev->pm.enable)
+ ret = mt7921_mcu_uni_bss_bcnft(dev, vif, true);
+ else
+ ret = mt7921_mcu_set_bss_pm(dev, vif, false);

- if (mt7921_mcu_set_bss_pm(dev, vif, dev->pm.enable))
+ if (ret)
return;

if (dev->pm.enable) {
--
2.29.2


2021-02-24 07:51:16

by Kalle Valo

[permalink] [raw]
Subject: Re: [PATCH v2 3/8] mt76: mt7921: switch to new api for hardware beacon filter

Lorenzo Bianconi <[email protected]> writes:

> From: Sean Wang <[email protected]>
>
> Current firmware only supports new api for enabling hardware beacon filter.
>
> Fixes: 1d8efc741df80 ("mt76: mt7921: introduce Runtime PM support")
> Beacon filter cmd have to rely on the associatied access point's beacon
> interval and DTIM information.
>
> Signed-off-by: Sean Wang <[email protected]>
> Signed-off-by: Lorenzo Bianconi <[email protected]>

The Fixes tag is in odd place.

--
https://patchwork.kernel.org/project/linux-wireless/list/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches

2021-02-24 08:44:05

by Lorenzo Bianconi

[permalink] [raw]
Subject: Re: [PATCH v2 3/8] mt76: mt7921: switch to new api for hardware beacon filter

> Lorenzo Bianconi <[email protected]> writes:
>
> > From: Sean Wang <[email protected]>
> >
> > Current firmware only supports new api for enabling hardware beacon filter.
> >
> > Fixes: 1d8efc741df80 ("mt76: mt7921: introduce Runtime PM support")
> > Beacon filter cmd have to rely on the associatied access point's beacon
> > interval and DTIM information.
> >
> > Signed-off-by: Sean Wang <[email protected]>
> > Signed-off-by: Lorenzo Bianconi <[email protected]>
>
> The Fixes tag is in odd place.

yes, I agree :)

@Felix: do I need to resubmit or can you take care of this?

Regards,
Lorenzo

>
> --
> https://patchwork.kernel.org/project/linux-wireless/list/
>
> https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches


Attachments:
(No filename) (795.00 B)
signature.asc (235.00 B)
Download all attachments