Received: by 2002:a25:824b:0:0:0:0:0 with SMTP id d11csp5935849ybn; Sun, 29 Sep 2019 08:48:17 -0700 (PDT) X-Google-Smtp-Source: APXvYqz+oHjof6PiGUQ1AgsftOTclwA64M3OWELPqWMQhWQzoLDbC2szcO8zhuH6ZJbLBSrJ1YvF X-Received: by 2002:a50:f603:: with SMTP id c3mr14821142edn.208.1569772097447; Sun, 29 Sep 2019 08:48:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569772097; cv=none; d=google.com; s=arc-20160816; b=tf/J7xc2R7mAsWNCShTquKLTH+DuOsFumGaQRMTxZIVg50NhjNYQxKan+dsglVtvLG Gb0w7llM+upeUcLUipy3JQ20S1XyudQZSAv7R8MrjsiB+/uQI0deRk0a9D0FVlDbX/cL FknQC+aDbUbjHhEzmq0EjbmSbeoRZdNdsqbRrrUe9/mIODmLk5wE8MgtIaPcd/fJaK9p T+2K8FMd1gqG3z95IdCpo8oWxi3y1vt1KdFFvmFvY8OFFN2pQkomHfQnzpSr+dem0LDj aPf+uUgOlRfLMD/6puKgTMtppdSWrVgrnrV6XMwOfwqdqQz9VJu/aBaGAZbvvbC1Fx3s Wi8A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature; bh=pQj+MbErxLF/AoTx92UNgwkNq1oEtPrBNHakCtTqRfk=; b=gJkQFSMT4zkhbX+hf5Qfzb2sQuJUekNXMvXILxshJ3XyVvcMtCUma/aVMb2UIVWl1C c+VCO9UtGUnReKNIEtKdO1iS7Orl3EuyAEmobubr4vPL4HwFzowMslgGnRgAxWlc0pkr iD4T0V4DQv6lfrUg38lR4ilFVvD8drE1GPAJtkClSVKo9kJaSCip3FcpW21HYJSd9cin O4g1De8spw2CIpMzWOpsODLio4ZJ2TqabQixSS1Op7pKPLL6bq9jJzl9cTZ3wv20gcfb XSdnSq6HTKa0xm0GoapigLwr2G1n+TrK1RFAwYqH/BDjZXAMwLXQnSauk0hya8mz/dFn zUvA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@nbd.name header.s=20160729 header.b=r9MefCVK; spf=pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l18si5663656ejg.248.2019.09.29.08.47.47; Sun, 29 Sep 2019 08:48:17 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@nbd.name header.s=20160729 header.b=r9MefCVK; spf=pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729039AbfI2Pqu (ORCPT + 99 others); Sun, 29 Sep 2019 11:46:50 -0400 Received: from nbd.name ([46.4.11.11]:60944 "EHLO nbd.name" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725948AbfI2Pqu (ORCPT ); Sun, 29 Sep 2019 11:46:50 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=nbd.name; s=20160729; h=Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=pQj+MbErxLF/AoTx92UNgwkNq1oEtPrBNHakCtTqRfk=; b=r9MefCVK6LutKmAXMplSGmQuh7 nWLZNLuDsb/cNrXT34M+zmpzhvUycsbRnL0+pl+26mnB3rKdsUtW3bfXifMtznU2umIdnlE/MQaar nW5E3X8nxijyh3lkkJ1IWS+dTX6BZMQMPClP4S8Dxo7IbaY/GIVb/Pv3BC2KhxMDH1sA=; Received: from p5b20652d.dip0.t-ipconnect.de ([91.32.101.45] helo=maeck.lan) by ds12 with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1iEbPL-0002oS-Ge; Sun, 29 Sep 2019 17:46:47 +0200 Received: by maeck.lan (Postfix, from userid 501) id 4EAD769F606A; Sun, 29 Sep 2019 17:46:46 +0200 (CEST) From: Felix Fietkau To: linux-wireless@vger.kernel.org Cc: johannes@sipsolutions.net Subject: [PATCH 1/2] mac80211: minstrel: remove divisions in tx status path Date: Sun, 29 Sep 2019 17:46:45 +0200 Message-Id: <20190929154646.90901-1-nbd@nbd.name> X-Mailer: git-send-email 2.17.0 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Use a slightly different threshold for downgrading spatial streams to make it easier to calculate without divisions. Slightly reduces CPU overhead. Signed-off-by: Felix Fietkau --- net/mac80211/rc80211_minstrel.c | 3 +-- net/mac80211/rc80211_minstrel_ht.c | 10 ++++------ 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/net/mac80211/rc80211_minstrel.c b/net/mac80211/rc80211_minstrel.c index ee86c3333999..f73017e08111 100644 --- a/net/mac80211/rc80211_minstrel.c +++ b/net/mac80211/rc80211_minstrel.c @@ -289,8 +289,7 @@ minstrel_tx_status(void *priv, struct ieee80211_supported_band *sband, if (mi->sample_deferred > 0) mi->sample_deferred--; - if (time_after(jiffies, mi->last_stats_update + - (mp->update_interval * HZ) / 1000)) + if (time_after(jiffies, mi->last_stats_update + mp->update_interval)) minstrel_update_stats(mp, mi); } diff --git a/net/mac80211/rc80211_minstrel_ht.c b/net/mac80211/rc80211_minstrel_ht.c index 0ef2633349b5..21c74b200269 100644 --- a/net/mac80211/rc80211_minstrel_ht.c +++ b/net/mac80211/rc80211_minstrel_ht.c @@ -970,23 +970,21 @@ minstrel_ht_tx_status(void *priv, struct ieee80211_supported_band *sband, */ rate = minstrel_get_ratestats(mi, mi->max_tp_rate[0]); if (rate->attempts > 30 && - MINSTREL_FRAC(rate->success, rate->attempts) < - MINSTREL_FRAC(20, 100)) { + rate->success < rate->attempts / 4) { minstrel_downgrade_rate(mi, &mi->max_tp_rate[0], true); update = true; } rate2 = minstrel_get_ratestats(mi, mi->max_tp_rate[1]); if (rate2->attempts > 30 && - MINSTREL_FRAC(rate2->success, rate2->attempts) < - MINSTREL_FRAC(20, 100)) { + rate2->success < rate2->attempts / 4) { minstrel_downgrade_rate(mi, &mi->max_tp_rate[1], false); update = true; } } if (time_after(jiffies, mi->last_stats_update + - (mp->update_interval / 2 * HZ) / 1000)) { + mp->update_interval / 2)) { update = true; minstrel_ht_update_stats(mp, mi, true); } @@ -1666,7 +1664,7 @@ minstrel_ht_alloc(struct ieee80211_hw *hw, struct dentry *debugfsdir) mp->has_mrr = true; mp->hw = hw; - mp->update_interval = 100; + mp->update_interval = HZ / 10; #ifdef CONFIG_MAC80211_DEBUGFS mp->fixed_rate_idx = (u32) -1; -- 2.17.0