diff options
author | Antoine Viallon | 2021-10-25 10:07:22 +0200 |
---|---|---|
committer | Antoine Viallon | 2021-10-25 10:18:23 +0200 |
commit | 41bde62c2f58d9c36197c3f83d1f24e0121fad71 (patch) | |
tree | c236faf61fd109fc39d712caac6fd7a2c4d3e752 /v2-mt76-mt7921-fix-kernel-warning-from-cfg80211_calculate_bitrate.patch | |
download | aur-41bde62c2f58d9c36197c3f83d1f24e0121fad71.tar.gz |
Reinit branch
Diffstat (limited to 'v2-mt76-mt7921-fix-kernel-warning-from-cfg80211_calculate_bitrate.patch')
-rw-r--r-- | v2-mt76-mt7921-fix-kernel-warning-from-cfg80211_calculate_bitrate.patch | 194 |
1 files changed, 194 insertions, 0 deletions
diff --git a/v2-mt76-mt7921-fix-kernel-warning-from-cfg80211_calculate_bitrate.patch b/v2-mt76-mt7921-fix-kernel-warning-from-cfg80211_calculate_bitrate.patch new file mode 100644 index 000000000000..0675a0da8d86 --- /dev/null +++ b/v2-mt76-mt7921-fix-kernel-warning-from-cfg80211_calculate_bitrate.patch @@ -0,0 +1,194 @@ +From patchwork Fri Aug 13 18:09:18 2021 +Content-Type: text/plain; charset="utf-8" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +X-Patchwork-Submitter: Sean Wang <sean.wang@mediatek.com> +X-Patchwork-Id: 12435999 +Return-Path: + <SRS0=ikIt=NE=lists.infradead.org=linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@kernel.org> +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.4 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, + URIBL_BLOCKED,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 85987C4338F + for <linux-mediatek@archiver.kernel.org>; + Fri, 13 Aug 2021 18:09:54 +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 2146E610E9 + for <linux-mediatek@archiver.kernel.org>; + Fri, 13 Aug 2021 18:09:54 +0000 (UTC) +DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 2146E610E9 +Authentication-Results: mail.kernel.org; + dmarc=fail (p=none dis=none) header.from=mediatek.com +Authentication-Results: mail.kernel.org; + spf=none smtp.mailfrom=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=0aRwGg0dzrHWWaZO2O5cCjiCmhy/BM1FkSnKydYU94U=; b=wFYXBsHUY1HSRj + q4yZqsoyQEiREu26XJAgYDhNlHcil7ycnSAvWRNFUdtgdFqvUr/n4+nnjcHdgu5QeBPkTOae0zHrN + eTF4P1CXFx6aTV7UrFew61TxVAXBAYgC9ldlXs2XGpI7StVnqGyXjfmBuv1lHk4zX2vYbeYsPbWBx + qyGgdUnEmxrgTBywXuOItY+IXpBFpZb3ohwVvhswwaZkvkEvXpQqyV+/wLP96PcTvLMIErLpt2EEK + ZTQfSU1TxQNY2zrLjIuNwO2HPxcYMYn/AzizKtKY2DdcCsjbzkeCGGFhgbLB4pXYARSTsMQcGKOu1 + u8MDEMWe9L/z2cIAGmCg==; +Received: from localhost ([::1] helo=bombadil.infradead.org) + by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) + id 1mEbci-00DKgu-D0; Fri, 13 Aug 2021 18:09:40 +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 1mEbcb-00DKfN-KS + for linux-mediatek@lists.infradead.org; Fri, 13 Aug 2021 18:09:37 +0000 +X-UUID: f9998e255f0e412581fa74b7d6003edb-20210813 +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=1AX8F79qACvbJzGrhNwzJ3VCwjf7YRFcxyDJLJfDQcQ=; + b=HuMsM37M7Ro2lVCCei4I5lmVlrWt5LqTO+YB9HBEXvV9RG4MrKLlAuD9/xv4Y+0CKNPSAbtRPenwLJlVstSWUGO5uaZnKRZnSvKcbiwLpfa2o8oLXFcArfKAtNp0MwLxv388CRP01KAgJE0o8Nr9PdGoiEenr7g/ivsguVnY02g=; +X-UUID: f9998e255f0e412581fa74b7d6003edb-20210813 +Received: from mtkcas67.mediatek.inc [(172.29.193.45)] by + mailgw01.mediatek.com + (envelope-from <sean.wang@mediatek.com>) + (musrelay.mediatek.com ESMTP with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) + with ESMTP id 886096985; Fri, 13 Aug 2021 11:09:30 -0700 +Received: from MTKMBS02N2.mediatek.inc (172.21.101.101) by + MTKMBS62N1.mediatek.inc (172.29.193.41) with Microsoft SMTP Server (TLS) id + 15.0.1497.2; Fri, 13 Aug 2021 11:09:28 -0700 +Received: from MTKCAS06.mediatek.inc (172.21.101.30) by + mtkmbs02n2.mediatek.inc (172.21.101.101) with Microsoft SMTP Server (TLS) id + 15.0.1497.2; Sat, 14 Aug 2021 02:09:20 +0800 +Received: from mtkswgap22.mediatek.inc (172.21.77.33) by MTKCAS06.mediatek.inc + (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via + Frontend Transport; Sat, 14 Aug 2021 02:09:21 +0800 +From: <sean.wang@mediatek.com> +To: <nbd@nbd.name>, <lorenzo.bianconi@redhat.com> +CC: <sean.wang@mediatek.com>, <Soul.Huang@mediatek.com>, + <YN.Chen@mediatek.com>, <Leon.Yen@mediatek.com>, + <Eric-SY.Chang@mediatek.com>, <Deren.Wu@mediatek.com>, <km.lin@mediatek.com>, + <robin.chiu@mediatek.com>, <ch.yeh@mediatek.com>, <posh.sun@mediatek.com>, + <Eric.Liang@mediatek.com>, <Stella.Chang@mediatek.com>, <jemele@google.com>, + <yenlinlai@google.com>, <linux-wireless@vger.kernel.org>, + <linux-mediatek@lists.infradead.org> +Subject: [PATCH v2] mt76: mt7921: fix kernel warning from + cfg80211_calculate_bitrate +Date: Sat, 14 Aug 2021 02:09:18 +0800 +Message-ID: + <a781b573380564be395500898269f27e5e4d2ba9.1628877755.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-20210813_110933_758439_3A80BBD7 +X-CRM114-Status: GOOD ( 12.12 ) +X-BeenThere: linux-mediatek@lists.infradead.org +X-Mailman-Version: 2.1.34 +Precedence: list +List-Id: <linux-mediatek.lists.infradead.org> +List-Unsubscribe: <http://lists.infradead.org/mailman/options/linux-mediatek>, + <mailto:linux-mediatek-request@lists.infradead.org?subject=unsubscribe> +List-Archive: <http://lists.infradead.org/pipermail/linux-mediatek/> +List-Post: <mailto:linux-mediatek@lists.infradead.org> +List-Help: <mailto:linux-mediatek-request@lists.infradead.org?subject=help> +List-Subscribe: <http://lists.infradead.org/mailman/listinfo/linux-mediatek>, + <mailto:linux-mediatek-request@lists.infradead.org?subject=subscribe> +Sender: "Linux-mediatek" <linux-mediatek-bounces@lists.infradead.org> +Errors-To: + linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org + +From: Sean Wang <sean.wang@mediatek.com> + +Fix the kernel warning from cfg80211_calculate_bitrate +due to the legacy rate is not parsed well in the current driver. + +Also, zeros struct rate_info before we fill it out to avoid the old value +is kept such as rate->legacy. + +[ 790.921560] WARNING: CPU: 7 PID: 970 at net/wireless/util.c:1298 cfg80211_calculate_bitrate+0x354/0x35c [cfg80211] +[ 790.987738] Hardware name: MediaTek Asurada rev1 board (DT) +[ 790.993298] pstate: a0400009 (NzCv daif +PAN -UAO) +[ 790.998104] pc : cfg80211_calculate_bitrate+0x354/0x35c [cfg80211] +[ 791.004295] lr : cfg80211_calculate_bitrate+0x180/0x35c [cfg80211] +[ 791.010462] sp : ffffffc0129c3880 +[ 791.013765] x29: ffffffc0129c3880 x28: ffffffd38305bea8 +[ 791.019065] x27: ffffffc0129c3970 x26: 0000000000000013 +[ 791.024364] x25: 00000000000003ca x24: 000000000000002f +[ 791.029664] x23: 00000000000000d0 x22: ffffff8d108bc000 +[ 791.034964] x21: ffffff8d108bc0d0 x20: ffffffc0129c39a8 +[ 791.040264] x19: ffffffc0129c39a8 x18: 00000000ffff0a10 +[ 791.045563] x17: 0000000000000050 x16: 00000000000000ec +[ 791.050910] x15: ffffffd3f9ebed9c x14: 0000000000000006 +[ 791.056211] x13: 00000000000b2eea x12: 0000000000000000 +[ 791.061511] x11: 00000000ffffffff x10: 0000000000000000 +[ 791.066811] x9 : 0000000000000000 x8 : 0000000000000000 +[ 791.072110] x7 : 0000000000000000 x6 : ffffffd3fafa5a7b +[ 791.077409] x5 : 0000000000000000 x4 : 0000000000000000 +[ 791.082708] x3 : 0000000000000000 x2 : 0000000000000000 +[ 791.088008] x1 : ffffff8d3f79c918 x0 : 0000000000000000 +[ 791.093308] Call trace: +[ 791.095770] cfg80211_calculate_bitrate+0x354/0x35c [cfg80211] +[ 791.101615] nl80211_put_sta_rate+0x6c/0x2c0 [cfg80211] +[ 791.106853] nl80211_send_station+0x980/0xaa4 [cfg80211] +[ 791.112178] nl80211_get_station+0xb4/0x134 [cfg80211] +[ 791.117308] genl_rcv_msg+0x3a0/0x440 +[ 791.120960] netlink_rcv_skb+0xcc/0x118 +[ 791.124785] genl_rcv+0x34/0x48 +[ 791.127916] netlink_unicast+0x144/0x1dc + +Fixes: 1c099ab44727 ("mt76: mt7921: add MCU support") +Signed-off-by: Sean Wang <sean.wang@mediatek.com> +--- +v2: don't do unnecessary line removal +--- + drivers/net/wireless/mediatek/mt76/mt7921/mcu.c | 11 +++++++++-- + 1 file changed, 9 insertions(+), 2 deletions(-) + +diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7921/mcu.c +index cadb633639d3..9b35b5da3619 100644 +--- a/drivers/net/wireless/mediatek/mt76/mt7921/mcu.c ++++ b/drivers/net/wireless/mediatek/mt76/mt7921/mcu.c +@@ -328,11 +328,13 @@ mt7921_mcu_tx_rate_parse(struct mt76_phy *mphy, + struct rate_info *rate, u16 r) + { + struct ieee80211_supported_band *sband; +- u16 flags = 0; ++ u16 flags = 0, rate_idx; + u8 txmode = FIELD_GET(MT_WTBL_RATE_TX_MODE, r); + u8 gi = 0; + u8 bw = 0; ++ bool cck = false; + ++ memset(rate, 0, sizeof(*rate)); + rate->mcs = FIELD_GET(MT_WTBL_RATE_MCS, r); + rate->nss = FIELD_GET(MT_WTBL_RATE_NSS, r) + 1; + +@@ -357,13 +359,18 @@ mt7921_mcu_tx_rate_parse(struct mt76_phy *mphy, + + switch (txmode) { + case MT_PHY_TYPE_CCK: ++ cck = true; ++ fallthrough; + case MT_PHY_TYPE_OFDM: + if (mphy->chandef.chan->band == NL80211_BAND_5GHZ) + sband = &mphy->sband_5g.sband; + else + sband = &mphy->sband_2g.sband; + +- rate->legacy = sband->bitrates[rate->mcs].bitrate; ++ rate_idx = FIELD_GET(MT_TX_RATE_IDX, r); ++ rate_idx = mt76_get_rate(mphy->dev, sband, rate_idx, ++ cck); ++ rate->legacy = sband->bitrates[rate_idx].bitrate; + break; + case MT_PHY_TYPE_HT: + case MT_PHY_TYPE_HT_GF: |