diff options
author | Zhu Yi <yi.zhu@intel.com> | 2006-08-20 23:39:03 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2006-08-29 17:06:34 -0400 |
commit | 094c4d2df6c17a37d9e1b88601990ab660c00c3e (patch) | |
tree | 3c414a9e08f2b94484409655d47d00be28d140cd /drivers/net/wireless/ipw2200.c | |
parent | efbd809829001c94e48b96337ea05a16d5ecee85 (diff) |
[PATCH] ipw2200: enable wireless extension passive scan
This patch enables the ipw2200 driver to support passive scanning as
offered by the wireless extensions. For this, I enhanced the ipw_wx_set_scan
function in such a way that it differentiates between a passive and an
active scan request. Additionally, I added a new function called
ipw_request_passive_scan that is similiar to the ipw_request_scan
function to perform passive scans. Last but not least, I added a field
(in fact it is a work_struct struct) called request_passive_scan to
the ipw_priv struct.
Signed-off-by: Thomas King <king@informatik.uni-mannheim.de>
Signed-off-by: Zhu Yi <yi.zhu@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/ipw2200.c')
-rw-r--r-- | drivers/net/wireless/ipw2200.c | 51 |
1 files changed, 38 insertions, 13 deletions
diff --git a/drivers/net/wireless/ipw2200.c b/drivers/net/wireless/ipw2200.c index 15258301b643..ea14b55e2633 100644 --- a/drivers/net/wireless/ipw2200.c +++ b/drivers/net/wireless/ipw2200.c | |||
@@ -6169,7 +6169,7 @@ static void ipw_add_scan_channels(struct ipw_priv *priv, | |||
6169 | } | 6169 | } |
6170 | } | 6170 | } |
6171 | 6171 | ||
6172 | static int ipw_request_scan(struct ipw_priv *priv) | 6172 | static int ipw_request_scan_helper(struct ipw_priv *priv, int type) |
6173 | { | 6173 | { |
6174 | struct ipw_scan_request_ext scan; | 6174 | struct ipw_scan_request_ext scan; |
6175 | int err = 0, scan_type; | 6175 | int err = 0, scan_type; |
@@ -6200,19 +6200,29 @@ static int ipw_request_scan(struct ipw_priv *priv) | |||
6200 | } | 6200 | } |
6201 | 6201 | ||
6202 | memset(&scan, 0, sizeof(scan)); | 6202 | memset(&scan, 0, sizeof(scan)); |
6203 | scan.full_scan_index = cpu_to_le32(ieee80211_get_scans(priv->ieee)); | ||
6203 | 6204 | ||
6204 | if (priv->config & CFG_SPEED_SCAN) | 6205 | if (type == IW_SCAN_TYPE_PASSIVE) { |
6206 | IPW_DEBUG_WX("use passive scanning\n"); | ||
6207 | scan_type = IPW_SCAN_PASSIVE_FULL_DWELL_SCAN; | ||
6208 | scan.dwell_time[IPW_SCAN_PASSIVE_FULL_DWELL_SCAN] = | ||
6209 | cpu_to_le16(120); | ||
6210 | ipw_add_scan_channels(priv, &scan, scan_type); | ||
6211 | goto send_request; | ||
6212 | } | ||
6213 | |||
6214 | /* Use active scan by default. */ | ||
6215 | if (priv->config & CFG_SPEED_SCAN) | ||
6205 | scan.dwell_time[IPW_SCAN_ACTIVE_BROADCAST_SCAN] = | 6216 | scan.dwell_time[IPW_SCAN_ACTIVE_BROADCAST_SCAN] = |
6206 | cpu_to_le16(30); | 6217 | cpu_to_le16(30); |
6207 | else | 6218 | else |
6208 | scan.dwell_time[IPW_SCAN_ACTIVE_BROADCAST_SCAN] = | 6219 | scan.dwell_time[IPW_SCAN_ACTIVE_BROADCAST_SCAN] = |
6209 | cpu_to_le16(20); | 6220 | cpu_to_le16(20); |
6210 | 6221 | ||
6211 | scan.dwell_time[IPW_SCAN_ACTIVE_BROADCAST_AND_DIRECT_SCAN] = | 6222 | scan.dwell_time[IPW_SCAN_ACTIVE_BROADCAST_AND_DIRECT_SCAN] = |
6212 | cpu_to_le16(20); | 6223 | cpu_to_le16(20); |
6213 | scan.dwell_time[IPW_SCAN_PASSIVE_FULL_DWELL_SCAN] = cpu_to_le16(120); | ||
6214 | 6224 | ||
6215 | scan.full_scan_index = cpu_to_le32(ieee80211_get_scans(priv->ieee)); | 6225 | scan.dwell_time[IPW_SCAN_PASSIVE_FULL_DWELL_SCAN] = cpu_to_le16(120); |
6216 | 6226 | ||
6217 | #ifdef CONFIG_IPW2200_MONITOR | 6227 | #ifdef CONFIG_IPW2200_MONITOR |
6218 | if (priv->ieee->iw_mode == IW_MODE_MONITOR) { | 6228 | if (priv->ieee->iw_mode == IW_MODE_MONITOR) { |
@@ -6249,7 +6259,7 @@ static int ipw_request_scan(struct ipw_priv *priv) | |||
6249 | * | 6259 | * |
6250 | * TODO: Move SPEED SCAN support to all modes and bands */ | 6260 | * TODO: Move SPEED SCAN support to all modes and bands */ |
6251 | scan.dwell_time[IPW_SCAN_PASSIVE_FULL_DWELL_SCAN] = | 6261 | scan.dwell_time[IPW_SCAN_PASSIVE_FULL_DWELL_SCAN] = |
6252 | cpu_to_le16(2000); | 6262 | cpu_to_le16(2000); |
6253 | } else { | 6263 | } else { |
6254 | #endif /* CONFIG_IPW2200_MONITOR */ | 6264 | #endif /* CONFIG_IPW2200_MONITOR */ |
6255 | /* If we are roaming, then make this a directed scan for the | 6265 | /* If we are roaming, then make this a directed scan for the |
@@ -6275,6 +6285,7 @@ static int ipw_request_scan(struct ipw_priv *priv) | |||
6275 | } | 6285 | } |
6276 | #endif | 6286 | #endif |
6277 | 6287 | ||
6288 | send_request: | ||
6278 | err = ipw_send_scan_request_ext(priv, &scan); | 6289 | err = ipw_send_scan_request_ext(priv, &scan); |
6279 | if (err) { | 6290 | if (err) { |
6280 | IPW_DEBUG_HC("Sending scan command failed: %08X\n", err); | 6291 | IPW_DEBUG_HC("Sending scan command failed: %08X\n", err); |
@@ -6285,11 +6296,19 @@ static int ipw_request_scan(struct ipw_priv *priv) | |||
6285 | priv->status &= ~STATUS_SCAN_PENDING; | 6296 | priv->status &= ~STATUS_SCAN_PENDING; |
6286 | queue_delayed_work(priv->workqueue, &priv->scan_check, | 6297 | queue_delayed_work(priv->workqueue, &priv->scan_check, |
6287 | IPW_SCAN_CHECK_WATCHDOG); | 6298 | IPW_SCAN_CHECK_WATCHDOG); |
6288 | done: | 6299 | done: |
6289 | mutex_unlock(&priv->mutex); | 6300 | mutex_unlock(&priv->mutex); |
6290 | return err; | 6301 | return err; |
6291 | } | 6302 | } |
6292 | 6303 | ||
6304 | static int ipw_request_passive_scan(struct ipw_priv *priv) { | ||
6305 | return ipw_request_scan_helper(priv, IW_SCAN_TYPE_PASSIVE); | ||
6306 | } | ||
6307 | |||
6308 | static int ipw_request_scan(struct ipw_priv *priv) { | ||
6309 | return ipw_request_scan_helper(priv, IW_SCAN_TYPE_ACTIVE); | ||
6310 | } | ||
6311 | |||
6293 | static void ipw_bg_abort_scan(void *data) | 6312 | static void ipw_bg_abort_scan(void *data) |
6294 | { | 6313 | { |
6295 | struct ipw_priv *priv = data; | 6314 | struct ipw_priv *priv = data; |
@@ -9378,15 +9397,19 @@ static int ipw_wx_set_scan(struct net_device *dev, | |||
9378 | union iwreq_data *wrqu, char *extra) | 9397 | union iwreq_data *wrqu, char *extra) |
9379 | { | 9398 | { |
9380 | struct ipw_priv *priv = ieee80211_priv(dev); | 9399 | struct ipw_priv *priv = ieee80211_priv(dev); |
9381 | struct iw_scan_req *req = NULL; | 9400 | struct iw_scan_req *req = (struct iw_scan_req *)extra; |
9382 | if (wrqu->data.length | 9401 | |
9383 | && wrqu->data.length == sizeof(struct iw_scan_req)) { | 9402 | if (wrqu->data.length == sizeof(struct iw_scan_req)) { |
9384 | req = (struct iw_scan_req *)extra; | ||
9385 | if (wrqu->data.flags & IW_SCAN_THIS_ESSID) { | 9403 | if (wrqu->data.flags & IW_SCAN_THIS_ESSID) { |
9386 | ipw_request_direct_scan(priv, req->essid, | 9404 | ipw_request_direct_scan(priv, req->essid, |
9387 | req->essid_len); | 9405 | req->essid_len); |
9388 | return 0; | 9406 | return 0; |
9389 | } | 9407 | } |
9408 | if (req->scan_type == IW_SCAN_TYPE_PASSIVE) { | ||
9409 | queue_work(priv->workqueue, | ||
9410 | &priv->request_passive_scan); | ||
9411 | return 0; | ||
9412 | } | ||
9390 | } | 9413 | } |
9391 | 9414 | ||
9392 | IPW_DEBUG_WX("Start scan\n"); | 9415 | IPW_DEBUG_WX("Start scan\n"); |
@@ -10618,6 +10641,8 @@ static int ipw_setup_deferred_work(struct ipw_priv *priv) | |||
10618 | INIT_WORK(&priv->down, (void (*)(void *))ipw_bg_down, priv); | 10641 | INIT_WORK(&priv->down, (void (*)(void *))ipw_bg_down, priv); |
10619 | INIT_WORK(&priv->request_scan, | 10642 | INIT_WORK(&priv->request_scan, |
10620 | (void (*)(void *))ipw_request_scan, priv); | 10643 | (void (*)(void *))ipw_request_scan, priv); |
10644 | INIT_WORK(&priv->request_passive_scan, | ||
10645 | (void (*)(void *))ipw_request_passive_scan, priv); | ||
10621 | INIT_WORK(&priv->gather_stats, | 10646 | INIT_WORK(&priv->gather_stats, |
10622 | (void (*)(void *))ipw_bg_gather_stats, priv); | 10647 | (void (*)(void *))ipw_bg_gather_stats, priv); |
10623 | INIT_WORK(&priv->abort_scan, (void (*)(void *))ipw_bg_abort_scan, priv); | 10648 | INIT_WORK(&priv->abort_scan, (void (*)(void *))ipw_bg_abort_scan, priv); |