From patchwork Sat Apr 2 15:30:13 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Seiderer X-Patchwork-Id: 556171 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4AC4CC4332F for ; Sat, 2 Apr 2022 15:30:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1357307AbiDBPcW (ORCPT ); Sat, 2 Apr 2022 11:32:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35648 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231587AbiDBPcT (ORCPT ); Sat, 2 Apr 2022 11:32:19 -0400 Received: from mout.gmx.net (mout.gmx.net [212.227.17.21]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1355F12342E; Sat, 2 Apr 2022 08:30:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1648913415; bh=qbwQAiVMk58tGGoiDErQltrxLS9k74j45rz0UOdmUWQ=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date; b=Pxd0aROwUk9/A9tQ0k2UKk1KJoSoKhHq8Hj4Hpv1A7iu7KUxhx5vCRGpEqVBGA1Un mKXYQkU168aFSMXIcm0y9RKJqg4GkaXqqmB/CVeejjpeF8pUggsHnMhYuX6obqH68G nNl7Hr0HJQDuN+Zr9P+2yxKLJB3u0fTAW+Czfsqc= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from localhost.fritz.box ([62.216.209.166]) by mail.gmx.net (mrgmx104 [212.227.17.168]) with ESMTPSA (Nemesis) id 1MeU0q-1oB6Rv2kaa-00aTDi; Sat, 02 Apr 2022 17:30:15 +0200 From: Peter Seiderer To: linux-wireless@vger.kernel.org Cc: =?utf-8?q?Toke_H=C3=B8iland-J=C3=B8rgensen?= , Kalle Valo , "David S . Miller" , Jakub Kicinski , Paolo Abeni , Johannes Berg , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v1 1/2] ath9k: fix ath_get_rate_txpower() to respect the rate list end tag Date: Sat, 2 Apr 2022 17:30:13 +0200 Message-Id: <20220402153014.31332-1-ps.report@gmx.net> X-Mailer: git-send-email 2.35.1 MIME-Version: 1.0 X-Provags-ID: V03:K1:MohT/QwUArtXl+6vE+K5BnfsY+AJOMTC9brnN5PqrveWj7Xtzwa j1ywHVQK9DWdQWyIXP9CE9NW9jemaU8t4AxgAof4IwMWM2AQ640M5+fARZa1dCkmw+s6/vd REm3JcmbEf9nGryy7qUj6rjx30DwGAL9zFd5X0HWciAmqhhMAGiYwkYgkI/FcDVisB3+lE0 5KI3gPozFDIhgaqbkyazg== X-UI-Out-Filterresults: notjunk:1;V03:K0:2AFzgIAydoo=:gxx+/aJDdCMsTVrHZa6T7x IFEhbQNpZasl2nJDKQO3OdsvBzEWesDMBPVFR4wz7DoNc1YUWWHev9hNJ3pDOKNSlzIHiCDmJ FC/J2YymhG86K3UqwZzZIT9TSU0MzGrzGreaUP8LMhZjt0UTrsCYXW4BNbXcYaIOfJXEzwZkj gblK6j5dE/aEJlGsMxTatBJe6VyD69ZglbNz/wcemnAFLoV0+twLaO715CEjsDUSWUvODiBkt 4udQQGG2ptTKh8fyhaD9fiYeX3qX/KXIRgjBF9PCqs0kKjDfTcE/WTTSLc5jZRf6fiFp61GHv g60vkct2wveZXnwqf+Jh3ywT92tuRyRiXvoB/trXKJvUrGj9d+ktuMxAkXANSBtQkQ/KTyXin 33ss4mCoLf++M8GM380Hj8wUUUdICx+Ovrwa+10I1XhlEueGiAkQKZl4ZO7C8A2FdPsMcyyeW V4jF3MLeGHDj7W7K5Go2TqXPTIFMyU/aHqhcHKBoZX8QikEbUOz80Ql/icf9V2Mh1a3xkQ/0R FejqxUaQBE7Y6jxs3z1VngMtwH9ear9Keu97Y+DagdOkHvnpjEKU7KhXvCpRW8T+KmRFt4CV1 6G7XFbl7hUqD4Qmn1JtkV0+dD4EYGouE9Ury7StHJeLskRMEAihpp51lA7Nuns2bL8ftUOe89 S2MT6Mfzp2/N3foX+OljyT0gDwfPorEIaIxux2RelPDSjP7yQgR1bDRgJTLtFJWivwoDrEt+m /y7GR5ckyIBDkyrtfCWtT1oRXv1h4+J260DUOMNQi2ijKfIlMrrhJTG6YfO6tzue9AHGzWxC6 BAjBUaZ7DmJl6GQzsfOj4h7ZvcKVQU6reJLD9aOQi1wIsaiDEWDz8vszssLuxZtKqfLOUqItE IpaMTm3+Nya5QYZ2imVpxTQmcuL5BbuYzGyQfxIaeM50N5Np3PaJNKuRYRsIT7asmrHXySUIh ZA0P57MjG9gwnbiwzsZyckYaB8AN1PuHWcHgH3MTwSxxvUk4ph43i5Jv5BNrFcEbpnMuw59hD LaczuQA9RLLNkTpATHzAe2y0HsxlTuSQR69kqfdYaf1sCX0cPmPSRRg5DkOrltjmKTsC1qQE+ pW4fVQxb8cA+ak= Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Stop reading (and copying) from ieee80211_tx_rate to ath_tx_info.rates after list end tag (count == 0, idx < 0), prevents copying of garbage to card registers. Note: no need to write to the remaining ath_tx_info.rates entries as the complete ath_tx_info struct is already initialized to zero from both call sites. Signed-off-by: Peter Seiderer --- drivers/net/wireless/ath/ath9k/xmit.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/wireless/ath/ath9k/xmit.c b/drivers/net/wireless/ath/ath9k/xmit.c index d0caf1de2bde..ec9bad2d9510 100644 --- a/drivers/net/wireless/ath/ath9k/xmit.c +++ b/drivers/net/wireless/ath/ath9k/xmit.c @@ -1271,7 +1271,7 @@ static void ath_buf_set_rate(struct ath_softc *sc, struct ath_buf *bf, int phy; if (!rates[i].count || (rates[i].idx < 0)) - continue; + break; rix = rates[i].idx; info->rates[i].Tries = rates[i].count; From patchwork Sat Apr 2 15:30:14 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Seiderer X-Patchwork-Id: 555921 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 426B1C433EF for ; Sat, 2 Apr 2022 15:30:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1355367AbiDBPcV (ORCPT ); Sat, 2 Apr 2022 11:32:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35650 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232006AbiDBPcT (ORCPT ); Sat, 2 Apr 2022 11:32:19 -0400 Received: from mout.gmx.net (mout.gmx.net [212.227.17.20]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D7F38123BC1; Sat, 2 Apr 2022 08:30:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1648913416; bh=lZSOBxnkYshkouLS0XGvOyWTUsSm5nmlSADx/QK6Sfw=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=kVQc5hIpXWsPIBo4CqyEoFtkrTTHR+l8ZKsnDBawQvRMO4d4OgLfptcilNjQPRmnP aGj5zk6Jd8xd0un09eFMrNQpKa9YzJNTRldjakHpkqr+fCrGEx5+yoEGK4BafWBypY i3kG9YNc2vhwGc7jleG6KxEMx+H3hSr7dsFSS9cA= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from localhost.fritz.box ([62.216.209.166]) by mail.gmx.net (mrgmx104 [212.227.17.168]) with ESMTPSA (Nemesis) id 1M6ll8-1neWn80Xq2-008JPY; Sat, 02 Apr 2022 17:30:16 +0200 From: Peter Seiderer To: linux-wireless@vger.kernel.org Cc: =?utf-8?q?Toke_H=C3=B8iland-J=C3=B8rgensen?= , Kalle Valo , "David S . Miller" , Jakub Kicinski , Paolo Abeni , Johannes Berg , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v1 2/2] mac80211: minstrel_ht: fill all requested rates Date: Sat, 2 Apr 2022 17:30:14 +0200 Message-Id: <20220402153014.31332-2-ps.report@gmx.net> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220402153014.31332-1-ps.report@gmx.net> References: <20220402153014.31332-1-ps.report@gmx.net> MIME-Version: 1.0 X-Provags-ID: V03:K1:0wr3EzeN+lXmgwruwVbHbIItUpzgHp396SesflJa0YdqyVF7t9q AAfaD+Bqk5Z8ghMD22ji/bpePDOkXCm5iQpJqWksXImYnUzRj3IAFShCWrAk5OvIJiWvQYV omYoq8j7QN2w//ZnHY94nI4eiXh194ZMZ/01En5eiderY913paxogcTgjPukBO9nqPK6iGd Doyvjg7XAqbkVVFsgTaTg== X-UI-Out-Filterresults: notjunk:1;V03:K0:dQFF1XUE+VA=:+9BjDVBnY0wpvaIt/MzbH9 pmGlfNEofzMulJnqM4e7NunE/2BHfI4EF4+aFHgR9G6w0cdeTeOZEujNlRBfUn+aDwuyOSoZZ jSEfcVb+rjw779miOENlYOfJWH4c0n74Vq8eUyEoaX8ZhYkddxLQAtNsjZQKQedXJFZ/AnNvY vcIc0BScF7Mt99WUQ7DUXxzj39AGkyRveARAvot6Nt6U2zPCdmqR7rCsEhMzusqkb0FrxR4Xd knNEbGPFU/LzzkCsVtV5hnLaCYPvx4w8OLso8z7RHYqWQgpUVr35Erd5jOAYRDBgRA94GE97p qX4IC2VxUuOw9rSLJJ5ysCtmgqoZY/Vb7N0zaabHdpF5QqwlpEpxiddiYuvhJ2jQTTVnzIThd 8vjmbpcGEUIFGG6EoezQ0exDBoC6jSQVa+2kBixxluHZOBgscNqSKUPb2H3PRpXxAojc0tec7 2uZon9zKNlviNUkvq/hZnN91YmdbqsecbE4gewXwzLWyUjH8oaJtbD5KDXSNcxod6tBPcw0JA JAJZ8ioMVb/ngpRW/LxoVlXMRkDIxzQb1xVxFLkH5Pp8Cobent8dSVJNMPyHPN17Aw6YlaQXu vtHq8gP6fRrRVL1RreRGmaOsHIhA4T6kdSux9OgJphSYz0z6YFTPqCUYik8GCzV3Htf9a2dVV lKT40dR5lF+jOly03fVVpFm6M2zEtFZFyVyqKztM48IS5Jd8dVDzZI/dhLvdwmlJYzvxXM4vR QrTQriskVhB2IynDyi9D9vp8KUgHLTxjY9nm/mMGB3nP6k3RBjzUqWV0/8sWdDighPD8oF0ao Ile0c7EaWDFVijVLkVFDl/roacDv5IMoEpkYIJHxU1rMaR0h/oKu3G5gjSEXNZCJRLJcWZj5h o0zJhHNwtDZi6iCUS4W9kRu1Q0oHw0ymjcPMuySxvR5RlDXrZ0N8w9V+scOJdOh8bdjv7d3lw q/kVvZjFHx7S6uiPeJ79Iy3CKH+G3W7DPma/qWkVyzbpWFJcumcmXlE7Q05cds9XYjSShygtF Sxvn8N0FfBA/nP1mGJTOv7A3Gts/ikY4r1Kzocg/NhkVkodaSjrSSwIA3gscDrWaxz+5w6LOc 6Gh/cNOWpDAJr4= Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Fill all requested rates (in case of ath9k 4 rate slots are available, so fill all 4 instead of only 3), improves throughput in noisy environment. Signed-off-by: Peter Seiderer --- net/mac80211/rc80211_minstrel_ht.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/net/mac80211/rc80211_minstrel_ht.c b/net/mac80211/rc80211_minstrel_ht.c index 9c6ace858107..cd6a0f153688 100644 --- a/net/mac80211/rc80211_minstrel_ht.c +++ b/net/mac80211/rc80211_minstrel_ht.c @@ -1436,17 +1436,17 @@ minstrel_ht_update_rates(struct minstrel_priv *mp, struct minstrel_ht_sta *mi) /* Start with max_tp_rate[0] */ minstrel_ht_set_rate(mp, mi, rates, i++, mi->max_tp_rate[0]); - if (mp->hw->max_rates >= 3) { - /* At least 3 tx rates supported, use max_tp_rate[1] next */ - minstrel_ht_set_rate(mp, mi, rates, i++, mi->max_tp_rate[1]); - } + /* Fill up remaining, keep one entry for max_probe_rate */ + for (; i < (mp->hw->max_rates - 1); i++) + minstrel_ht_set_rate(mp, mi, rates, i, mi->max_tp_rate[i]); - if (mp->hw->max_rates >= 2) { + if (i < mp->hw->max_rates) minstrel_ht_set_rate(mp, mi, rates, i++, mi->max_prob_rate); - } + + if (i < IEEE80211_TX_RATE_TABLE_SIZE) + rates->rate[i].idx = -1; mi->sta->max_rc_amsdu_len = minstrel_ht_get_max_amsdu_len(mi); - rates->rate[i].idx = -1; rate_control_set_rates(mp->hw, mi->sta, rates); }