From patchwork Mon Feb 1 21:59:38 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sven Eckelmann X-Patchwork-Id: 8183871 X-Patchwork-Delegate: johannes@sipsolutions.net Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 52B8E9F3CD for ; Mon, 1 Feb 2016 21:59:53 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 6FDA320381 for ; Mon, 1 Feb 2016 21:59:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 66B8620375 for ; Mon, 1 Feb 2016 21:59:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932306AbcBAV7t (ORCPT ); Mon, 1 Feb 2016 16:59:49 -0500 Received: from mail-wm0-f45.google.com ([74.125.82.45]:32815 "EHLO mail-wm0-f45.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932285AbcBAV7s (ORCPT ); Mon, 1 Feb 2016 16:59:48 -0500 Received: by mail-wm0-f45.google.com with SMTP id l66so90781318wml.0 for ; Mon, 01 Feb 2016 13:59:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=open-mesh-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id; bh=tSCrt8uhI3ei0k2dQGuFfx4QG0EpJAGY8RzDfGnpCBI=; b=hBM0l9HyEfuXyzMPgtXqB65O/uhGZ6iyaopJ/2n7hATLe8c7NmXpGQ9xCGabsyNIac CS9mfk+Rldo+ZMc9ruvqIM26C/E3KkOOZCaYauLYuve2eweaMgOS7W8owcKnjnRB4rCV GIDtlvZwfOd4ywSrX6HhR26A4cK+EvGxKF1l8YtiMDXTqWpqBX20d8G0QlplLixm1oAv erWXMT1jcPbAXkEPADuTGwzW5IZhiPsi8PtRlCj6X+IpGijPdJyK2wILynjTyoLy0inf JhomHemV48UqgOubfz4n9p2Cv9aJTGq6/OnTHU7ziKcpkZ+t2byg+shcpW/yGsiFfaKG tWmA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=tSCrt8uhI3ei0k2dQGuFfx4QG0EpJAGY8RzDfGnpCBI=; b=IsQCND+f27kbHaal8mcRvg23uS+i/TXupLRR57IYk7w8Fa+r0SWME6Xv67+EG5nFIp jeNBQgEiQ+N/2BvUx1r6q1pNCFSjcArSVaUZcHZmk7xyBMs5qR9wB3D1d2xQh649PZHW nCtSZPZNDh5lymTJpPVJOwtIcp9ljXQA6vy3KSsAkoYmLvy5jRMcHcIIUqtUteL+RQOy QUUUZJnyWS+mNTxv+q46zoQRlRbvfePhAV9or/tnJeX1X8dyT9kaQ1M5kWKMzX/7SCSb z1mUTfMRYo/cJICZN+WBWRCPJDZIZpuOF27sEFQpkw50Fk0+Q/Y7vBY73MGG/BC/6w4+ lwkg== X-Gm-Message-State: AG10YOQIqaM9zzMDwFX+J9UmGECzjsE3rdDzJYDaSh55KF0eDNAyXCyPea4wlMowCDNeAsII X-Received: by 10.28.148.68 with SMTP id w65mr14703525wmd.66.1454363987409; Mon, 01 Feb 2016 13:59:47 -0800 (PST) Received: from sven-desktop.home.narfation.org (p200300C593C056FD0000000000002E16.dip0.t-ipconnect.de. [2003:c5:93c0:56fd::2e16]) by smtp.gmail.com with ESMTPSA id i12sm2577080wmf.10.2016.02.01.13.59.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 01 Feb 2016 13:59:46 -0800 (PST) From: Sven Eckelmann To: linux-wireless@vger.kernel.org Cc: thomas@net.t-labs.tu-berlin.de, antonio@open-mesh.com, nbd@nbd.name, johannes@sipsolutions.net, Sven Eckelmann Subject: [PATCH] mac80211: minstrel: Change expected throughput unit back to Kbps Date: Mon, 1 Feb 2016 22:59:38 +0100 Message-Id: <1454363978-3176-1-git-send-email-sven@open-mesh.com> X-Mailer: git-send-email 2.7.0 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Spam-Status: No, score=-7.3 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The change from cur_tp to the function minstrel_get_tp_avg/minstrel_ht_get_tp_avg changed the unit used for the current throughput. For example in minstrel_ht the correct conversion between them would be: mrs->cur_tp / 10 == minstrel_ht_get_tp_avg(..). This factor 10 must also be included in the calculation of minstrel_get_expected_throughput and minstrel_ht_get_expected_throughput to return values with the unit [Kbps] instead of [10Kbps]. Otherwise routing algorithms like B.A.T.M.A.N. V will make incorrect decision based on these values. Its kernel based implementation expects expected_throughput always to have the unit [Kbps] and not sometimes [10Kbps] and sometimes [Kbps]. The same requirement has iw or olsrdv2's nl80211 based statistics module which retrieve the same data via NL80211_STA_INFO_TX_BITRATE. Fixes: 6a27b2c40b48 ("mac80211: restructure per-rate throughput calculation into function") Signed-off-by: Sven Eckelmann --- v3: - fix typo in title - extend description to better explain why this is important v2: - Modified PATCH title --- net/mac80211/rc80211_minstrel.c | 2 +- net/mac80211/rc80211_minstrel_ht.c | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/net/mac80211/rc80211_minstrel.c b/net/mac80211/rc80211_minstrel.c index 3ece7d1..b54f398 100644 --- a/net/mac80211/rc80211_minstrel.c +++ b/net/mac80211/rc80211_minstrel.c @@ -711,7 +711,7 @@ static u32 minstrel_get_expected_throughput(void *priv_sta) * computing cur_tp */ tmp_mrs = &mi->r[idx].stats; - tmp_cur_tp = minstrel_get_tp_avg(&mi->r[idx], tmp_mrs->prob_ewma); + tmp_cur_tp = minstrel_get_tp_avg(&mi->r[idx], tmp_mrs->prob_ewma) * 10; tmp_cur_tp = tmp_cur_tp * 1200 * 8 / 1024; return tmp_cur_tp; diff --git a/net/mac80211/rc80211_minstrel_ht.c b/net/mac80211/rc80211_minstrel_ht.c index 3928dbd..8928151 100644 --- a/net/mac80211/rc80211_minstrel_ht.c +++ b/net/mac80211/rc80211_minstrel_ht.c @@ -1334,7 +1334,8 @@ static u32 minstrel_ht_get_expected_throughput(void *priv_sta) prob = mi->groups[i].rates[j].prob_ewma; /* convert tp_avg from pkt per second in kbps */ - tp_avg = minstrel_ht_get_tp_avg(mi, i, j, prob) * AVG_PKT_SIZE * 8 / 1024; + tp_avg = minstrel_ht_get_tp_avg(mi, i, j, prob) * 10; + tp_avg *= AVG_PKT_SIZE * 8 / 1024; return tp_avg; }