From patchwork Sun Mar 30 20:35:02 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Antonio Quartulli X-Patchwork-Id: 3970 Return-Path: Received: from s3.neomailbox.net (s3.neomailbox.net [178.209.62.157]) by open-mesh.org (Postfix) with ESMTPS id 42441602268 for ; Sun, 30 Mar 2014 22:35:38 +0200 (CEST) From: Antonio Quartulli To: Johannes Berg Date: Sun, 30 Mar 2014 22:35:02 +0200 Message-Id: <1396211704-4677-5-git-send-email-antonio@meshcoding.com> In-Reply-To: <1396211704-4677-1-git-send-email-antonio@meshcoding.com> References: <1396211704-4677-1-git-send-email-antonio@meshcoding.com> Cc: devel@lists.open80211s.org, Felix Fietkau , b.a.t.m.a.n@lists.open-mesh.org, linux-wireless@vger.kernel.org, Antonio Quartulli Subject: [B.A.T.M.A.N.] [RFCv2 4/6] mac80211: minstrel - implement get_expected_throughput() API X-BeenThere: b.a.t.m.a.n@lists.open-mesh.org X-Mailman-Version: 2.1.15 Precedence: list Reply-To: The list for a Better Approach To Mobile Ad-hoc Networking List-Id: The list for a Better Approach To Mobile Ad-hoc Networking List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 30 Mar 2014 20:35:38 -0000 From: Antonio Quartulli Cc: Felix Fietkau Signed-off-by: Antonio Quartulli --- net/mac80211/rc80211_minstrel.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/net/mac80211/rc80211_minstrel.c b/net/mac80211/rc80211_minstrel.c index 26fd94f..9434435d 100644 --- a/net/mac80211/rc80211_minstrel.c +++ b/net/mac80211/rc80211_minstrel.c @@ -657,6 +657,20 @@ minstrel_free(void *priv) kfree(priv); } +static u32 +minstrel_get_expected_throughput(void *priv, void *priv_sta, + struct ieee80211_supported_band *sband) +{ + struct minstrel_sta_info *mi = priv_sta; + int idx = mi->max_tp_rate[0]; + u32 bitrate, ret; + + bitrate = sband->bitrates[mi->r[idx].rix].bitrate; + ret = bitrate * MINSTREL_TRUNC(mi->r[idx].probability * 1000) / 1000; + + return ret; +} + const struct rate_control_ops mac80211_minstrel = { .name = "minstrel", .tx_status = minstrel_tx_status, @@ -670,6 +684,7 @@ const struct rate_control_ops mac80211_minstrel = { .add_sta_debugfs = minstrel_add_sta_debugfs, .remove_sta_debugfs = minstrel_remove_sta_debugfs, #endif + .get_expected_throughput = minstrel_get_expected_throughput, }; int __init