All of lore.kernel.org
 help / color / mirror / Atom feed
From: Felix Fietkau <nbd@openwrt.org>
To: linux-wireless <linux-wireless@vger.kernel.org>
Cc: Johannes Berg <johannes@sipsolutions.net>,
	"John W. Linville" <linville@tuxdriver.com>
Subject: [PATCH 1/2] cfg80211: add a callback for querying the operating frequency and export it through nl80211
Date: Sun, 17 Jan 2010 20:54:45 +0100	[thread overview]
Message-ID: <4B536B05.6070301@openwrt.org> (raw)

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
---
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -954,6 +954,8 @@ struct cfg80211_pmksa {
  *
  * @set_txq_params: Set TX queue parameters
  *
+ * @get_channel: Get operating channel
+ *
  * @set_channel: Set channel
  *
  * @scan: Request to do a scan. If returning zero, the scan request is given
@@ -1079,6 +1081,10 @@ struct cfg80211_ops {
 	int	(*set_txq_params)(struct wiphy *wiphy,
 				  struct ieee80211_txq_params *params);
 
+	int	(*get_channel)(struct wiphy *wiphy,
+			       struct ieee80211_channel **chan,
+			       enum nl80211_channel_type *channel_type);
+
 	int	(*set_channel)(struct wiphy *wiphy,
 			       struct ieee80211_channel *chan,
 			       enum nl80211_channel_type channel_type);
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -427,7 +427,8 @@ static int nl80211_send_wiphy(struct sk_
 	struct nlattr *nl_modes;
 	struct nlattr *nl_cmds;
 	enum ieee80211_band band;
-	struct ieee80211_channel *chan;
+	struct ieee80211_channel *chan = NULL;
+	enum nl80211_channel_type chan_type;
 	struct ieee80211_rate *rate;
 	int i;
 	u16 ifmodes = dev->wiphy.interface_modes;
@@ -465,6 +466,12 @@ static int nl80211_send_wiphy(struct sk_
 	NLA_PUT_U8(msg, NL80211_ATTR_MAX_NUM_PMKIDS,
 		   dev->wiphy.max_num_pmkids);
 
+	if (dev->ops->get_channel &&
+	    dev->ops->get_channel(&dev->wiphy, &chan, &chan_type) == 0) {
+		NLA_PUT_U32(msg, NL80211_ATTR_WIPHY_FREQ, chan->center_freq);
+		NLA_PUT_U32(msg, NL80211_ATTR_WIPHY_CHANNEL_TYPE, chan_type);
+	}
+
 	nl_modes = nla_nest_start(msg, NL80211_ATTR_SUPPORTED_IFTYPES);
 	if (!nl_modes)
 		goto nla_put_failure;

             reply	other threads:[~2010-01-17 19:55 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-17 19:54 Felix Fietkau [this message]
2010-01-17 19:55 ` [PATCH 2/2] mac80211: implement the callback for querying the operating frequency Felix Fietkau
2010-01-17 19:57 ` [PATCH 1/2] cfg80211: add a callback for querying the operating frequency and export it through nl80211 Johannes Berg
2010-01-17 20:00   ` Johannes Berg
2010-01-17 20:12     ` Felix Fietkau
2010-01-17 20:14       ` Johannes Berg
2010-01-17 20:23         ` Felix Fietkau
2010-01-17 20:48           ` Johannes Berg
2010-01-17 21:01             ` Felix Fietkau
2010-01-17 21:03               ` Felix Fietkau
2010-01-17 21:05               ` Johannes Berg
2010-01-19 17:39                 ` Luis R. Rodriguez
2010-01-20  7:32                 ` Holger Schurig
2010-01-20  9:49                   ` Johannes Berg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4B536B05.6070301@openwrt.org \
    --to=nbd@openwrt.org \
    --cc=johannes@sipsolutions.net \
    --cc=linux-wireless@vger.kernel.org \
    --cc=linville@tuxdriver.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.