From: Jussi Kivilinna <jussi.kivilinna@mbnet.fi>
To: linux-wireless@vger.kernel.org
Cc: "John W. Linville" <linville@tuxdriver.com>,
Johannes Berg <johannes@sipsolutions.net>
Subject: [RFC PATCH 02/10] rndis_wlan: add cfg80211 set_channel
Date: Fri, 28 Aug 2009 13:27:53 +0300 [thread overview]
Message-ID: <20090828102753.15684.40187.stgit@fate.lan> (raw)
In-Reply-To: <20090828102742.15684.10566.stgit@fate.lan>
Add cfg80211 set_channel and convert wext to use it.
Signed-off-by: Jussi Kivilinna <jussi.kivilinna@mbnet.fi>
---
drivers/net/wireless/rndis_wlan.c | 105 +++++--------------------------------
1 files changed, 15 insertions(+), 90 deletions(-)
diff --git a/drivers/net/wireless/rndis_wlan.c b/drivers/net/wireless/rndis_wlan.c
index c2af5be..ffb195d 100644
--- a/drivers/net/wireless/rndis_wlan.c
+++ b/drivers/net/wireless/rndis_wlan.c
@@ -517,6 +517,9 @@ static int rndis_join_ibss(struct wiphy *wiphy, struct net_device *dev,
static int rndis_leave_ibss(struct wiphy *wiphy, struct net_device *dev);
+static int rndis_set_channel(struct wiphy *wiphy,
+ struct ieee80211_channel *chan, enum nl80211_channel_type channel_type);
+
static struct cfg80211_ops rndis_config_ops = {
.change_virtual_intf = rndis_change_virtual_intf,
.scan = rndis_scan,
@@ -527,6 +530,7 @@ static struct cfg80211_ops rndis_config_ops = {
.disconnect = rndis_disconnect,
.join_ibss = rndis_join_ibss,
.leave_ibss = rndis_leave_ibss,
+ .set_channel = rndis_set_channel,
};
static void *rndis_wiphy_privid = &rndis_wiphy_privid;
@@ -924,46 +928,6 @@ static int level_to_qual(int level)
}
-static void dsconfig_to_freq(unsigned int dsconfig, struct iw_freq *freq)
-{
- freq->e = 0;
- freq->i = 0;
- freq->flags = 0;
-
- /* see comment in wireless.h above the "struct iw_freq"
- * definition for an explanation of this if
- * NOTE: 1000000 is due to the kHz
- */
- if (dsconfig > 1000000) {
- freq->m = dsconfig / 10;
- freq->e = 1;
- } else
- freq->m = dsconfig;
-
- /* convert from kHz to Hz */
- freq->e += 3;
-}
-
-
-static int freq_to_dsconfig(struct iw_freq *freq, unsigned int *dsconfig)
-{
- if (freq->m < 1000 && freq->e == 0) {
- if (freq->m >= 1 && freq->m <= 14)
- *dsconfig = ieee80211_dsss_chan_to_freq(freq->m) * 1000;
- else
- return -1;
- } else {
- int i;
- *dsconfig = freq->m;
- for (i = freq->e; i > 0; i--)
- *dsconfig *= 10;
- *dsconfig /= 1000;
- }
-
- return 0;
-}
-
-
/*
* common functions
*/
@@ -2067,6 +2031,15 @@ static int rndis_leave_ibss(struct wiphy *wiphy, struct net_device *dev)
return deauthenticate(usbdev);
}
+static int rndis_set_channel(struct wiphy *wiphy,
+ struct ieee80211_channel *chan, enum nl80211_channel_type channel_type)
+{
+ struct rndis_wlan_private *priv = wiphy_priv(wiphy);
+ struct usbnet *usbdev = priv->usbdev;
+
+ return set_channel(usbdev,
+ ieee80211_frequency_to_channel(chan->center_freq));
+}
/*
* wireless extension handlers
@@ -2416,54 +2389,6 @@ static int rndis_iw_set_encode_ext(struct net_device *dev,
}
-static int rndis_iw_set_freq(struct net_device *dev,
- struct iw_request_info *info, union iwreq_data *wrqu, char *extra)
-{
- struct usbnet *usbdev = netdev_priv(dev);
- struct ndis_80211_conf config;
- unsigned int dsconfig;
- int len, ret;
-
- /* this OID is valid only when not associated */
- if (is_associated(usbdev))
- return 0;
-
- dsconfig = 0;
- if (freq_to_dsconfig(&wrqu->freq, &dsconfig))
- return -EINVAL;
-
- len = sizeof(config);
- ret = rndis_query_oid(usbdev, OID_802_11_CONFIGURATION, &config, &len);
- if (ret != 0) {
- devdbg(usbdev, "SIOCSIWFREQ: querying configuration failed");
- return 0;
- }
-
- config.ds_config = cpu_to_le32(dsconfig);
-
- devdbg(usbdev, "SIOCSIWFREQ: %d * 10^%d", wrqu->freq.m, wrqu->freq.e);
- return rndis_set_oid(usbdev, OID_802_11_CONFIGURATION, &config,
- sizeof(config));
-}
-
-
-static int rndis_iw_get_freq(struct net_device *dev,
- struct iw_request_info *info, union iwreq_data *wrqu, char *extra)
-{
- struct usbnet *usbdev = netdev_priv(dev);
- struct ndis_80211_conf config;
- int len, ret;
-
- len = sizeof(config);
- ret = rndis_query_oid(usbdev, OID_802_11_CONFIGURATION, &config, &len);
- if (ret == 0)
- dsconfig_to_freq(le32_to_cpu(config.ds_config), &wrqu->freq);
-
- devdbg(usbdev, "SIOCGIWFREQ: %d", wrqu->freq.m);
- return ret;
-}
-
-
static int rndis_iw_get_rate(struct net_device *dev,
struct iw_request_info *info, union iwreq_data *wrqu, char *extra)
{
@@ -2501,8 +2426,8 @@ static const iw_handler rndis_iw_handler[] =
{
IW_IOCTL(SIOCSIWCOMMIT) = rndis_iw_commit,
IW_IOCTL(SIOCGIWNAME) = (iw_handler) cfg80211_wext_giwname,
- IW_IOCTL(SIOCSIWFREQ) = rndis_iw_set_freq,
- IW_IOCTL(SIOCGIWFREQ) = rndis_iw_get_freq,
+ IW_IOCTL(SIOCSIWFREQ) = (iw_handler) cfg80211_wext_siwfreq,
+ IW_IOCTL(SIOCGIWFREQ) = (iw_handler) cfg80211_wext_giwfreq,
IW_IOCTL(SIOCSIWMODE) = (iw_handler) cfg80211_wext_siwmode,
IW_IOCTL(SIOCGIWMODE) = (iw_handler) cfg80211_wext_giwmode,
IW_IOCTL(SIOCGIWRANGE) = (iw_handler) cfg80211_wext_giwrange,
next prev parent reply other threads:[~2009-08-28 10:27 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-08-28 10:27 [RFC PATCH 00/10] complete cfg80211 conversion Jussi Kivilinna
2009-08-28 10:27 ` [RFC PATCH 01/10] rndis_wlan: add cfg80211 connect, disconnect, join_ibss and leave_ibss Jussi Kivilinna
2009-08-28 10:27 ` Jussi Kivilinna [this message]
2009-08-28 10:27 ` [RFC PATCH 03/10] rndis_wlan: add cfg80211 key handling Jussi Kivilinna
2009-08-28 10:28 ` [RFC PATCH 04/10] rndis_wlan: add cfg80211 get_station Jussi Kivilinna
2009-08-28 10:28 ` [RFC PATCH 05/10] rndis_wlan: add cfg80211 dump_station Jussi Kivilinna
2009-08-28 10:28 ` [RFC PATCH 06/10] rndis_wlan: rename wireless stats worker to device poller Jussi Kivilinna
2009-08-28 10:28 ` [RFC PATCH 07/10] rndis_wlan: remove unneeded SIOCSIWCOMMIT Jussi Kivilinna
2009-08-28 10:28 ` [RFC PATCH 08/10] rndis_wlan: convert mic failure wireless event to cfg80211 Jussi Kivilinna
2009-08-28 10:28 ` [RFC PATCH 09/10] rndis_wlan: disable IWEVPMKIDCAND wireless event Jussi Kivilinna
2009-08-28 10:28 ` [RFC PATCH 10/10] rndis_wlan: use cfg80211_wext_handler Jussi Kivilinna
2009-08-28 11:11 ` Johannes Berg
2009-08-28 13:11 ` [RFC PATCH 00/10] complete cfg80211 conversion John W. Linville
2009-08-28 14:34 ` Jussi Kivilinna
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=20090828102753.15684.40187.stgit@fate.lan \
--to=jussi.kivilinna@mbnet.fi \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).