Ticket #275: backout-preempt-scan.diff
| File backout-preempt-scan.diff, 3.1 kB (added by mrenzmann, 5 years ago) |
|---|
-
net80211/ieee80211_wireless.c
old new 48 48 #include <linux/netdevice.h> 49 49 #include <linux/utsname.h> 50 50 #include <linux/if_arp.h> /* for ARPHRD_ETHER */ 51 #include <linux/delay.h>52 51 53 52 #include <linux/wireless.h> 54 53 #include <net/iw_handler.h> … … 75 74 static void 76 75 pre_announced_chanswitch(struct net_device *dev, u_int32_t channel, u_int32_t tbtt); 77 76 78 static int79 preempt_scan(struct net_device *dev, int max_grace, int max_wait)80 {81 struct ieee80211vap *vap = dev->priv;82 struct ieee80211com *ic = vap->iv_ic;83 int total_delay = 0;84 int canceled = 0, ready = 0;85 86 while (!ready && total_delay < max_grace + max_wait) {87 if ((ic->ic_flags & IEEE80211_F_SCAN) == 0) {88 ready = 1;89 } else {90 if (!canceled && (total_delay > max_grace)) {91 /* Cancel any existing active scan, so that any new parameters92 * in this scan ioctl (or the defaults) can be honored, then93 * wait around a while to see if the scan cancels properly. */94 IEEE80211_DPRINTF(vap, IEEE80211_MSG_SCAN,95 "%s: cancel pending scan request\n", __func__);96 (void) ieee80211_cancel_scan(vap);97 canceled = 1;98 }99 mdelay (1);100 total_delay += 1;101 }102 }103 104 if (!ready) {105 IEEE80211_DPRINTF(vap, IEEE80211_MSG_SCAN,106 "%s: Timeout canceling current scan.\n",107 __func__);108 }109 110 return ready;111 }112 113 77 static struct iw_statistics * 114 78 ieee80211_iw_getstats(struct net_device *dev) 115 79 { … … 1536 1500 /* XXX always manual... */ 1537 1501 IEEE80211_DPRINTF(vap, IEEE80211_MSG_SCAN, 1538 1502 "%s: active scan request\n", __func__); 1539 preempt_scan(dev, 100, 100);1540 1503 #if WIRELESS_EXT > 17 1504 /* XXX do we need to remove this code after backing 1505 * out preempt_scan? 1506 * => ticket 275 */ 1541 1507 if (data && (data->flags & IW_SCAN_THIS_ESSID)) { 1542 1508 struct iw_scan_req req; 1543 1509 struct ieee80211_scan_ssid ssid; … … 1957 1923 struct ieee80211com *ic = vap->iv_ic; 1958 1924 struct ifreq ifr; 1959 1925 char s[6]; /* big enough for ``11adt'' */ 1960 int retv, mode, ifr_mode ;1926 int retv, mode, ifr_mode, itr_count; 1961 1927 1962 1928 if (ic->ic_media.ifm_cur == NULL) 1963 1929 return -EINVAL; /* XXX: Wrong error */ … … 1990 1956 1991 1957 retv = ifmedia_ioctl(ic->ic_dev, &ifr, &ic->ic_media, SIOCSIFMEDIA); 1992 1958 if ((!retv || retv == -ENETRESET) && (mode != vap->iv_des_mode)) { 1993 if (preempt_scan(dev, 100, 100)) 1994 ieee80211_scan_flush(ic); /* NB: could optimize */ 1995 else 1996 return -ETIMEDOUT; 1997 1959 ieee80211_scan_flush(ic); /* NB: could optimize */ 1998 1960 vap->iv_des_mode = mode; 1999 if (IS_UP_AUTO(vap)) 1961 1962 if (IS_UP_AUTO(vap)) { 1963 ieee80211_cancel_scan(vap); 1964 itr_count = 0; 1965 while ((ic->ic_flags & IEEE80211_F_SCAN) != 0) { 1966 mdelay(1); /* XXX: ugly */ 1967 if (itr_count < 100) { 1968 itr_count++; 1969 continue; 1970 } 1971 IEEE80211_DPRINTF(vap, IEEE80211_MSG_SCAN, 1972 "%s: Timeout cancelling current scan.}n", 1973 __func__); 1974 return -ETIMEDOUT; 1975 } 2000 1976 ieee80211_new_state(vap, IEEE80211_S_SCAN, 0); 1977 } 2001 1978 2002 1979 retv = 0; 2003 1980 }
