ieee80211_scan_sw.c (296241) | ieee80211_scan_sw.c (297405) |
---|---|
1/*- 2 * Copyright (c) 2002-2008 Sam Leffler, Errno Consulting 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 10 unchanged lines hidden (view full) --- 19 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 20 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 21 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 */ 25 26#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 2002-2008 Sam Leffler, Errno Consulting 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 10 unchanged lines hidden (view full) --- 19 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 20 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 21 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 */ 25 26#include <sys/cdefs.h> |
27__FBSDID("$FreeBSD: head/sys/net80211/ieee80211_scan_sw.c 296241 2016-02-29 23:09:31Z glebius $"); | 27__FBSDID("$FreeBSD: head/sys/net80211/ieee80211_scan_sw.c 297405 2016-03-30 00:44:10Z adrian $"); |
28 29/* 30 * IEEE 802.11 scanning support. 31 */ 32#include "opt_wlan.h" 33 34#include <sys/param.h> 35#include <sys/systm.h> --- 263 unchanged lines hidden (view full) --- 299 * Update the ssid list and mark flags so if 300 * we call start_scan it doesn't duplicate work. 301 */ 302 ieee80211_scan_copy_ssid(vap, ss, nssid, ssids); 303 flags |= IEEE80211_SCAN_NOSSID; 304 } 305 if ((ic->ic_flags & IEEE80211_F_SCAN) == 0 && 306 (flags & IEEE80211_SCAN_FLUSH) == 0 && | 28 29/* 30 * IEEE 802.11 scanning support. 31 */ 32#include "opt_wlan.h" 33 34#include <sys/param.h> 35#include <sys/systm.h> --- 263 unchanged lines hidden (view full) --- 299 * Update the ssid list and mark flags so if 300 * we call start_scan it doesn't duplicate work. 301 */ 302 ieee80211_scan_copy_ssid(vap, ss, nssid, ssids); 303 flags |= IEEE80211_SCAN_NOSSID; 304 } 305 if ((ic->ic_flags & IEEE80211_F_SCAN) == 0 && 306 (flags & IEEE80211_SCAN_FLUSH) == 0 && |
307 time_before(ticks, ic->ic_lastscan + vap->iv_scanvalid)) { | 307 ieee80211_time_before(ticks, ic->ic_lastscan + vap->iv_scanvalid)) { |
308 /* 309 * We're not currently scanning and the cache is 310 * deemed hot enough to consult. Lock out others 311 * by marking IEEE80211_F_SCAN while we decide if 312 * something is already in the scan cache we can 313 * use. Also discard any frames that might come 314 * in while temporarily marked as scanning. 315 */ --- 353 unchanged lines hidden (view full) --- 669 670 IEEE80211_DPRINTF(ss->ss_vap, IEEE80211_MSG_SCAN, 671 "%s: loop start; scandone=%d\n", 672 __func__, 673 scandone); 674 675 if (scandone || (ss->ss_flags & IEEE80211_SCAN_GOTPICK) || 676 (ss_priv->ss_iflags & ISCAN_ABORT) || | 308 /* 309 * We're not currently scanning and the cache is 310 * deemed hot enough to consult. Lock out others 311 * by marking IEEE80211_F_SCAN while we decide if 312 * something is already in the scan cache we can 313 * use. Also discard any frames that might come 314 * in while temporarily marked as scanning. 315 */ --- 353 unchanged lines hidden (view full) --- 669 670 IEEE80211_DPRINTF(ss->ss_vap, IEEE80211_MSG_SCAN, 671 "%s: loop start; scandone=%d\n", 672 __func__, 673 scandone); 674 675 if (scandone || (ss->ss_flags & IEEE80211_SCAN_GOTPICK) || 676 (ss_priv->ss_iflags & ISCAN_ABORT) || |
677 time_after(ticks + ss->ss_mindwell, ss_priv->ss_scanend)) { | 677 ieee80211_time_after(ticks + ss->ss_mindwell, ss_priv->ss_scanend)) { |
678 ss_priv->ss_iflags &= ~ISCAN_RUNNING; 679 scan_end(ss, scandone); 680 return; 681 } else 682 ss_priv->ss_iflags |= ISCAN_RUNNING; 683 684 chan = ss->ss_chans[ss->ss_next++]; 685 686 /* 687 * Watch for truncation due to the scan end time. 688 */ | 678 ss_priv->ss_iflags &= ~ISCAN_RUNNING; 679 scan_end(ss, scandone); 680 return; 681 } else 682 ss_priv->ss_iflags |= ISCAN_RUNNING; 683 684 chan = ss->ss_chans[ss->ss_next++]; 685 686 /* 687 * Watch for truncation due to the scan end time. 688 */ |
689 if (time_after(ticks + ss->ss_maxdwell, ss_priv->ss_scanend)) | 689 if (ieee80211_time_after(ticks + ss->ss_maxdwell, ss_priv->ss_scanend)) |
690 maxdwell = ss_priv->ss_scanend - ticks; 691 else 692 maxdwell = ss->ss_maxdwell; 693 694 IEEE80211_DPRINTF(ss->ss_vap, IEEE80211_MSG_SCAN, 695 "%s: chan %3d%c -> %3d%c [%s, dwell min %lums max %lums]\n", 696 __func__, 697 ieee80211_chan2ieee(ic, ic->ic_curchan), --- 104 unchanged lines hidden (view full) --- 802 * If the callback function returns 0, then it wants to 803 * continue/restart scanning. Unfortunately we needed to 804 * notify the driver to end the scan above to avoid having 805 * rx frames alter the scan candidate list. 806 */ 807 if ((ss_priv->ss_iflags & ISCAN_CANCEL) == 0 && 808 !ss->ss_ops->scan_end(ss, vap) && 809 (ss->ss_flags & IEEE80211_SCAN_ONCE) == 0 && | 690 maxdwell = ss_priv->ss_scanend - ticks; 691 else 692 maxdwell = ss->ss_maxdwell; 693 694 IEEE80211_DPRINTF(ss->ss_vap, IEEE80211_MSG_SCAN, 695 "%s: chan %3d%c -> %3d%c [%s, dwell min %lums max %lums]\n", 696 __func__, 697 ieee80211_chan2ieee(ic, ic->ic_curchan), --- 104 unchanged lines hidden (view full) --- 802 * If the callback function returns 0, then it wants to 803 * continue/restart scanning. Unfortunately we needed to 804 * notify the driver to end the scan above to avoid having 805 * rx frames alter the scan candidate list. 806 */ 807 if ((ss_priv->ss_iflags & ISCAN_CANCEL) == 0 && 808 !ss->ss_ops->scan_end(ss, vap) && 809 (ss->ss_flags & IEEE80211_SCAN_ONCE) == 0 && |
810 time_before(ticks + ss->ss_mindwell, ss_priv->ss_scanend)) { | 810 ieee80211_time_before(ticks + ss->ss_mindwell, ss_priv->ss_scanend)) { |
811 IEEE80211_DPRINTF(vap, IEEE80211_MSG_SCAN, 812 "%s: done, restart " 813 "[ticks %u, dwell min %lu scanend %lu]\n", 814 __func__, 815 ticks, ss->ss_mindwell, ss_priv->ss_scanend); 816 ss->ss_next = 0; /* reset to begining */ 817 if (ss->ss_flags & IEEE80211_SCAN_ACTIVE) 818 vap->iv_stats.is_scan_active++; --- 99 unchanged lines hidden (view full) --- 918#endif 919 if (ss->ss_ops != NULL && 920 ss->ss_ops->scan_add(ss, curchan, sp, wh, subtype, rssi, noise)) { 921 /* 922 * If we've reached the min dwell time terminate 923 * the timer so we'll switch to the next channel. 924 */ 925 if ((SCAN_PRIVATE(ss)->ss_iflags & ISCAN_MINDWELL) == 0 && | 811 IEEE80211_DPRINTF(vap, IEEE80211_MSG_SCAN, 812 "%s: done, restart " 813 "[ticks %u, dwell min %lu scanend %lu]\n", 814 __func__, 815 ticks, ss->ss_mindwell, ss_priv->ss_scanend); 816 ss->ss_next = 0; /* reset to begining */ 817 if (ss->ss_flags & IEEE80211_SCAN_ACTIVE) 818 vap->iv_stats.is_scan_active++; --- 99 unchanged lines hidden (view full) --- 918#endif 919 if (ss->ss_ops != NULL && 920 ss->ss_ops->scan_add(ss, curchan, sp, wh, subtype, rssi, noise)) { 921 /* 922 * If we've reached the min dwell time terminate 923 * the timer so we'll switch to the next channel. 924 */ 925 if ((SCAN_PRIVATE(ss)->ss_iflags & ISCAN_MINDWELL) == 0 && |
926 time_after_eq(ticks, SCAN_PRIVATE(ss)->ss_chanmindwell)) { | 926 ieee80211_time_after_eq(ticks, SCAN_PRIVATE(ss)->ss_chanmindwell)) { |
927 IEEE80211_DPRINTF(vap, IEEE80211_MSG_SCAN, 928 "%s: chan %3d%c min dwell met (%u > %lu)\n", 929 __func__, 930 ieee80211_chan2ieee(ic, ic->ic_curchan), 931 ieee80211_channel_type_char(ic->ic_curchan), 932 ticks, SCAN_PRIVATE(ss)->ss_chanmindwell); 933 SCAN_PRIVATE(ss)->ss_iflags |= ISCAN_MINDWELL; 934 /* --- 55 unchanged lines hidden --- | 927 IEEE80211_DPRINTF(vap, IEEE80211_MSG_SCAN, 928 "%s: chan %3d%c min dwell met (%u > %lu)\n", 929 __func__, 930 ieee80211_chan2ieee(ic, ic->ic_curchan), 931 ieee80211_channel_type_char(ic->ic_curchan), 932 ticks, SCAN_PRIVATE(ss)->ss_chanmindwell); 933 SCAN_PRIVATE(ss)->ss_iflags |= ISCAN_MINDWELL; 934 /* --- 55 unchanged lines hidden --- |