Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp4185546pxb; Tue, 26 Jan 2021 14:57:03 -0800 (PST) X-Google-Smtp-Source: ABdhPJxPsCiO7mgk1cuEov8PcNI0rvTdnzIkJwXfC+1TqoNgBba2HZhpY2OVwrI7gtfTo+N/BsSx X-Received: by 2002:a05:6402:1249:: with SMTP id l9mr5934470edw.375.1611701822952; Tue, 26 Jan 2021 14:57:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611701822; cv=none; d=google.com; s=arc-20160816; b=cA+83o2uB2J2l/aKKicMLHQDp0r78Ovu9hvFB64hfQGMvuFwhmIY/CjRusy8rGY8KR Bd7oEzXLC2pBVFpnp2rz5kaX3xRKrs1pqKzh15Ch2Cj1EJQwYZB6l4SIBNVlO5BupJsl l4M0ysKK4Vg3OjzguPGuTjnwVAug61QXIx5Hvs04yzmUVYryXb4JZrjkB5ackLDKtpyv ueBG2hVX/2t5q+TVRINv+H0l1owpIswfsVzH6mfP9Pj064nhwm54IoiJFFe05twDhrkU cSyrCOMnJvYJ2Kqg0Hqdb1sq9HJjAZv2ysx8rpdDydxUMhAC98/Yama9O6Q14eoihl19 Rncg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=CTU01+4gDwzxV4APRS56YBvPHonhs76M/aaxuYO3vWM=; b=LFyU6Y9DtqJ2zH17/wK8o8pzJ0MuxUGEpLIVIOw23YJllGzQEtIQ77fektGOtufJCk rBZwewyUwwA8K/vUMwybcmMSyDQHWDf3rSnsxbux8J27xQd1bh571JFPTTC/8zZvwLmj AfzbgaQzXSdkmzOz3zFYA1FsudxVMMqcYYeXznn1gmAgbWQ3zw8i3U5SAMBT/uuHHZuj he5mnH0NcE85XDfELPW7wIAYyBDA+ZiwtmqGV/rHFbUpiNPm3U5a0y6x61Az+sER4c1V cUIPfG3N0o+4ygdgvViWkElHnT8DJSvMBxjpx9Ctyk5go6jcZbor42pSWUoIDb+MS4JU S3tA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@nbd.name header.s=20160729 header.b=qhVmd9b8; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id br22si32825ejb.431.2021.01.26.14.56.38; Tue, 26 Jan 2021 14:57:02 -0800 (PST) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=fail header.i=@nbd.name header.s=20160729 header.b=qhVmd9b8; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729857AbhAZWp2 (ORCPT + 99 others); Tue, 26 Jan 2021 17:45:28 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46818 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2395040AbhAZS7A (ORCPT ); Tue, 26 Jan 2021 13:59:00 -0500 Received: from nbd.name (nbd.name [IPv6:2a01:4f8:221:3d45::2]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A2B12C061793 for ; Tue, 26 Jan 2021 10:58:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=nbd.name; s=20160729; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=CTU01+4gDwzxV4APRS56YBvPHonhs76M/aaxuYO3vWM=; b=qhVmd9b8pn8KKz5gAQgi5TCmuI 9DabHYupol5JIyAUpXLgfmnZkdE+k1Pfok9qkJM2qd25BsSEi0Y68XAEUDjqPvVvygZ9AnOJIfoek vGjX07uBpWlqtq1eqsqlGolnZyud7qf+vvMo9Qzg7Dasb8Euk3Y2wmEZkh2orQfZFgVQ=; Received: from p54ae953c.dip0.t-ipconnect.de ([84.174.149.60] helo=localhost.localdomain) by ds12 with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.89) (envelope-from ) id 1l4TXU-0003cb-FN; Tue, 26 Jan 2021 19:58:08 +0100 From: Felix Fietkau To: linux-wireless@vger.kernel.org Cc: johannes@sipsolutions.net Subject: [PATCH v2 3/6] mac80211: minstrel_ht: reduce the need to sample slower rates Date: Tue, 26 Jan 2021 19:58:03 +0100 Message-Id: <20210126185806.61770-3-nbd@nbd.name> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20210126185806.61770-1-nbd@nbd.name> References: <20210126185806.61770-1-nbd@nbd.name> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org In order to more gracefully be able to fall back to lower rates without too much throughput fluctuations, initialize all untested rates below tested ones to the maximum probabilty of higher rates. Usually this leads to untested lower rates getting initialized with a probability value of 100%, making them better candidates for fallback without having to rely on random probing Signed-off-by: Felix Fietkau --- net/mac80211/rc80211_minstrel_ht.c | 18 ++++++++---------- net/mac80211/rc80211_minstrel_ht.h | 2 -- 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/net/mac80211/rc80211_minstrel_ht.c b/net/mac80211/rc80211_minstrel_ht.c index 7846782840a9..4d4eb4aa46bd 100644 --- a/net/mac80211/rc80211_minstrel_ht.c +++ b/net/mac80211/rc80211_minstrel_ht.c @@ -791,14 +791,11 @@ minstrel_ht_calc_rate_stats(struct minstrel_priv *mp, unsigned int cur_prob; if (unlikely(mrs->attempts > 0)) { - mrs->sample_skipped = 0; cur_prob = MINSTREL_FRAC(mrs->success, mrs->attempts); minstrel_filter_avg_add(&mrs->prob_avg, &mrs->prob_avg_1, cur_prob); mrs->att_hist += mrs->attempts; mrs->succ_hist += mrs->success; - } else { - mrs->sample_skipped++; } mrs->last_success = mrs->success; @@ -851,7 +848,6 @@ minstrel_ht_update_stats(struct minstrel_priv *mp, struct minstrel_ht_sta *mi, mi->ampdu_packets = 0; } - mi->sample_slow = 0; mi->sample_count = 0; if (mi->supported[MINSTREL_CCK_GROUP]) @@ -882,6 +878,7 @@ minstrel_ht_update_stats(struct minstrel_priv *mp, struct minstrel_ht_sta *mi, /* Find best rate sets within all MCS groups*/ for (group = 0; group < ARRAY_SIZE(minstrel_mcs_groups); group++) { u16 *tp_rate = tmp_mcs_tp_rate; + u16 last_prob = 0; mg = &mi->groups[group]; if (!mi->supported[group]) @@ -896,7 +893,7 @@ minstrel_ht_update_stats(struct minstrel_priv *mp, struct minstrel_ht_sta *mi, if (group == MINSTREL_CCK_GROUP && ht_supported) tp_rate = tmp_legacy_tp_rate; - for (i = 0; i < MCS_GROUP_RATES; i++) { + for (i = MCS_GROUP_RATES - 1; i >= 0; i--) { if (!(mi->supported[group] & BIT(i))) continue; @@ -905,6 +902,11 @@ minstrel_ht_update_stats(struct minstrel_priv *mp, struct minstrel_ht_sta *mi, mrs = &mg->rates[i]; mrs->retry_updated = false; minstrel_ht_calc_rate_stats(mp, mrs); + + if (mrs->att_hist) + last_prob = max(last_prob, mrs->prob_avg); + else + mrs->prob_avg = max(last_prob, mrs->prob_avg); cur_prob = mrs->prob_avg; if (minstrel_ht_get_tp_avg(mi, group, i, cur_prob) == 0) @@ -1469,13 +1471,9 @@ minstrel_get_sample_rate(struct minstrel_priv *mp, struct minstrel_ht_sta *mi) if (sample_dur >= minstrel_get_duration(tp_rate2) && (cur_max_tp_streams - 1 < minstrel_mcs_groups[sample_group].streams || - sample_dur >= minstrel_get_duration(mi->max_prob_rate))) { - if (mrs->sample_skipped < 20) + sample_dur >= minstrel_get_duration(mi->max_prob_rate))) return -1; - if (mi->sample_slow++ > 2) - return -1; - } mi->sample_tries--; return sample_idx; diff --git a/net/mac80211/rc80211_minstrel_ht.h b/net/mac80211/rc80211_minstrel_ht.h index 5912f7dc5267..ebb2b88f44d9 100644 --- a/net/mac80211/rc80211_minstrel_ht.h +++ b/net/mac80211/rc80211_minstrel_ht.h @@ -123,7 +123,6 @@ struct minstrel_rate_stats { u8 retry_count; u8 retry_count_rtscts; - u8 sample_skipped; bool retry_updated; }; @@ -179,7 +178,6 @@ struct minstrel_ht_sta { u8 sample_wait; u8 sample_tries; u8 sample_count; - u8 sample_slow; enum minstrel_sample_mode sample_mode; u16 sample_rate; -- 2.28.0