2023-03-04 08:10:15

by Deren Wu

[permalink] [raw]
Subject: [PATCH] wifi: mt76: mt7921: use driver flags rather than mac80211 flags to mcu

From: Neil Chen <[email protected]>

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 <[email protected]>
---
.../net/wireless/mediatek/mt76/mt7921/main.c | 17 ++++++++++++++++-
1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/main.c b/drivers/net/wireless/mediatek/mt76/mt7921/main.c
index 75eaf86c6a78..f67b37d38dbc 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);
--
2.18.0



2023-03-07 01:12:03

by Ping-Ke Shih

[permalink] [raw]
Subject: RE: [PATCH] wifi: mt76: mt7921: use driver flags rather than mac80211 flags to mcu



> -----Original Message-----
> From: Deren Wu <[email protected]>
> Sent: Saturday, March 4, 2023 4:10 PM
> To: Felix Fietkau <[email protected]>; Lorenzo Bianconi <[email protected]>
> Cc: Sean Wang <[email protected]>; Soul Huang <[email protected]>; YN Chen
> <[email protected]>; Leon Yen <[email protected]>; Eric-SY Chang <[email protected]>;
> Deren Wu <[email protected]>; KM Lin <[email protected]>; Robin Chiu <[email protected]>; CH
> Yeh <[email protected]>; Posh Sun <[email protected]>; Stella Chang <[email protected]>;
> Evelyn Tsai <[email protected]>; Ryder Lee <[email protected]>; Shayne Chen
> <[email protected]>; linux-wireless <[email protected]>; linux-mediatek
> <[email protected]>; Neil Chen <[email protected]>
> Subject: [PATCH] wifi: mt76: mt7921: use driver flags rather than mac80211 flags to mcu
>
> From: Neil Chen <[email protected]>
>
> 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 <[email protected]>

Miss your s-o-b, Deren?

> ---
> .../net/wireless/mediatek/mt76/mt7921/main.c | 17 ++++++++++++++++-
> 1 file changed, 16 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/main.c
> b/drivers/net/wireless/mediatek/mt76/mt7921/main.c
> index 75eaf86c6a78..f67b37d38dbc 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);
> --
> 2.18.0
>
>
> ------Please consider the environment before printing this e-mail.

2023-03-07 11:20:52

by Deren Wu

[permalink] [raw]
Subject: Re: [PATCH] wifi: mt76: mt7921: use driver flags rather than mac80211 flags to mcu

On Tue, 2023-03-07 at 01:11 +0000, Ping-Ke Shih wrote:
> > -----Original Message-----
> > From: Deren Wu <[email protected]>
> > Sent: Saturday, March 4, 2023 4:10 PM
> > To: Felix Fietkau <[email protected]>; Lorenzo Bianconi <
> > [email protected]>
> > Cc: Sean Wang <[email protected]>; Soul Huang <
> > [email protected]>; YN Chen
> > <[email protected]>; Leon Yen <[email protected]>; Eric-SY
> > Chang <[email protected]>;
> > Deren Wu <[email protected]>; KM Lin <[email protected]>;
> > Robin Chiu <[email protected]>; CH
> > Yeh <[email protected]>; Posh Sun <[email protected]>; Stella
> > Chang <[email protected]>;
> > Evelyn Tsai <[email protected]>; Ryder Lee <
> > [email protected]>; Shayne Chen
> > <[email protected]>; linux-wireless <
> > [email protected]>; linux-mediatek
> > <[email protected]>; Neil Chen <
> > [email protected]>
> > Subject: [PATCH] wifi: mt76: mt7921: use driver flags rather than
> > mac80211 flags to mcu
> >
> > From: Neil Chen <[email protected]>
> >
> > 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 <[email protected]>
>
> Miss your s-o-b, Deren?

Thanks, I forgot adding the tag. Let me post v2. :)