| 782 | } |
| 783 | |
| 784 | static void |
| 785 | scan_end(struct ieee80211_scan_state *ss, int scandone) |
| 786 | { |
| 787 | struct scan_state *ss_priv = SCAN_PRIVATE(ss); |
| 788 | struct ieee80211vap *vap = ss->ss_vap; |
| 789 | struct ieee80211com *ic = ss->ss_ic; |
| 790 | |
| 791 | IEEE80211_LOCK_ASSERT(ic); |
| 792 | |
| 793 | IEEE80211_DPRINTF(vap, IEEE80211_MSG_SCAN, "%s: out\n", __func__); |
| 794 | |
| 795 | if (ss_priv->ss_iflags & ISCAN_ABORT) { |
| 796 | scan_done(ss, scandone); |
| 797 | return; |
| 798 | } |
| 799 | |
| 800 | IEEE80211_UNLOCK(ic); |
| 801 | ic->ic_scan_end(ic); /* notify driver */ |
| 802 | IEEE80211_LOCK(ic); |
| 803 | /* XXX scan state can change! Re-validate scan state! */ |
| 804 | |
| 805 | /* |
| 806 | * Since a cancellation may have occurred during one of the |
| 807 | * driver calls (whilst unlocked), update scandone. |
| 808 | */ |
| 809 | if ((scandone == 0) && ((ss_priv->ss_iflags & ISCAN_PAUSE) == ISCAN_CANCEL)) { |
| 810 | /* XXX printf? */ |
| 811 | if_printf(vap->iv_ifp, |
| 812 | "%s: OOPS! scan cancelled during driver call (1) (ss_iflags=0x%x)!\n", |
| 813 | __func__, |
| 814 | ss_priv->ss_iflags); |
| 815 | scandone = 1; |
| 816 | } |
| 817 | |
| 818 | /* |
| 819 | * Record scan complete time. Note that we also do |
| 820 | * this when canceled so any background scan will |
| 821 | * not be restarted for a while. |
| 822 | */ |
| 823 | if (scandone) |
| 824 | ic->ic_lastscan = ticks; |
| 825 | /* return to the bss channel */ |
| 826 | if (ic->ic_bsschan != IEEE80211_CHAN_ANYC && |
| 827 | ic->ic_curchan != ic->ic_bsschan) { |
| 828 | ieee80211_setupcurchan(ic, ic->ic_bsschan); |
| 829 | IEEE80211_UNLOCK(ic); |
| 830 | ic->ic_set_channel(ic); |
| 831 | ieee80211_radiotap_chan_change(ic); |
| 832 | IEEE80211_LOCK(ic); |
| 833 | } |
| 834 | /* clear internal flags and any indication of a pick */ |
| 835 | ss_priv->ss_iflags &= ~ISCAN_REP; |
| 836 | ss->ss_flags &= ~IEEE80211_SCAN_GOTPICK; |
| 837 | |
| 838 | /* |
| 839 | * If not canceled and scan completed, do post-processing. |
| 840 | * If the callback function returns 0, then it wants to |
| 841 | * continue/restart scanning. Unfortunately we needed to |
no test coverage detected