@@ -4147,6 +4147,8 @@ struct rate_control_ops {
void (*add_sta_debugfs)(void *priv, void *priv_sta,
struct dentry *dir);
void (*remove_sta_debugfs)(void *priv, void *priv_sta);
+
+ void (*get_max_tp)(void *priv_sta, u32 *tp);
};
static inline int rate_supported(struct ieee80211_sta *sta,
@@ -604,6 +604,14 @@ minstrel_free(void *priv)
kfree(priv);
}
+static void minstrel_get_max_tp(void *priv_sta, u32 *tp)
+{
+ struct minstrel_sta_info *mi = priv_sta;
+ int idx = mi->max_tp_rate[0];
+
+ *tp = MINSTREL_TRUNC(mi->r[idx].cur_tp / 10);
+}
+
struct rate_control_ops mac80211_minstrel = {
.name = "minstrel",
.tx_status = minstrel_tx_status,
@@ -617,6 +625,7 @@ struct rate_control_ops mac80211_minstrel = {
.add_sta_debugfs = minstrel_add_sta_debugfs,
.remove_sta_debugfs = minstrel_remove_sta_debugfs,
#endif
+ .get_max_tp = minstrel_get_max_tp,
};
int __init
@@ -960,6 +960,26 @@ error:
return NULL;
}
+static void minstrel_ht_get_max_tp(void *priv_sta, u32 *tp)
+{
+ struct minstrel_ht_sta_priv *msp = priv_sta;
+ struct minstrel_ht_sta *mi = &msp->ht;
+ struct minstrel_rate_stats *mr;
+ int i, j;
+
+ if (!msp->is_ht) {
+ mac80211_minstrel.get_max_tp(priv_sta, tp);
+ return;
+ }
+
+ i = mi->max_tp_rate / MCS_GROUP_RATES;
+ j = mi->max_tp_rate % MCS_GROUP_RATES;
+
+ mr = &mi->groups[i].rates[j];
+
+ *tp = mr->cur_tp / 10;
+}
+
static void
minstrel_ht_free_sta(void *priv, struct ieee80211_sta *sta, void *priv_sta)
{
@@ -996,6 +1016,7 @@ static struct rate_control_ops mac80211_minstrel_ht = {
.add_sta_debugfs = minstrel_ht_add_sta_debugfs,
.remove_sta_debugfs = minstrel_ht_remove_sta_debugfs,
#endif
+ .get_max_tp = minstrel_ht_get_max_tp,
};
This new API is aimed to return the maximum throughput estimated by a rate control algorithm towards a given peer. The API is implemented for minstrel and minstrel_ht. Signed-off-by: Antonio Quartulli <antonio@open-mesh.com> --- include/net/mac80211.h | 2 ++ net/mac80211/rc80211_minstrel.c | 9 +++++++++ net/mac80211/rc80211_minstrel_ht.c | 21 +++++++++++++++++++++ 3 files changed, 32 insertions(+)