Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp1236823pxu; Mon, 23 Nov 2020 15:34:15 -0800 (PST) X-Google-Smtp-Source: ABdhPJxfF/nIUouCuwBMQvRVWEjdSzBRz9D8OYeZ839YScPYIqmEnmKPUzv9C43RKZ56CHv4YnZy X-Received: by 2002:a17:906:1b01:: with SMTP id o1mr1808589ejg.334.1606174455380; Mon, 23 Nov 2020 15:34:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606174455; cv=none; d=google.com; s=arc-20160816; b=l8rChr7HnufaiBWN57EmVwj/2A63NbuQ4cw4KwQo11br5LfkLeQMshv7yM74UMi0BH 0u78wf3ul8scJvGPrx0Xo2DUbDW7cMs1Sw5PqM06YR//UQf66KDyiJQ/hk80iRthRByD 5F7Km3m2Bv9ierhvQvA5SeLodNgWjYVZHPiiziMKWqYeHQOkTv4n/jSkN/gVKRrR8M6b Zo39RMLtIR9HlrGV7QF4nINCVMs0aLzGRrUB07pMf0pRBneOzoWX4bIVaVsvlSaSo/JL 6QYtBZ6/r3xhSQFNAQDWWK6dutJaBc6CQmkBzRXwxWWtod+ZjeeiKoJz/2FH7lKlLPeF wFqg== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=jiptw4bEcdiX67qWuGWP9NYXgqft8ArQpSCYuL7+BVo=; b=KesnwA0/HUK2QHH8sQCNA60MXMmeomLAcTW2eV2+MD06gWRW7GSRRprbXfPW+/vuqG divBjvipVmuJMENAZiaf2zt5NImIzlxKo97XiFWyz0ArkUYa9Gd9iOr00wmUOKHCQ+C9 XyoH+wXpPumwnh8dXjQD1pvOty/kWaRpBODMcYybKU2aukXseyZQaS5FhHglnTnwH90n /pouD5hZqbzJtTdAwD+uamr0qxA8HFAk8p7iew2HpYKBuBSbC/Aq+AASTS4Xv50dGkP0 3MV2iN6QUsHxPSL4qHyuI4uaU0WuxAZ/+EB3UQ6SlX92Dd+f08RfZDTZ/dG5Xmc633Vo zlaA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=DWnTDiZw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id x17si8970566edq.475.2020.11.23.15.33.52; Mon, 23 Nov 2020 15:34:15 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=DWnTDiZw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730576AbgKWM3U (ORCPT + 99 others); Mon, 23 Nov 2020 07:29:20 -0500 Received: from mail.kernel.org ([198.145.29.99]:39640 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730566AbgKWM3R (ORCPT ); Mon, 23 Nov 2020 07:29:17 -0500 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id BB33120857; Mon, 23 Nov 2020 12:29:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1606134556; bh=KSX0GOJAIGf/XPCwJh5SbZHN4b3oQ1XwQefD9h4Ag9g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DWnTDiZwxcgzoU0R9YfpecGM06RVz6XRTRrnxrCRJu+nP+/dmm+Ayf6myLgLohIA9 eauMSCxt0CLqS8o8xRXLJb0Xt6A3fmnukOd8jxCJIlNjHf2y0xtnbx8DB4XrAr4Zi2 psk9uTfCRolqx7sLGAZVESKza6Zjsw9yt6oILJqw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Felix Fietkau , Johannes Berg Subject: [PATCH 4.14 55/60] mac80211: minstrel: remove deferred sampling code Date: Mon, 23 Nov 2020 13:22:37 +0100 Message-Id: <20201123121807.705465888@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201123121805.028396732@linuxfoundation.org> References: <20201123121805.028396732@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Felix Fietkau commit 4fe40b8e1566dad04c87fbf299049a1d0d4bd58d upstream. Deferring sampling attempts to the second stage has some bad interactions with drivers that process the rate table in hardware and use the probe flag to indicate probing packets (e.g. most mt76 drivers). On affected drivers it can lead to probing not working at all. If the link conditions turn worse, it might not be such a good idea to do a lot of sampling for lower rates in this case. Fix this by simply skipping the sample attempt instead of deferring it, but keep the checks that would allow it to be sampled if it was skipped too often, but only if it has less than 95% success probability. Also ensure that IEEE80211_TX_CTL_RATE_CTRL_PROBE is set for all probing packets. Cc: stable@vger.kernel.org Fixes: cccf129f820e ("mac80211: add the 'minstrel' rate control algorithm") Signed-off-by: Felix Fietkau Link: https://lore.kernel.org/r/20201111183359.43528-2-nbd@nbd.name Signed-off-by: Johannes Berg Signed-off-by: Greg Kroah-Hartman --- net/mac80211/rc80211_minstrel.c | 25 ++++--------------------- net/mac80211/rc80211_minstrel.h | 1 - 2 files changed, 4 insertions(+), 22 deletions(-) --- a/net/mac80211/rc80211_minstrel.c +++ b/net/mac80211/rc80211_minstrel.c @@ -289,12 +289,6 @@ minstrel_tx_status(void *priv, struct ie mi->r[ndx].stats.success += success; } - if ((info->flags & IEEE80211_TX_CTL_RATE_CTRL_PROBE) && (i >= 0)) - mi->sample_packets++; - - if (mi->sample_deferred > 0) - mi->sample_deferred--; - if (time_after(jiffies, mi->last_stats_update + (mp->update_interval * HZ) / 1000)) minstrel_update_stats(mp, mi); @@ -373,7 +367,7 @@ minstrel_get_rate(void *priv, struct iee return; delta = (mi->total_packets * sampling_ratio / 100) - - (mi->sample_packets + mi->sample_deferred / 2); + mi->sample_packets; /* delta < 0: no sampling required */ prev_sample = mi->prev_sample; @@ -382,7 +376,6 @@ minstrel_get_rate(void *priv, struct iee return; if (mi->total_packets >= 10000) { - mi->sample_deferred = 0; mi->sample_packets = 0; mi->total_packets = 0; } else if (delta > mi->n_rates * 2) { @@ -407,19 +400,8 @@ minstrel_get_rate(void *priv, struct iee * rate sampling method should be used. * Respect such rates that are not sampled for 20 interations. */ - if (mrr_capable && - msr->perfect_tx_time > mr->perfect_tx_time && - msr->stats.sample_skipped < 20) { - /* Only use IEEE80211_TX_CTL_RATE_CTRL_PROBE to mark - * packets that have the sampling rate deferred to the - * second MRR stage. Increase the sample counter only - * if the deferred sample rate was actually used. - * Use the sample_deferred counter to make sure that - * the sampling is not done in large bursts */ - info->flags |= IEEE80211_TX_CTL_RATE_CTRL_PROBE; - rate++; - mi->sample_deferred++; - } else { + if (msr->perfect_tx_time < mr->perfect_tx_time || + msr->stats.sample_skipped >= 20) { if (!msr->sample_limit) return; @@ -439,6 +421,7 @@ minstrel_get_rate(void *priv, struct iee rate->idx = mi->r[ndx].rix; rate->count = minstrel_get_retry_count(&mi->r[ndx], info); + info->flags |= IEEE80211_TX_CTL_RATE_CTRL_PROBE; } --- a/net/mac80211/rc80211_minstrel.h +++ b/net/mac80211/rc80211_minstrel.h @@ -98,7 +98,6 @@ struct minstrel_sta_info { u8 max_prob_rate; unsigned int total_packets; unsigned int sample_packets; - int sample_deferred; unsigned int sample_row; unsigned int sample_column;