From patchwork Mon Feb 1 22:00:16 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sven Eckelmann X-Patchwork-Id: 8183881 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 CE8C59F3CD for ; Mon, 1 Feb 2016 22:00:35 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id EFB9E20381 for ; Mon, 1 Feb 2016 22:00:34 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1760720375 for ; Mon, 1 Feb 2016 22:00:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932385AbcBAWAc (ORCPT ); Mon, 1 Feb 2016 17:00:32 -0500 Received: from mail-wm0-f52.google.com ([74.125.82.52]:38704 "EHLO mail-wm0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932285AbcBAWAc (ORCPT ); Mon, 1 Feb 2016 17:00:32 -0500 Received: by mail-wm0-f52.google.com with SMTP id p63so92040427wmp.1 for ; Mon, 01 Feb 2016 14:00:31 -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=4GSVgvJKXD+kEx0YDanNk8rT6aDAbjghpgbLRJ55yDI=; b=n5CuwhfH5uMPd7S6CBpFGc4z8dzqeF8/23suHnl04DwAHMycCLdOes1gSz5x8Nj9ZZ RANSDW04E3l0b7xWobQ2inaWqU8dqajjyp0Wvhkvm6pM55swh78nybxIXhCGgn+xWPAZ /ni4iyl6yoH7asLm2RxxgXT6cV5LmWnqJSabzYS6hhiUNeISuedN5c8r5A3ob/W5qV6F 5vTYgR8G27d4LfHi6wz+L/tfRoxMfLPqj/0Rl76/6zuyjMJkGwmuvioT0ji3wQ6b6t0u G+YwpHIK8DAx7+s1Lbu5c08/ZX5DiNpmI+JOOmcjKABTeVBb5ssSCRVjJ6uWZ0WbIvX7 ezIA== 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=4GSVgvJKXD+kEx0YDanNk8rT6aDAbjghpgbLRJ55yDI=; b=MWxlIgicdlQ+799XA2MUooE5cpnl0j63+Nc1woNQvZDPi6VWfmsjQ8xkredRXZTWvD PBFQ5aGq8ccnbpbXiDFhE36/CLrEuEbGtUqjDGtnZwwzsLZeaX0soO3oWnHTAFTFUGfM EsTCH+a+7kS55HNYW5UXIuuVRrMzAdRNIVFogFDYVme2Rcj75NzzmbIIk0SIfxLMjtwh nMaKsfUuegd9/y5SjdESNHRFHt7LZjWjQK/VvPhCpuv/muwVAU20HhzR0P5mp3+yu6/4 69havf+DTDhWn2m+Hk0XZNLlMWihb1x8Y5dTAore1wCQIQssT1BtasoChT/V1IREntfp zc6w== X-Gm-Message-State: AG10YORPJvPdc5ZnSjU3vmP0IdBP4PcLVFPzxc+r4D8q14dOz5SAvzqxM82EGXD81jGsgSrs X-Received: by 10.195.11.35 with SMTP id ef3mr24565774wjd.35.1454364030788; Mon, 01 Feb 2016 14:00:30 -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 q75sm13484538wmd.6.2016.02.01.14.00.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 01 Feb 2016 14:00:29 -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: [PATCHv3] mac80211: minstrel: Change expected throughput unit back to Kbps Date: Mon, 1 Feb 2016 23:00:16 +0100 Message-Id: <1454364016-3234-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; }