diff options
author | Johannes Berg <johannes@sipsolutions.net> | 2010-05-03 02:49:48 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2010-05-03 14:53:10 -0400 |
commit | be4a4b6a5d2f76393f545a2545fbaa1b65577e13 (patch) | |
tree | 5456729061f295a1e7782766eb195707228475f8 /net/mac80211/scan.c | |
parent | a75b4363eaafa99d909da4f1192322a78b074c73 (diff) |
mac80211: improve IBSS scanning
When IBSS is fixed to a frequency, it can still
scan to try to find the right BSSID. This makes
sense if the BSSID isn't also fixed, but it need
not scan all channels -- just one is sufficient.
Make it do that by moving the scan setup code to
ieee80211_request_internal_scan() and include
a channel variable setting.
Note that this can be further improved to start
the IBSS right away if both frequency and BSSID
are fixed.
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/mac80211/scan.c')
-rw-r--r-- | net/mac80211/scan.c | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/net/mac80211/scan.c b/net/mac80211/scan.c index a9d40584e383..414651217b49 100644 --- a/net/mac80211/scan.c +++ b/net/mac80211/scan.c | |||
@@ -728,10 +728,12 @@ int ieee80211_request_scan(struct ieee80211_sub_if_data *sdata, | |||
728 | } | 728 | } |
729 | 729 | ||
730 | int ieee80211_request_internal_scan(struct ieee80211_sub_if_data *sdata, | 730 | int ieee80211_request_internal_scan(struct ieee80211_sub_if_data *sdata, |
731 | const u8 *ssid, u8 ssid_len) | 731 | const u8 *ssid, u8 ssid_len, |
732 | struct ieee80211_channel *chan) | ||
732 | { | 733 | { |
733 | struct ieee80211_local *local = sdata->local; | 734 | struct ieee80211_local *local = sdata->local; |
734 | int ret = -EBUSY; | 735 | int ret = -EBUSY; |
736 | enum nl80211_band band; | ||
735 | 737 | ||
736 | mutex_lock(&local->scan_mtx); | 738 | mutex_lock(&local->scan_mtx); |
737 | 739 | ||
@@ -739,6 +741,30 @@ int ieee80211_request_internal_scan(struct ieee80211_sub_if_data *sdata, | |||
739 | if (local->scan_req) | 741 | if (local->scan_req) |
740 | goto unlock; | 742 | goto unlock; |
741 | 743 | ||
744 | /* fill internal scan request */ | ||
745 | if (!chan) { | ||
746 | int i, nchan = 0; | ||
747 | |||
748 | for (band = 0; band < IEEE80211_NUM_BANDS; band++) { | ||
749 | if (!local->hw.wiphy->bands[band]) | ||
750 | continue; | ||
751 | for (i = 0; | ||
752 | i < local->hw.wiphy->bands[band]->n_channels; | ||
753 | i++) { | ||
754 | local->int_scan_req->channels[nchan] = | ||
755 | &local->hw.wiphy->bands[band]->channels[i]; | ||
756 | nchan++; | ||
757 | } | ||
758 | } | ||
759 | |||
760 | local->int_scan_req->n_channels = nchan; | ||
761 | } else { | ||
762 | local->int_scan_req->channels[0] = chan; | ||
763 | local->int_scan_req->n_channels = 1; | ||
764 | } | ||
765 | |||
766 | local->int_scan_req->ssids = &local->scan_ssid; | ||
767 | local->int_scan_req->n_ssids = 1; | ||
742 | memcpy(local->int_scan_req->ssids[0].ssid, ssid, IEEE80211_MAX_SSID_LEN); | 768 | memcpy(local->int_scan_req->ssids[0].ssid, ssid, IEEE80211_MAX_SSID_LEN); |
743 | local->int_scan_req->ssids[0].ssid_len = ssid_len; | 769 | local->int_scan_req->ssids[0].ssid_len = ssid_len; |
744 | 770 | ||