From patchwork Mon Jun 4 09:19:41 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lorenzo Bianconi X-Patchwork-Id: 10446149 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 211CE60375 for ; Mon, 4 Jun 2018 09:19:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1132C28B2B for ; Mon, 4 Jun 2018 09:19:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 05CD028BB5; Mon, 4 Jun 2018 09:19:55 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9EBE028B2B for ; Mon, 4 Jun 2018 09:19:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752005AbeFDJTx (ORCPT ); Mon, 4 Jun 2018 05:19:53 -0400 Received: from mail-wm0-f66.google.com ([74.125.82.66]:33739 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750868AbeFDJTw (ORCPT ); Mon, 4 Jun 2018 05:19:52 -0400 Received: by mail-wm0-f66.google.com with SMTP id z6-v6so13387714wma.0 for ; Mon, 04 Jun 2018 02:19:51 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=prH/EZHlVsama3cgWJxROuMT1i4CMRVp7mZ4urt5W5o=; b=s2NuGXNtgQjPNNmBl3sVBO5WkXwXA1shcSck9d9PPlFl/cK8RyeioafpbGTFMS1dpy qQ3tNLRD6vq21xoEMI2FEoBNKKbI2D1ncBcaRo0lW9a2cC2MVQUwEWPsCPYkaj2FoSNP qS+HS14FntXmRlx40cEIfgV4nNl/hq9XSH+TZb0gFjwqjUsA9LksBPr2Zf3tVMNsM1b1 UgB91PfR0jTgkl1sWlNDpiq78FVEmD0xkDXDOTE1jVVD5D8rwTDTxH0e3gIWix5S+GgR eKmP9l+H/g0ZyBlEU98AvShTy2RZLLLdDQTtofglBLEd03GCJ/rPg+93duIr1sdtsroB yqrA== X-Gm-Message-State: ALKqPwd/vlk2Hgtf2R4+TN1U7jyo9a4VD5wR5moyWlrLIiBSLDD2M1Vf u/G9DPUH8ixPAI8koBIwL3m9R4cHq8A= X-Google-Smtp-Source: ADUXVKL3dR7cYvmax8rYI/NlCQD19AfjtHELRzkqdkhx+jvvjKHoHlvJCPz1vlMOuGOZQGCbPjGVyA== X-Received: by 2002:a1c:6c09:: with SMTP id h9-v6mr9244287wmc.138.1528103990955; Mon, 04 Jun 2018 02:19:50 -0700 (PDT) Received: from localhost.localdomain.com (nat-pool-mxp-t.redhat.com. [149.6.153.186]) by smtp.gmail.com with ESMTPSA id b74-v6sm11036860wmi.13.2018.06.04.02.19.50 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 04 Jun 2018 02:19:50 -0700 (PDT) From: Lorenzo Bianconi To: nbd@nbd.name Cc: linux-wireless@vger.kernel.org Subject: [PATCH] mt76x2: fix mrr idx/count estimation in mt76x2_mac_fill_tx_status() Date: Mon, 4 Jun 2018 11:19:41 +0200 Message-Id: X-Mailer: git-send-email 2.14.4 In-Reply-To: References: Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- 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 = -1; - cur_idx = rate[last_rate].idx + st->retry; + cur_idx = rate[last_rate].idx + last_rate; for (i = 0; i <= last_rate; i++) { rate[i].flags = rate[last_rate].flags; rate[i].idx = max_t(int, 0, cur_idx - i); rate[i].count = 1; } - - if (last_rate > 0) - rate[last_rate - 1].count = st->retry + 1 - last_rate; + rate[last_rate].count = st->retry + 1 - last_rate; info->status.ampdu_len = n_frames; info->status.ampdu_ack_len = st->success ? n_frames : 0;