Received: by 2002:a05:6504:5087:b0:1e5:d399:13c4 with SMTP id i7csp1970062ltq; Fri, 30 Sep 2022 16:13:53 -0700 (PDT) X-Google-Smtp-Source: AMsMyM62dBtVLBVP85SY6XkrUFYNeqkoWPelEjtMXLwvqRFrkGierX4hdF3JCXNq44718nEr38Kx X-Received: by 2002:a17:906:bcf6:b0:781:be0a:5c8 with SMTP id op22-20020a170906bcf600b00781be0a05c8mr7858285ejb.363.1664579633279; Fri, 30 Sep 2022 16:13:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664579633; cv=none; d=google.com; s=arc-20160816; b=lUzNlo/LwfTbJAz4q+zUf9ONI5G7fFVBG5mpfwZBddcxxl2cKXUWC7ytPjzXCkmfTp 2ginwx9L5fFw3HhePole8rgQV8MyM5g5XgBUEgJxfpbAWrEMXmIKmFATLn4wyQU1P8Jj b1g19Ly1z0Gjy/fcyGhQbRJrtS5B+mxw5pNrJ3w7QqibTqyVjRUlBpH0VL2mnKV1GqGS 89a7PI+8hHoC1VKGv+MU31gcSSLm261frNM2iaA30LgbCQgGu0TGs3yhaM5ZaNhKMYOi zoCliQLclhTzkNzc6euIkIcPICCTvZrNnBAvKdD9IXAshQnmtj7eJJyAvoFJHHxDDf+0 3eVA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:subject:cc:to:from :dkim-signature; bh=ESuS85YGKs22BGzs7UY91ezzOpwdIemOOw147QVtRUg=; b=MsWJvB2XJNqhoUollm7S6WzHRTmvP5u/7qTXWQ2yM/rwqzmD35j/1o+mdLorsaHrcm y+/oK/4vhYeICWdm/Qj+h9ozKBHYjBZQs1t12NTwJLPvQ8SPLSh346QQ8T5UAD0UK9nm d8mG/Qzft1HnYZxqjr0a9gmsYc1xNaxtrP7MI3q3kCNEGB6QjcyX26Qa2q8v4oRJqJRe vwoLb3szSbqnYE/sc+E8+egbsGKpt/cJ0c2uzGMiZEbA3NJhkm/YNcWu+xeYtRB+vaR/ XITY41G2y60/V4xKkoNjRF7FvvsKUSMOrbLlZY4A8XNSl5LmfCXckBJ2a/lOfbkrcs8I ImPQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=u4YwqBNF; 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=pass (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 dr11-20020a170907720b00b007414886601asi2802860ejc.25.2022.09.30.16.13.35; Fri, 30 Sep 2022 16:13:53 -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; dkim=pass header.i=@mediatek.com header.s=dk header.b=u4YwqBNF; 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=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=mediatek.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231180AbiI3XHn (ORCPT + 59 others); Fri, 30 Sep 2022 19:07:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42392 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231157AbiI3XHm (ORCPT ); Fri, 30 Sep 2022 19:07:42 -0400 Received: from mailgw01.mediatek.com (unknown [60.244.123.138]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E3CDF1DBED7 for ; Fri, 30 Sep 2022 16:07:35 -0700 (PDT) X-UUID: 4eb112a45cd3418dbf1ccf8bf2e10468-20221001 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Type:MIME-Version:Message-ID:Date:Subject:CC:To:From; bh=ESuS85YGKs22BGzs7UY91ezzOpwdIemOOw147QVtRUg=; b=u4YwqBNFeBuDd9hBu4QYHhnt5gtXds5t+hPp0QU+hd4zPb/sD+E65KgvaW4OY3xl2tlfh089cZxBJArazxXHwxRG63SPbU694FukDDgf8u7ZMU0FFEFMGN0b2lDa9VzqeqmXFmQXs5VrV9BzTqIOQmLl0h7wZfQhNCt37ob2S8Y=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.11,REQID:cfd191b4-f6b5-4aca-b6bc-944366291880,IP:0,U RL:0,TC:0,Content:0,EDM:0,RT:0,SF:95,FILE:0,BULK:0,RULE:Release_Ham,ACTION :release,TS:95 X-CID-INFO: VERSION:1.1.11,REQID:cfd191b4-f6b5-4aca-b6bc-944366291880,IP:0,URL :0,TC:0,Content:0,EDM:0,RT:0,SF:95,FILE:0,BULK:0,RULE:Spam_GS981B3D,ACTION :quarantine,TS:95 X-CID-META: VersionHash:39a5ff1,CLOUDID:db7a9e07-1cee-4c38-b21b-a45f9682fdc0,B ulkID:221001070731YDZ7HB0W,BulkQuantity:0,Recheck:0,SF:38|28|17|19|48|823| 824,TC:nil,Content:0,EDM:-3,IP:nil,URL:0,File:nil,Bulk:nil,QS:nil,BEC:nil, COL:0 X-UUID: 4eb112a45cd3418dbf1ccf8bf2e10468-20221001 Received: from mtkcas10.mediatek.inc [(172.21.101.39)] by mailgw01.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 553854698; Sat, 01 Oct 2022 07:07:29 +0800 Received: from mtkmbs11n2.mediatek.inc (172.21.101.187) by mtkmbs10n2.mediatek.inc (172.21.101.183) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.792.3; Sat, 1 Oct 2022 07:07:28 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkmbs11n2.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.792.15 via Frontend Transport; Sat, 1 Oct 2022 07:07:28 +0800 From: Ryder Lee To: Felix Fietkau , CC: Lorenzo Bianconi , Shayne Chen , Evelyn Tsai , , Ryder Lee Subject: [PATCH] wifi: mt76: mt7915: fix mt7915_mac_set_timing() Date: Sat, 1 Oct 2022 07:07:26 +0800 Message-ID: <745d9c4b5c4b7395395025a8dcb5ce68cf360383.1664578145.git.ryder.lee@mediatek.com> X-Mailer: git-send-email 2.18.0 MIME-Version: 1.0 Content-Type: text/plain X-MTK: N X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS, T_SPF_TEMPERROR,UNPARSEABLE_RELAY,URIBL_CSS 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 Correct mac timiing settings for different hardware generations. This improves 40-60Mbps performance. Fixes: 9aac2969fe5f ("mt76: mt7915: update mac timing settings") Reported-By: Carson Vandegriffe Tested-by: Chad Monroe Signed-off-by: Ryder Lee --- drivers/net/wireless/mediatek/mt76/mt7915/mac.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/mac.c b/drivers/net/wireless/mediatek/mt76/mt7915/mac.c index be97dede2634..09f0fab7c958 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7915/mac.c +++ b/drivers/net/wireless/mediatek/mt76/mt7915/mac.c @@ -1149,7 +1149,7 @@ void mt7915_mac_set_timing(struct mt7915_phy *phy) FIELD_PREP(MT_TIMEOUT_VAL_CCA, 48); u32 ofdm = FIELD_PREP(MT_TIMEOUT_VAL_PLCP, 60) | FIELD_PREP(MT_TIMEOUT_VAL_CCA, 28); - int offset; + int eifs_ofdm = 360, sifs = 10, offset; bool a_band = !(phy->mt76->chandef.chan->band == NL80211_BAND_2GHZ); if (!test_bit(MT76_STATE_RUNNING, &phy->mt76->state)) @@ -1167,6 +1167,18 @@ void mt7915_mac_set_timing(struct mt7915_phy *phy) reg_offset = FIELD_PREP(MT_TIMEOUT_VAL_PLCP, offset) | FIELD_PREP(MT_TIMEOUT_VAL_CCA, offset); + if (!is_mt7915(&dev->mt76)) { + if (!a_band) { + mt76_wr(dev, MT_TMAC_ICR1(phy->band_idx), + FIELD_PREP(MT_IFS_EIFS_CCK, 314)); + eifs_ofdm = 78; + } else { + eifs_ofdm = 84; + } + } else if (a_band) { + sifs = 16; + } + mt76_wr(dev, MT_TMAC_CDTR(phy->band_idx), cck + reg_offset); mt76_wr(dev, MT_TMAC_ODTR(phy->band_idx), ofdm + reg_offset); mt76_wr(dev, MT_TMAC_ICR0(phy->band_idx), @@ -1175,9 +1187,6 @@ void mt7915_mac_set_timing(struct mt7915_phy *phy) FIELD_PREP(MT_IFS_SIFS, 10) | FIELD_PREP(MT_IFS_SLOT, phy->slottime)); - mt76_wr(dev, MT_TMAC_ICR1(phy->band_idx), - FIELD_PREP(MT_IFS_EIFS_CCK, 314)); - if (phy->slottime < 20 || a_band) val = MT7915_CFEND_RATE_DEFAULT; else -- 2.36.1