Search Linux Wireless

[PATCH 1/9] [mac80211] add method to access oper chan

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I'm really not sure about this.. is there another/better way to
access the current channel last set on a wiphy?

Signed-off-by: Bernhard Schmidt <bernhard.schmidt@xxxxxxxxx>
---
 include/net/cfg80211.h |    2 ++
 net/mac80211/cfg.c     |    8 ++++++++
 net/wireless/chan.c    |    2 +-
 3 files changed, 11 insertions(+), 1 deletions(-)

diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index 679a049..8300699 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -1121,6 +1121,7 @@ struct cfg80211_pmksa {
  *	doesn't verify much. Note, however, that the passed netdev may be
  *	%NULL as well if the user requested changing the channel for the
  *	device itself, or for a monitor interface.
+ * @get_channel: Get current channel for a given wireless interface.
  *
  * @scan: Request to do a scan. If returning zero, the scan request is given
  *	the driver, and will be valid until passed to cfg80211_scan_done().
@@ -1276,6 +1277,7 @@ struct cfg80211_ops {
 	int	(*set_channel)(struct wiphy *wiphy, struct net_device *dev,
 			       struct ieee80211_channel *chan,
 			       enum nl80211_channel_type channel_type);
+	struct ieee80211_channel *(*get_channel)(struct wiphy *wiphy);
 
 	int	(*scan)(struct wiphy *wiphy, struct net_device *dev,
 			struct cfg80211_scan_request *request);
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index 8b436c7..2a05b31 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -1257,6 +1257,13 @@ static int ieee80211_set_channel(struct wiphy *wiphy,
 	return 0;
 }
 
+static struct ieee80211_channel *ieee80211_get_oper_channel(struct wiphy *wiphy)
+{
+	struct ieee80211_local *local = wiphy_priv(wiphy);
+
+	return local->oper_channel;
+}
+
 #ifdef CONFIG_PM
 static int ieee80211_suspend(struct wiphy *wiphy)
 {
@@ -2027,6 +2034,7 @@ struct cfg80211_ops mac80211_config_ops = {
 	.change_bss = ieee80211_change_bss,
 	.set_txq_params = ieee80211_set_txq_params,
 	.set_channel = ieee80211_set_channel,
+	.get_channel = ieee80211_get_oper_channel,
 	.suspend = ieee80211_suspend,
 	.resume = ieee80211_resume,
 	.scan = ieee80211_scan,
diff --git a/net/wireless/chan.c b/net/wireless/chan.c
index 17cd0c0..4e63e67 100644
--- a/net/wireless/chan.c
+++ b/net/wireless/chan.c
@@ -93,7 +93,7 @@ int cfg80211_set_freq(struct cfg80211_registered_device *rdev,
 			return -ENETDOWN;
 	}
 
-	if (!rdev->ops->set_channel)
+	if (!rdev->ops->set_channel || !rdev->ops->get_channel)
 		return -EOPNOTSUPP;
 
 	chan = rdev_freq_to_chan(rdev, freq, channel_type);
-- 
1.7.2.3
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]
  Powered by Linux