diff mbox series

[v2] wifi: mt76: mt7921: use driver flags rather than mac80211 flags to mcu

Message ID 0c2eed5226aef8e7e219c748b9d20cb234cf9f8f.1678186986.git.deren.wu@mediatek.com
State New
Headers show
Series [v2] wifi: mt76: mt7921: use driver flags rather than mac80211 flags to mcu | expand

Commit Message

Deren Wu March 7, 2023, 11:22 a.m. UTC
From: Neil Chen <yn.chen@mediatek.com>

FIF_* flags from mac80211 is not ABI. mt7921 should not pass it into mcu
directly. Remap FIF_* to driver defined flags as mcu command input.

Fixes: c222f77fd421 ("wifi: mt76: mt7921: fix rx filter incorrect by drv/fw inconsistent")
Signed-off-by: Neil Chen <yn.chen@mediatek.com>
Signed-off-by: Deren Wu <deren.wu@mediatek.com>
---
v2: 1. add tag Signed-off-by: Deren Wu <deren.wu@mediatek.com>
    2. rebase to the top of staging tree
---
 .../net/wireless/mediatek/mt76/mt7921/main.c    | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

Comments

Ben Greear March 10, 2023, 12:50 a.m. UTC | #1
On 3/7/23 03:22, Deren Wu wrote:
> From: Neil Chen <yn.chen@mediatek.com>
> 
> FIF_* flags from mac80211 is not ABI. mt7921 should not pass it into mcu
> directly. Remap FIF_* to driver defined flags as mcu command input.
> 
> Fixes: c222f77fd421 ("wifi: mt76: mt7921: fix rx filter incorrect by drv/fw inconsistent")
> Signed-off-by: Neil Chen <yn.chen@mediatek.com> > Signed-off-by: Deren Wu <deren.wu@mediatek.com>

I tried this plus the patch it is fixing on 6.2.2+ kernel with 7922 radios,
and behaviour seems worse than before the two patches were applied.

Original problem I was trying to fix is that my STAs will connect fine on 5Ghz,
but then when I try to move them to 2.4Ghz, most will not scan anything.
Packet sniff shows probe responses and requests, so I suspected firmware is
filtering when it should not.

With the two patches applied, even 5Ghz is showing failure, with lots of
beacon loss messages (I am disabling beacon filtering, which previously worked
fine on 7921 nic in 5.19 kernel).

Are there other patches that I should consider to get 7922 to work better in 6.2.2+
kernel?

[root@ct523c-3b7f ~]# cat /debug/ieee80211/wiphy0/mt76/version
chipset:       7922
ASIC-Revision: 0x79220010
hw_sw_ver:     0x8a108a10
build_date:    20221227123154a
bus:           0000:04:00.0
fwcfg:         fwcfg-mmio-0000:04:00.0.txt
WM-hw_sw_ver:  ____000000
WM-build_date: 20221227123243
WA-hw_sw_ver:
WA-build_date:


Thanks,
Ben
Deren Wu March 10, 2023, 1:17 a.m. UTC | #2
On Thu, 2023-03-09 at 16:50 -0800, Ben Greear wrote:
> On 3/7/23 03:22, Deren Wu wrote:
> > From: Neil Chen <yn.chen@mediatek.com>
> > 
> > FIF_* flags from mac80211 is not ABI. mt7921 should not pass it
> > into mcu
> > directly. Remap FIF_* to driver defined flags as mcu command input.
> > 
> > Fixes: c222f77fd421 ("wifi: mt76: mt7921: fix rx filter incorrect
> > by drv/fw inconsistent")
> > Signed-off-by: Neil Chen <yn.chen@mediatek.com> > Signed-off-by:
> > Deren Wu <deren.wu@mediatek.com>
> 
> I tried this plus the patch it is fixing on 6.2.2+ kernel with 7922
> radios,
> and behaviour seems worse than before the two patches were applied.
> 
> Original problem I was trying to fix is that my STAs will connect
> fine on 5Ghz,
> but then when I try to move them to 2.4Ghz, most will not scan
> anything.
> Packet sniff shows probe responses and requests, so I suspected
> firmware is
> filtering when it should not.
> 
> With the two patches applied, even 5Ghz is showing failure, with lots
> of
> beacon loss messages (I am disabling beacon filtering, which
> previously worked
> fine on 7921 nic in 5.19 kernel).
> 
> Are there other patches that I should consider to get 7922 to work
> better in 6.2.2+
> kernel?
> 
> [root@ct523c-3b7f ~]# cat /debug/ieee80211/wiphy0/mt76/version
> chipset:       7922
> ASIC-Revision: 0x79220010
> hw_sw_ver:     0x8a108a10
> build_date:    20221227123154a
> bus:           0000:04:00.0
> fwcfg:         fwcfg-mmio-0000:04:00.0.txt
> WM-hw_sw_ver:  ____000000
> WM-build_date: 20221227123243
> WA-hw_sw_ver:
> WA-build_date:

Hi Ben,

The issues you mention are more like other problems in firmware side.
We did fix them in mt7921 firmware and plan to post 7922 version. I
will update the progress soon.

Regards,
Deren

> 
> 
> Thanks,
> Ben
>
diff mbox series

Patch

diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/main.c b/drivers/net/wireless/mediatek/mt76/mt7921/main.c
index a72964e7a807..f1d537a7705a 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7921/main.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7921/main.c
@@ -703,10 +703,25 @@  static void mt7921_configure_filter(struct ieee80211_hw *hw,
 				    unsigned int *total_flags,
 				    u64 multicast)
 {
+#define MT7921_FILTER_FCSFAIL    BIT(2)
+#define MT7921_FILTER_CONTROL    BIT(5)
+#define MT7921_FILTER_OTHER_BSS  BIT(6)
+#define MT7921_FILTER_ENABLE     BIT(31)
+
 	struct mt7921_dev *dev = mt7921_hw_dev(hw);
+	u32 flags = MT7921_FILTER_ENABLE;
+
+#define MT7921_FILTER(_fif, _type) do {			\
+		if (*total_flags & (_fif))		\
+			flags |= MT7921_FILTER_##_type;	\
+	} while (0)
+
+	MT7921_FILTER(FIF_FCSFAIL, FCSFAIL);
+	MT7921_FILTER(FIF_CONTROL, CONTROL);
+	MT7921_FILTER(FIF_OTHER_BSS, OTHER_BSS);
 
 	mt7921_mutex_acquire(dev);
-	mt7921_mcu_set_rxfilter(dev, *total_flags, 0, 0);
+	mt7921_mcu_set_rxfilter(dev, flags, 0, 0);
 	mt7921_mutex_release(dev);
 
 	*total_flags &= (FIF_OTHER_BSS | FIF_FCSFAIL | FIF_CONTROL);