[5/7] mac80211: minstrel - implement get_expected_throughput() API
Commit Message
From: Antonio Quartulli <antonio@open-mesh.com>
Cc: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: Antonio Quartulli <antonio@open-mesh.com>
---
net/mac80211/rc80211_minstrel.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
Comments
On Mon, 2014-04-14 at 16:03 +0200, Antonio Quartulli wrote:
> From: Antonio Quartulli <antonio@open-mesh.com>
>
> Cc: Felix Fietkau <nbd@openwrt.org>
> Signed-off-by: Antonio Quartulli <antonio@open-mesh.com>
> ---
> net/mac80211/rc80211_minstrel.c | 13 +++++++++++++
> 1 file changed, 13 insertions(+)
>
> diff --git a/net/mac80211/rc80211_minstrel.c b/net/mac80211/rc80211_minstrel.c
> index 26fd94f..cd40bc0 100644
> --- a/net/mac80211/rc80211_minstrel.c
> +++ b/net/mac80211/rc80211_minstrel.c
> @@ -657,6 +657,18 @@ 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;
> + return bitrate * MINSTREL_TRUNC(mi->r[idx].probability * 1000) / 100;
/100? didn't you say minstrel already used your units?
johannes
On 25/04/14 17:46, Johannes Berg wrote:
> On Mon, 2014-04-14 at 16:03 +0200, Antonio Quartulli wrote:
>> From: Antonio Quartulli <antonio@open-mesh.com>
>>
>> Cc: Felix Fietkau <nbd@openwrt.org>
>> Signed-off-by: Antonio Quartulli <antonio@open-mesh.com>
>> ---
>> net/mac80211/rc80211_minstrel.c | 13 +++++++++++++
>> 1 file changed, 13 insertions(+)
>>
>> diff --git a/net/mac80211/rc80211_minstrel.c b/net/mac80211/rc80211_minstrel.c
>> index 26fd94f..cd40bc0 100644
>> --- a/net/mac80211/rc80211_minstrel.c
>> +++ b/net/mac80211/rc80211_minstrel.c
>> @@ -657,6 +657,18 @@ 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;
>> + return bitrate * MINSTREL_TRUNC(mi->r[idx].probability * 1000) / 100;
>
> /100? didn't you say minstrel already used your units?
MinstrelHT does, Minstrel does not...
Cheers,
@@ -657,6 +657,18 @@ 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;
+ return bitrate * MINSTREL_TRUNC(mi->r[idx].probability * 1000) / 100;
+}
+
const struct rate_control_ops mac80211_minstrel = {
.name = "minstrel",
.tx_status = minstrel_tx_status,
@@ -670,6 +682,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