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: 3910071 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.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 1491C9F1E1 for ; Sun, 30 Mar 2014 20:35:56 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 4082620166 for ; Sun, 30 Mar 2014 20:35:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 76B5A2015E for ; Sun, 30 Mar 2014 20:35:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752581AbaC3Ufr (ORCPT ); Sun, 30 Mar 2014 16:35:47 -0400 Received: from s3.neomailbox.net ([178.209.62.157]:17402 "EHLO s3.neomailbox.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752515AbaC3Ufj (ORCPT ); Sun, 30 Mar 2014 16:35:39 -0400 From: Antonio Quartulli To: Johannes Berg Cc: b.a.t.m.a.n@lists.open-mesh.org, linux-wireless@vger.kernel.org, devel@lists.open80211s.org, Antonio Quartulli , Felix Fietkau Subject: [RFCv2 4/6] mac80211: minstrel - implement get_expected_throughput() API 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> 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.4 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, 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 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