From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-eopbgr710102.outbound.protection.outlook.com ([40.107.71.102]:64704 "EHLO NAM05-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727664AbeIQI1u (ORCPT ); Mon, 17 Sep 2018 04:27:50 -0400 From: Sasha Levin To: "stable@vger.kernel.org" , "linux-kernel@vger.kernel.org" CC: Lorenzo Bianconi , Kalle Valo , Sasha Levin Subject: [PATCH AUTOSEL 4.18 091/136] mt76x2: fix mrr idx/count estimation in mt76x2_mac_fill_tx_status() Date: Mon, 17 Sep 2018 03:01:09 +0000 Message-ID: <20180917030006.245495-91-alexander.levin@microsoft.com> References: <20180917030006.245495-1-alexander.levin@microsoft.com> In-Reply-To: <20180917030006.245495-1-alexander.levin@microsoft.com> Content-Language: en-US Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org List-ID: From: Lorenzo Bianconi [ Upstream commit 2d1e9be0016230f3707812243561fbd16f1aea4b ] Fix mcs and attempt count estimation in mt76x2_mac_fill_tx_status routine if the number of tx retries reported by the hw is grater than IEEE80211_TX_MAX_RATES Fixes: 7bc04215a66b ("mt76: add driver code for MT76x2e") Signed-off-by: Lorenzo Bianconi Signed-off-by: Kalle Valo Signed-off-by: Sasha Levin --- drivers/net/wireless/mediatek/mt76/mt76x2_mac.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt76x2_mac.c b/drivers/net/= wireless/mediatek/mt76/mt76x2_mac.c index b49aea4da2d6..8985446570bd 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76x2_mac.c +++ b/drivers/net/wireless/mediatek/mt76/mt76x2_mac.c @@ -439,15 +439,13 @@ mt76x2_mac_fill_tx_status(struct mt76x2_dev *dev, if (last_rate < IEEE80211_TX_MAX_RATES - 1) rate[last_rate + 1].idx =3D -1; =20 - cur_idx =3D rate[last_rate].idx + st->retry; + cur_idx =3D rate[last_rate].idx + last_rate; for (i =3D 0; i <=3D last_rate; i++) { rate[i].flags =3D rate[last_rate].flags; rate[i].idx =3D max_t(int, 0, cur_idx - i); rate[i].count =3D 1; } - - if (last_rate > 0) - rate[last_rate - 1].count =3D st->retry + 1 - last_rate; + rate[last_rate].count =3D st->retry + 1 - last_rate; =20 info->status.ampdu_len =3D n_frames; info->status.ampdu_ack_len =3D st->success ? n_frames : 0; --=20 2.17.1