diff mbox

[3/3] mac80211: implement cfg80211_ops::get_max_tp() API

Message ID 1365105442-31876-3-git-send-email-antonio@open-mesh.com (mailing list archive)
State Not Applicable, archived
Headers show

Commit Message

Antonio Quartulli April 4, 2013, 7:57 p.m. UTC
Implement the get_max_tp() API function by asking the
rate control algorithm for the maximum estimated throughput

Signed-off-by: Antonio Quartulli <antonio@open-mesh.com>
---
 net/mac80211/cfg.c | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)
diff mbox

Patch

diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index edca2a2..2a78957 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -3374,6 +3374,27 @@  static int ieee80211_cfg_get_channel(struct wiphy *wiphy,
 	return ret;
 }
 
+int ieee80211_get_max_tp(struct wireless_dev *wdev, const u8 *peer, u32 *tp)
+{
+	struct ieee80211_sub_if_data *sdata = IEEE80211_WDEV_TO_SUB_IF(wdev);
+	struct rate_control_ref *ref = sdata->local->rate_ctrl;
+	struct sta_info *sta;
+
+	rcu_read_lock();
+	sta = sta_info_get(sdata, peer);
+	rcu_read_unlock();
+
+	if (!sta)
+		return -ENOENT;
+
+	if (!ref->ops->get_max_tp)
+		return -EOPNOTSUPP;
+
+	ref->ops->get_max_tp(sta->rate_ctrl_priv, tp);
+
+	return 0;
+}
+
 #ifdef CONFIG_PM
 static void ieee80211_set_wakeup(struct wiphy *wiphy, bool enabled)
 {
@@ -3459,4 +3480,5 @@  struct cfg80211_ops mac80211_config_ops = {
 	.get_et_strings = ieee80211_get_et_strings,
 	.get_channel = ieee80211_cfg_get_channel,
 	.start_radar_detection = ieee80211_start_radar_detection,
+	.get_max_tp = ieee80211_get_max_tp,
 };