diff options
author | Antonio Quartulli <antonio@open-mesh.com> | 2014-05-19 15:53:20 -0400 |
---|---|---|
committer | Johannes Berg <johannes.berg@intel.com> | 2014-05-21 03:15:16 -0400 |
commit | cca674d47e59665630f3005291b61bb883015fc5 (patch) | |
tree | bd83cc2c0b576cdc7adae72ca7c170c1e1648fa8 /net/mac80211/rc80211_minstrel.c | |
parent | 867d849fc844623a88ec7b380442952b5ffe5e68 (diff) |
mac80211: export the expected throughput
Add get_expected_throughput() API to mac80211 so that each
driver can implement its own version based on the RC
algorithm they are using (might be using an HW RC algo).
The API returns a value expressed in Kbps.
Also, add the new get_expected_throughput() member
to the rate_control_ops structure in order to be
able to query the RC algorithm (this patch provides an
implementation of this API for both minstrel and
minstrel_ht).
The related member in the station_info object is now
filled accordingly when dumping a station.
Cc: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: Antonio Quartulli <antonio@open-mesh.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net/mac80211/rc80211_minstrel.c')
-rw-r--r-- | net/mac80211/rc80211_minstrel.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/net/mac80211/rc80211_minstrel.c b/net/mac80211/rc80211_minstrel.c index 26fd94fa0aed..1c1469c36dca 100644 --- a/net/mac80211/rc80211_minstrel.c +++ b/net/mac80211/rc80211_minstrel.c | |||
@@ -657,6 +657,17 @@ minstrel_free(void *priv) | |||
657 | kfree(priv); | 657 | kfree(priv); |
658 | } | 658 | } |
659 | 659 | ||
660 | static u32 minstrel_get_expected_throughput(void *priv_sta) | ||
661 | { | ||
662 | struct minstrel_sta_info *mi = priv_sta; | ||
663 | int idx = mi->max_tp_rate[0]; | ||
664 | |||
665 | /* convert pkt per sec in kbps (1200 is the average pkt size used for | ||
666 | * computing cur_tp | ||
667 | */ | ||
668 | return MINSTREL_TRUNC(mi->r[idx].cur_tp) * 1200 * 8 / 1024; | ||
669 | } | ||
670 | |||
660 | const struct rate_control_ops mac80211_minstrel = { | 671 | const struct rate_control_ops mac80211_minstrel = { |
661 | .name = "minstrel", | 672 | .name = "minstrel", |
662 | .tx_status = minstrel_tx_status, | 673 | .tx_status = minstrel_tx_status, |
@@ -670,6 +681,7 @@ const struct rate_control_ops mac80211_minstrel = { | |||
670 | .add_sta_debugfs = minstrel_add_sta_debugfs, | 681 | .add_sta_debugfs = minstrel_add_sta_debugfs, |
671 | .remove_sta_debugfs = minstrel_remove_sta_debugfs, | 682 | .remove_sta_debugfs = minstrel_remove_sta_debugfs, |
672 | #endif | 683 | #endif |
684 | .get_expected_throughput = minstrel_get_expected_throughput, | ||
673 | }; | 685 | }; |
674 | 686 | ||
675 | int __init | 687 | int __init |