From patchwork Tue Jul 13 20:15:58 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Wang X-Patchwork-Id: 12374971 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.5 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2AF6BC11F67 for ; Tue, 13 Jul 2021 20:16:29 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id D2EB161360 for ; Tue, 13 Jul 2021 20:16:28 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D2EB161360 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=mediatek.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date:Subject:CC :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=+OcIK6rCg9kufDxeiQzqISDttQ0k64Fj97nmDZ40lKI=; b=Y68yhvwgJcr51v EubrXb89lGKAsBHzg616+zcdPNvZRpIv3BjRsluOxG/XqaOX6ob4xhAFbTWhG+fD1xIDtOpfBBAKH TiMxVr5W4dMK69bHlqydUxDfd/Q4NkTQwZO8puj172KVTVfUpk1rbImr/JxNX5dUJRjg35GEnr+Ev HOKhQuN6blaOohKCoxljKtQ2QxN1oZyVB3Zk08cNaJF6ZhqHmP34PZVTiX1npN30jWOplXt/CNLA3 zkYz1eOB/6DeXM+1dJ/Zy7VMBn0v8bbdrj0vmyiD87mwN4Bc18JrchnPI0dm+b5ocGcS1U8Pd8jUH aBdzuJ4SEj5MyYXr0B7w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1m3OpI-00BI7U-H2; Tue, 13 Jul 2021 20:16:20 +0000 Received: from mailgw01.mediatek.com ([216.200.240.184]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1m3OpE-00BI65-A5 for linux-mediatek@lists.infradead.org; Tue, 13 Jul 2021 20:16:17 +0000 X-UUID: c240df837aca47e3822593a9941dd41d-20210713 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Transfer-Encoding:Content-Type:MIME-Version:Message-ID:Date:Subject:CC:To:From; bh=u3u+dqy9P1rscpK44zrg0iHFckHIVon5Z1gcX6Qq0KQ=; b=kH8tRj7sbjnkri4s7GgnXuYGmZftxh56IFxL11c9c0GXYFJBCXqSMBjU6w5jdZ0dfv2eJLYIrTmipv+AST6LNBEgqvuyfUJQ+boyYMMXIFrotmBD0yWy6jwPx2v6ekO2wNUcix8N0jAXIIgw6fq0tKM850Ui7YvRNbYYrbhwtX4=; X-UUID: c240df837aca47e3822593a9941dd41d-20210713 Received: from mtkcas67.mediatek.inc [(172.29.193.45)] by mailgw01.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 1348886311; Tue, 13 Jul 2021 13:16:12 -0700 Received: from MTKMBS01N1.mediatek.inc (172.21.101.68) by MTKMBS62DR.mediatek.inc (172.29.94.18) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Tue, 13 Jul 2021 13:16:10 -0700 Received: from mtkcas07.mediatek.inc (172.21.101.84) by mtkmbs01n1.mediatek.inc (172.21.101.68) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 14 Jul 2021 04:16:02 +0800 Received: from mtkswgap22.mediatek.inc (172.21.77.33) by mtkcas07.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Wed, 14 Jul 2021 04:16:02 +0800 From: To: , CC: , , , , , , , , , , , , , , , Subject: [PATCH v3 1/4] mt76: fix mt76_rates for the multiple devices Date: Wed, 14 Jul 2021 04:15:58 +0800 Message-ID: <92a8ecfdf198b34f98d5c1489a83adf151657760.1626207204.git.objelf@gmail.com> X-Mailer: git-send-email 1.7.9.5 MIME-Version: 1.0 X-MTK: N X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210713_131616_381457_67CB81F3 X-CRM114-Status: GOOD ( 13.34 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org From: Sean Wang PHY offset in either .hw_value or .hw_value_short for mt7615, mt7663, mt7915 and mt7921 device all start at bit 6, not 8. Suggested-by: Ryder Lee Signed-off-by: Sean Wang --- v2: splitted out from the patch ("mt76: mt7921: fix mgmt frame using unexpected bitrate") to cover more devices which have the same issue. v3: no change. --- drivers/net/wireless/mediatek/mt76/mac80211.c | 24 +++++++++---------- drivers/net/wireless/mediatek/mt76/mt76.h | 12 +++++----- .../net/wireless/mediatek/mt76/mt7603/init.c | 19 +++++++++++++-- .../net/wireless/mediatek/mt76/mt76x02_util.c | 16 ++++++------- 4 files changed, 43 insertions(+), 28 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mac80211.c b/drivers/net/wireless/mediatek/mt76/mac80211.c index d03aedc3286b..20b2423efc19 100644 --- a/drivers/net/wireless/mediatek/mt76/mac80211.c +++ b/drivers/net/wireless/mediatek/mt76/mac80211.c @@ -84,18 +84,18 @@ static const struct ieee80211_tpt_blink mt76_tpt_blink[] = { }; struct ieee80211_rate mt76_rates[] = { - CCK_RATE(0, 10), - CCK_RATE(1, 20), - CCK_RATE(2, 55), - CCK_RATE(3, 110), - OFDM_RATE(11, 60), - OFDM_RATE(15, 90), - OFDM_RATE(10, 120), - OFDM_RATE(14, 180), - OFDM_RATE(9, 240), - OFDM_RATE(13, 360), - OFDM_RATE(8, 480), - OFDM_RATE(12, 540), + CCK_RATE(0, 10, 6), + CCK_RATE(1, 20, 6), + CCK_RATE(2, 55, 6), + CCK_RATE(3, 110, 6), + OFDM_RATE(11, 60, 6), + OFDM_RATE(15, 90, 6), + OFDM_RATE(10, 120, 6), + OFDM_RATE(14, 180, 6), + OFDM_RATE(9, 240, 6), + OFDM_RATE(13, 360, 6), + OFDM_RATE(8, 480, 6), + OFDM_RATE(12, 540, 6), }; EXPORT_SYMBOL_GPL(mt76_rates); diff --git a/drivers/net/wireless/mediatek/mt76/mt76.h b/drivers/net/wireless/mediatek/mt76/mt76.h index 25c5ceef5257..e51ab917296d 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76.h +++ b/drivers/net/wireless/mediatek/mt76/mt76.h @@ -755,17 +755,17 @@ enum mt76_phy_type { MT_PHY_TYPE_HE_MU, }; -#define CCK_RATE(_idx, _rate) { \ +#define CCK_RATE(_idx, _rate, _offset) { \ .bitrate = _rate, \ .flags = IEEE80211_RATE_SHORT_PREAMBLE, \ - .hw_value = (MT_PHY_TYPE_CCK << 8) | (_idx), \ - .hw_value_short = (MT_PHY_TYPE_CCK << 8) | (4 + _idx), \ + .hw_value = (MT_PHY_TYPE_CCK << (_offset)) | (_idx), \ + .hw_value_short = (MT_PHY_TYPE_CCK << (_offset)) | (4 + _idx), \ } -#define OFDM_RATE(_idx, _rate) { \ +#define OFDM_RATE(_idx, _rate, _offset) { \ .bitrate = _rate, \ - .hw_value = (MT_PHY_TYPE_OFDM << 8) | (_idx), \ - .hw_value_short = (MT_PHY_TYPE_OFDM << 8) | (_idx), \ + .hw_value = (MT_PHY_TYPE_OFDM << (_offset)) | (_idx), \ + .hw_value_short = (MT_PHY_TYPE_OFDM << (_offset)) | (_idx), \ } extern struct ieee80211_rate mt76_rates[12]; diff --git a/drivers/net/wireless/mediatek/mt76/mt7603/init.c b/drivers/net/wireless/mediatek/mt76/mt7603/init.c index 031d39a48a55..59f684b08c55 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7603/init.c +++ b/drivers/net/wireless/mediatek/mt76/mt7603/init.c @@ -304,6 +304,21 @@ mt7603_init_hardware(struct mt7603_dev *dev) return 0; } +static struct ieee80211_rate mt7603_rates[] = { + CCK_RATE(0, 10, 8), + CCK_RATE(1, 20, 8), + CCK_RATE(2, 55, 8), + CCK_RATE(3, 110, 8), + OFDM_RATE(11, 60, 8), + OFDM_RATE(15, 90, 8), + OFDM_RATE(10, 120, 8), + OFDM_RATE(14, 180, 8), + OFDM_RATE(9, 240, 8), + OFDM_RATE(13, 360, 8), + OFDM_RATE(8, 480, 8), + OFDM_RATE(12, 540, 8), +}; + static const struct ieee80211_iface_limit if_limits[] = { { .max = 1, @@ -541,8 +556,8 @@ int mt7603_register_device(struct mt7603_dev *dev) wiphy->reg_notifier = mt7603_regd_notifier; - ret = mt76_register_device(&dev->mt76, true, mt76_rates, - ARRAY_SIZE(mt76_rates)); + ret = mt76_register_device(&dev->mt76, true, mt7603_rates, + ARRAY_SIZE(mt7603_rates)); if (ret) return ret; diff --git a/drivers/net/wireless/mediatek/mt76/mt76x02_util.c b/drivers/net/wireless/mediatek/mt76/mt76x02_util.c index ccdbab341271..70a62bf16425 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76x02_util.c +++ b/drivers/net/wireless/mediatek/mt76/mt76x02_util.c @@ -19,14 +19,14 @@ struct ieee80211_rate mt76x02_rates[] = { MT76x02_CCK_RATE(1, 20), MT76x02_CCK_RATE(2, 55), MT76x02_CCK_RATE(3, 110), - OFDM_RATE(0, 60), - OFDM_RATE(1, 90), - OFDM_RATE(2, 120), - OFDM_RATE(3, 180), - OFDM_RATE(4, 240), - OFDM_RATE(5, 360), - OFDM_RATE(6, 480), - OFDM_RATE(7, 540), + OFDM_RATE(0, 60, 8), + OFDM_RATE(1, 90, 8), + OFDM_RATE(2, 120, 8), + OFDM_RATE(3, 180, 8), + OFDM_RATE(4, 240, 8), + OFDM_RATE(5, 360, 8), + OFDM_RATE(6, 480, 8), + OFDM_RATE(7, 540, 8), }; EXPORT_SYMBOL_GPL(mt76x02_rates); From patchwork Tue Jul 13 20:15:59 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Wang X-Patchwork-Id: 12374969 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.5 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 58D6BC07E96 for ; Tue, 13 Jul 2021 20:16:28 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 237B46135A for ; Tue, 13 Jul 2021 20:16:28 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 237B46135A Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=mediatek.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:CC:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=K/3Vr7I30PSvMpy10evGaxcJXXDhBXSVdf/eszf7p3g=; b=HUOYO3aJcn8kxP 9wn8mjDpVN7ptc/R+pcnLJpxfw4+/fM+HKIQqoSisegtcTto4O2ZYmNvjQYgo8BpbjVXY9PHgdwQh 4cUsEeh7BS92PozHSO+PH8f6v1GyaWafQY+s0ORDXjxM3r8IVIbVGXsS+tt0gVmu6+xmW9J6ZubBQ qZc7/0zgiMaoTIpqmdw4WiJnrTsZ4NfByY+BSMcq7qOgMbC6Yps4cnGZ7GYPDNZybHqMEbZimPb7T 2ZVeWM5CI4tqwG/sbkJOC8/ZS5GtzPviAOWsinZsXyhkWTwq5cDINPPk8akrqlkAkn9/qAt2ys80T 9MbV8rdcFJqrFu//CThA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1m3OpG-00BI7A-Jz; Tue, 13 Jul 2021 20:16:18 +0000 Received: from mailgw01.mediatek.com ([216.200.240.184]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1m3OpD-00BI5A-G8 for linux-mediatek@lists.infradead.org; Tue, 13 Jul 2021 20:16:16 +0000 X-UUID: 58a82fcc52934846898511f93cbd23e6-20210713 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Transfer-Encoding:Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; bh=pRTSLKA9pRUwLIWGLNxaL3mkS0Rn9ReUu8u4C4DfE8c=; b=s7sV265TYdkN8uac20ppVH3JmUCSM9Ap+ztL0rH5Qbh3qPkWon6ValMs2lKYjajsqXzhlzghhdEh9oLu/i/ValAgAQ7/TQ3Oe0gc/iWHMX28+Sp/B5X44Py0zRGV7bq3pfcZPt4PYmFgCQqhsWXoaop0KuTHWKjpnNNcpSr0MsA=; X-UUID: 58a82fcc52934846898511f93cbd23e6-20210713 Received: from mtkcas67.mediatek.inc [(172.29.193.45)] by mailgw01.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 282691490; Tue, 13 Jul 2021 13:16:12 -0700 Received: from MTKMBS01N1.mediatek.inc (172.21.101.68) by MTKMBS62DR.mediatek.inc (172.29.94.18) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Tue, 13 Jul 2021 13:16:11 -0700 Received: from mtkcas07.mediatek.inc (172.21.101.84) by mtkmbs01n1.mediatek.inc (172.21.101.68) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 14 Jul 2021 04:16:04 +0800 Received: from mtkswgap22.mediatek.inc (172.21.77.33) by mtkcas07.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Wed, 14 Jul 2021 04:16:04 +0800 From: To: , CC: , , , , , , , , , , , , , , , Subject: [PATCH v3 2/4] mt76: add mt76_default_basic_rate more devices can rely on Date: Wed, 14 Jul 2021 04:15:59 +0800 Message-ID: <8a86a3483ac686d40861489884c7737d38648905.1626207204.git.objelf@gmail.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <92a8ecfdf198b34f98d5c1489a83adf151657760.1626207204.git.objelf@gmail.com> References: <92a8ecfdf198b34f98d5c1489a83adf151657760.1626207204.git.objelf@gmail.com> MIME-Version: 1.0 X-MTK: N X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210713_131615_566891_069C5FD4 X-CRM114-Status: GOOD ( 11.39 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org From: Sean Wang add mt76_default_basic_rate to mt76 core more devices can rely on to send frames which require the rate in the basic rates. Suggested-by: Ryder Lee Signed-off-by: Sean Wang --- v3: created in v3 that is splitted out from the patch ("mt76: mt7921: fix mgmt frame using unexpected bitrate") v2 for more mt76 devices like mt7915 can reuse. --- drivers/net/wireless/mediatek/mt76/mac80211.c | 14 ++++++++++++++ drivers/net/wireless/mediatek/mt76/mt76.h | 1 + 2 files changed, 15 insertions(+) diff --git a/drivers/net/wireless/mediatek/mt76/mac80211.c b/drivers/net/wireless/mediatek/mt76/mac80211.c index 20b2423efc19..56e80e0fb2c2 100644 --- a/drivers/net/wireless/mediatek/mt76/mac80211.c +++ b/drivers/net/wireless/mediatek/mt76/mac80211.c @@ -1336,3 +1336,17 @@ mt76_init_queue(struct mt76_dev *dev, int qid, int idx, int n_desc, return hwq; } EXPORT_SYMBOL_GPL(mt76_init_queue); + +u16 mt76_default_basic_rate(struct mt76_phy *phy, struct ieee80211_vif *vif) +{ + int i = ffs(vif->bss_conf.basic_rates) - 1, offset = 0; + struct ieee80211_rate *rate; + + if (phy->chandef.chan->band == NL80211_BAND_5GHZ) + offset = 4; + + rate = &mt76_rates[offset + i]; + + return rate->hw_value; +} +EXPORT_SYMBOL_GPL(mt76_default_basic_rate); diff --git a/drivers/net/wireless/mediatek/mt76/mt76.h b/drivers/net/wireless/mediatek/mt76/mt76.h index e51ab917296d..d34d77967780 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76.h +++ b/drivers/net/wireless/mediatek/mt76/mt76.h @@ -881,6 +881,7 @@ int mt76_get_of_eeprom(struct mt76_dev *dev, void *data, int offset, int len); struct mt76_queue * mt76_init_queue(struct mt76_dev *dev, int qid, int idx, int n_desc, int ring_base); +u16 mt76_default_basic_rate(struct mt76_phy *phy, struct ieee80211_vif *vif); static inline int mt76_init_tx_queue(struct mt76_phy *phy, int qid, int idx, int n_desc, int ring_base) { From patchwork Tue Jul 13 20:16:00 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Wang X-Patchwork-Id: 12374967 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.5 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C03B6C07E95 for ; Tue, 13 Jul 2021 20:16:27 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 85C9A61360 for ; Tue, 13 Jul 2021 20:16:27 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 85C9A61360 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=mediatek.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:CC:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=k0Jpwz7HOVTGlDj18WpVm4OYrWxx4XO7RnIfNIyUhc4=; b=u6UDy7iPgUePha dG3juBcOjyBKhJHt+CmzmJ/pXFTsjiv6MRkSYtB0Vb8OSTTvw5tJ9E8lq1g/J4kOKrV8Ra+6Ksdvu 6HbGJ5Tk3GNLujg4ADf67biky4E1bLihGfsflYJEdFNcxHG/ILR6zb8KTSHycyaHYAXBtSch/wiFv 1cypKsVhA+OKBYCcX8SxZ3AsDe3Qj0HMfQN/UcqAN21Xz3ZQzTG0zBKQko2Q+zZoyZ4r49dbIStao /bCJ189l526GuNCMvNr1eh420/KOgcpiyl3mtjdFlPCdY89v+xXfZhOKh44McH5WiqfmRrf9DNaT8 YWq0D4qL4xxXqgmxRbJA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1m3OpE-00BI6N-Lz; Tue, 13 Jul 2021 20:16:16 +0000 Received: from mailgw01.mediatek.com ([216.200.240.184]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1m3OpA-00BI5A-FN for linux-mediatek@lists.infradead.org; Tue, 13 Jul 2021 20:16:15 +0000 X-UUID: 7888eeb7a20940cb8f6c9c365e63ee21-20210713 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Transfer-Encoding:Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; bh=hzNcWn68U4UfJzk4pKLOsUiGSNeHyLTbDgJVrc/a55g=; b=FWQyY10b6EuZFv8Fh2LjwzeKvhtVmwhT1vwaHyGJmT5rNbCPpuYZ3BvuD42V0amQnyEKtFK/z3Zg6q6H9Jt2AMzK/IuErAbjigi7BWOuofQYmj7MSUgpJemtopjjZC1N1jssKdq7/NgfX2XKfXILn1/ajGFXBrgpYYGq5JrHQxk=; X-UUID: 7888eeb7a20940cb8f6c9c365e63ee21-20210713 Received: from mtkcas66.mediatek.inc [(172.29.193.44)] by mailgw01.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 2080234158; Tue, 13 Jul 2021 13:16:09 -0700 Received: from MTKMBS06N1.mediatek.inc (172.21.101.129) by MTKMBS62N1.mediatek.inc (172.29.193.41) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Tue, 13 Jul 2021 13:16:07 -0700 Received: from mtkcas07.mediatek.inc (172.21.101.84) by mtkmbs06n1.mediatek.inc (172.21.101.129) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 14 Jul 2021 04:16:06 +0800 Received: from mtkswgap22.mediatek.inc (172.21.77.33) by mtkcas07.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Wed, 14 Jul 2021 04:16:06 +0800 From: To: , CC: , , , , , , , , , , , , , , , Subject: [PATCH v3 3/4] mt76: mt7921: fix mgmt frame using unexpected bitrate Date: Wed, 14 Jul 2021 04:16:00 +0800 Message-ID: <3d68ff612bacf2c8d2b7b414f2b3cf14daf443f8.1626207204.git.objelf@gmail.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <92a8ecfdf198b34f98d5c1489a83adf151657760.1626207204.git.objelf@gmail.com> References: <92a8ecfdf198b34f98d5c1489a83adf151657760.1626207204.git.objelf@gmail.com> MIME-Version: 1.0 X-MTK: N X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210713_131613_970877_5DCF42D9 X-CRM114-Status: GOOD ( 13.32 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org From: Sean Wang Fix the current driver mgmt frame is not respecting the basic rates field provided by the AP and then unconditionally is using the lowest (1 or 6 Mbps) rate. For example, if the AP only supported basic rate {24, 36, 48, 54} Mbps, mt7921 cannot send mgmt frame with the rate not in the group. So, instead, we pick up the lowest basic rate the AP can support to send. Fixes: 163f4d22c118 ("mt76: mt7921: add MAC support") Signed-off-by: Sean Wang --- v2: 1. introduce another patch ("mt76: fix mt76_rates for the multiple devices") for those devices which have the same issue. 2. drop the own mt7921_rates, the unused macro and variable. v3: 1. introduce and rely on another patch ("mt76: add mt76_default_basic_rate more devices can rely on"). 2. add Fixes tag. --- drivers/net/wireless/mediatek/mt76/mt7921/mac.c | 5 +---- drivers/net/wireless/mediatek/mt76/mt7921/mt7921.h | 2 -- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/mac.c b/drivers/net/wireless/mediatek/mt76/mt7921/mac.c index 7fe2e3a50428..a4ce362286eb 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7921/mac.c +++ b/drivers/net/wireless/mediatek/mt76/mt7921/mac.c @@ -815,10 +815,7 @@ void mt7921_mac_write_txwi(struct mt7921_dev *dev, __le32 *txwi, /* hardware won't add HTC for mgmt/ctrl frame */ txwi[2] |= cpu_to_le32(MT_TXD2_HTC_VLD); - if (mphy->chandef.chan->band == NL80211_BAND_5GHZ) - rate = MT7921_5G_RATE_DEFAULT; - else - rate = MT7921_2G_RATE_DEFAULT; + rate = mt76_default_basic_rate(mphy, vif); val = MT_TXD6_FIXED_BW | FIELD_PREP(MT_TXD6_TX_RATE, rate); diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/mt7921.h b/drivers/net/wireless/mediatek/mt76/mt7921/mt7921.h index 2d8bd6bfc820..be16d528a923 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7921/mt7921.h +++ b/drivers/net/wireless/mediatek/mt76/mt7921/mt7921.h @@ -38,8 +38,6 @@ #define MT7921_CFEND_RATE_DEFAULT 0x49 /* OFDM 24M */ #define MT7921_CFEND_RATE_11B 0x03 /* 11B LP, 11M */ -#define MT7921_5G_RATE_DEFAULT 0x4b /* OFDM 6M */ -#define MT7921_2G_RATE_DEFAULT 0x0 /* CCK 1M */ #define MT7921_SKU_RATE_NUM 161 #define MT7921_SKU_MAX_DELTA_IDX MT7921_SKU_RATE_NUM From patchwork Tue Jul 13 20:16:01 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Wang X-Patchwork-Id: 12374973 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.5 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CC58CC07E95 for ; Tue, 13 Jul 2021 20:16:36 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 962E561351 for ; Tue, 13 Jul 2021 20:16:36 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 962E561351 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=mediatek.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:CC:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=2ccJwtveIJ6fJaARhxIBek9QHurJHGajYlHnAMWWs24=; b=B8urwXeywJdu8e NHnmllKxyNCHELgzQiV/SsqvvSaQDkFk1HPyt1IqXL0ygAKozBSdRpF3M5PJ1WinAdKKBmGiwv3eu yNWZWn7AEgx8aKa1E99MCcXFqOqdpB1wKCjPlq6PB3pzNvW2i1jNjSrQW4eChOknb0ZU1QdiHcF7l iJ7N7MczGmiFl7oueFDSgjSAt9q4dDgiHFtJXb2jJHmxC5nV8Ug+g2YCUWwXDO56d9mxDZGjBH9lv KHWyK4EpwJCtjJI59GjPkivGAoiHlOMifWjgR6cxPz6vduAZOmbOFD+fiVo/9Zrmt5UbOJ+9BT9T7 SsoNJSzXMUYqnbsoQGkg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1m3OpQ-00BIAZ-DJ; Tue, 13 Jul 2021 20:16:28 +0000 Received: from mailgw02.mediatek.com ([216.200.240.185]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1m3OpO-00BI8I-AM for linux-mediatek@lists.infradead.org; Tue, 13 Jul 2021 20:16:27 +0000 X-UUID: 7034ef2805cc4009a34fffb7f7225aa5-20210713 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Transfer-Encoding:Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; bh=jpdFWpmKuOmAuiGW5WC8E84plpAbPLQtF//9P+m8Lqo=; b=CAqNevK5/2ekgcsyu38ekU8mN/ZVl+5UwkOEFaZVgJrNxbfgQdSiqfgMYKOPVn/S2SAYuPXTiv30NMKWrb4Jhfzlx/I1IMqQYmHSIYiwteSba94HWN2JDRVRG53XkOoogiRvBa6KnOi/88Ltm0abmJnm5ETxdawW898+yptcvPQ=; X-UUID: 7034ef2805cc4009a34fffb7f7225aa5-20210713 Received: from mtkcas67.mediatek.inc [(172.29.193.45)] by mailgw02.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 1051685400; Tue, 13 Jul 2021 13:16:22 -0700 Received: from MTKMBS01N2.mediatek.inc (172.21.101.79) by MTKMBS62N2.mediatek.inc (172.29.193.42) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Tue, 13 Jul 2021 13:16:21 -0700 Received: from mtkcas07.mediatek.inc (172.21.101.84) by mtkmbs01n2.mediatek.inc (172.21.101.79) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 14 Jul 2021 04:16:07 +0800 Received: from mtkswgap22.mediatek.inc (172.21.77.33) by mtkcas07.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Wed, 14 Jul 2021 04:16:08 +0800 From: To: , CC: , , , , , , , , , , , , , , , Subject: [PATCH v3 4/4] mt76: mt7915: fix mgmt frame using unexpected bitrate Date: Wed, 14 Jul 2021 04:16:01 +0800 Message-ID: X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <92a8ecfdf198b34f98d5c1489a83adf151657760.1626207204.git.objelf@gmail.com> References: <92a8ecfdf198b34f98d5c1489a83adf151657760.1626207204.git.objelf@gmail.com> MIME-Version: 1.0 X-MTK: N X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210713_131626_384529_0098E3EB X-CRM114-Status: GOOD ( 12.92 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org From: Sean Wang Fix the current driver mgmt frame is not respecting the basic rates field provided by the AP and then unconditionally is using the lowest (1 or 6 Mbps) rate. For example, if the AP only supported basic rate {24, 36, 48, 54} Mbps, mt7921 cannot send mgmt frame with the rate not in the group. So, instead, we pick up the lowest basic rate the AP can support to send. Fixes: e57b7901469f ("mt76: add mac80211 driver for MT7915 PCIe-based chipsets") Suggested-by: Ryder Lee Signed-off-by: Sean Wang --- v3: created in v3 to solve the same issue found in mt7921. --- drivers/net/wireless/mediatek/mt76/mt7915/mac.c | 5 +---- drivers/net/wireless/mediatek/mt76/mt7915/mt7915.h | 2 -- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/mac.c b/drivers/net/wireless/mediatek/mt76/mt7915/mac.c index 2462704094b0..b48249518459 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7915/mac.c +++ b/drivers/net/wireless/mediatek/mt76/mt7915/mac.c @@ -979,10 +979,7 @@ void mt7915_mac_write_txwi(struct mt7915_dev *dev, __le32 *txwi, /* hardware won't add HTC for mgmt/ctrl frame */ txwi[2] |= cpu_to_le32(MT_TXD2_HTC_VLD); - if (mphy->chandef.chan->band == NL80211_BAND_5GHZ) - rate = MT7915_5G_RATE_DEFAULT; - else - rate = MT7915_2G_RATE_DEFAULT; + rate = mt76_default_basic_rate(mphy, vif); val = MT_TXD6_FIXED_BW | FIELD_PREP(MT_TXD6_TX_RATE, rate); diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/mt7915.h b/drivers/net/wireless/mediatek/mt76/mt7915/mt7915.h index 3f613fae6218..b41a31ad316d 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7915/mt7915.h +++ b/drivers/net/wireless/mediatek/mt76/mt7915/mt7915.h @@ -36,8 +36,6 @@ #define MT7915_CFEND_RATE_DEFAULT 0x49 /* OFDM 24M */ #define MT7915_CFEND_RATE_11B 0x03 /* 11B LP, 11M */ -#define MT7915_5G_RATE_DEFAULT 0x4b /* OFDM 6M */ -#define MT7915_2G_RATE_DEFAULT 0x0 /* CCK 1M */ #define MT7915_THERMAL_THROTTLE_MAX 100