diff options
author | nbd <nbd@3c298f89-4303-0410-b956-a3cf2f4a3e73> | 2007-02-01 21:06:24 +0000 |
---|---|---|
committer | nbd <nbd@3c298f89-4303-0410-b956-a3cf2f4a3e73> | 2007-02-01 21:06:24 +0000 |
commit | 4b191d9789dca901687e6ce441a363ce56132408 (patch) | |
tree | 1b02277981c5053a2bfab25f5f6b96c10c7cda61 /package/d80211/src/ieee80211_scan.c | |
parent | 91ea78a8426e0962192a60368110c637411d4408 (diff) |
update d80211 to latest wireless-dev version
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@6241 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'package/d80211/src/ieee80211_scan.c')
-rw-r--r-- | package/d80211/src/ieee80211_scan.c | 83 |
1 files changed, 39 insertions, 44 deletions
diff --git a/package/d80211/src/ieee80211_scan.c b/package/d80211/src/ieee80211_scan.c index 6db66f0831..fe28f578b2 100644 --- a/package/d80211/src/ieee80211_scan.c +++ b/package/d80211/src/ieee80211_scan.c @@ -24,49 +24,49 @@ #define SCAN_TXRX_THRESHOLD 75 static void get_channel_params(struct ieee80211_local *local, int channel, - struct ieee80211_hw_modes **mode, + struct ieee80211_hw_mode **mode, struct ieee80211_channel **chan) { - int m; + struct ieee80211_hw_mode *m; - for (m = 0; m < local->hw.num_modes; m++) { - *mode = &local->hw.modes[m]; - if ((*mode)->mode == local->hw.conf.phymode) + list_for_each_entry(m, &local->modes_list, list) { + *mode = m; + if (m->mode == local->hw.conf.phymode) break; } - local->scan.mode_idx = m; + local->scan.mode = m; local->scan.chan_idx = 0; do { - *chan = &(*mode)->channels[local->scan.chan_idx]; - if ((*chan)->chan == channel) { + *chan = &m->channels[local->scan.chan_idx]; + if ((*chan)->chan == channel) return; - } local->scan.chan_idx++; - } while (local->scan.chan_idx < (*mode)->num_channels); + } while (local->scan.chan_idx < m->num_channels); *chan = NULL; } static void next_chan_same_mode(struct ieee80211_local *local, - struct ieee80211_hw_modes **mode, + struct ieee80211_hw_mode **mode, struct ieee80211_channel **chan) { - int m, prev; + struct ieee80211_hw_mode *m; + int prev; - for (m = 0; m < local->hw.num_modes; m++) { - *mode = &local->hw.modes[m]; - if ((*mode)->mode == local->hw.conf.phymode) + list_for_each_entry(m, &local->modes_list, list) { + *mode = m; + if (m->mode == local->hw.conf.phymode) break; } - local->scan.mode_idx = m; + local->scan.mode = m; /* Select next channel - scan only channels marked with W_SCAN flag */ prev = local->scan.chan_idx; do { local->scan.chan_idx++; - if (local->scan.chan_idx >= (*mode)->num_channels) + if (local->scan.chan_idx >= m->num_channels) local->scan.chan_idx = 0; - *chan = &(*mode)->channels[local->scan.chan_idx]; + *chan = &m->channels[local->scan.chan_idx]; if ((*chan)->flag & IEEE80211_CHAN_W_SCAN) break; } while (local->scan.chan_idx != prev); @@ -74,43 +74,44 @@ static void next_chan_same_mode(struct ieee80211_local *local, static void next_chan_all_modes(struct ieee80211_local *local, - struct ieee80211_hw_modes **mode, + struct ieee80211_hw_mode **mode, struct ieee80211_channel **chan) { - int prev, prev_m; - - if (local->scan.mode_idx >= local->hw.num_modes) { - local->scan.mode_idx = 0; - local->scan.chan_idx = 0; - } + struct ieee80211_hw_mode *prev_m; + int prev; /* Select next channel - scan only channels marked with W_SCAN flag */ prev = local->scan.chan_idx; - prev_m = local->scan.mode_idx; + prev_m = local->scan.mode; do { - *mode = &local->hw.modes[local->scan.mode_idx]; + *mode = local->scan.mode; local->scan.chan_idx++; if (local->scan.chan_idx >= (*mode)->num_channels) { + struct list_head *next; + local->scan.chan_idx = 0; - local->scan.mode_idx++; - if (local->scan.mode_idx >= local->hw.num_modes) - local->scan.mode_idx = 0; - *mode = &local->hw.modes[local->scan.mode_idx]; + next = (*mode)->list.next; + if (next == &local->modes_list) + next = next->next; + *mode = list_entry(next, + struct ieee80211_hw_mode, + list); + local->scan.mode = *mode; } *chan = &(*mode)->channels[local->scan.chan_idx]; if ((*chan)->flag & IEEE80211_CHAN_W_SCAN) break; } while (local->scan.chan_idx != prev || - local->scan.mode_idx != prev_m); + local->scan.mode != prev_m); } static void ieee80211_scan_start(struct ieee80211_local *local, struct ieee80211_scan_conf *conf) { - int old_mode_idx = local->scan.mode_idx; + struct ieee80211_hw_mode *old_mode = local->scan.mode; int old_chan_idx = local->scan.chan_idx; - struct ieee80211_hw_modes *mode = NULL; + struct ieee80211_hw_mode *mode = NULL; struct ieee80211_channel *chan = NULL; int ret; @@ -189,7 +190,7 @@ static void ieee80211_scan_start(struct ieee80211_local *local, if (ret == -EAGAIN) { local->scan.timer.expires = jiffies + (local->scan.interval * HZ / 100); - local->scan.mode_idx = old_mode_idx; + local->scan.mode = old_mode; local->scan.chan_idx = old_chan_idx; } else { printk(KERN_DEBUG "%s: Got unknown error from " @@ -207,23 +208,17 @@ static void ieee80211_scan_start(struct ieee80211_local *local, static void ieee80211_scan_stop(struct ieee80211_local *local, struct ieee80211_scan_conf *conf) { - struct ieee80211_hw_modes *mode; + struct ieee80211_hw_mode *mode; struct ieee80211_channel *chan; int wait; if (!local->ops->passive_scan) return; - if (local->scan.mode_idx >= local->hw.num_modes) { - local->scan.mode_idx = 0; - local->scan.chan_idx = 0; - } + mode = local->scan.mode; - mode = &local->hw.modes[local->scan.mode_idx]; - - if (local->scan.chan_idx >= mode->num_channels) { + if (local->scan.chan_idx >= mode->num_channels) local->scan.chan_idx = 0; - } chan = &mode->channels[local->scan.chan_idx]; |