diff options
Diffstat (limited to 'net/mac80211/scan.c')
-rw-r--r-- | net/mac80211/scan.c | 40 |
1 files changed, 26 insertions, 14 deletions
diff --git a/net/mac80211/scan.c b/net/mac80211/scan.c index db122e4e60e5..48f910ae95c0 100644 --- a/net/mac80211/scan.c +++ b/net/mac80211/scan.c | |||
@@ -376,7 +376,7 @@ static int ieee80211_start_sw_scan(struct ieee80211_local *local) | |||
376 | } | 376 | } |
377 | mutex_unlock(&local->iflist_mtx); | 377 | mutex_unlock(&local->iflist_mtx); |
378 | 378 | ||
379 | local->scan_state = SCAN_SET_CHANNEL; | 379 | local->scan_state = SCAN_DECISION; |
380 | local->scan_channel_idx = 0; | 380 | local->scan_channel_idx = 0; |
381 | 381 | ||
382 | spin_lock_bh(&local->filter_lock); | 382 | spin_lock_bh(&local->filter_lock); |
@@ -474,18 +474,27 @@ static int __ieee80211_start_scan(struct ieee80211_sub_if_data *sdata, | |||
474 | return rc; | 474 | return rc; |
475 | } | 475 | } |
476 | 476 | ||
477 | static int ieee80211_scan_state_set_channel(struct ieee80211_local *local, | 477 | static int ieee80211_scan_state_decision(struct ieee80211_local *local, |
478 | unsigned long *next_delay) | 478 | unsigned long *next_delay) |
479 | { | 479 | { |
480 | int skip; | ||
481 | struct ieee80211_channel *chan; | ||
482 | struct ieee80211_sub_if_data *sdata = local->scan_sdata; | ||
483 | |||
484 | /* if no more bands/channels left, complete scan */ | 480 | /* if no more bands/channels left, complete scan */ |
485 | if (local->scan_channel_idx >= local->scan_req->n_channels) { | 481 | if (local->scan_channel_idx >= local->scan_req->n_channels) { |
486 | ieee80211_scan_completed(&local->hw, false); | 482 | ieee80211_scan_completed(&local->hw, false); |
487 | return 1; | 483 | return 1; |
488 | } | 484 | } |
485 | |||
486 | *next_delay = 0; | ||
487 | local->scan_state = SCAN_SET_CHANNEL; | ||
488 | return 0; | ||
489 | } | ||
490 | |||
491 | static void ieee80211_scan_state_set_channel(struct ieee80211_local *local, | ||
492 | unsigned long *next_delay) | ||
493 | { | ||
494 | int skip; | ||
495 | struct ieee80211_channel *chan; | ||
496 | struct ieee80211_sub_if_data *sdata = local->scan_sdata; | ||
497 | |||
489 | skip = 0; | 498 | skip = 0; |
490 | chan = local->scan_req->channels[local->scan_channel_idx]; | 499 | chan = local->scan_req->channels[local->scan_channel_idx]; |
491 | 500 | ||
@@ -505,7 +514,7 @@ static int ieee80211_scan_state_set_channel(struct ieee80211_local *local, | |||
505 | local->scan_channel_idx++; | 514 | local->scan_channel_idx++; |
506 | 515 | ||
507 | if (skip) | 516 | if (skip) |
508 | return 0; | 517 | return; |
509 | 518 | ||
510 | /* | 519 | /* |
511 | * Probe delay is used to update the NAV, cf. 11.1.3.2.2 | 520 | * Probe delay is used to update the NAV, cf. 11.1.3.2.2 |
@@ -520,13 +529,13 @@ static int ieee80211_scan_state_set_channel(struct ieee80211_local *local, | |||
520 | if (chan->flags & IEEE80211_CHAN_PASSIVE_SCAN || | 529 | if (chan->flags & IEEE80211_CHAN_PASSIVE_SCAN || |
521 | !local->scan_req->n_ssids) { | 530 | !local->scan_req->n_ssids) { |
522 | *next_delay = IEEE80211_PASSIVE_CHANNEL_TIME; | 531 | *next_delay = IEEE80211_PASSIVE_CHANNEL_TIME; |
523 | return 0; | 532 | local->scan_state = SCAN_DECISION; |
533 | return; | ||
524 | } | 534 | } |
525 | 535 | ||
536 | /* active scan, send probes */ | ||
526 | *next_delay = IEEE80211_PROBE_DELAY; | 537 | *next_delay = IEEE80211_PROBE_DELAY; |
527 | local->scan_state = SCAN_SEND_PROBE; | 538 | local->scan_state = SCAN_SEND_PROBE; |
528 | |||
529 | return 0; | ||
530 | } | 539 | } |
531 | 540 | ||
532 | static void ieee80211_scan_state_send_probe(struct ieee80211_local *local, | 541 | static void ieee80211_scan_state_send_probe(struct ieee80211_local *local, |
@@ -547,7 +556,7 @@ static void ieee80211_scan_state_send_probe(struct ieee80211_local *local, | |||
547 | * on the channel. | 556 | * on the channel. |
548 | */ | 557 | */ |
549 | *next_delay = IEEE80211_CHANNEL_TIME; | 558 | *next_delay = IEEE80211_CHANNEL_TIME; |
550 | local->scan_state = SCAN_SET_CHANNEL; | 559 | local->scan_state = SCAN_DECISION; |
551 | } | 560 | } |
552 | 561 | ||
553 | void ieee80211_scan_work(struct work_struct *work) | 562 | void ieee80211_scan_work(struct work_struct *work) |
@@ -593,10 +602,13 @@ void ieee80211_scan_work(struct work_struct *work) | |||
593 | */ | 602 | */ |
594 | do { | 603 | do { |
595 | switch (local->scan_state) { | 604 | switch (local->scan_state) { |
596 | case SCAN_SET_CHANNEL: | 605 | case SCAN_DECISION: |
597 | if (ieee80211_scan_state_set_channel(local, &next_delay)) | 606 | if (ieee80211_scan_state_decision(local, &next_delay)) |
598 | return; | 607 | return; |
599 | break; | 608 | break; |
609 | case SCAN_SET_CHANNEL: | ||
610 | ieee80211_scan_state_set_channel(local, &next_delay); | ||
611 | break; | ||
600 | case SCAN_SEND_PROBE: | 612 | case SCAN_SEND_PROBE: |
601 | ieee80211_scan_state_send_probe(local, &next_delay); | 613 | ieee80211_scan_state_send_probe(local, &next_delay); |
602 | break; | 614 | break; |