1 /* 2 * Copyright (c) 2016-2018 The Linux Foundation. All rights reserved. 3 * Copyright (c) 2002-2010, Atheros Communications Inc. 4 * 5 * Permission to use, copy, modify, and/or distribute this software for any 6 * purpose with or without fee is hereby granted, provided that the above 7 * copyright notice and this permission notice appear in all copies. 8 * 9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 10 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 11 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 12 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 13 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 14 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 15 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 16 */ 17 18 /** 19 * DOC: This file contains NOL related functionality, NOL being the non 20 * occupancy list. After radar has been detected in a particular channel, 21 * the channel cannot be used for a period of 30 minutes which is called 22 * the non occupancy. The NOL is basically a list of all the channels that 23 * radar has been detected on. Each channel has a 30 minute timer associated 24 * with it. This file contains the functionality to add a channel to the NOL, 25 * the NOL timer function and the functionality to remove a channel from the 26 * NOL when its time is up. 27 */ 28 29 #include "../dfs.h" 30 #include "../dfs_channel.h" 31 #include "../dfs_ioctl_private.h" 32 #include "../dfs_internal.h" 33 #include <qdf_time.h> 34 #include <wlan_dfs_mlme_api.h> 35 #include <wlan_dfs_utils_api.h> 36 #include <wlan_reg_services_api.h> 37 #if defined(WLAN_DFS_PARTIAL_OFFLOAD) && defined(HOST_DFS_SPOOF_TEST) 38 #include "../dfs_process_radar_found_ind.h" 39 #include "../dfs_partial_offload_radar.h" 40 #endif 41 42 void dfs_set_update_nol_flag(struct wlan_dfs *dfs, bool val) 43 { 44 dfs->update_nol = val; 45 } 46 47 bool dfs_get_update_nol_flag(struct wlan_dfs *dfs) 48 { 49 return dfs->update_nol; 50 } 51 52 /** 53 * dfs_nol_timeout() - NOL timeout function. 54 * 55 * Clears the WLAN_CHAN_DFS_RADAR_FOUND flag for the NOL timeout channel. 56 */ 57 static os_timer_func(dfs_nol_timeout) 58 { 59 struct dfs_channel *c = NULL, lc; 60 unsigned long oldest, now; 61 struct wlan_dfs *dfs = NULL; 62 int i; 63 int nchans = 0; 64 65 c = &lc; 66 67 OS_GET_TIMER_ARG(dfs, struct wlan_dfs *); 68 dfs_mlme_get_dfs_ch_nchans(dfs->dfs_pdev_obj, &nchans); 69 70 now = oldest = qdf_system_ticks(); 71 for (i = 0; i < nchans; i++) { 72 dfs_mlme_get_dfs_ch_channels(dfs->dfs_pdev_obj, 73 &(c->dfs_ch_freq), 74 &(c->dfs_ch_flags), 75 &(c->dfs_ch_flagext), 76 &(c->dfs_ch_ieee), 77 &(c->dfs_ch_vhtop_ch_freq_seg1), 78 &(c->dfs_ch_vhtop_ch_freq_seg2), 79 i); 80 if (WLAN_IS_CHAN_RADAR(c)) { 81 if (qdf_system_time_after_eq(now, 82 dfs->dfs_nol_event[i] + 83 dfs_get_nol_timeout(dfs))) { 84 c->dfs_ch_flagext &= 85 ~WLAN_CHAN_DFS_RADAR_FOUND; 86 if (c->dfs_ch_flags & 87 WLAN_CHAN_DFS_RADAR) { 88 /* 89 * NB: do this here so we get only one 90 * msg instead of one for every channel 91 * table entry. 92 */ 93 dfs_debug(dfs, WLAN_DEBUG_DFS, 94 "radar on channel %u (%u MHz) cleared after timeout", 95 96 c->dfs_ch_ieee, 97 c->dfs_ch_freq); 98 } 99 } else if (dfs->dfs_nol_event[i] < oldest) 100 oldest = dfs->dfs_nol_event[i]; 101 } 102 } 103 if (oldest != now) { 104 /* Arrange to process next channel up for a status change. */ 105 qdf_timer_mod(&dfs->dfs_nol_timer, 106 dfs_get_nol_timeout(dfs) - 107 qdf_system_ticks_to_msecs(qdf_system_ticks())); 108 } 109 } 110 111 /** 112 * dfs_nol_elem_free_work_cb - Free NOL element 113 * 114 * Free the NOL element memory 115 */ 116 static void dfs_nol_elem_free_work_cb(void *context) 117 { 118 struct wlan_dfs *dfs = (struct wlan_dfs *)context; 119 struct dfs_nolelem *nol_head; 120 121 while (true) { 122 WLAN_DFSNOL_LOCK(dfs); 123 124 nol_head = TAILQ_FIRST(&dfs->dfs_nol_free_list); 125 if (nol_head) { 126 TAILQ_REMOVE(&dfs->dfs_nol_free_list, nol_head, 127 nolelem_list); 128 WLAN_DFSNOL_UNLOCK(dfs); 129 130 qdf_timer_free(&nol_head->nol_timer); 131 qdf_mem_free(nol_head); 132 } else { 133 WLAN_DFSNOL_UNLOCK(dfs); 134 break; 135 } 136 } 137 } 138 139 void dfs_nol_timer_init(struct wlan_dfs *dfs) 140 { 141 qdf_timer_init(NULL, 142 &(dfs->dfs_nol_timer), 143 dfs_nol_timeout, 144 (void *)(dfs), 145 QDF_TIMER_TYPE_WAKE_APPS); 146 } 147 148 void dfs_nol_attach(struct wlan_dfs *dfs) 149 { 150 dfs->wlan_dfs_nol_timeout = DFS_NOL_TIMEOUT_S; 151 dfs_nol_timer_init(dfs); 152 qdf_create_work(NULL, &dfs->dfs_nol_elem_free_work, 153 dfs_nol_elem_free_work_cb, dfs); 154 TAILQ_INIT(&dfs->dfs_nol_free_list); 155 dfs->dfs_use_nol = 1; 156 WLAN_DFSNOL_LOCK_CREATE(dfs); 157 } 158 159 void dfs_nol_detach(struct wlan_dfs *dfs) 160 { 161 dfs_nol_timer_cleanup(dfs); 162 qdf_flush_work(&dfs->dfs_nol_elem_free_work); 163 qdf_destroy_work(NULL, &dfs->dfs_nol_elem_free_work); 164 WLAN_DFSNOL_LOCK_DESTROY(dfs); 165 } 166 167 void dfs_nol_timer_detach(struct wlan_dfs *dfs) 168 { 169 qdf_timer_free(&dfs->dfs_nol_timer); 170 } 171 172 /** 173 * dfs_nol_delete() - Delete the given frequency/chwidth from the NOL. 174 * @dfs: Pointer to wlan_dfs structure. 175 * @delfreq: Freq to delete. 176 * @delchwidth: Channel width to delete. 177 */ 178 static void dfs_nol_delete(struct wlan_dfs *dfs, 179 uint16_t delfreq, 180 uint16_t delchwidth) 181 { 182 struct dfs_nolelem *nol, **prev_next; 183 184 if (!dfs) { 185 dfs_err(dfs, WLAN_DEBUG_DFS_ALWAYS, "dfs is NULL"); 186 return; 187 } 188 189 dfs_debug(dfs, WLAN_DEBUG_DFS_NOL, 190 "remove channel=%d/%d MHz from NOL", 191 delfreq, delchwidth); 192 prev_next = &(dfs->dfs_nol); 193 nol = dfs->dfs_nol; 194 while (nol != NULL) { 195 if (nol->nol_freq == delfreq && 196 nol->nol_chwidth == delchwidth) { 197 *prev_next = nol->nol_next; 198 dfs_debug(dfs, WLAN_DEBUG_DFS_NOL, 199 "removing channel %d/%dMHz from NOL tstamp=%d", 200 nol->nol_freq, 201 nol->nol_chwidth, 202 (qdf_system_ticks_to_msecs 203 (qdf_system_ticks()) / 1000)); 204 TAILQ_INSERT_TAIL(&dfs->dfs_nol_free_list, 205 nol, nolelem_list); 206 nol = *prev_next; 207 208 /* Update the NOL counter. */ 209 dfs->dfs_nol_count--; 210 211 /* Be paranoid! */ 212 if (dfs->dfs_nol_count < 0) { 213 dfs_info(NULL, WLAN_DEBUG_DFS_ALWAYS, "dfs_nol_count < 0; eek!"); 214 dfs->dfs_nol_count = 0; 215 } 216 217 } else { 218 prev_next = &(nol->nol_next); 219 nol = nol->nol_next; 220 } 221 } 222 } 223 224 /** 225 * dfs_remove_from_nol() - Remove the freq from NOL list. 226 * 227 * When NOL times out, this function removes the channel from NOL list. 228 */ 229 static os_timer_func(dfs_remove_from_nol) 230 { 231 struct dfs_nolelem *nol_arg; 232 struct wlan_dfs *dfs; 233 uint16_t delfreq; 234 uint16_t delchwidth; 235 uint8_t chan; 236 237 OS_GET_TIMER_ARG(nol_arg, struct dfs_nolelem *); 238 239 dfs = nol_arg->nol_dfs; 240 delfreq = nol_arg->nol_freq; 241 delchwidth = nol_arg->nol_chwidth; 242 243 /* Delete the given NOL entry. */ 244 DFS_NOL_DELETE_CHAN_LOCKED(dfs, delfreq, delchwidth); 245 246 /* Update the wireless stack with the new NOL. */ 247 dfs_nol_update(dfs); 248 249 dfs_mlme_nol_timeout_notification(dfs->dfs_pdev_obj); 250 chan = utils_dfs_freq_to_chan(delfreq); 251 dfs_debug(dfs, WLAN_DEBUG_DFS_NOL, 252 "remove channel %d from nol", chan); 253 utils_dfs_reg_update_nol_ch(dfs->dfs_pdev_obj, 254 &chan, 1, DFS_NOL_RESET); 255 utils_dfs_save_nol(dfs->dfs_pdev_obj); 256 257 /* 258 * Free the NOL element in a thread. This is to avoid freeing the 259 * timer object from within timer callback function . The nol element 260 * contains the timer Object. 261 */ 262 qdf_sched_work(NULL, &dfs->dfs_nol_elem_free_work); 263 } 264 265 void dfs_print_nol(struct wlan_dfs *dfs) 266 { 267 struct dfs_nolelem *nol; 268 int i = 0; 269 uint32_t diff_ms, remaining_sec; 270 271 if (!dfs) { 272 dfs_err(dfs, WLAN_DEBUG_DFS_ALWAYS, "dfs is NULL"); 273 return; 274 } 275 276 nol = dfs->dfs_nol; 277 dfs_debug(dfs, WLAN_DEBUG_DFS_NOL, "NOL"); 278 while (nol != NULL) { 279 diff_ms = qdf_system_ticks_to_msecs(qdf_system_ticks() - 280 nol->nol_start_ticks); 281 diff_ms = (nol->nol_timeout_ms - diff_ms); 282 remaining_sec = diff_ms / 1000; /* Convert to seconds */ 283 dfs_info(NULL, WLAN_DEBUG_DFS_ALWAYS, 284 "nol:%d channel=%d MHz width=%d MHz time left=%u seconds nol starttick=%llu", 285 i++, nol->nol_freq, 286 nol->nol_chwidth, 287 remaining_sec, 288 (uint64_t)nol->nol_start_ticks); 289 nol = nol->nol_next; 290 } 291 } 292 293 void dfs_print_nolhistory(struct wlan_dfs *dfs) 294 { 295 struct dfs_channel *chan_list; 296 int i, j; 297 int nchans; 298 299 if (!dfs) { 300 dfs_err(dfs, WLAN_DEBUG_DFS_ALWAYS, "dfs is NULL"); 301 return; 302 } 303 304 nchans = dfs_get_num_chans(); 305 306 chan_list = qdf_mem_malloc(nchans * sizeof(*chan_list)); 307 if (!chan_list) 308 return; 309 310 utils_dfs_get_nol_history_chan_list(dfs->dfs_pdev_obj, 311 (void *)chan_list, &nchans); 312 if (!nchans) { 313 dfs_err(dfs, WLAN_DEBUG_DFS_ALWAYS, "zero chans"); 314 qdf_mem_free(chan_list); 315 return; 316 } 317 318 for (i = 0, j = 0; i < nchans; i++, j++) 319 dfs_info(NULL, WLAN_DEBUG_DFS_ALWAYS, 320 "nolhistory = %d channel = %d MHz", 321 j, chan_list[i].dfs_ch_freq); 322 323 qdf_mem_free(chan_list); 324 } 325 326 void dfs_get_nol(struct wlan_dfs *dfs, 327 struct dfsreq_nolelem *dfs_nol, 328 int *nchan) 329 { 330 struct dfs_nolelem *nol; 331 332 *nchan = 0; 333 334 if (!dfs) { 335 dfs_err(dfs, WLAN_DEBUG_DFS_ALWAYS, "dfs is NULL"); 336 return; 337 } 338 339 nol = dfs->dfs_nol; 340 while (nol != NULL) { 341 dfs_nol[*nchan].nol_freq = nol->nol_freq; 342 dfs_nol[*nchan].nol_chwidth = nol->nol_chwidth; 343 dfs_nol[*nchan].nol_start_ticks = nol->nol_start_ticks; 344 dfs_nol[*nchan].nol_timeout_ms = nol->nol_timeout_ms; 345 ++(*nchan); 346 nol = nol->nol_next; 347 } 348 } 349 350 void dfs_set_nol(struct wlan_dfs *dfs, 351 struct dfsreq_nolelem *dfs_nol, 352 int nchan) 353 { 354 #define TIME_IN_MS 1000 355 uint32_t nol_time_left_ms; 356 struct dfs_channel chan; 357 int i; 358 uint8_t chan_num; 359 360 if (!dfs) { 361 dfs_err(dfs, WLAN_DEBUG_DFS_ALWAYS, "dfs is NULL"); 362 return; 363 } 364 365 for (i = 0; i < nchan; i++) { 366 nol_time_left_ms = 367 qdf_system_ticks_to_msecs(qdf_system_ticks() - 368 dfs_nol[i].nol_start_ticks); 369 370 if (nol_time_left_ms < dfs_nol[i].nol_timeout_ms) { 371 chan.dfs_ch_freq = dfs_nol[i].nol_freq; 372 chan.dfs_ch_flags = 0; 373 chan.dfs_ch_flagext = 0; 374 nol_time_left_ms = 375 (dfs_nol[i].nol_timeout_ms - nol_time_left_ms); 376 377 DFS_NOL_ADD_CHAN_LOCKED(dfs, chan.dfs_ch_freq, 378 (nol_time_left_ms / TIME_IN_MS)); 379 chan_num = utils_dfs_freq_to_chan(chan.dfs_ch_freq); 380 utils_dfs_reg_update_nol_ch(dfs->dfs_pdev_obj, 381 &chan_num, 1, DFS_NOL_SET); 382 } 383 } 384 #undef TIME_IN_MS 385 dfs_nol_update(dfs); 386 } 387 388 void dfs_nol_addchan(struct wlan_dfs *dfs, 389 uint16_t freq, 390 uint32_t dfs_nol_timeout) 391 { 392 #define TIME_IN_MS 1000 393 #define TIME_IN_US (TIME_IN_MS * 1000) 394 struct dfs_nolelem *nol, *elem, *prev; 395 /* For now, assume all events are 20MHz wide. */ 396 int ch_width = 20; 397 398 if (!dfs) { 399 dfs_err(dfs, WLAN_DEBUG_DFS_ALWAYS, "dfs is NULL"); 400 return; 401 } 402 nol = dfs->dfs_nol; 403 prev = dfs->dfs_nol; 404 elem = NULL; 405 while (nol != NULL) { 406 if ((nol->nol_freq == freq) && 407 (nol->nol_chwidth == ch_width)) { 408 nol->nol_start_ticks = qdf_system_ticks(); 409 nol->nol_timeout_ms = dfs_nol_timeout * TIME_IN_MS; 410 411 dfs_debug(dfs, WLAN_DEBUG_DFS_NOL, 412 "Update OS Ticks for NOL %d MHz / %d MHz", 413 nol->nol_freq, nol->nol_chwidth); 414 415 qdf_timer_stop(&nol->nol_timer); 416 qdf_timer_mod(&nol->nol_timer, 417 dfs_nol_timeout * TIME_IN_MS); 418 return; 419 } 420 prev = nol; 421 nol = nol->nol_next; 422 } 423 424 /* Add a new element to the NOL. */ 425 elem = (struct dfs_nolelem *)qdf_mem_malloc(sizeof(struct dfs_nolelem)); 426 if (!elem) 427 goto bad; 428 429 qdf_mem_zero(elem, sizeof(*elem)); 430 elem->nol_dfs = dfs; 431 elem->nol_freq = freq; 432 elem->nol_chwidth = ch_width; 433 elem->nol_start_ticks = qdf_system_ticks(); 434 elem->nol_timeout_ms = dfs_nol_timeout*TIME_IN_MS; 435 elem->nol_next = NULL; 436 if (prev) { 437 prev->nol_next = elem; 438 } else { 439 /* This is the first element in the NOL. */ 440 dfs->dfs_nol = elem; 441 } 442 443 qdf_timer_init(NULL, 444 &elem->nol_timer, dfs_remove_from_nol, 445 elem, QDF_TIMER_TYPE_WAKE_APPS); 446 qdf_timer_mod(&elem->nol_timer, dfs_nol_timeout * TIME_IN_MS); 447 448 /* Update the NOL counter. */ 449 dfs->dfs_nol_count++; 450 451 dfs_debug(dfs, WLAN_DEBUG_DFS_NOL, 452 "new NOL channel %d MHz / %d MHz", 453 elem->nol_freq, elem->nol_chwidth); 454 return; 455 456 bad: 457 dfs_debug(dfs, WLAN_DEBUG_DFS_NOL | WLAN_DEBUG_DFS, 458 "failed to allocate memory for nol entry"); 459 460 #undef TIME_IN_MS 461 #undef TIME_IN_US 462 } 463 464 void dfs_get_nol_chfreq_and_chwidth(struct dfsreq_nolelem *dfs_nol, 465 uint32_t *nol_chfreq, 466 uint32_t *nol_chwidth, 467 int index) 468 { 469 if (!dfs_nol) 470 return; 471 472 *nol_chfreq = dfs_nol[index].nol_freq; 473 *nol_chwidth = dfs_nol[index].nol_chwidth; 474 } 475 476 void dfs_nol_update(struct wlan_dfs *dfs) 477 { 478 struct dfsreq_nolelem *dfs_nol; 479 int nlen; 480 481 if (!dfs->dfs_nol_count) { 482 dfs_debug(dfs, WLAN_DEBUG_DFS_NOL, "dfs_nol_count is zero"); 483 dfs_mlme_clist_update(dfs->dfs_pdev_obj, NULL, 0); 484 return; 485 } 486 487 /* 488 * Allocate enough entries to store the NOL. At least on Linux 489 * (don't ask why), if you allocate a 0 entry array, the 490 * returned pointer is 0x10. Make sure you're aware of this 491 * when you start debugging. 492 */ 493 dfs_nol = (struct dfsreq_nolelem *)qdf_mem_malloc( 494 sizeof(struct dfsreq_nolelem) * dfs->dfs_nol_count); 495 496 if (!dfs_nol) { 497 /* 498 * XXX TODO: if this fails, just schedule a task to retry 499 * updating the NOL at a later stage. That way the NOL 500 * update _DOES_ happen - hopefully the failure was just 501 * temporary. 502 */ 503 dfs_alert(dfs, WLAN_DEBUG_DFS_ALWAYS, "failed to allocate NOL update memory!"); 504 return; 505 } 506 507 DFS_GET_NOL_LOCKED(dfs, dfs_nol, &nlen); 508 509 /* Be suitably paranoid for now. */ 510 if (nlen != dfs->dfs_nol_count) 511 dfs_info(NULL, WLAN_DEBUG_DFS_ALWAYS, "nlen (%d) != dfs->dfs_nol_count (%d)!", 512 nlen, dfs->dfs_nol_count); 513 514 /* 515 * Call the driver layer to have it recalculate the NOL flags 516 * for each driver/umac channel. If the list is empty, pass 517 * NULL instead of dfs_nol. The operating system may have some 518 * special representation for "malloc a 0 byte memory region" 519 * - for example, Linux 2.6.38-13 (ubuntu) returns 0x10 rather 520 * than a valid allocation (and is likely not NULL so the 521 * pointer doesn't match NULL checks in any later code. 522 */ 523 dfs_mlme_clist_update(dfs->dfs_pdev_obj, 524 (nlen > 0) ? dfs_nol : NULL, 525 nlen); 526 527 qdf_mem_free(dfs_nol); 528 } 529 530 void dfs_nol_free_list(struct wlan_dfs *dfs) 531 { 532 struct dfs_nolelem *nol = dfs->dfs_nol, *prev; 533 534 while (nol) { 535 prev = nol; 536 nol = nol->nol_next; 537 qdf_mem_free(prev); 538 /* Update the NOL counter. */ 539 dfs->dfs_nol_count--; 540 541 if (dfs->dfs_nol_count < 0) { 542 dfs_err(dfs, WLAN_DEBUG_DFS_ALWAYS, "dfs_nol_count < 0"); 543 ASSERT(0); 544 } 545 } 546 547 dfs->dfs_nol = NULL; 548 } 549 550 void dfs_nol_timer_cleanup(struct wlan_dfs *dfs) 551 { 552 struct dfs_nolelem *nol; 553 554 while (true) { 555 WLAN_DFSNOL_LOCK(dfs); 556 557 nol = dfs->dfs_nol; 558 if (nol) { 559 dfs->dfs_nol = nol->nol_next; 560 dfs->dfs_nol_count--; 561 WLAN_DFSNOL_UNLOCK(dfs); 562 563 qdf_timer_free(&nol->nol_timer); 564 qdf_mem_free(nol); 565 } else { 566 WLAN_DFSNOL_UNLOCK(dfs); 567 break; 568 } 569 } 570 } 571 572 void dfs_nol_workqueue_cleanup(struct wlan_dfs *dfs) 573 { 574 qdf_flush_work(&dfs->dfs_nol_elem_free_work); 575 } 576 577 int dfs_get_use_nol(struct wlan_dfs *dfs) 578 { 579 return dfs->dfs_use_nol; 580 } 581 582 int dfs_get_nol_timeout(struct wlan_dfs *dfs) 583 { 584 return dfs->wlan_dfs_nol_timeout; 585 } 586 587 void dfs_getnol(struct wlan_dfs *dfs, void *dfs_nolinfo) 588 { 589 struct dfsreq_nolinfo *nolinfo = (struct dfsreq_nolinfo *)dfs_nolinfo; 590 591 DFS_GET_NOL_LOCKED(dfs, nolinfo->dfs_nol, &(nolinfo->dfs_ch_nchans)); 592 } 593 594 void dfs_clear_nolhistory(struct wlan_dfs *dfs) 595 { 596 struct dfs_channel *chan_list; 597 int nchans = 0; 598 bool sta_opmode; 599 600 if (!dfs->dfs_is_stadfs_enabled) 601 return; 602 603 sta_opmode = dfs_mlme_is_opmode_sta(dfs->dfs_pdev_obj); 604 if (!sta_opmode) 605 return; 606 607 nchans = dfs_get_num_chans(); 608 609 chan_list = qdf_mem_malloc(nchans * sizeof(*chan_list)); 610 if (!chan_list) 611 return; 612 613 utils_dfs_get_nol_history_chan_list(dfs->dfs_pdev_obj, 614 (void *)chan_list, &nchans); 615 if (!nchans) { 616 dfs_err(dfs, WLAN_DEBUG_DFS_ALWAYS, "zero chans"); 617 qdf_mem_free(chan_list); 618 return; 619 } 620 621 utils_dfs_reg_update_nol_history_ch(dfs->dfs_pdev_obj, 622 (void *)chan_list, nchans, 623 DFS_NOL_HISTORY_RESET); 624 625 qdf_mem_free(chan_list); 626 } 627 628 #if defined(WLAN_DFS_PARTIAL_OFFLOAD) && defined(HOST_DFS_SPOOF_TEST) 629 void dfs_remove_spoof_channel_from_nol(struct wlan_dfs *dfs) 630 { 631 struct dfs_nolelem *nol; 632 uint8_t channels[NUM_CHANNELS_160MHZ]; 633 int i, nchans = 0; 634 635 nchans = dfs_get_bonding_channels(dfs, &dfs->dfs_radar_found_chan, 0, 636 channels); 637 638 WLAN_DFSNOL_LOCK(dfs); 639 for (i = 0; i < nchans && i < NUM_CHANNELS_160MHZ; i++) { 640 nol = dfs->dfs_nol; 641 while (nol) { 642 if (nol->nol_freq == (uint16_t)utils_dfs_chan_to_freq( 643 channels[i])) { 644 OS_SET_TIMER(&nol->nol_timer, 0); 645 break; 646 } 647 nol = nol->nol_next; 648 } 649 } 650 WLAN_DFSNOL_UNLOCK(dfs); 651 652 utils_dfs_reg_update_nol_ch(dfs->dfs_pdev_obj, 653 channels, nchans, DFS_NOL_RESET); 654 } 655 #endif 656