Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp2123422iob; Thu, 5 May 2022 16:32:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzUaJBB96w0FsCb6ftQHUPSU9NQxziItoqrEE2nQu6brHLGs0WCIWfNsovGy9t7/kzNgCLF X-Received: by 2002:a05:6402:2741:b0:41f:69dc:9bcd with SMTP id z1-20020a056402274100b0041f69dc9bcdmr622185edd.239.1651793562565; Thu, 05 May 2022 16:32:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651793562; cv=none; d=google.com; s=arc-20160816; b=w64j+PfbHCSekr10vJ2nqIrn3NZTjTBQOKQZjKyO4IBUlszl8r1ilnzfnhAasWEQlN dLC2FmxYHa34N6AvSLvNh+OQAm9zySvzsSEyQWDvWBUf88Cygcv9qT8as++1W+SLzHjD TK4tvPq0UhWl15WJU+ATG5a4Vooav+gRHMm56ba1fWUfqUIZe/aJbESh6uyBX12EvPjy NRh3B16bsOkWOtEMCgBkjF1R0MegLwsvheLCZnYiNbaDy8UFKGHeXXIZ5B/7IrAP61zU vDQtyQQSsdAufWSeKtMwRrnDbqLXwLzgEeeJWwZ7Zt11X4V7JN11f9dezYM8GeVicJao bnbA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from; bh=ie8KvnanCNy9+40KiORkzxgOxAx2UT0XXI1mN405quw=; b=icJVWZYXUG7STZu1J3PR7GWqCU5K5C5SZnOWeqDMUOePThz3WBZe2k0u5ZU3ZoACZE Ow8wHTJzRvql781YqCQyahpbkNAu8ZmQIfV7vvlslWGtP7xoT4F5R0CPKe+bQhALRV0W Ed2DiFrfRPRYayGfBL8agtmTnqd31JLGwpVQslMldLy72hQOT0A2A75WBXGFoxwnjmXP gh1z4twyc2Rb60n3VIl+y+PMuEQY/BN0bWOohVADA3ZNWFd8VX1p5RNw6wgJ1sYrEyjd jmfzYmM/K02wCnLygdAF4gyn7GzMDA5Y+Sx1s1dOnSI2fYZbRBRfUN4Ba07IpbynmS3N Ydpg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=mediatek.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id sa24-20020a1709076d1800b006f39e0407e1si2473573ejc.342.2022.05.05.16.32.18; Thu, 05 May 2022 16:32:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=mediatek.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347742AbiEEI3z (ORCPT + 68 others); Thu, 5 May 2022 04:29:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40032 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238329AbiEEI3s (ORCPT ); Thu, 5 May 2022 04:29:48 -0400 Received: from mailgw02.mediatek.com (unknown [210.61.82.184]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 39F1E2D1F5 for ; Thu, 5 May 2022 01:26:04 -0700 (PDT) X-UUID: c186732969904fe3b24f21083a24a98e-20220505 X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.4,REQID:17151af6-e12e-44a0-b815-5fc877a7fe06,OB:0,LO B:0,IP:0,URL:0,TC:0,Content:0,EDM:0,RT:0,SF:0,FILE:0,RULE:Release_Ham,ACTI ON:release,TS:0 X-CID-META: VersionHash:faefae9,CLOUDID:8a284b16-2e53-443e-b81a-655c13977218,C OID:IGNORED,Recheck:0,SF:nil,TC:nil,Content:0,EDM:-3,File:nil,QS:0,BEC:nil X-UUID: c186732969904fe3b24f21083a24a98e-20220505 Received: from mtkmbs10n2.mediatek.inc [(172.21.101.183)] by mailgw02.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 1736132449; Thu, 05 May 2022 16:25:57 +0800 Received: from MTKMBS07N2.mediatek.inc (172.21.101.141) by mtkmbs11n2.mediatek.inc (172.21.101.187) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.2.792.3; Thu, 5 May 2022 16:25:57 +0800 Received: from mtkcas10.mediatek.inc (172.21.101.39) by mtkmbs07n2.mediatek.inc (172.21.101.141) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Thu, 5 May 2022 16:25:56 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkcas10.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Thu, 5 May 2022 16:25:56 +0800 From: Peter Chiu To: Felix Fietkau CC: Lorenzo Bianconi , Ryder Lee , Evelyn Tsai , Shayne Chen , , , Peter Chiu Subject: [PATCH 4/4] mt76: mt7915: limit minimum twt duration Date: Thu, 5 May 2022 16:25:54 +0800 Message-ID: <20220505082554.16656-4-chui-hao.chiu@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20220505082554.16656-1-chui-hao.chiu@mediatek.com> References: <20220505082554.16656-1-chui-hao.chiu@mediatek.com> MIME-Version: 1.0 Content-Type: text/plain X-MTK: N X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org 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 --- 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