scan.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603
  1. /*
  2. * This file is part of wl1271
  3. *
  4. * Copyright (C) 2009-2010 Nokia Corporation
  5. *
  6. * Contact: Luciano Coelho <luciano.coelho@nokia.com>
  7. *
  8. * This program is free software; you can redistribute it and/or
  9. * modify it under the terms of the GNU General Public License
  10. * version 2 as published by the Free Software Foundation.
  11. *
  12. * This program is distributed in the hope that it will be useful, but
  13. * WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  15. * General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with this program; if not, write to the Free Software
  19. * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
  20. * 02110-1301 USA
  21. *
  22. */
  23. #include <linux/ieee80211.h>
  24. #include "wl12xx.h"
  25. #include "cmd.h"
  26. #include "scan.h"
  27. #include "acx.h"
  28. #include "ps.h"
  29. void wl1271_scan_complete_work(struct work_struct *work)
  30. {
  31. struct delayed_work *dwork;
  32. struct wl1271 *wl;
  33. dwork = container_of(work, struct delayed_work, work);
  34. wl = container_of(dwork, struct wl1271, scan_complete_work);
  35. wl1271_debug(DEBUG_SCAN, "Scanning complete");
  36. mutex_lock(&wl->mutex);
  37. if (wl->state == WL1271_STATE_OFF)
  38. goto out;
  39. if (wl->scan.state == WL1271_SCAN_STATE_IDLE)
  40. goto out;
  41. wl->scan.state = WL1271_SCAN_STATE_IDLE;
  42. memset(wl->scan.scanned_ch, 0, sizeof(wl->scan.scanned_ch));
  43. wl->scan.req = NULL;
  44. ieee80211_scan_completed(wl->hw, false);
  45. /* restore hardware connection monitoring template */
  46. if (test_bit(WL1271_FLAG_STA_ASSOCIATED, &wl->flags)) {
  47. if (wl1271_ps_elp_wakeup(wl) == 0) {
  48. wl1271_cmd_build_ap_probe_req(wl, wl->probereq);
  49. wl1271_ps_elp_sleep(wl);
  50. }
  51. }
  52. if (wl->scan.failed) {
  53. wl1271_info("Scan completed due to error.");
  54. wl12xx_queue_recovery_work(wl);
  55. }
  56. out:
  57. mutex_unlock(&wl->mutex);
  58. }
  59. static int wl1271_get_scan_channels(struct wl1271 *wl,
  60. struct cfg80211_scan_request *req,
  61. struct basic_scan_channel_params *channels,
  62. enum ieee80211_band band, bool passive)
  63. {
  64. struct conf_scan_settings *c = &wl->conf.scan;
  65. int i, j;
  66. u32 flags;
  67. for (i = 0, j = 0;
  68. i < req->n_channels && j < WL1271_SCAN_MAX_CHANNELS;
  69. i++) {
  70. flags = req->channels[i]->flags;
  71. if (!test_bit(i, wl->scan.scanned_ch) &&
  72. !(flags & IEEE80211_CHAN_DISABLED) &&
  73. ((!!(flags & IEEE80211_CHAN_PASSIVE_SCAN)) == passive) &&
  74. (req->channels[i]->band == band)) {
  75. wl1271_debug(DEBUG_SCAN, "band %d, center_freq %d ",
  76. req->channels[i]->band,
  77. req->channels[i]->center_freq);
  78. wl1271_debug(DEBUG_SCAN, "hw_value %d, flags %X",
  79. req->channels[i]->hw_value,
  80. req->channels[i]->flags);
  81. wl1271_debug(DEBUG_SCAN,
  82. "max_antenna_gain %d, max_power %d",
  83. req->channels[i]->max_antenna_gain,
  84. req->channels[i]->max_power);
  85. wl1271_debug(DEBUG_SCAN, "beacon_found %d",
  86. req->channels[i]->beacon_found);
  87. if (!passive) {
  88. channels[j].min_duration =
  89. cpu_to_le32(c->min_dwell_time_active);
  90. channels[j].max_duration =
  91. cpu_to_le32(c->max_dwell_time_active);
  92. } else {
  93. channels[j].min_duration =
  94. cpu_to_le32(c->min_dwell_time_passive);
  95. channels[j].max_duration =
  96. cpu_to_le32(c->max_dwell_time_passive);
  97. }
  98. channels[j].early_termination = 0;
  99. channels[j].tx_power_att = req->channels[i]->max_power;
  100. channels[j].channel = req->channels[i]->hw_value;
  101. memset(&channels[j].bssid_lsb, 0xff, 4);
  102. memset(&channels[j].bssid_msb, 0xff, 2);
  103. /* Mark the channels we already used */
  104. set_bit(i, wl->scan.scanned_ch);
  105. j++;
  106. }
  107. }
  108. return j;
  109. }
  110. #define WL1271_NOTHING_TO_SCAN 1
  111. static int wl1271_scan_send(struct wl1271 *wl, enum ieee80211_band band,
  112. bool passive, u32 basic_rate)
  113. {
  114. struct wl1271_cmd_scan *cmd;
  115. struct wl1271_cmd_trigger_scan_to *trigger;
  116. int ret;
  117. u16 scan_options = 0;
  118. cmd = kzalloc(sizeof(*cmd), GFP_KERNEL);
  119. trigger = kzalloc(sizeof(*trigger), GFP_KERNEL);
  120. if (!cmd || !trigger) {
  121. ret = -ENOMEM;
  122. goto out;
  123. }
  124. /* We always use high priority scans */
  125. scan_options = WL1271_SCAN_OPT_PRIORITY_HIGH;
  126. /* No SSIDs means that we have a forced passive scan */
  127. if (passive || wl->scan.req->n_ssids == 0)
  128. scan_options |= WL1271_SCAN_OPT_PASSIVE;
  129. cmd->params.scan_options = cpu_to_le16(scan_options);
  130. cmd->params.n_ch = wl1271_get_scan_channels(wl, wl->scan.req,
  131. cmd->channels,
  132. band, passive);
  133. if (cmd->params.n_ch == 0) {
  134. ret = WL1271_NOTHING_TO_SCAN;
  135. goto out;
  136. }
  137. cmd->params.tx_rate = cpu_to_le32(basic_rate);
  138. cmd->params.n_probe_reqs = wl->conf.scan.num_probe_reqs;
  139. cmd->params.tx_rate = cpu_to_le32(basic_rate);
  140. cmd->params.tid_trigger = 0;
  141. cmd->params.scan_tag = WL1271_SCAN_DEFAULT_TAG;
  142. if (band == IEEE80211_BAND_2GHZ)
  143. cmd->params.band = WL1271_SCAN_BAND_2_4_GHZ;
  144. else
  145. cmd->params.band = WL1271_SCAN_BAND_5_GHZ;
  146. if (wl->scan.ssid_len && wl->scan.ssid) {
  147. cmd->params.ssid_len = wl->scan.ssid_len;
  148. memcpy(cmd->params.ssid, wl->scan.ssid, wl->scan.ssid_len);
  149. }
  150. ret = wl1271_cmd_build_probe_req(wl, wl->scan.ssid, wl->scan.ssid_len,
  151. wl->scan.req->ie, wl->scan.req->ie_len,
  152. band);
  153. if (ret < 0) {
  154. wl1271_error("PROBE request template failed");
  155. goto out;
  156. }
  157. /* disable the timeout */
  158. trigger->timeout = 0;
  159. ret = wl1271_cmd_send(wl, CMD_TRIGGER_SCAN_TO, trigger,
  160. sizeof(*trigger), 0);
  161. if (ret < 0) {
  162. wl1271_error("trigger scan to failed for hw scan");
  163. goto out;
  164. }
  165. wl1271_dump(DEBUG_SCAN, "SCAN: ", cmd, sizeof(*cmd));
  166. ret = wl1271_cmd_send(wl, CMD_SCAN, cmd, sizeof(*cmd), 0);
  167. if (ret < 0) {
  168. wl1271_error("SCAN failed");
  169. goto out;
  170. }
  171. out:
  172. kfree(cmd);
  173. kfree(trigger);
  174. return ret;
  175. }
  176. void wl1271_scan_stm(struct wl1271 *wl)
  177. {
  178. int ret = 0;
  179. switch (wl->scan.state) {
  180. case WL1271_SCAN_STATE_IDLE:
  181. break;
  182. case WL1271_SCAN_STATE_2GHZ_ACTIVE:
  183. ret = wl1271_scan_send(wl, IEEE80211_BAND_2GHZ, false,
  184. wl->conf.tx.basic_rate);
  185. if (ret == WL1271_NOTHING_TO_SCAN) {
  186. wl->scan.state = WL1271_SCAN_STATE_2GHZ_PASSIVE;
  187. wl1271_scan_stm(wl);
  188. }
  189. break;
  190. case WL1271_SCAN_STATE_2GHZ_PASSIVE:
  191. ret = wl1271_scan_send(wl, IEEE80211_BAND_2GHZ, true,
  192. wl->conf.tx.basic_rate);
  193. if (ret == WL1271_NOTHING_TO_SCAN) {
  194. if (wl->enable_11a)
  195. wl->scan.state = WL1271_SCAN_STATE_5GHZ_ACTIVE;
  196. else
  197. wl->scan.state = WL1271_SCAN_STATE_DONE;
  198. wl1271_scan_stm(wl);
  199. }
  200. break;
  201. case WL1271_SCAN_STATE_5GHZ_ACTIVE:
  202. ret = wl1271_scan_send(wl, IEEE80211_BAND_5GHZ, false,
  203. wl->conf.tx.basic_rate_5);
  204. if (ret == WL1271_NOTHING_TO_SCAN) {
  205. wl->scan.state = WL1271_SCAN_STATE_5GHZ_PASSIVE;
  206. wl1271_scan_stm(wl);
  207. }
  208. break;
  209. case WL1271_SCAN_STATE_5GHZ_PASSIVE:
  210. ret = wl1271_scan_send(wl, IEEE80211_BAND_5GHZ, true,
  211. wl->conf.tx.basic_rate_5);
  212. if (ret == WL1271_NOTHING_TO_SCAN) {
  213. wl->scan.state = WL1271_SCAN_STATE_DONE;
  214. wl1271_scan_stm(wl);
  215. }
  216. break;
  217. case WL1271_SCAN_STATE_DONE:
  218. wl->scan.failed = false;
  219. cancel_delayed_work(&wl->scan_complete_work);
  220. ieee80211_queue_delayed_work(wl->hw, &wl->scan_complete_work,
  221. msecs_to_jiffies(0));
  222. break;
  223. default:
  224. wl1271_error("invalid scan state");
  225. break;
  226. }
  227. if (ret < 0) {
  228. cancel_delayed_work(&wl->scan_complete_work);
  229. ieee80211_queue_delayed_work(wl->hw, &wl->scan_complete_work,
  230. msecs_to_jiffies(0));
  231. }
  232. }
  233. int wl1271_scan(struct wl1271 *wl, const u8 *ssid, size_t ssid_len,
  234. struct cfg80211_scan_request *req)
  235. {
  236. /*
  237. * cfg80211 should guarantee that we don't get more channels
  238. * than what we have registered.
  239. */
  240. BUG_ON(req->n_channels > WL1271_MAX_CHANNELS);
  241. if (wl->scan.state != WL1271_SCAN_STATE_IDLE)
  242. return -EBUSY;
  243. wl->scan.state = WL1271_SCAN_STATE_2GHZ_ACTIVE;
  244. if (ssid_len && ssid) {
  245. wl->scan.ssid_len = ssid_len;
  246. memcpy(wl->scan.ssid, ssid, ssid_len);
  247. } else {
  248. wl->scan.ssid_len = 0;
  249. }
  250. wl->scan.req = req;
  251. memset(wl->scan.scanned_ch, 0, sizeof(wl->scan.scanned_ch));
  252. /* we assume failure so that timeout scenarios are handled correctly */
  253. wl->scan.failed = true;
  254. ieee80211_queue_delayed_work(wl->hw, &wl->scan_complete_work,
  255. msecs_to_jiffies(WL1271_SCAN_TIMEOUT));
  256. wl1271_scan_stm(wl);
  257. return 0;
  258. }
  259. int wl1271_scan_stop(struct wl1271 *wl)
  260. {
  261. struct wl1271_cmd_header *cmd = NULL;
  262. int ret = 0;
  263. if (WARN_ON(wl->scan.state == WL1271_SCAN_STATE_IDLE))
  264. return -EINVAL;
  265. wl1271_debug(DEBUG_CMD, "cmd scan stop");
  266. cmd = kzalloc(sizeof(*cmd), GFP_KERNEL);
  267. if (!cmd) {
  268. ret = -ENOMEM;
  269. goto out;
  270. }
  271. ret = wl1271_cmd_send(wl, CMD_STOP_SCAN, cmd,
  272. sizeof(*cmd), 0);
  273. if (ret < 0) {
  274. wl1271_error("cmd stop_scan failed");
  275. goto out;
  276. }
  277. out:
  278. kfree(cmd);
  279. return ret;
  280. }
  281. static int
  282. wl1271_scan_get_sched_scan_channels(struct wl1271 *wl,
  283. struct cfg80211_sched_scan_request *req,
  284. struct conn_scan_ch_params *channels,
  285. u32 band, bool radar, bool passive,
  286. int start, int max_channels)
  287. {
  288. struct conf_sched_scan_settings *c = &wl->conf.sched_scan;
  289. int i, j;
  290. u32 flags;
  291. bool force_passive = !req->n_ssids;
  292. for (i = 0, j = start;
  293. i < req->n_channels && j < max_channels;
  294. i++) {
  295. flags = req->channels[i]->flags;
  296. if (force_passive)
  297. flags |= IEEE80211_CHAN_PASSIVE_SCAN;
  298. if ((req->channels[i]->band == band) &&
  299. !(flags & IEEE80211_CHAN_DISABLED) &&
  300. (!!(flags & IEEE80211_CHAN_RADAR) == radar) &&
  301. /* if radar is set, we ignore the passive flag */
  302. (radar ||
  303. !!(flags & IEEE80211_CHAN_PASSIVE_SCAN) == passive)) {
  304. wl1271_debug(DEBUG_SCAN, "band %d, center_freq %d ",
  305. req->channels[i]->band,
  306. req->channels[i]->center_freq);
  307. wl1271_debug(DEBUG_SCAN, "hw_value %d, flags %X",
  308. req->channels[i]->hw_value,
  309. req->channels[i]->flags);
  310. wl1271_debug(DEBUG_SCAN, "max_power %d",
  311. req->channels[i]->max_power);
  312. if (flags & IEEE80211_CHAN_RADAR) {
  313. channels[j].flags |= SCAN_CHANNEL_FLAGS_DFS;
  314. channels[j].passive_duration =
  315. cpu_to_le16(c->dwell_time_dfs);
  316. }
  317. else if (flags & IEEE80211_CHAN_PASSIVE_SCAN) {
  318. channels[j].passive_duration =
  319. cpu_to_le16(c->dwell_time_passive);
  320. } else {
  321. channels[j].min_duration =
  322. cpu_to_le16(c->min_dwell_time_active);
  323. channels[j].max_duration =
  324. cpu_to_le16(c->max_dwell_time_active);
  325. }
  326. channels[j].tx_power_att = req->channels[i]->max_power;
  327. channels[j].channel = req->channels[i]->hw_value;
  328. j++;
  329. }
  330. }
  331. return j - start;
  332. }
  333. static bool
  334. wl1271_scan_sched_scan_channels(struct wl1271 *wl,
  335. struct cfg80211_sched_scan_request *req,
  336. struct wl1271_cmd_sched_scan_config *cfg)
  337. {
  338. cfg->passive[0] =
  339. wl1271_scan_get_sched_scan_channels(wl, req, cfg->channels_2,
  340. IEEE80211_BAND_2GHZ,
  341. false, true, 0,
  342. MAX_CHANNELS_2GHZ);
  343. cfg->active[0] =
  344. wl1271_scan_get_sched_scan_channels(wl, req, cfg->channels_2,
  345. IEEE80211_BAND_2GHZ,
  346. false, false,
  347. cfg->passive[0],
  348. MAX_CHANNELS_2GHZ);
  349. cfg->passive[1] =
  350. wl1271_scan_get_sched_scan_channels(wl, req, cfg->channels_5,
  351. IEEE80211_BAND_5GHZ,
  352. false, true, 0,
  353. MAX_CHANNELS_5GHZ);
  354. cfg->dfs =
  355. wl1271_scan_get_sched_scan_channels(wl, req, cfg->channels_5,
  356. IEEE80211_BAND_5GHZ,
  357. true, true,
  358. cfg->passive[1],
  359. MAX_CHANNELS_5GHZ);
  360. cfg->active[1] =
  361. wl1271_scan_get_sched_scan_channels(wl, req, cfg->channels_5,
  362. IEEE80211_BAND_5GHZ,
  363. false, false,
  364. cfg->passive[1] + cfg->dfs,
  365. MAX_CHANNELS_5GHZ);
  366. /* 802.11j channels are not supported yet */
  367. cfg->passive[2] = 0;
  368. cfg->active[2] = 0;
  369. wl1271_debug(DEBUG_SCAN, " 2.4GHz: active %d passive %d",
  370. cfg->active[0], cfg->passive[0]);
  371. wl1271_debug(DEBUG_SCAN, " 5GHz: active %d passive %d",
  372. cfg->active[1], cfg->passive[1]);
  373. wl1271_debug(DEBUG_SCAN, " DFS: %d", cfg->dfs);
  374. return cfg->passive[0] || cfg->active[0] ||
  375. cfg->passive[1] || cfg->active[1] || cfg->dfs ||
  376. cfg->passive[2] || cfg->active[2];
  377. }
  378. int wl1271_scan_sched_scan_config(struct wl1271 *wl,
  379. struct cfg80211_sched_scan_request *req,
  380. struct ieee80211_sched_scan_ies *ies)
  381. {
  382. struct wl1271_cmd_sched_scan_config *cfg = NULL;
  383. struct conf_sched_scan_settings *c = &wl->conf.sched_scan;
  384. int i, ret;
  385. bool force_passive = !req->n_ssids;
  386. wl1271_debug(DEBUG_CMD, "cmd sched_scan scan config");
  387. cfg = kzalloc(sizeof(*cfg), GFP_KERNEL);
  388. if (!cfg)
  389. return -ENOMEM;
  390. cfg->rssi_threshold = c->rssi_threshold;
  391. cfg->snr_threshold = c->snr_threshold;
  392. cfg->n_probe_reqs = c->num_probe_reqs;
  393. /* cycles set to 0 it means infinite (until manually stopped) */
  394. cfg->cycles = 0;
  395. /* report APs when at least 1 is found */
  396. cfg->report_after = 1;
  397. /* don't stop scanning automatically when something is found */
  398. cfg->terminate = 0;
  399. cfg->tag = WL1271_SCAN_DEFAULT_TAG;
  400. /* don't filter on BSS type */
  401. cfg->bss_type = SCAN_BSS_TYPE_ANY;
  402. /* currently NL80211 supports only a single interval */
  403. for (i = 0; i < SCAN_MAX_CYCLE_INTERVALS; i++)
  404. cfg->intervals[i] = cpu_to_le32(req->interval);
  405. if (!force_passive && req->ssids[0].ssid_len && req->ssids[0].ssid) {
  406. cfg->filter_type = SCAN_SSID_FILTER_SPECIFIC;
  407. cfg->ssid_len = req->ssids[0].ssid_len;
  408. memcpy(cfg->ssid, req->ssids[0].ssid,
  409. req->ssids[0].ssid_len);
  410. } else {
  411. cfg->filter_type = SCAN_SSID_FILTER_ANY;
  412. cfg->ssid_len = 0;
  413. }
  414. if (!wl1271_scan_sched_scan_channels(wl, req, cfg)) {
  415. wl1271_error("scan channel list is empty");
  416. ret = -EINVAL;
  417. goto out;
  418. }
  419. if (!force_passive && cfg->active[0]) {
  420. ret = wl1271_cmd_build_probe_req(wl, req->ssids[0].ssid,
  421. req->ssids[0].ssid_len,
  422. ies->ie[IEEE80211_BAND_2GHZ],
  423. ies->len[IEEE80211_BAND_2GHZ],
  424. IEEE80211_BAND_2GHZ);
  425. if (ret < 0) {
  426. wl1271_error("2.4GHz PROBE request template failed");
  427. goto out;
  428. }
  429. }
  430. if (!force_passive && cfg->active[1]) {
  431. ret = wl1271_cmd_build_probe_req(wl, req->ssids[0].ssid,
  432. req->ssids[0].ssid_len,
  433. ies->ie[IEEE80211_BAND_5GHZ],
  434. ies->len[IEEE80211_BAND_5GHZ],
  435. IEEE80211_BAND_5GHZ);
  436. if (ret < 0) {
  437. wl1271_error("5GHz PROBE request template failed");
  438. goto out;
  439. }
  440. }
  441. wl1271_dump(DEBUG_SCAN, "SCAN_CFG: ", cfg, sizeof(*cfg));
  442. ret = wl1271_cmd_send(wl, CMD_CONNECTION_SCAN_CFG, cfg,
  443. sizeof(*cfg), 0);
  444. if (ret < 0) {
  445. wl1271_error("SCAN configuration failed");
  446. goto out;
  447. }
  448. out:
  449. kfree(cfg);
  450. return ret;
  451. }
  452. int wl1271_scan_sched_scan_start(struct wl1271 *wl)
  453. {
  454. struct wl1271_cmd_sched_scan_start *start;
  455. int ret = 0;
  456. wl1271_debug(DEBUG_CMD, "cmd periodic scan start");
  457. if (wl->bss_type != BSS_TYPE_STA_BSS)
  458. return -EOPNOTSUPP;
  459. if (!test_bit(WL1271_FLAG_IDLE, &wl->flags))
  460. return -EBUSY;
  461. start = kzalloc(sizeof(*start), GFP_KERNEL);
  462. if (!start)
  463. return -ENOMEM;
  464. start->tag = WL1271_SCAN_DEFAULT_TAG;
  465. ret = wl1271_cmd_send(wl, CMD_START_PERIODIC_SCAN, start,
  466. sizeof(*start), 0);
  467. if (ret < 0) {
  468. wl1271_error("failed to send scan start command");
  469. goto out_free;
  470. }
  471. out_free:
  472. kfree(start);
  473. return ret;
  474. }
  475. void wl1271_scan_sched_scan_results(struct wl1271 *wl)
  476. {
  477. wl1271_debug(DEBUG_SCAN, "got periodic scan results");
  478. ieee80211_sched_scan_results(wl->hw);
  479. }
  480. void wl1271_scan_sched_scan_stop(struct wl1271 *wl)
  481. {
  482. struct wl1271_cmd_sched_scan_stop *stop;
  483. int ret = 0;
  484. wl1271_debug(DEBUG_CMD, "cmd periodic scan stop");
  485. /* FIXME: what to do if alloc'ing to stop fails? */
  486. stop = kzalloc(sizeof(*stop), GFP_KERNEL);
  487. if (!stop) {
  488. wl1271_error("failed to alloc memory to send sched scan stop");
  489. return;
  490. }
  491. stop->tag = WL1271_SCAN_DEFAULT_TAG;
  492. ret = wl1271_cmd_send(wl, CMD_STOP_PERIODIC_SCAN, stop,
  493. sizeof(*stop), 0);
  494. if (ret < 0) {
  495. wl1271_error("failed to send sched scan stop command");
  496. goto out_free;
  497. }
  498. wl->sched_scanning = false;
  499. out_free:
  500. kfree(stop);
  501. }