2022-05-05 23:32:42

by Peter Chiu

[permalink] [raw]
Subject: [PATCH 4/4] mt76: mt7915: limit minimum twt duration

The minimum twt duration supported by mt7915 is 64 according to hardware
design. Reply station with TWT_SETUP_CMD_DICTATE if min_twt_dur smaller
than 64.

Signed-off-by: Peter Chiu <[email protected]>
---
drivers/net/wireless/mediatek/mt76/mt7915/mac.c | 7 +++++++
1 file changed, 7 insertions(+)

diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/mac.c b/drivers/net/wireless/mediatek/mt76/mt7915/mac.c
index ff60a3d2d26d..e912ecacb578 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7915/mac.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7915/mac.c
@@ -2633,6 +2633,7 @@ void mt7915_mac_add_twt_setup(struct ieee80211_hw *hw,
struct ieee80211_sta *sta,
struct ieee80211_twt_setup *twt)
{
+#define MT7915_MIN_TWT_DUR 64
enum ieee80211_twt_setup_cmd setup_cmd = TWT_SETUP_CMD_REJECT;
struct mt7915_sta *msta = (struct mt7915_sta *)sta->drv_priv;
struct ieee80211_twt_params *twt_agrt = (void *)twt->params;
@@ -2654,6 +2655,12 @@ void mt7915_mac_add_twt_setup(struct ieee80211_hw *hw,
if (hweight8(msta->twt.flowid_mask) == ARRAY_SIZE(msta->twt.flow))
goto unlock;

+ if (twt_agrt->min_twt_dur < MT7915_MIN_TWT_DUR) {
+ setup_cmd = TWT_SETUP_CMD_DICTATE;
+ twt_agrt->min_twt_dur = MT7915_MIN_TWT_DUR;
+ goto unlock;
+ }
+
flowid = ffs(~msta->twt.flowid_mask) - 1;
le16p_replace_bits(&twt_agrt->req_type, flowid,
IEEE80211_TWT_REQTYPE_FLOWID);
--
2.18.0



2022-05-06 07:29:29

by Lorenzo Bianconi

[permalink] [raw]
Subject: Re: [PATCH 4/4] mt76: mt7915: limit minimum twt duration

> The minimum twt duration supported by mt7915 is 64 according to hardware
> design. Reply station with TWT_SETUP_CMD_DICTATE if min_twt_dur smaller
> than 64.
>
> Signed-off-by: Peter Chiu <[email protected]>
> ---
> drivers/net/wireless/mediatek/mt76/mt7915/mac.c | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/mac.c b/drivers/net/wireless/mediatek/mt76/mt7915/mac.c
> index ff60a3d2d26d..e912ecacb578 100644
> --- a/drivers/net/wireless/mediatek/mt76/mt7915/mac.c
> +++ b/drivers/net/wireless/mediatek/mt76/mt7915/mac.c
> @@ -2633,6 +2633,7 @@ void mt7915_mac_add_twt_setup(struct ieee80211_hw *hw,
> struct ieee80211_sta *sta,
> struct ieee80211_twt_setup *twt)
> {
> +#define MT7915_MIN_TWT_DUR 64

nit: can you please move MT7915_MIN_TWT_DUR in mt7915.h since we have other twt
defs there?

Regards,
Lorenzo

> enum ieee80211_twt_setup_cmd setup_cmd = TWT_SETUP_CMD_REJECT;
> struct mt7915_sta *msta = (struct mt7915_sta *)sta->drv_priv;
> struct ieee80211_twt_params *twt_agrt = (void *)twt->params;
> @@ -2654,6 +2655,12 @@ void mt7915_mac_add_twt_setup(struct ieee80211_hw *hw,
> if (hweight8(msta->twt.flowid_mask) == ARRAY_SIZE(msta->twt.flow))
> goto unlock;
>
> + if (twt_agrt->min_twt_dur < MT7915_MIN_TWT_DUR) {
> + setup_cmd = TWT_SETUP_CMD_DICTATE;
> + twt_agrt->min_twt_dur = MT7915_MIN_TWT_DUR;
> + goto unlock;
> + }
> +
> flowid = ffs(~msta->twt.flowid_mask) - 1;
> le16p_replace_bits(&twt_agrt->req_type, flowid,
> IEEE80211_TWT_REQTYPE_FLOWID);
> --
> 2.18.0
>


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