aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohannes Berg <johannes.berg@intel.com>2012-07-12 13:45:08 -0400
committerJohannes Berg <johannes.berg@intel.com>2012-07-13 10:16:11 -0400
commit5b7ccaf3fc7446e42b83a77fd7aa7ad92850acdd (patch)
treee87b3f28cdfe513de4f3527fabaaacca63eedc24
parent075e08477d51709ae1998a05c35aadf59ef823b9 (diff)
cfg80211/mac80211: re-add get_channel operation
This essentially reverts commit 2e165b818456 but introduces the get_channel operation with a new wireless_dev argument so that you can retrieve the channel per interface. This is necessary as even though we can track all interface channels (except monitor) we can't track the channel type used. Signed-off-by: Johannes Berg <johannes.berg@intel.com>
-rw-r--r--include/net/cfg80211.h9
-rw-r--r--net/mac80211/cfg.c11
-rw-r--r--net/wireless/nl80211.c16
-rw-r--r--net/wireless/wext-compat.c9
4 files changed, 38 insertions, 7 deletions
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index 5a67165f3b1..8115d68eb60 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -1612,6 +1612,10 @@ struct cfg80211_gtk_rekey_data {
1612 * @get_et_strings: Ethtool API to get a set of strings to describe stats 1612 * @get_et_strings: Ethtool API to get a set of strings to describe stats
1613 * and perhaps other supported types of ethtool data-sets. 1613 * and perhaps other supported types of ethtool data-sets.
1614 * See @ethtool_ops.get_strings 1614 * See @ethtool_ops.get_strings
1615 *
1616 * @get_channel: Get the current operating channel for the virtual interface.
1617 * For monitor interfaces, it should return %NULL unless there's a single
1618 * current monitoring channel.
1615 */ 1619 */
1616struct cfg80211_ops { 1620struct cfg80211_ops {
1617 int (*suspend)(struct wiphy *wiphy, struct cfg80211_wowlan *wow); 1621 int (*suspend)(struct wiphy *wiphy, struct cfg80211_wowlan *wow);
@@ -1821,6 +1825,11 @@ struct cfg80211_ops {
1821 u32 sset, u8 *data); 1825 u32 sset, u8 *data);
1822 1826
1823 void (*set_monitor_enabled)(struct wiphy *wiphy, bool enabled); 1827 void (*set_monitor_enabled)(struct wiphy *wiphy, bool enabled);
1828
1829 struct ieee80211_channel *
1830 (*get_channel)(struct wiphy *wiphy,
1831 struct wireless_dev *wdev,
1832 enum nl80211_channel_type *type);
1824}; 1833};
1825 1834
1826/* 1835/*
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index e95f24eef87..10dd9631e4d 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -2982,6 +2982,16 @@ static int ieee80211_probe_client(struct wiphy *wiphy, struct net_device *dev,
2982 return 0; 2982 return 0;
2983} 2983}
2984 2984
2985static struct ieee80211_channel *
2986ieee80211_cfg_get_channel(struct wiphy *wiphy, struct wireless_dev *wdev,
2987 enum nl80211_channel_type *type)
2988{
2989 struct ieee80211_local *local = wiphy_priv(wiphy);
2990
2991 *type = local->_oper_channel_type;
2992 return local->oper_channel;
2993}
2994
2985#ifdef CONFIG_PM 2995#ifdef CONFIG_PM
2986static void ieee80211_set_wakeup(struct wiphy *wiphy, bool enabled) 2996static void ieee80211_set_wakeup(struct wiphy *wiphy, bool enabled)
2987{ 2997{
@@ -3062,4 +3072,5 @@ struct cfg80211_ops mac80211_config_ops = {
3062 .get_et_sset_count = ieee80211_get_et_sset_count, 3072 .get_et_sset_count = ieee80211_get_et_sset_count,
3063 .get_et_stats = ieee80211_get_et_stats, 3073 .get_et_stats = ieee80211_get_et_stats,
3064 .get_et_strings = ieee80211_get_et_strings, 3074 .get_et_strings = ieee80211_get_et_strings,
3075 .get_channel = ieee80211_cfg_get_channel,
3065}; 3076};
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index 079fc49e397..6b001e44571 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -1759,11 +1759,17 @@ static int nl80211_send_iface(struct sk_buff *msg, u32 pid, u32 seq, int flags,
1759 (cfg80211_rdev_list_generation << 2))) 1759 (cfg80211_rdev_list_generation << 2)))
1760 goto nla_put_failure; 1760 goto nla_put_failure;
1761 1761
1762 if (rdev->monitor_channel) { 1762 if (rdev->ops->get_channel) {
1763 if (nla_put_u32(msg, NL80211_ATTR_WIPHY_FREQ, 1763 struct ieee80211_channel *chan;
1764 rdev->monitor_channel->center_freq) || 1764 enum nl80211_channel_type channel_type;
1765 nla_put_u32(msg, NL80211_ATTR_WIPHY_CHANNEL_TYPE, 1765
1766 rdev->monitor_channel_type)) 1766 chan = rdev->ops->get_channel(&rdev->wiphy, wdev,
1767 &channel_type);
1768 if (chan &&
1769 (nla_put_u32(msg, NL80211_ATTR_WIPHY_FREQ,
1770 chan->center_freq) ||
1771 nla_put_u32(msg, NL80211_ATTR_WIPHY_CHANNEL_TYPE,
1772 channel_type)))
1767 goto nla_put_failure; 1773 goto nla_put_failure;
1768 } 1774 }
1769 1775
diff --git a/net/wireless/wext-compat.c b/net/wireless/wext-compat.c
index 7df42f54187..494379eb464 100644
--- a/net/wireless/wext-compat.c
+++ b/net/wireless/wext-compat.c
@@ -827,6 +827,8 @@ static int cfg80211_wext_giwfreq(struct net_device *dev,
827{ 827{
828 struct wireless_dev *wdev = dev->ieee80211_ptr; 828 struct wireless_dev *wdev = dev->ieee80211_ptr;
829 struct cfg80211_registered_device *rdev = wiphy_to_dev(wdev->wiphy); 829 struct cfg80211_registered_device *rdev = wiphy_to_dev(wdev->wiphy);
830 struct ieee80211_channel *chan;
831 enum nl80211_channel_type channel_type;
830 832
831 switch (wdev->iftype) { 833 switch (wdev->iftype) {
832 case NL80211_IFTYPE_STATION: 834 case NL80211_IFTYPE_STATION:
@@ -834,10 +836,13 @@ static int cfg80211_wext_giwfreq(struct net_device *dev,
834 case NL80211_IFTYPE_ADHOC: 836 case NL80211_IFTYPE_ADHOC:
835 return cfg80211_ibss_wext_giwfreq(dev, info, freq, extra); 837 return cfg80211_ibss_wext_giwfreq(dev, info, freq, extra);
836 case NL80211_IFTYPE_MONITOR: 838 case NL80211_IFTYPE_MONITOR:
837 if (!rdev->monitor_channel) 839 if (!rdev->ops->get_channel)
838 return -EINVAL; 840 return -EINVAL;
839 841
840 freq->m = rdev->monitor_channel->center_freq; 842 chan = rdev->ops->get_channel(wdev->wiphy, wdev, &channel_type);
843 if (!chan)
844 return -EINVAL;
845 freq->m = chan->center_freq;
841 freq->e = 6; 846 freq->e = 6;
842 return 0; 847 return 0;
843 default: 848 default: