blob: d5aafcb937f27090acba2988e19d3e21a420bf09 [file] [log] [blame]
From 58706d81a82726f488cda771097f5586708b47f2 Mon Sep 17 00:00:00 2001
From: Peter Chiu <chui-hao.chiu@mediatek.com>
Date: Tue, 12 Apr 2022 16:06:36 +0800
Subject: [PATCH] mt76: mt7915: limit minimum twt duration due to hw limitation
---
mt7915/mac.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/mt7915/mac.c b/mt7915/mac.c
index 925f5eb9..fd897fd5 100644
--- a/mt7915/mac.c
+++ b/mt7915/mac.c
@@ -2698,6 +2698,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;
@@ -2719,6 +2720,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