aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/net/wireless/mac80211_hwsim.c28
-rw-r--r--include/net/mac80211.h3
-rw-r--r--net/mac80211/cfg.c12
-rw-r--r--net/mac80211/driver-ops.h9
4 files changed, 51 insertions, 1 deletions
diff --git a/drivers/net/wireless/mac80211_hwsim.c b/drivers/net/wireless/mac80211_hwsim.c
index ec8b08291790..79bb8833ddb9 100644
--- a/drivers/net/wireless/mac80211_hwsim.c
+++ b/drivers/net/wireless/mac80211_hwsim.c
@@ -829,6 +829,33 @@ static int mac80211_hwsim_conf_tx(
829 return 0; 829 return 0;
830} 830}
831 831
832static int mac80211_hwsim_get_survey(
833 struct ieee80211_hw *hw, int idx,
834 struct survey_info *survey)
835{
836 struct ieee80211_conf *conf = &hw->conf;
837
838 printk(KERN_DEBUG "%s:%s (idx=%d)\n",
839 wiphy_name(hw->wiphy), __func__, idx);
840
841 if (idx != 0)
842 return -ENOENT;
843
844 /* Current channel */
845 survey->channel = conf->channel;
846
847 /*
848 * Magically conjured noise level --- this is only ok for simulated hardware.
849 *
850 * A real driver which cannot determine the real channel noise MUST NOT
851 * report any noise, especially not a magically conjured one :-)
852 */
853 survey->filled = SURVEY_INFO_NOISE_DBM;
854 survey->noise = -92;
855
856 return 0;
857}
858
832#ifdef CONFIG_NL80211_TESTMODE 859#ifdef CONFIG_NL80211_TESTMODE
833/* 860/*
834 * This section contains example code for using netlink 861 * This section contains example code for using netlink
@@ -1012,6 +1039,7 @@ static struct ieee80211_ops mac80211_hwsim_ops =
1012 .sta_notify = mac80211_hwsim_sta_notify, 1039 .sta_notify = mac80211_hwsim_sta_notify,
1013 .set_tim = mac80211_hwsim_set_tim, 1040 .set_tim = mac80211_hwsim_set_tim,
1014 .conf_tx = mac80211_hwsim_conf_tx, 1041 .conf_tx = mac80211_hwsim_conf_tx,
1042 .get_survey = mac80211_hwsim_get_survey,
1015 CFG80211_TESTMODE_CMD(mac80211_hwsim_testmode_cmd) 1043 CFG80211_TESTMODE_CMD(mac80211_hwsim_testmode_cmd)
1016 .ampdu_action = mac80211_hwsim_ampdu_action, 1044 .ampdu_action = mac80211_hwsim_ampdu_action,
1017 .sw_scan_start = mac80211_hwsim_sw_scan, 1045 .sw_scan_start = mac80211_hwsim_sw_scan,
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index 63e9d37e3e71..cd9915686dd9 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -1674,7 +1674,8 @@ struct ieee80211_ops {
1674 struct ieee80211_vif *vif, 1674 struct ieee80211_vif *vif,
1675 enum ieee80211_ampdu_mlme_action action, 1675 enum ieee80211_ampdu_mlme_action action,
1676 struct ieee80211_sta *sta, u16 tid, u16 *ssn); 1676 struct ieee80211_sta *sta, u16 tid, u16 *ssn);
1677 1677 int (*get_survey)(struct ieee80211_hw *hw, int idx,
1678 struct survey_info *survey);
1678 void (*rfkill_poll)(struct ieee80211_hw *hw); 1679 void (*rfkill_poll)(struct ieee80211_hw *hw);
1679 void (*set_coverage_class)(struct ieee80211_hw *hw, u8 coverage_class); 1680 void (*set_coverage_class)(struct ieee80211_hw *hw, u8 coverage_class);
1680#ifdef CONFIG_NL80211_TESTMODE 1681#ifdef CONFIG_NL80211_TESTMODE
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index 4edd73cbf052..f97dda735cbb 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -410,6 +410,17 @@ static int ieee80211_dump_station(struct wiphy *wiphy, struct net_device *dev,
410 return ret; 410 return ret;
411} 411}
412 412
413static int ieee80211_dump_survey(struct wiphy *wiphy, struct net_device *dev,
414 int idx, struct survey_info *survey)
415{
416 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
417
418 if (!local->ops->get_survey)
419 return -EOPNOTSUPP;
420
421 return drv_get_survey(local, idx, survey);
422}
423
413static int ieee80211_get_station(struct wiphy *wiphy, struct net_device *dev, 424static int ieee80211_get_station(struct wiphy *wiphy, struct net_device *dev,
414 u8 *mac, struct station_info *sinfo) 425 u8 *mac, struct station_info *sinfo)
415{ 426{
@@ -1507,6 +1518,7 @@ struct cfg80211_ops mac80211_config_ops = {
1507 .change_station = ieee80211_change_station, 1518 .change_station = ieee80211_change_station,
1508 .get_station = ieee80211_get_station, 1519 .get_station = ieee80211_get_station,
1509 .dump_station = ieee80211_dump_station, 1520 .dump_station = ieee80211_dump_station,
1521 .dump_survey = ieee80211_dump_survey,
1510#ifdef CONFIG_MAC80211_MESH 1522#ifdef CONFIG_MAC80211_MESH
1511 .add_mpath = ieee80211_add_mpath, 1523 .add_mpath = ieee80211_add_mpath,
1512 .del_mpath = ieee80211_del_mpath, 1524 .del_mpath = ieee80211_del_mpath,
diff --git a/net/mac80211/driver-ops.h b/net/mac80211/driver-ops.h
index c3d844093a2f..d1f8a7c2225a 100644
--- a/net/mac80211/driver-ops.h
+++ b/net/mac80211/driver-ops.h
@@ -346,6 +346,15 @@ static inline int drv_ampdu_action(struct ieee80211_local *local,
346 return ret; 346 return ret;
347} 347}
348 348
349static inline int drv_get_survey(struct ieee80211_local *local, int idx,
350 struct survey_info *survey)
351{
352 int ret = -EOPNOTSUPP;
353 if (local->ops->conf_tx)
354 ret = local->ops->get_survey(&local->hw, idx, survey);
355 /* trace_drv_get_survey(local, idx, survey, ret); */
356 return ret;
357}
349 358
350static inline void drv_rfkill_poll(struct ieee80211_local *local) 359static inline void drv_rfkill_poll(struct ieee80211_local *local)
351{ 360{