mt76: mt7915: limit minimum twt duration
authorPeter Chiu <chui-hao.chiu@mediatek.com>
Thu, 5 May 2022 08:25:54 +0000 (16:25 +0800)
committerFelix Fietkau <nbd@nbd.name>
Fri, 13 May 2022 07:39:35 +0000 (09:39 +0200)
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 <chui-hao.chiu@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
drivers/net/wireless/mediatek/mt76/mt7915/mac.c
drivers/net/wireless/mediatek/mt76/mt7915/mt7915.h

index bc6e3c8..7b04fd8 100644 (file)
@@ -2654,6 +2654,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);
index 0f51d76..0219f94 100644 (file)
@@ -66,6 +66,7 @@
 
 #define MT7915_MAX_TWT_AGRT            16
 #define MT7915_MAX_STA_TWT_AGRT                8
+#define MT7915_MIN_TWT_DUR 64
 #define MT7915_MAX_QUEUE               (__MT_RXQ_MAX + __MT_MCUQ_MAX + 2)
 
 struct mt7915_vif;