dfs.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676
  1. /*
  2. * DFS - Dynamic Frequency Selection
  3. * Copyright (c) 2002-2013, Jouni Malinen <j@w1.fi>
  4. * Copyright (c) 2013, Qualcomm Atheros, Inc.
  5. *
  6. * This software may be distributed under the terms of the BSD license.
  7. * See README for more details.
  8. */
  9. #include "utils/includes.h"
  10. #include "utils/common.h"
  11. #include "common/ieee802_11_defs.h"
  12. #include "hostapd.h"
  13. #include "ap_drv_ops.h"
  14. #include "drivers/driver.h"
  15. #include "dfs.h"
  16. static int dfs_get_used_n_chans(struct hostapd_data *hapd)
  17. {
  18. int n_chans = 1;
  19. if (hapd->iconf->ieee80211n && hapd->iconf->secondary_channel)
  20. n_chans = 2;
  21. if (hapd->iconf->ieee80211ac) {
  22. switch (hapd->iconf->vht_oper_chwidth) {
  23. case VHT_CHANWIDTH_USE_HT:
  24. break;
  25. case VHT_CHANWIDTH_80MHZ:
  26. n_chans = 4;
  27. break;
  28. case VHT_CHANWIDTH_160MHZ:
  29. n_chans = 8;
  30. break;
  31. default:
  32. break;
  33. }
  34. }
  35. return n_chans;
  36. }
  37. static int dfs_channel_available(struct hostapd_channel_data *chan)
  38. {
  39. if (chan->flag & HOSTAPD_CHAN_DISABLED)
  40. return 0;
  41. if ((chan->flag & HOSTAPD_CHAN_RADAR) &&
  42. ((chan->flag & HOSTAPD_CHAN_DFS_MASK) ==
  43. HOSTAPD_CHAN_DFS_UNAVAILABLE))
  44. return 0;
  45. return 1;
  46. }
  47. static int dfs_is_chan_allowed(struct hostapd_channel_data *chan, int n_chans)
  48. {
  49. /*
  50. * The tables contain first valid channel number based on channel width.
  51. * We will also choose this first channel as the control one.
  52. */
  53. int allowed_40[] = { 36, 44, 52, 60, 100, 108, 116, 124, 132, 149, 157,
  54. 184, 192 };
  55. /*
  56. * VHT80, valid channels based on center frequency:
  57. * 42, 58, 106, 122, 138, 155
  58. */
  59. int allowed_80[] = { 36, 52, 100, 116, 132, 149 };
  60. int *allowed = allowed_40;
  61. unsigned int i, allowed_no = 0;
  62. switch (n_chans) {
  63. case 2:
  64. allowed = allowed_40;
  65. allowed_no = ARRAY_SIZE(allowed_40);
  66. break;
  67. case 4:
  68. allowed = allowed_80;
  69. allowed_no = ARRAY_SIZE(allowed_80);
  70. break;
  71. default:
  72. wpa_printf(MSG_DEBUG, "Unknown width for %d channels", n_chans);
  73. break;
  74. }
  75. for (i = 0; i < allowed_no; i++) {
  76. if (chan->chan == allowed[i])
  77. return 1;
  78. }
  79. return 0;
  80. }
  81. static int dfs_chan_range_available(struct hostapd_hw_modes *mode,
  82. int first_chan_idx, int num_chans)
  83. {
  84. struct hostapd_channel_data *first_chan, *chan;
  85. int i;
  86. if (first_chan_idx + num_chans >= mode->num_channels)
  87. return 0;
  88. first_chan = &mode->channels[first_chan_idx];
  89. for (i = 0; i < num_chans; i++) {
  90. chan = &mode->channels[first_chan_idx + i];
  91. if (first_chan->freq + i * 20 != chan->freq)
  92. return 0;
  93. if (!dfs_channel_available(chan))
  94. return 0;
  95. }
  96. return 1;
  97. }
  98. /*
  99. * The function assumes HT40+ operation.
  100. * Make sure to adjust the following variables after calling this:
  101. * - hapd->secondary_channel
  102. * - hapd->vht_oper_centr_freq_seg0_idx
  103. * - hapd->vht_oper_centr_freq_seg1_idx
  104. */
  105. static int dfs_find_channel(struct hostapd_data *hapd,
  106. struct hostapd_channel_data **ret_chan,
  107. int idx)
  108. {
  109. struct hostapd_hw_modes *mode;
  110. struct hostapd_channel_data *chan;
  111. int i, channel_idx = 0, n_chans;
  112. mode = hapd->iface->current_mode;
  113. n_chans = dfs_get_used_n_chans(hapd);
  114. wpa_printf(MSG_DEBUG, "DFS new chan checking %d channels", n_chans);
  115. for (i = 0; i < mode->num_channels; i++) {
  116. chan = &mode->channels[i];
  117. /* Skip HT40/VHT incompatible channels */
  118. if (hapd->iconf->ieee80211n &&
  119. hapd->iconf->secondary_channel &&
  120. !dfs_is_chan_allowed(chan, n_chans))
  121. continue;
  122. /* Skip incompatible chandefs */
  123. if (!dfs_chan_range_available(mode, i, n_chans))
  124. continue;
  125. if (ret_chan && idx == channel_idx) {
  126. wpa_printf(MSG_DEBUG, "Selected ch. #%d", chan->chan);
  127. *ret_chan = chan;
  128. return idx;
  129. }
  130. wpa_printf(MSG_DEBUG, "Adding channel: %d", chan->chan);
  131. channel_idx++;
  132. }
  133. return channel_idx;
  134. }
  135. static void dfs_adjust_vht_center_freq(struct hostapd_data *hapd,
  136. struct hostapd_channel_data *chan,
  137. u8 *vht_oper_centr_freq_seg0_idx,
  138. u8 *vht_oper_centr_freq_seg1_idx)
  139. {
  140. if (!hapd->iconf->ieee80211ac)
  141. return;
  142. if (!chan)
  143. return;
  144. *vht_oper_centr_freq_seg1_idx = 0;
  145. switch (hapd->iconf->vht_oper_chwidth) {
  146. case VHT_CHANWIDTH_USE_HT:
  147. if (hapd->iconf->secondary_channel == 1)
  148. *vht_oper_centr_freq_seg0_idx = chan->chan + 2;
  149. else if (hapd->iconf->secondary_channel == -1)
  150. *vht_oper_centr_freq_seg0_idx = chan->chan - 2;
  151. else
  152. *vht_oper_centr_freq_seg0_idx = chan->chan;
  153. break;
  154. case VHT_CHANWIDTH_80MHZ:
  155. *vht_oper_centr_freq_seg0_idx = chan->chan + 6;
  156. break;
  157. case VHT_CHANWIDTH_160MHZ:
  158. *vht_oper_centr_freq_seg0_idx = chan->chan + 14;
  159. break;
  160. default:
  161. wpa_printf(MSG_INFO, "DFS only VHT20/40/80/160 is supported now");
  162. break;
  163. }
  164. wpa_printf(MSG_DEBUG, "DFS adjusting VHT center frequency: %d, %d",
  165. *vht_oper_centr_freq_seg0_idx,
  166. *vht_oper_centr_freq_seg1_idx);
  167. }
  168. /* Return start channel idx we will use for mode->channels[idx] */
  169. static int dfs_get_start_chan_idx(struct hostapd_data *hapd)
  170. {
  171. struct hostapd_hw_modes *mode;
  172. struct hostapd_channel_data *chan;
  173. int channel_no = hapd->iconf->channel;
  174. int res = -1, i;
  175. /* HT40- */
  176. if (hapd->iconf->ieee80211n && hapd->iconf->secondary_channel == -1)
  177. channel_no -= 4;
  178. /* VHT */
  179. if (hapd->iconf->ieee80211ac) {
  180. switch (hapd->iconf->vht_oper_chwidth) {
  181. case VHT_CHANWIDTH_USE_HT:
  182. break;
  183. case VHT_CHANWIDTH_80MHZ:
  184. channel_no =
  185. hapd->iconf->vht_oper_centr_freq_seg0_idx - 6;
  186. break;
  187. case VHT_CHANWIDTH_160MHZ:
  188. channel_no =
  189. hapd->iconf->vht_oper_centr_freq_seg0_idx - 14;
  190. break;
  191. default:
  192. wpa_printf(MSG_INFO,
  193. "DFS only VHT20/40/80/160 is supported now");
  194. channel_no = -1;
  195. break;
  196. }
  197. }
  198. /* Get idx */
  199. mode = hapd->iface->current_mode;
  200. for (i = 0; i < mode->num_channels; i++) {
  201. chan = &mode->channels[i];
  202. if (chan->chan == channel_no) {
  203. res = i;
  204. break;
  205. }
  206. }
  207. if (res == -1)
  208. wpa_printf(MSG_DEBUG, "DFS chan_idx seems wrong: -1");
  209. return res;
  210. }
  211. /* At least one channel have radar flag */
  212. static int dfs_check_chans_radar(struct hostapd_data *hapd, int start_chan_idx,
  213. int n_chans)
  214. {
  215. struct hostapd_channel_data *channel;
  216. struct hostapd_hw_modes *mode;
  217. int i, res = 0;
  218. mode = hapd->iface->current_mode;
  219. for (i = 0; i < n_chans; i++) {
  220. channel = &mode->channels[start_chan_idx + i];
  221. if (channel->flag & HOSTAPD_CHAN_RADAR)
  222. res++;
  223. }
  224. return res;
  225. }
  226. /* All channels available */
  227. static int dfs_check_chans_available(struct hostapd_data *hapd,
  228. int start_chan_idx, int n_chans)
  229. {
  230. struct hostapd_channel_data *channel;
  231. struct hostapd_hw_modes *mode;
  232. int i;
  233. mode = hapd->iface->current_mode;
  234. for(i = 0; i < n_chans; i++) {
  235. channel = &mode->channels[start_chan_idx + i];
  236. if ((channel->flag & HOSTAPD_CHAN_DFS_MASK) !=
  237. HOSTAPD_CHAN_DFS_AVAILABLE)
  238. break;
  239. }
  240. return i == n_chans;
  241. }
  242. /* At least one channel unavailable */
  243. static int dfs_check_chans_unavailable(struct hostapd_data *hapd,
  244. int start_chan_idx,
  245. int n_chans)
  246. {
  247. struct hostapd_channel_data *channel;
  248. struct hostapd_hw_modes *mode;
  249. int i, res = 0;
  250. mode = hapd->iface->current_mode;
  251. for(i = 0; i < n_chans; i++) {
  252. channel = &mode->channels[start_chan_idx + i];
  253. if (channel->flag & HOSTAPD_CHAN_DISABLED)
  254. res++;
  255. if ((channel->flag & HOSTAPD_CHAN_DFS_MASK) ==
  256. HOSTAPD_CHAN_DFS_UNAVAILABLE)
  257. res++;
  258. }
  259. return res;
  260. }
  261. static struct hostapd_channel_data *
  262. dfs_get_valid_channel(struct hostapd_data *hapd,
  263. int *secondary_channel,
  264. u8 *vht_oper_centr_freq_seg0_idx,
  265. u8 *vht_oper_centr_freq_seg1_idx)
  266. {
  267. struct hostapd_hw_modes *mode;
  268. struct hostapd_channel_data *chan = NULL;
  269. int num_available_chandefs;
  270. int chan_idx;
  271. u32 _rand;
  272. wpa_printf(MSG_DEBUG, "DFS: Selecting random channel");
  273. if (hapd->iface->current_mode == NULL)
  274. return NULL;
  275. mode = hapd->iface->current_mode;
  276. if (mode->mode != HOSTAPD_MODE_IEEE80211A)
  277. return NULL;
  278. /* Get the count first */
  279. num_available_chandefs = dfs_find_channel(hapd, NULL, 0);
  280. if (num_available_chandefs == 0)
  281. return NULL;
  282. os_get_random((u8 *) &_rand, sizeof(_rand));
  283. chan_idx = _rand % num_available_chandefs;
  284. dfs_find_channel(hapd, &chan, chan_idx);
  285. /* dfs_find_channel() calculations assume HT40+ */
  286. if (hapd->iconf->secondary_channel)
  287. *secondary_channel = 1;
  288. else
  289. *secondary_channel = 0;
  290. dfs_adjust_vht_center_freq(hapd, chan,
  291. vht_oper_centr_freq_seg0_idx,
  292. vht_oper_centr_freq_seg1_idx);
  293. return chan;
  294. }
  295. static int set_dfs_state_freq(struct hostapd_data *hapd, int freq, u32 state)
  296. {
  297. struct hostapd_hw_modes *mode;
  298. struct hostapd_channel_data *chan = NULL;
  299. int i;
  300. mode = hapd->iface->current_mode;
  301. if (mode == NULL)
  302. return 0;
  303. wpa_printf(MSG_DEBUG, "set_dfs_state 0x%X for %d MHz", state, freq);
  304. for (i = 0; i < hapd->iface->current_mode->num_channels; i++) {
  305. chan = &hapd->iface->current_mode->channels[i];
  306. if (chan->freq == freq) {
  307. if (chan->flag & HOSTAPD_CHAN_RADAR) {
  308. chan->flag &= ~HOSTAPD_CHAN_DFS_MASK;
  309. chan->flag |= state;
  310. return 1; /* Channel found */
  311. }
  312. }
  313. }
  314. wpa_printf(MSG_WARNING, "Can't set DFS state for freq %d MHz", freq);
  315. return 0;
  316. }
  317. static int set_dfs_state(struct hostapd_data *hapd, int freq, int ht_enabled,
  318. int chan_offset, int chan_width, int cf1,
  319. int cf2, u32 state)
  320. {
  321. int n_chans = 1, i;
  322. struct hostapd_hw_modes *mode;
  323. int frequency = freq;
  324. int ret = 0;
  325. mode = hapd->iface->current_mode;
  326. if (mode == NULL)
  327. return 0;
  328. if (mode->mode != HOSTAPD_MODE_IEEE80211A) {
  329. wpa_printf(MSG_WARNING, "current_mode != IEEE80211A");
  330. return 0;
  331. }
  332. /* Seems cf1 and chan_width is enough here */
  333. switch (chan_width) {
  334. case CHAN_WIDTH_20_NOHT:
  335. case CHAN_WIDTH_20:
  336. n_chans = 1;
  337. frequency = cf1;
  338. break;
  339. case CHAN_WIDTH_40:
  340. n_chans = 2;
  341. frequency = cf1 - 10;
  342. break;
  343. case CHAN_WIDTH_80:
  344. n_chans = 4;
  345. frequency = cf1 - 30;
  346. break;
  347. case CHAN_WIDTH_160:
  348. n_chans = 8;
  349. frequency = cf1 - 70;
  350. break;
  351. default:
  352. wpa_printf(MSG_INFO, "DFS chan_width %d not supported",
  353. chan_width);
  354. break;
  355. }
  356. wpa_printf(MSG_DEBUG, "DFS freq: %dMHz, n_chans: %d", frequency,
  357. n_chans);
  358. for (i = 0; i < n_chans; i++) {
  359. ret += set_dfs_state_freq(hapd, frequency, state);
  360. frequency = frequency + 20;
  361. }
  362. return ret;
  363. }
  364. static int dfs_are_channels_overlapped(struct hostapd_data *hapd, int freq,
  365. int chan_width, int cf1, int cf2)
  366. {
  367. int start_chan_idx;
  368. struct hostapd_hw_modes *mode;
  369. struct hostapd_channel_data *chan;
  370. int n_chans, i, j, frequency = freq, radar_n_chans = 1;
  371. u8 radar_chan;
  372. int res = 0;
  373. /* Our configuration */
  374. mode = hapd->iface->current_mode;
  375. start_chan_idx = dfs_get_start_chan_idx(hapd);
  376. n_chans = dfs_get_used_n_chans(hapd);
  377. /* Check we are on DFS channel(s) */
  378. if (!dfs_check_chans_radar(hapd, start_chan_idx, n_chans))
  379. return 0;
  380. /* Reported via radar event */
  381. switch (chan_width) {
  382. case CHAN_WIDTH_20_NOHT:
  383. case CHAN_WIDTH_20:
  384. radar_n_chans = 1;
  385. frequency = cf1;
  386. break;
  387. case CHAN_WIDTH_40:
  388. radar_n_chans = 2;
  389. frequency = cf1 - 10;
  390. break;
  391. case CHAN_WIDTH_80:
  392. radar_n_chans = 4;
  393. frequency = cf1 - 30;
  394. break;
  395. case CHAN_WIDTH_160:
  396. radar_n_chans = 8;
  397. frequency = cf1 - 70;
  398. break;
  399. default:
  400. wpa_printf(MSG_INFO, "DFS chan_width %d not supported",
  401. chan_width);
  402. break;
  403. }
  404. ieee80211_freq_to_chan(frequency, &radar_chan);
  405. for (i = 0; i < n_chans; i++) {
  406. chan = &mode->channels[start_chan_idx + i];
  407. if (!(chan->flag & HOSTAPD_CHAN_RADAR))
  408. continue;
  409. for (j = 0; j < radar_n_chans; j++) {
  410. wpa_printf(MSG_DEBUG, "checking our: %d, radar: %d",
  411. chan->chan, radar_chan + j * 4);
  412. if (chan->chan == radar_chan + j * 4)
  413. res++;
  414. }
  415. }
  416. wpa_printf(MSG_DEBUG, "overlapped: %d", res);
  417. return res;
  418. }
  419. /*
  420. * Main DFS handler
  421. * 1 - continue channel/ap setup
  422. * 0 - channel/ap setup will be continued after CAC
  423. * -1 - hit critical error
  424. */
  425. int hostapd_handle_dfs(struct hostapd_data *hapd)
  426. {
  427. struct hostapd_channel_data *channel;
  428. int res, n_chans, start_chan_idx;
  429. hapd->cac_started = 0;
  430. do {
  431. /* Get start (first) channel for current configuration */
  432. start_chan_idx = dfs_get_start_chan_idx(hapd);
  433. if (start_chan_idx == -1)
  434. return -1;
  435. /* Get number of used channels, depend on width */
  436. n_chans = dfs_get_used_n_chans(hapd);
  437. /* Check if any of configured channels require DFS */
  438. res = dfs_check_chans_radar(hapd, start_chan_idx, n_chans);
  439. wpa_printf(MSG_DEBUG,
  440. "DFS %d channels required radar detection",
  441. res);
  442. if (!res)
  443. return 1;
  444. /* Check if all channels are DFS available */
  445. res = dfs_check_chans_available(hapd, start_chan_idx, n_chans);
  446. wpa_printf(MSG_DEBUG,
  447. "DFS all channels available, (SKIP CAC): %s",
  448. res ? "yes" : "no");
  449. if (res)
  450. return 1;
  451. /* Check if any of configured channels is unavailable */
  452. res = dfs_check_chans_unavailable(hapd, start_chan_idx,
  453. n_chans);
  454. wpa_printf(MSG_DEBUG, "DFS %d chans unavailable - choose other channel: %s",
  455. res, res ? "yes": "no");
  456. if (res) {
  457. int sec;
  458. u8 cf1, cf2;
  459. channel = dfs_get_valid_channel(hapd, &sec, &cf1, &cf2);
  460. if (!channel) {
  461. wpa_printf(MSG_ERROR, "could not get valid channel");
  462. return -1;
  463. }
  464. hapd->iface->freq = channel->freq;
  465. hapd->iconf->channel = channel->chan;
  466. hapd->iconf->secondary_channel = sec;
  467. hapd->iconf->vht_oper_centr_freq_seg0_idx = cf1;
  468. hapd->iconf->vht_oper_centr_freq_seg1_idx = cf2;
  469. }
  470. } while (res);
  471. /* Finally start CAC */
  472. wpa_printf(MSG_DEBUG, "DFS start CAC on %d MHz", hapd->iface->freq);
  473. if (hostapd_start_dfs_cac(hapd, hapd->iconf->hw_mode,
  474. hapd->iface->freq,
  475. hapd->iconf->channel,
  476. hapd->iconf->ieee80211n,
  477. hapd->iconf->ieee80211ac,
  478. hapd->iconf->secondary_channel,
  479. hapd->iconf->vht_oper_chwidth,
  480. hapd->iconf->vht_oper_centr_freq_seg0_idx,
  481. hapd->iconf->vht_oper_centr_freq_seg1_idx)) {
  482. wpa_printf(MSG_DEBUG, "DFS start_dfs_cac() failed");
  483. return -1;
  484. }
  485. return 0;
  486. }
  487. int hostapd_dfs_complete_cac(struct hostapd_data *hapd, int success, int freq,
  488. int ht_enabled, int chan_offset, int chan_width,
  489. int cf1, int cf2)
  490. {
  491. if (success) {
  492. /* Complete iface/ap configuration */
  493. set_dfs_state(hapd, freq, ht_enabled, chan_offset,
  494. chan_width, cf1, cf2,
  495. HOSTAPD_CHAN_DFS_AVAILABLE);
  496. hapd->cac_started = 0;
  497. hostapd_setup_interface_complete(hapd->iface, 0);
  498. }
  499. return 0;
  500. }
  501. static int hostapd_dfs_start_channel_switch(struct hostapd_data *hapd)
  502. {
  503. struct hostapd_channel_data *channel;
  504. int err = 1;
  505. int secondary_channel;
  506. u8 vht_oper_centr_freq_seg0_idx;
  507. u8 vht_oper_centr_freq_seg1_idx;
  508. wpa_printf(MSG_DEBUG, "%s called", __func__);
  509. channel = dfs_get_valid_channel(hapd, &secondary_channel,
  510. &vht_oper_centr_freq_seg0_idx,
  511. &vht_oper_centr_freq_seg1_idx);
  512. if (channel) {
  513. hapd->iconf->channel = channel->chan;
  514. hapd->iconf->secondary_channel = secondary_channel;
  515. hapd->iconf->vht_oper_centr_freq_seg0_idx =
  516. vht_oper_centr_freq_seg0_idx;
  517. hapd->iconf->vht_oper_centr_freq_seg1_idx =
  518. vht_oper_centr_freq_seg1_idx;
  519. err = 0;
  520. } else {
  521. wpa_printf(MSG_ERROR, "No valid channel available");
  522. }
  523. if (!hapd->cac_started) {
  524. wpa_printf(MSG_DEBUG, "DFS radar detected");
  525. hapd->driver->stop_ap(hapd->drv_priv);
  526. } else {
  527. wpa_printf(MSG_DEBUG, "DFS radar detected during CAC");
  528. hapd->cac_started = 0;
  529. }
  530. hostapd_setup_interface_complete(hapd->iface, err);
  531. return 0;
  532. }
  533. int hostapd_dfs_radar_detected(struct hostapd_data *hapd, int freq,
  534. int ht_enabled, int chan_offset, int chan_width,
  535. int cf1, int cf2)
  536. {
  537. int res;
  538. if (!hapd->iconf->ieee80211h)
  539. return 0;
  540. /* mark radar frequency as invalid */
  541. res = set_dfs_state(hapd, freq, ht_enabled, chan_offset,
  542. chan_width, cf1, cf2,
  543. HOSTAPD_CHAN_DFS_UNAVAILABLE);
  544. /* Skip if reported radar event not overlapped our channels */
  545. res = dfs_are_channels_overlapped(hapd, freq, chan_width, cf1, cf2);
  546. if (!res)
  547. return 0;
  548. /* radar detected while operating, switch the channel. */
  549. res = hostapd_dfs_start_channel_switch(hapd);
  550. return res;
  551. }
  552. int hostapd_dfs_nop_finished(struct hostapd_data *hapd, int freq,
  553. int ht_enabled, int chan_offset, int chan_width,
  554. int cf1, int cf2)
  555. {
  556. /* TODO add correct implementation here */
  557. set_dfs_state(hapd, freq, ht_enabled, chan_offset, chan_width, cf1, cf2,
  558. HOSTAPD_CHAN_DFS_USABLE);
  559. return 0;
  560. }