Message ID | 1396211704-4677-5-git-send-email-antonio@meshcoding.com (mailing list archive) |
---|---|
State | Not Applicable, archived |
Headers | show |
On 30/03/14 22:35, Antonio Quartulli wrote: > +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; Thanks to the point raised by Andrew Lunn I just realised that this value is expressed in Mbps/10 and so should be converted to Mbps/100 before being returned (assuming we agree on using this unit). Cheers,
On Sun, 2014-03-30 at 22:35 +0200, Antonio Quartulli wrote: > +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; You don't need a ret variable. johannes -- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On 08/04/14 12:05, Johannes Berg wrote: > On Sun, 2014-03-30 at 22:35 +0200, Antonio Quartulli wrote: > >> +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; > > You don't need a ret variable. True. thanks!
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