1 /* 2 * Copyright (c) 2013, 2016-2019 The Linux Foundation. All rights reserved. 3 * Copyright (c) 2005-2006 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 has main dfs structures. 20 */ 21 22 #ifndef _DFS_H_ 23 #define _DFS_H_ 24 25 #include <qdf_types.h> /* QDF_NBUF_EXEMPT_NO_EXEMPTION, etc. */ 26 #include <qdf_net_types.h> /* QDF_NBUF_EXEMPT_NO_EXEMPTION, etc. */ 27 #include <qdf_nbuf.h> /* qdf_nbuf_t, etc. */ 28 #include <qdf_util.h> /* qdf_assert */ 29 #include <qdf_lock.h> /* qdf_spinlock */ 30 #include <qdf_time.h> 31 #include <qdf_timer.h> 32 #include <qdf_str.h> /* qdf_str_lcopy */ 33 34 #include <wlan_dfs_ioctl.h> 35 #include "dfs_structs.h" 36 #include "dfs_channel.h" 37 #include "dfs_ioctl_private.h" 38 #include <i_qdf_types.h> /* For qdf_packed*/ 39 #include "queue.h" /* For STAILQ_ENTRY */ 40 #include <wlan_objmgr_psoc_obj.h> 41 #include <wlan_objmgr_pdev_obj.h> 42 #include <osdep.h> 43 #include <wlan_cmn.h> 44 45 /* File Line and Submodule String */ 46 #define FLSM(x, str) #str " : " FL(x) 47 /* Cast to dfs type */ 48 #define DC(x) ((struct wlan_dfs *)(x)) 49 50 /** 51 * dfs_log: dfs logging using submodule MASKs and 52 * QDF trace level. 53 * The logging is controlled by two bitmasks: 54 * 1) submodule bitmask: sm 55 * 2) trace level masks: level 56 * 57 * @dfs: The dfs object pointer or NULL if dfs is not defined. 58 * @sm: Submodule BITMASK. 59 * @level: QDF trace level. 60 * @args...: Variable argument list. 61 * 62 * The submodule(sm) cannot be empty even if argument dfs is NULL. 63 * Else the macro will create a compilation error. 64 * One may provide WLAN_DEBUG_DFS_ALWAYS when the argument dfs is NULL. 65 * Example:- 66 * dfs_log(NULL, WLAN_DEBUG_DFS_ALWAYS, QDF_TRACE_LEVEL_INFO,"Error pulse"); 67 * 68 * Why DC(x) is required? 69 * Since NULL is defined as ((void *)(0)), if the argument "dfs" 70 * in a call to the macro "dfs_log" is NULL 71 * then during compilation (NULL)->dfs_debug_mask will dereference 72 * a (void *) type, which is illegal. Therefore, we need 73 * the cast: (DC(dfs))->dfs_debug_mask. 74 * Example:- 75 * dfs_log(NULL, WLAN_DEBUG_DFS, QDF_TRACE_LEVEL_INFO,"dfs is NULL"); 76 */ 77 #define dfs_log(dfs, sm, level, args...) do { \ 78 if (((dfs) == NULL) || \ 79 ((sm) == WLAN_DEBUG_DFS_ALWAYS) || \ 80 ((sm) & ((DC(dfs))->dfs_debug_mask))) { \ 81 QDF_TRACE(QDF_MODULE_ID_DFS, level, ## args); \ 82 } \ 83 } while (0) 84 85 #define dfs_logfl(dfs, level, sm, format, args...) \ 86 dfs_log(dfs, sm, level, FLSM(format, sm), ## args) 87 88 #define dfs_alert(dfs, sm, format, args...) \ 89 dfs_logfl(dfs, QDF_TRACE_LEVEL_FATAL, sm, format, ## args) 90 91 #define dfs_err(dfs, sm, format, args...) \ 92 dfs_logfl(dfs, QDF_TRACE_LEVEL_ERROR, sm, format, ## args) 93 94 #define dfs_warn(dfs, sm, format, args...) \ 95 dfs_logfl(dfs, QDF_TRACE_LEVEL_WARN, sm, format, ## args) 96 97 #define dfs_info(dfs, sm, format, args...) \ 98 dfs_logfl(dfs, QDF_TRACE_LEVEL_INFO, sm, format, ## args) 99 100 #define dfs_debug(dfs, sm, format, args...) \ 101 dfs_logfl(dfs, QDF_TRACE_LEVEL_DEBUG, sm, format, ## args) 102 103 #define DFS_MIN(a, b) ((a) < (b)?(a):(b)) 104 #define DFS_MAX(a, b) ((a) > (b)?(a) : (b)) 105 #define DFS_DIFF(a, b)(DFS_MAX(a, b) - DFS_MIN(a, b)) 106 107 /** 108 * Maximum number of radar events to be processed in a single iteration. 109 * Allows soft watchdog to run. 110 */ 111 #define MAX_EVENTS 100 112 113 /** 114 * Constants to use for chirping detection. 115 * 116 * All are unconverted as HW reports them. 117 * 118 * XXX Are these constants with or without fast clock 5GHz operation? 119 * XXX Peregrine reports pulses in microseconds, not hardware clocks! 120 */ 121 122 #define MAX_DUR_FOR_LOW_RSSI 4 123 124 /** 125 * Cascade has issue with reported duration especially when there is a 126 * crossover of chirp from one segment to another. It may report a value 127 * of duration that is well below 50us for a valid FCC type 5 chirping 128 * pulse. For now changing minimum duration as a work around. This will 129 * affect all chips but since we detect chirp with Merlin+, we may be OK 130 * for now. We need a more robust solution for this. 131 */ 132 #define MIN_BIN5_DUR_CAS 25 /* 50 * 1.25*/ 133 #define MIN_BIN5_DUR_MICROSEC_CAS 20 134 #define MIN_BIN5_DUR 63 /* 50 * 1.25*/ 135 #define MIN_BIN5_DUR_MICROSEC 50 136 #define MAYBE_BIN5_DUR 35 /* 28 * 1.25*/ 137 #define MAYBE_BIN5_DUR_MICROSEC 28 138 139 /* Conversion is already done using dfs->dur_multiplier */ 140 #define MAX_BIN5_DUR 145 /* use 145 for osprey */ 141 #define MAX_BIN5_DUR_MICROSEC 105 142 143 #define DFS_MARGIN_EQUAL(a, b, margin) ((DFS_DIFF(a, b)) <= margin) 144 #define DFS_MAX_STAGGERED_BURSTS 3 145 146 /** 147 * All filter thresholds in the radar filter tables are effective at a 50% 148 * channel loading. 149 */ 150 #define DFS_CHAN_LOADING_THRESH 50 151 #define DFS_EXT_CHAN_LOADING_THRESH 30 152 #define DFS_DEFAULT_PRI_MARGIN 6 153 #define DFS_DEFAULT_FIXEDPATTERN_PRI_MARGIN 4 154 155 #define WLAN_DFSQ_LOCK(_dfs) qdf_spin_lock_bh(&(_dfs)->dfs_radarqlock) 156 #define WLAN_DFSQ_UNLOCK(_dfs) qdf_spin_unlock_bh(&(_dfs)->dfs_radarqlock) 157 #define WLAN_DFSQ_LOCK_CREATE(_dfs) qdf_spinlock_create( \ 158 &(_dfs)->dfs_radarqlock) 159 #define WLAN_DFSQ_LOCK_DESTROY(_dfs) qdf_spinlock_destroy( \ 160 &(_dfs)->dfs_radarqlock) 161 162 #define WLAN_ARQ_LOCK(_dfs) qdf_spin_lock_bh(&(_dfs)->dfs_arqlock) 163 #define WLAN_ARQ_UNLOCK(_dfs) qdf_spin_unlock_bh(&(_dfs)->dfs_arqlock) 164 #define WLAN_ARQ_LOCK_CREATE(_dfs) qdf_spinlock_create(&(_dfs)->dfs_arqlock) 165 #define WLAN_ARQ_LOCK_DESTROY(_dfs) qdf_spinlock_destroy(&(_dfs)->dfs_arqlock) 166 167 #define WLAN_DFSEVENTQ_LOCK(_dfs) qdf_spin_lock_bh(&(_dfs)->dfs_eventqlock) 168 #define WLAN_DFSEVENTQ_UNLOCK(_dfs) qdf_spin_unlock_bh( \ 169 &(_dfs)->dfs_eventqlock) 170 #define WLAN_DFSEVENTQ_LOCK_CREATE(_dfs) qdf_spinlock_create( \ 171 &(_dfs)->dfs_eventqlock) 172 #define WLAN_DFSEVENTQ_LOCK_DESTROY(_dfs) qdf_spinlock_destroy( \ 173 &(_dfs)->dfs_eventqlock) 174 175 #define WLAN_DFSNOL_LOCK(_dfs) qdf_spin_lock_bh(&(_dfs)->dfs_nol_lock) 176 #define WLAN_DFSNOL_UNLOCK(_dfs) qdf_spin_unlock_bh(&(_dfs)->dfs_nol_lock) 177 #define WLAN_DFSNOL_LOCK_CREATE(_dfs) qdf_spinlock_create( \ 178 &(_dfs)->dfs_nol_lock) 179 #define WLAN_DFSNOL_LOCK_DESTROY(_dfs) qdf_spinlock_destroy( \ 180 &(_dfs)->dfs_nol_lock) 181 182 #define PRECAC_LIST_LOCK(_dfs) qdf_spin_lock_irqsave( \ 183 &(_dfs)->dfs_precac_lock) 184 #define PRECAC_LIST_UNLOCK(_dfs) qdf_spin_unlock_irqrestore( \ 185 &(_dfs)->dfs_precac_lock) 186 #define PRECAC_LIST_LOCK_CREATE(_dfs) qdf_spinlock_create( \ 187 &(_dfs)->dfs_precac_lock) 188 #define PRECAC_LIST_LOCK_DESTROY(_dfs) qdf_spinlock_destroy( \ 189 &(_dfs)->dfs_precac_lock) 190 191 #define WLAN_DFS_DATA_STRUCT_LOCK(_dfs) \ 192 qdf_spin_lock_bh(&(_dfs)->dfs_data_struct_lock) 193 #define WLAN_DFS_DATA_STRUCT_UNLOCK(_dfs) \ 194 qdf_spin_unlock_bh(&(_dfs)->dfs_data_struct_lock) 195 #define WLAN_DFS_DATA_STRUCT_LOCK_CREATE(_dfs) \ 196 qdf_spinlock_create(&(_dfs)->dfs_data_struct_lock) 197 #define WLAN_DFS_DATA_STRUCT_LOCK_DESTROY(_dfs) \ 198 qdf_spinlock_destroy(&(_dfs)->dfs_data_struct_lock) 199 200 /* Mask for time stamp from descriptor */ 201 #define DFS_TSMASK 0xFFFFFFFF 202 /* Shift for time stamp from descriptor */ 203 #define DFS_TSSHIFT 32 204 /* 64 bit TSF wrap value */ 205 #define DFS_TSF_WRAP 0xFFFFFFFFFFFFFFFFULL 206 /* TS mask for 64 bit value */ 207 #define DFS_64BIT_TSFMASK 0x0000000000007FFFULL 208 209 #define DFS_AR_RADAR_RSSI_THR 5 /* in dB */ 210 #define DFS_AR_RADAR_RESET_INT 1 /* in secs */ 211 #define DFS_AR_RADAR_MAX_HISTORY 500 212 #define DFS_AR_REGION_WIDTH 128 213 #define DFS_AR_RSSI_THRESH_STRONG_PKTS 17 /* in dB */ 214 #define DFS_AR_RSSI_DOUBLE_THRESHOLD 15 /* in dB */ 215 #define DFS_AR_MAX_NUM_ACK_REGIONS 9 216 #define DFS_AR_ACK_DETECT_PAR_THRESH 20 217 #define DFS_AR_PKT_COUNT_THRESH 20 218 219 #define DFS_MAX_DL_SIZE 64 220 #define DFS_MAX_DL_MASK 0x3F 221 222 #define DFS_NOL_TIME DFS_NOL_TIMEOUT_US 223 /* 30 minutes in usecs */ 224 225 #define DFS_WAIT_TIME (60*1000000) /* 1 minute in usecs */ 226 227 #define DFS_DISABLE_TIME (3*60*1000000) /* 3 minutes in usecs */ 228 229 #define DFS_MAX_B5_SIZE 128 230 #define DFS_MAX_B5_MASK 0x0000007F /* 128 */ 231 232 /* Max number of overlapping filters */ 233 #define DFS_MAX_RADAR_OVERLAP 16 234 235 /* Max number of dfs events which can be q'd */ 236 #define DFS_MAX_EVENTS 1024 237 238 #define DFS_RADAR_EN 0x80000000 /* Radar detect is capable */ 239 #define DFS_AR_EN 0x40000000 /* AR detect is capable */ 240 /* Radar detect in second segment is capable */ 241 #define DFS_SECOND_SEGMENT_RADAR_EN 0x20000000 242 #define DFS_MAX_RSSI_VALUE 0x7fffffff /* Max rssi value */ 243 244 #define DFS_BIN_MAX_PULSES 60 /* max num of pulses in a burst */ 245 #define DFS_BIN5_PRI_LOWER_LIMIT 990 /* us */ 246 247 /** 248 * To cover the single pusle burst case, change from 2010 us to 249 * 2010000 us. 250 */ 251 252 /** 253 * This is reverted back to 2010 as larger value causes false 254 * bin5 detect (EV76432, EV76320) 255 */ 256 #define DFS_BIN5_PRI_HIGHER_LIMIT 2010 /* us */ 257 258 #define DFS_BIN5_WIDTH_MARGIN 4 /* us */ 259 #define DFS_BIN5_RSSI_MARGIN 5 /* dBm */ 260 261 /** 262 * Following threshold is not specified but should be 263 * okay statistically. 264 */ 265 #define DFS_BIN5_BRI_LOWER_LIMIT 300000 /* us */ 266 #define DFS_BIN5_BRI_UPPER_LIMIT 12000000 /* us */ 267 268 /* Max number of pulses kept in buffer */ 269 #define DFS_MAX_PULSE_BUFFER_SIZE 1024 270 #define DFS_MAX_PULSE_BUFFER_MASK 0x3ff 271 272 #define DFS_FAST_CLOCK_MULTIPLIER (800/11) 273 #define DFS_NO_FAST_CLOCK_MULTIPLIER (80) 274 #define DFS_BIG_SIDX 10000 275 276 /* Min value of valid psidx diff */ 277 #define DFS_MIN_PSIDX_DIFF 4 278 /* Max value of valid psidx diff */ 279 #define DFS_MAX_PSIDX_DIFF 16 280 281 /** 282 * Software use: channel interference used for as AR as well as RADAR 283 * interference detection. 284 */ 285 #define CHANNEL_INTERFERENCE 0x01 286 287 #define CHANNEL_2GHZ 0x00080 /* 2 GHz spectrum channel. */ 288 #define CHANNEL_OFDM 0x00040 /* OFDM channel */ 289 #define CHANNEL_TURBO 0x00010 /* Turbo Channel */ 290 #define CHANNEL_108G (CHANNEL_2GHZ|CHANNEL_OFDM|CHANNEL_TURBO) 291 292 /* qdf_packed - denotes structure is packed. */ 293 #define qdf_packed __qdf_packed 294 295 #define SEG_ID_PRIMARY 0 296 #define SEG_ID_SECONDARY 1 297 298 /* MIN and MAX width for different regions */ 299 #define REG0_MIN_WIDTH 33 300 #define REG0_MAX_WIDTH 38 301 #define REG1_MIN_WIDTH 39 302 #define REG1_MAX_WIDTH 44 303 #define REG2_MIN_WIDTH 53 304 #define REG2_MAX_WIDTH 58 305 #define REG3_MIN_WIDTH 126 306 #define REG3_MAX_WIDTH 140 307 #define REG4_MIN_WIDTH 141 308 #define REG4_MAX_WIDTH 160 309 #define REG5_MIN_WIDTH 189 310 #define REG5_MAX_WIDTH 210 311 #define REG6_MIN_WIDTH 360 312 #define REG6_MAX_WIDTH 380 313 #define REG7_MIN_WIDTH 257 314 #define REG7_MAX_WIDTH 270 315 #define REG8_MIN_WIDTH 295 316 #define REG8_MAX_WIDTH 302 317 318 #define OVER_SAMPLING_FREQ 44000 319 #define SAMPLING_FREQ 40000 320 #define HUNDRED 100 321 #define NUM_BINS 128 322 #define THOUSAND 1000 323 324 /* Array offset to ETSI legacy pulse */ 325 #define ETSI_LEGACY_PULSE_ARR_OFFSET 4 326 327 #define ETSI_RADAR_EN302_502_FREQ_LOWER 5725 328 #define ETSI_RADAR_EN302_502_FREQ_UPPER 5865 329 330 #define DFS_NOL_ADD_CHAN_LOCKED(dfs, freq, timeout) \ 331 do { \ 332 WLAN_DFSNOL_LOCK(dfs); \ 333 dfs_nol_addchan(dfs, freq, timeout); \ 334 WLAN_DFSNOL_UNLOCK(dfs); \ 335 } while (0) 336 337 /* 338 * Free the NOL element in a thread. This is to avoid freeing the 339 * timer object from within timer callback function . The nol element 340 * contains the timer Object. 341 */ 342 #define DFS_NOL_DELETE_CHAN_LOCKED(dfs, freq, chwidth) \ 343 do { \ 344 WLAN_DFSNOL_LOCK(dfs); \ 345 dfs_nol_delete(dfs, freq, chwidth); \ 346 qdf_sched_work(NULL, &dfs->dfs_nol_elem_free_work); \ 347 WLAN_DFSNOL_UNLOCK(dfs); \ 348 } while (0) 349 350 #define DFS_GET_NOL_LOCKED(dfs, dfs_nol, nchan) \ 351 do { \ 352 WLAN_DFSNOL_LOCK(dfs); \ 353 dfs_get_nol(dfs, dfs_nol, nchan); \ 354 WLAN_DFSNOL_UNLOCK(dfs); \ 355 } while (0) 356 357 #define DFS_PRINT_NOL_LOCKED(dfs) \ 358 do { \ 359 WLAN_DFSNOL_LOCK(dfs); \ 360 dfs_print_nol(dfs); \ 361 WLAN_DFSNOL_UNLOCK(dfs); \ 362 } while (0) 363 364 #define DFS_NOL_FREE_LIST_LOCKED(dfs) \ 365 do { \ 366 WLAN_DFSNOL_LOCK(dfs); \ 367 dfs_nol_free_list(dfs); \ 368 WLAN_DFSNOL_UNLOCK(dfs); \ 369 } while (0) 370 371 /* Host sends the average parameters of the radar pulses and starts the status 372 * wait timer with this timeout. 373 */ 374 #if defined(WLAN_DFS_PARTIAL_OFFLOAD) && defined(HOST_DFS_SPOOF_TEST) 375 #define HOST_DFS_STATUS_WAIT_TIMER_MS 200 376 #endif 377 378 /* 379 * USENOL_DISABLE_NOL_HOST_AND_FW : Do not add radar hit channel to NOL 380 * in host and FW. Enable CSA on the same channel. 381 */ 382 #define USENOL_DISABLE_NOL_HOST_AND_FW 0 383 /* 384 * USENOL_ENABLE_NOL_HOST_AND_FW : Add the radar hit channel to NOL in 385 * host and FW (in case of FO). NOL timer cannot be configured by the user 386 * as FW does not allow manipulating NOL timeout. If noltimeout is configured, 387 * (say 1 min) FW will not be intimated about the configuration and hence NOL 388 * timer may elapse at different instances in host (after 1 min) and FW (after 389 * default 30 min) which could lead to DFS Violation if host tries to come up 390 * on the channel after host NOL timeout (of 1 min) as the FW would still 391 * have the channel in NOL list. 392 */ 393 #define USENOL_ENABLE_NOL_HOST_AND_FW 1 394 /* 395 * USENOL_ENABLE_NOL_HOST_DISABLE_NOL_FW : Add the radar hit channel to NOL 396 * in host. NOL timer can be configured by user. NOL in FW (for FO) is disabled. 397 */ 398 #define USENOL_ENABLE_NOL_HOST_DISABLE_NOL_FW 2 399 400 /* Non Agile detector IDs */ 401 #define DETECTOR_ID_0 0 402 #define DETECTOR_ID_1 1 403 /* Agile detector ID */ 404 #define AGILE_DETECTOR_ID 2 405 406 /** 407 * struct dfs_pulseparams - DFS pulse param structure. 408 * @p_time: Time for start of pulse in usecs. 409 * @p_dur: Duration of pulse in usecs. 410 * @p_rssi: RSSI of pulse. 411 * @p_seg_id: Segment id. 412 * @p_sidx: Sidx value. 413 * @p_delta_peak: Delta peak value. 414 * @p_psidx_diff: The difference in the FFT peak index between the short FFT 415 * and the first long FFT. 416 * @p_seq_num: Sequence number. 417 */ 418 struct dfs_pulseparams { 419 uint64_t p_time; 420 uint8_t p_dur; 421 uint8_t p_rssi; 422 uint8_t p_seg_id; 423 int16_t p_sidx; 424 int8_t p_delta_peak; 425 int16_t p_psidx_diff; 426 uint32_t p_seq_num; 427 } qdf_packed; 428 429 /** 430 * struct dfs_pulseline - Pulseline structure. 431 * @pl_elems[]: array of pulses in delay line. 432 * @pl_firstelem: Index of the first element. 433 * @pl_lastelem: Index of the last element. 434 * @pl_numelems: Number of elements in the delay line. 435 */ 436 struct dfs_pulseline { 437 struct dfs_pulseparams pl_elems[DFS_MAX_PULSE_BUFFER_SIZE]; 438 uint32_t pl_firstelem; 439 uint32_t pl_lastelem; 440 uint32_t pl_numelems; 441 } qdf_packed; 442 443 #define DFS_EVENT_CHECKCHIRP 0x01 /* Whether to check the chirp flag */ 444 #define DFS_EVENT_HW_CHIRP 0x02 /* hardware chirp */ 445 #define DFS_EVENT_SW_CHIRP 0x04 /* software chirp */ 446 /* Whether the event contains valid psidx diff value*/ 447 #define DFS_EVENT_VALID_PSIDX_DIFF 0x08 448 449 /* Use this only if the event has CHECKCHIRP set. */ 450 #define DFS_EVENT_ISCHIRP(e) \ 451 ((e)->re_flags & (DFS_EVENT_HW_CHIRP | DFS_EVENT_SW_CHIRP)) 452 453 /** 454 * Check if the given event is to be rejected as not possibly 455 * a chirp. This means: 456 * (a) it's a hardware or software checked chirp, and 457 * (b) the HW/SW chirp bits are both 0. 458 */ 459 #define DFS_EVENT_NOTCHIRP(e) \ 460 (((e)->re_flags & (DFS_EVENT_CHECKCHIRP)) && (!DFS_EVENT_ISCHIRP((e)))) 461 462 /** 463 * struct dfs_event - DFS event structure. 464 * @re_full_ts: 64-bit full timestamp from interrupt time. 465 * @re_ts: Original 15 bit recv timestamp. 466 * @re_rssi: Rssi of radar event. 467 * @re_dur: Duration of radar pulse. 468 * @re_chanindex: Channel of event. 469 * @re_flags: Event flags. 470 * @re_freq: Centre frequency of event, KHz. 471 * @re_freq_lo: Lower bounds of frequency, KHz. 472 * @re_freq_hi: Upper bounds of frequency, KHz. 473 * @re_seg_id: HT80_80/HT160 use. 474 * @re_sidx: Seg index. 475 * @re_freq_offset_khz: Freq offset in KHz 476 * @re_peak_mag: Peak mag. 477 * @re_total_gain: Total gain. 478 * @re_mb_gain: Mb gain. 479 * @re_relpwr_db: Relpower in db. 480 * @re_delta_diff: Delta diff. 481 * @re_delta_peak: Delta peak. 482 * @re_psidx_diff: Psidx diff. 483 * @re_list: List of radar events. 484 */ 485 struct dfs_event { 486 uint64_t re_full_ts; 487 uint32_t re_ts; 488 uint8_t re_rssi; 489 uint8_t re_dur; 490 uint8_t re_chanindex; 491 uint8_t re_flags; 492 uint32_t re_freq; 493 uint32_t re_freq_lo; 494 uint32_t re_freq_hi; 495 uint8_t re_seg_id; 496 int re_sidx; 497 u_int re_freq_offset_khz; 498 int re_peak_mag; 499 int re_total_gain; 500 int re_mb_gain; 501 int re_relpwr_db; 502 uint8_t re_delta_diff; 503 int8_t re_delta_peak; 504 int16_t re_psidx_diff; 505 506 STAILQ_ENTRY(dfs_event) re_list; 507 } qdf_packed; 508 509 #define DFS_AR_MAX_ACK_RADAR_DUR 511 510 #define DFS_AR_MAX_NUM_PEAKS 3 511 #define DFS_AR_ARQ_SIZE 2048 /* 8K AR events for buffer size */ 512 #define DFS_AR_ARQ_SEQSIZE 2049 /* Sequence counter wrap for AR */ 513 514 #define DFS_RADARQ_SIZE 512 /* 1K radar events for buffer size */ 515 #define DFS_RADARQ_SEQSIZE 513 /* Sequence counter wrap for radar */ 516 /* Number of radar channels we keep state for */ 517 #define DFS_NUM_RADAR_STATES 64 518 /* Max number radar filters for each type */ 519 #define DFS_MAX_NUM_RADAR_FILTERS 10 520 /* Number of different radar types */ 521 #define DFS_MAX_RADAR_TYPES 32 522 /* Number of filter index table rows */ 523 #define DFS_NUM_FT_IDX_TBL_ROWS 256 524 525 /* RADAR filter pattern type 1*/ 526 #define WLAN_DFS_RF_PATTERN_TYPE_1 1 527 528 /** 529 * struct dfs_ar_state - DFS AR state structure. 530 * @ar_prevwidth: Previous width. 531 * @ar_phyerrcount[]: Phy error count. 532 * @ar_acksum: Acksum. 533 * @ar_packetthreshold: Thresh to determine traffic load. 534 * @ar_parthreshold: Thresh to determine peak. 535 * @ar_radarrssi: Rssi threshold for AR event. 536 * @ar_prevtimestamp: Prev time stamp. 537 * @ar_peaklist[]: Peak list. 538 */ 539 struct dfs_ar_state { 540 uint32_t ar_prevwidth; 541 uint32_t ar_phyerrcount[DFS_AR_MAX_ACK_RADAR_DUR]; 542 uint32_t ar_acksum; 543 uint32_t ar_packetthreshold; 544 uint32_t ar_parthreshold; 545 uint32_t ar_radarrssi; 546 uint16_t ar_prevtimestamp; 547 uint16_t ar_peaklist[DFS_AR_MAX_NUM_PEAKS]; 548 }; 549 550 /** 551 * struct dfs_delayelem - Delay Element. 552 * @de_time: Current "filter" time for start of pulse in usecs. 553 * @de_dur: Duration of pulse in usecs. 554 * @de_rssi: Rssi of pulse in dB. 555 * @de_ts: Time stamp for this delay element. 556 * @de_seg_id: Segment id for HT80_80/HT160 use. 557 * @de_sidx: Sidx value. 558 * @de_delta_peak: Delta peak. 559 * @de_psidx_diff: Psidx diff. 560 * @de_seq_num: Sequence number. 561 */ 562 struct dfs_delayelem { 563 uint32_t de_time; 564 uint8_t de_dur; 565 uint8_t de_rssi; 566 uint64_t de_ts; 567 uint8_t de_seg_id; 568 int16_t de_sidx; 569 int8_t de_delta_peak; 570 int16_t de_psidx_diff; 571 uint32_t de_seq_num; 572 } qdf_packed; 573 574 /** 575 * struct dfs_delayline - DFS Delay Line. 576 * @dl_elems[]: Array of pulses in delay line. 577 * @dl_last_ts: Last timestamp the delay line was used (in usecs). 578 * @dl_firstelem: Index of the first element. 579 * @dl_lastelem: Index of the last element. 580 * @dl_numelems: Number of elements in the delay line. 581 * The following is to handle fractional PRI pulses that can cause false 582 * detection. 583 * @dl_seq_num_start: Sequence number of first pulse that was part of 584 * threshold match. 585 * @dl_seq_num_stop: Sequence number of last pulse that was part of threshold 586 * match. 587 * The following is required because the first pulse may or may not be in the 588 * delay line but we will find it iin the pulse line using dl_seq_num_second's 589 * diff_ts value. 590 * @dl_seq_num_second: Sequence number of second pulse that was part of 591 * threshold match. 592 * @dl_search_pri: We need final search PRI to identify possible fractional 593 * PRI issue. 594 * @dl_min_sidx: Minimum sidx value of pulses used to match thershold. 595 * Used for sidx spread check. 596 * @dl_max_sidx: Maximum sidx value of pulses used to match thershold. 597 * Used for sidx spread check. 598 * @dl_delta_peak_match_count: Number of pulse in the delay line that had valid 599 * delta peak value. 600 * @dl_psidx_diff_match_count: Number of pulse in the delay line that had valid 601 * psidx diff value. 602 */ 603 struct dfs_delayline { 604 struct dfs_delayelem dl_elems[DFS_MAX_DL_SIZE]; 605 uint64_t dl_last_ts; 606 uint32_t dl_firstelem; 607 uint32_t dl_lastelem; 608 uint32_t dl_numelems; 609 uint32_t dl_seq_num_start; 610 uint32_t dl_seq_num_stop; 611 uint32_t dl_seq_num_second; 612 uint32_t dl_search_pri; 613 int16_t dl_min_sidx; 614 int8_t dl_max_sidx; 615 uint8_t dl_delta_peak_match_count; 616 uint8_t dl_psidx_diff_match_count; 617 } qdf_packed; 618 619 /** 620 * struct dfs_filter - Dfs filter. 621 * @rf_dl: Delay line of pulses for this filter. 622 * @rf_numpulses: Number of pulses in the filter. 623 * @rf_minpri: Min pri to be considered for this filter. 624 * @rf_maxpri: Max pri to be considered for this filter. 625 * @rf_threshold: Match filter output threshold for radar detect. 626 * @rf_filterlen: Length (in usecs) of the filter. 627 * @rf_patterntype: Fixed or variable pattern type. 628 * @rf_fixed_pri_radar_pulse: indicates if it is a fixed pri pulse. 629 * @rf_mindur: Min duration for this radar filter. 630 * @rf_maxdur: Max duration for this radar filter. 631 * @rf_ignore_pri_window: Ignore pri window. 632 * @rf_pulseid: Unique ID corresponding to the original filter ID. 633 * To reduce false detection, look at frequency spread. For now we will use 634 * sidx spread. But for HT160 frequency spread will be a better measure. 635 * @rf_sidx_spread: Maximum SIDX value spread in a matched sequence 636 * excluding FCC Bin 5. 637 * @rf_check_delta_peak: Minimum allowed delta_peak value for a pulse to be 638 * considetred for this filter's match. 639 */ 640 struct dfs_filter { 641 struct dfs_delayline rf_dl; 642 uint32_t rf_numpulses; 643 uint32_t rf_minpri; 644 uint32_t rf_maxpri; 645 uint32_t rf_threshold; 646 uint32_t rf_filterlen; 647 uint32_t rf_patterntype; 648 uint32_t rf_fixed_pri_radar_pulse; 649 uint32_t rf_mindur; 650 uint32_t rf_maxdur; 651 uint32_t rf_ignore_pri_window; 652 uint32_t rf_pulseid; 653 uint16_t rf_sidx_spread; 654 int8_t rf_check_delta_peak; 655 } qdf_packed; 656 657 /** 658 * struct dfs_filtertype - Structure of DFS Filter type. 659 * @ft_filters[]: Array of ptrs storing addresses for struct of dfs_filter. 660 * @ft_filterdur: Duration of pulse which specifies filter type. 661 * @ft_numfilters: Num filters of this type. 662 * @ft_last_ts: Last timestamp this filtertype was used (in usecs). 663 * @ft_mindur: Min pulse duration to be considered for this filter type. 664 * @ft_maxdur: Max pulse duration to be considered for this filter type. 665 * @ft_rssithresh: Min rssi to be considered for this filter type. 666 * @ft_numpulses: Num pulses in each filter of this type. 667 * @ft_patterntype: Fixed or variable pattern type. 668 * @ft_minpri: Min pri to be considered for this type. 669 * @ft_rssimargin: Rssi threshold margin. In Turbo Mode HW reports rssi 3dB 670 * lower than in non TURBO mode. This will offset that diff. 671 */ 672 struct dfs_filtertype { 673 struct dfs_filter *ft_filters[DFS_MAX_NUM_RADAR_FILTERS]; 674 uint32_t ft_filterdur; 675 uint32_t ft_numfilters; 676 uint64_t ft_last_ts; 677 uint32_t ft_mindur; 678 uint32_t ft_maxdur; 679 uint32_t ft_rssithresh; 680 uint32_t ft_numpulses; 681 uint32_t ft_patterntype; 682 uint32_t ft_minpri; 683 uint32_t ft_rssimargin; 684 }; 685 686 /** 687 * struct dfs_channel - Channel structure for dfs component. 688 * @dfs_ch_freq: Frequency in Mhz. 689 * @dfs_ch_flags: Channel flags. 690 * @dfs_ch_flagext: Extended channel flags. 691 * @dfs_ch_ieee: IEEE channel number. 692 * @dfs_ch_vhtop_ch_freq_seg1: IEEE Channel Center of primary segment 693 * @dfs_ch_vhtop_ch_freq_seg2: IEEE Channel Center applicable for 80+80MHz 694 * mode of operation. 695 * @dfs_ch_mhz_freq_seg1: Channel center frequency of primary segment in 696 * MHZ. 697 * @dfs_ch_mhz_freq_seg2: Channel center frequency of secondary segment 698 * in MHZ applicable only for 80+80MHZ mode of 699 * operation. 700 */ 701 struct dfs_channel { 702 uint16_t dfs_ch_freq; 703 uint64_t dfs_ch_flags; 704 uint16_t dfs_ch_flagext; 705 uint8_t dfs_ch_ieee; 706 uint8_t dfs_ch_vhtop_ch_freq_seg1; 707 uint8_t dfs_ch_vhtop_ch_freq_seg2; 708 uint16_t dfs_ch_mhz_freq_seg1; 709 uint16_t dfs_ch_mhz_freq_seg2; 710 }; 711 712 /** 713 * struct dfs_state - DFS state. 714 * @rs_chan: Channel info. 715 * @rs_chanindex: Channel index in radar structure. 716 * @rs_numradarevents: Number of radar events. 717 * @rs_param: Phy param. 718 */ 719 struct dfs_state { 720 struct dfs_channel rs_chan; 721 uint8_t rs_chanindex; 722 uint32_t rs_numradarevents; 723 struct wlan_dfs_phyerr_param rs_param; 724 }; 725 726 #define DFS_NOL_TIMEOUT_S (30*60) /* 30 minutes in seconds */ 727 #define DFS_NOL_TIMEOUT_MS (DFS_NOL_TIMEOUT_S * 1000) 728 #define DFS_NOL_TIMEOUT_US (DFS_NOL_TIMEOUT_MS * 1000) 729 730 /** 731 * struct dfs_nolelem - DFS NOL element. 732 * @nol_dfs Back pointer to dfs object. 733 * @nol_freq: Centre frequency. 734 * @nol_chwidth: Event width (MHz). 735 * @nol_start_ticks: NOL start time in OS ticks. 736 * @nol_timeout_ms: NOL timeout value in msec. 737 * @nol_timer: Per element NOL timer. 738 * @nol_next: Next element pointer. 739 */ 740 struct dfs_nolelem { 741 TAILQ_ENTRY(dfs_nolelem) nolelem_list; 742 struct wlan_dfs *nol_dfs; 743 uint32_t nol_freq; 744 uint32_t nol_chwidth; 745 unsigned long nol_start_ticks; 746 uint32_t nol_timeout_ms; 747 qdf_timer_t nol_timer; 748 struct dfs_nolelem *nol_next; 749 } qdf_packed; 750 751 752 /** 753 * struct dfs_info - DFS Info. 754 * @rn_ftindex: Number of different types of radars. 755 * @rn_lastfull_ts: Last 64 bit timstamp from recv interrupt. 756 * @rn_last_ts: last 15 bit ts from recv descriptor. 757 * @rn_last_unique_ts: last unique 32 bit ts from recv descriptor. 758 * @rn_ts_prefix: Prefix to prepend to 15 bit recv ts. 759 * @rn_numbin5radars: Number of bin5 radar pulses to search for. 760 * @rn_fastdivGCval: Value of fast diversity gc limit from init file. 761 * @rn_minrssithresh: Min rssi for all radar types. 762 * @rn_maxpulsedur: Max pulse width in TSF ticks. 763 * @dfs_ext_chan_busy: Ext chan busy. 764 * @ext_chan_busy_ts: Ext chan busy time. 765 * @dfs_bin5_chirp_ts: Ext bin5 chrip time. 766 * @dfs_last_bin5_dur: Last bin5 during. 767 */ 768 struct dfs_info { 769 uint32_t rn_ftindex; 770 uint64_t rn_lastfull_ts; 771 uint16_t rn_last_ts; 772 uint32_t rn_last_unique_ts; 773 uint64_t rn_ts_prefix; 774 uint32_t rn_numbin5radars; 775 uint32_t rn_fastdivGCval; 776 int32_t rn_minrssithresh; 777 uint32_t rn_maxpulsedur; 778 uint8_t dfs_ext_chan_busy; 779 uint64_t ext_chan_busy_ts; 780 uint64_t dfs_bin5_chirp_ts; 781 uint8_t dfs_last_bin5_dur; 782 } qdf_packed; 783 784 /** 785 * struct dfs_bin5elem - BIN5 elements. 786 * @be_ts: Timestamp for the bin5 element. 787 * @be_rssi: Rssi for the bin5 element. 788 * @be_dur: Duration of bin5 element. 789 */ 790 struct dfs_bin5elem { 791 uint64_t be_ts; 792 uint32_t be_rssi; 793 uint32_t be_dur; 794 }; 795 796 /** 797 * struct dfs_bin5radars - BIN5 radars. 798 * @br_elems[]: List of bin5 elems that fall within the time window. 799 * @br_firstelem: Index of the first element. 800 * @br_lastelem: Index of the last element. 801 * @br_numelems: Number of elements in the delay line. 802 * @br_pulse: Original info about bin5 pulse. 803 */ 804 struct dfs_bin5radars { 805 struct dfs_bin5elem br_elems[DFS_MAX_B5_SIZE]; 806 uint32_t br_firstelem; 807 uint32_t br_lastelem; 808 uint32_t br_numelems; 809 struct dfs_bin5pulse br_pulse; 810 }; 811 812 /** 813 * struct dfs_stats - DFS stats. 814 * @num_radar_detects: Total num. of radar detects. 815 * @num_seg_two_radar_detects: Total num. of radar detected in secondary segment 816 * @total_phy_errors: Total PHY errors. 817 * @owl_phy_errors: OWL PHY errors. 818 * @pri_phy_errors: Primary channel phy errors. 819 * @ext_phy_errors: Extension channel phy errors. 820 * @dc_phy_errors: DC PHY errors. 821 * @early_ext_phy_errors: Extension channel early radar found error. 822 * @bwinfo_errors: Bogus bandwidth info received in descriptor. 823 * @datalen_discards: data length at least three bytes of payload. 824 * @rssi_discards: RSSI is not accurate. 825 * @last_reset_tstamp: Last reset timestamp. 826 */ 827 struct dfs_stats { 828 uint32_t num_radar_detects; 829 uint32_t num_seg_two_radar_detects; 830 uint32_t total_phy_errors; 831 uint32_t owl_phy_errors; 832 uint32_t pri_phy_errors; 833 uint32_t ext_phy_errors; 834 uint32_t dc_phy_errors; 835 uint32_t early_ext_phy_errors; 836 uint32_t bwinfo_errors; 837 uint32_t datalen_discards; 838 uint32_t rssi_discards; 839 uint64_t last_reset_tstamp; 840 }; 841 842 #define DFS_EVENT_LOG_SIZE 256 843 844 /** 845 * struct dfs_event_log - DFS event log. 846 * @ts: 64-bit full timestamp from interrupt time. 847 * @diff_ts: Diff timestamp. 848 * @rssi: Rssi of radar event. 849 * @dur: Duration of radar pulse. 850 * @is_chirp: Chirp flag. 851 * @seg_id: HT80_80/HT160 use. 852 * @sidx: Seg index. 853 * @freq_offset_khz: Freq offset in KHz 854 * @peak_mag: Peak mag. 855 * @total_gain: Total gain. 856 * @mb_gain: Mb gain. 857 * @relpwr_db: Relpower in db. 858 * @delta_diff: Delta diff. 859 * @delta_peak: Delta peak. 860 * @psidx_diff: Psidx diff. 861 */ 862 863 struct dfs_event_log { 864 uint64_t ts; 865 uint32_t diff_ts; 866 uint8_t rssi; 867 uint8_t dur; 868 int is_chirp; 869 uint8_t seg_id; 870 int sidx; 871 u_int freq_offset_khz; 872 int peak_mag; 873 int total_gain; 874 int mb_gain; 875 int relpwr_db; 876 uint8_t delta_diff; 877 int8_t delta_peak; 878 int16_t psidx_diff; 879 }; 880 881 #define WLAN_DFS_WEATHER_CHANNEL_WAIT_MIN 10 /*10 minutes*/ 882 #define WLAN_DFS_WEATHER_CHANNEL_WAIT_S (WLAN_DFS_WEATHER_CHANNEL_WAIT_MIN * 60) 883 #define WLAN_DFS_WEATHER_CHANNEL_WAIT_MS \ 884 ((WLAN_DFS_WEATHER_CHANNEL_WAIT_S) * 1000) /*in MS*/ 885 886 #define WLAN_DFS_WAIT_POLL_PERIOD 2 /* 2 seconds */ 887 #define WLAN_DFS_WAIT_POLL_PERIOD_MS \ 888 ((WLAN_DFS_WAIT_POLL_PERIOD) * 1000) /*in MS*/ 889 890 #define DFS_DEBUG_TIMEOUT_S 30 /* debug timeout is 30 seconds */ 891 #define DFS_DEBUG_TIMEOUT_MS (DFS_DEBUG_TIMEOUT_S * 1000) 892 893 #define RSSI_POSSIBLY_FALSE 50 894 #define SEARCH_FFT_REPORT_PEAK_MAG_THRSH 40 895 896 #define MIN_DFS_SUBCHAN_BW 20 /* Minimum bandwidth of each subchannel. */ 897 898 #define FREQ_OFFSET_BOUNDARY_FOR_80MHZ 40 899 900 /** 901 * struct wlan_dfs - The main dfs structure. 902 * @dfs_debug_mask: Current debug bitmask. 903 * @dfs_curchan_radindex: Current channel radar index. 904 * @dfs_extchan_radindex: Extension channel radar index. 905 * @dfsdomain: Current DFS domain. 906 * @dfs_proc_phyerr: Flags for Phy Errs to process. 907 * @dfs_eventq: Q of free dfs event objects. 908 * @dfs_eventqlock: Lock for free dfs event list. 909 * @dfs_radarq: Q of radar events. 910 * @dfs_radarqlock: Lock for dfs q. 911 * @dfs_arq: Q of AR events. 912 * @dfs_arqlock: Lock for AR q. 913 * @dfs_ar_state: AR state. 914 * @dfs_radar[]: Per-Channel Radar detector state. 915 * @dfs_radarf[]: One filter for each radar pulse type. 916 * @dfs_rinfo: State vars for radar processing. 917 * @dfs_b5radars: Array of bin5 radar events. 918 * @dfs_ftindextable: Map of radar durs to filter types. 919 * @dfs_nol: Non occupancy list for radar. 920 * @dfs_nol_count: How many items? 921 * @dfs_defaultparams: Default phy params per radar state. 922 * @wlan_dfs_stats: DFS related stats. 923 * @pulses: Pulse history. 924 * @events: Events structure. 925 * @wlan_radar_tasksched: Radar task is scheduled. 926 * @wlan_dfswait: Waiting on channel for radar detect. 927 * @wlan_dfstest: Test timer in progress. 928 * @dfs_caps: Object of wlan_dfs_caps structure. 929 * @wlan_dfstest_ieeechan: IEEE chan num to return to after a dfs mute 930 * test. 931 * @wlan_dfs_cac_time: CAC period. 932 * @wlan_dfstesttime: Time to stay off chan during dfs test. 933 * @wlan_dfswaittimer: Dfs wait timer. 934 * @wlan_dfstesttimer: Dfs mute test timer. 935 * @wlan_dfs_debug_timer: Dfs debug timer. 936 * @dfs_bangradar_type: Radar simulation type. 937 * @is_radar_found_on_secondary_seg: Radar on second segment. 938 * @dfs_radar_found_for_fo: Radar found event for FO(Full Offload) is 939 * received. 940 * @is_radar_during_precac: Radar found during precac. 941 * @dfs_precac_lock: Lock to protect precac lists. 942 * @dfs_precac_secondary_freq: Second segment freq for precac. 943 * Applicable to only legacy chips. 944 * @dfs_precac_secondary_freq_mhz: Second segment freq in MHZ for precac. 945 * Applicable to only legacy chips. 946 * @dfs_precac_primary_freq: PreCAC Primary freq applicable only to 947 * legacy chips. 948 * @dfs_precac_primary_freq_mhz: PreCAC Primary freq in MHZ applicable only 949 * to legacy chips. 950 * @dfs_defer_precac_channel_change: Defer precac channel change. 951 * @dfs_precac_inter_chan: Intermediate non-DFS channel used while 952 * doing precac. 953 * @dfs_precac_inter_chan_freq: Intermediate non-DFS freq used while 954 * doing precac. 955 * @dfs_autoswitch_des_chan: Desired channel which has to be used 956 * after precac. 957 * @dfs_autoswitch_des_chan_freq: Desired freq which has to be used 958 * after precac. 959 * @dfs_autoswitch_des_mode: Desired PHY mode which has to be used 960 * after precac. 961 * @dfs_pre_cac_timeout_channel_change: Channel change due to precac timeout. 962 * @wlan_dfs_task_timer: Dfs wait timer. 963 * @dur_multiplier: Duration multiplier. 964 * @wlan_dfs_isdfsregdomain: True when AP is in DFS domain 965 * @wlan_dfs_false_rssi_thres: False RSSI Threshold. 966 * @wlan_dfs_peak_mag: Peak mag. 967 * @radar_log[]: Radar log. 968 * @dfs_event_log_count: Event log count. 969 * @dfs_event_log_on: Event log on. 970 * @dfs_phyerr_count: Same as number of PHY radar interrupts. 971 * @dfs_phyerr_reject_count: When TLV is supported, # of radar events 972 * ignored after TLV is parsed. 973 * @dfs_phyerr_queued_count: Number of radar events queued for matching 974 * the filters. 975 * @dfs_phyerr_freq_min: Phyerr min freq. 976 * @dfs_phyerr_freq_max: Phyerr max freq. 977 * @dfs_phyerr_w53_counter: Phyerr w53 counter. 978 * @dfs_pri_multiplier: Allow pulse if they are within multiple of 979 * PRI for the radar type. 980 * @wlan_dfs_nol_timeout: NOL timeout. 981 * @update_nol: Update NOL. 982 * @dfs_seq_num: Sequence number. 983 * @dfs_nol_event[]: NOL event. 984 * @dfs_nol_timer: NOL list processing. 985 * @dfs_nol_free_list: NOL free list. 986 * @dfs_nol_elem_free_work: The work queue to free an NOL element. 987 * @dfs_cac_timer: CAC timer. 988 * @dfs_cac_valid_timer: Ignore CAC when this timer is running. 989 * @dfs_cac_timeout_override: Overridden cac timeout. 990 * @dfs_enable: DFS Enable. 991 * @dfs_cac_timer_running: DFS CAC timer running. 992 * @dfs_ignore_dfs: Ignore DFS. 993 * @dfs_ignore_cac: Ignore CAC. 994 * @dfs_cac_valid: DFS CAC valid. 995 * @dfs_cac_valid_time: Time for which CAC will be valid and will 996 * not be re-done. 997 * @dfs_precac_timeout_override: Overridden precac timeout. 998 * @dfs_num_precac_freqs: Number of PreCAC VHT80 frequencies. 999 * @dfs_precac_list: PreCAC list (contains individual trees). 1000 * @dfs_precac_chwidth: PreCAC channel width enum. 1001 * @dfs_curchan: DFS current channel. 1002 * @dfs_prevchan: DFS previous channel. 1003 * @dfs_cac_started_chan: CAC started channel. 1004 * @dfs_pdev_obj: DFS pdev object. 1005 * @dfs_is_offload_enabled: Set if DFS offload enabled. 1006 * @dfs_agile_precac_freq_mhz: Freq in MHZ configured on Agile DFS engine. 1007 * @dfs_use_nol: Use the NOL when radar found(default: TRUE) 1008 * @dfs_nol_lock: Lock to protect nol list. 1009 * @tx_leakage_threshold: Tx leakage threshold for dfs. 1010 * @dfs_use_nol_subchannel_marking: Use subchannel marking logic to add only 1011 * radar affected subchannel instead of all 1012 * bonding channels. 1013 * @dfs_host_wait_timer: The timer that is started from host after 1014 * sending the average radar parameters. 1015 * Before this timeout host expects its dfs 1016 * status from fw. 1017 * @dfs_average_pri: Average pri value of the received radar 1018 * pulses. 1019 * @dfs_average_duration: Average duration of the received radar 1020 * pulses. 1021 * @dfs_average_sidx: Average sidx of the received radar pulses. 1022 * @dfs_is_host_wait_running: Indicates if host dfs status wait timer is 1023 * running. 1024 * @dfs_average_params_sent: Indicates if host has sent the average 1025 * radar parameters. 1026 * @dfs_no_res_from_fw: Indicates no response from fw. 1027 * @dfs_spoof_check_failed: Indicates if the spoof check has failed. 1028 * @dfs_spoof_test_done: Indicates if the sppof test is done. 1029 * @dfs_status_timeout_override: Used to change the timeout value of 1030 * dfs_host_wait_timer. 1031 * @dfs_is_stadfs_enabled: Is STADFS enabled. 1032 * @dfs_min_sidx: Minimum sidx of the received radar pulses. 1033 * @dfs_max_sidx: Maximum sidx of the received radar pulses. 1034 * @dfs_seg_id: Segment ID of the radar hit channel. 1035 * @dfs_is_chirp: Radar Chirp in pulse present or not. 1036 * @dfs_bw_reduced: DFS bandwidth reduced channel bit. 1037 * @dfs_freq_offset: Frequency offset where radar was found. 1038 * @dfs_cac_aborted: DFS cac is aborted. 1039 * @dfs_disable_radar_marking: To mark or unmark NOL chan as radar hit. 1040 * @dfs_data_struct_lock: DFS data structure lock. This is to protect 1041 * all the filtering data structures. For 1042 * example: dfs_bin5radars, dfs_filtertype, 1043 * etc. 1044 * @dfs_nol_ie_bandwidth: Minimum Bandwidth of subchannels that 1045 * are added to NOL. 1046 * @dfs_nol_ie_startfreq: The centre frequency of the starting 1047 * subchannel in the current channel list 1048 * to be sent in NOL IE with RCSA. 1049 * @dfs_nol_ie_bitmap: The bitmap of radar affected subchannels 1050 * in the current channel list 1051 * to be sent in NOL IE with RCSA. 1052 * @dfs_is_rcsa_ie_sent: To send or to not send RCSA IE. 1053 * @dfs_is_nol_ie_sent: To send or to not send NOL IE. 1054 * @dfs_legacy_precac_ucfg: User configuration for legacy preCAC in 1055 * partial offload chipsets. 1056 * @dfs_agile_precac_ucfg: User configuration for agile preCAC. 1057 * @dfs_fw_adfs_support_non_160: Target Agile DFS support for non-160 BWs. 1058 * @dfs_fw_adfs_support_160: Target Agile DFS support for 160 BW. 1059 * @dfs_allow_hw_pulses: Allow/Block HW pulses. When synthetic 1060 * pulses are injected, the HW pulses should 1061 * be blocked and this variable should be 1062 * false so that HW pulses and synthetic 1063 * pulses do not get mixed up. 1064 */ 1065 struct wlan_dfs { 1066 uint32_t dfs_debug_mask; 1067 int16_t dfs_curchan_radindex; 1068 int16_t dfs_extchan_radindex; 1069 uint32_t dfsdomain; 1070 uint32_t dfs_proc_phyerr; 1071 1072 STAILQ_HEAD(, dfs_event) dfs_eventq; 1073 qdf_spinlock_t dfs_eventqlock; 1074 1075 STAILQ_HEAD(, dfs_event) dfs_radarq; 1076 qdf_spinlock_t dfs_radarqlock; 1077 1078 STAILQ_HEAD(, dfs_event) dfs_arq; 1079 qdf_spinlock_t dfs_arqlock; 1080 1081 struct dfs_ar_state dfs_ar_state; 1082 struct dfs_state dfs_radar[DFS_NUM_RADAR_STATES]; 1083 struct dfs_filtertype *dfs_radarf[DFS_MAX_RADAR_TYPES]; 1084 struct dfs_info dfs_rinfo; 1085 struct dfs_bin5radars *dfs_b5radars; 1086 int8_t **dfs_ftindextable; 1087 struct dfs_nolelem *dfs_nol; 1088 int dfs_nol_count; 1089 struct wlan_dfs_phyerr_param dfs_defaultparams; 1090 struct dfs_stats wlan_dfs_stats; 1091 struct dfs_pulseline *pulses; 1092 struct dfs_event *events; 1093 1094 uint32_t wlan_radar_tasksched:1, 1095 wlan_dfswait:1, 1096 wlan_dfstest:1; 1097 struct wlan_dfs_caps dfs_caps; 1098 uint8_t wlan_dfstest_ieeechan; 1099 uint32_t wlan_dfs_cac_time; 1100 uint32_t wlan_dfstesttime; 1101 qdf_timer_t wlan_dfswaittimer; 1102 qdf_timer_t wlan_dfstesttimer; 1103 qdf_timer_t wlan_dfs_debug_timer; 1104 enum dfs_bangradar_types dfs_bangradar_type; 1105 bool is_radar_found_on_secondary_seg; 1106 bool dfs_radar_found_for_fo; 1107 bool is_radar_during_precac; 1108 qdf_spinlock_t dfs_precac_lock; 1109 bool dfs_precac_enable; 1110 #ifdef CONFIG_CHAN_NUM_API 1111 uint8_t dfs_precac_secondary_freq; 1112 uint8_t dfs_precac_primary_freq; 1113 #endif 1114 #ifdef CONFIG_CHAN_FREQ_API 1115 uint16_t dfs_precac_secondary_freq_mhz; 1116 uint16_t dfs_precac_primary_freq_mhz; 1117 #endif 1118 uint8_t dfs_defer_precac_channel_change; 1119 #ifdef WLAN_DFS_PRECAC_AUTO_CHAN_SUPPORT 1120 #ifdef CONFIG_CHAN_NUM_API 1121 uint8_t dfs_precac_inter_chan; 1122 uint8_t dfs_autoswitch_des_chan; 1123 #endif 1124 enum wlan_phymode dfs_autoswitch_des_mode; 1125 #endif 1126 #ifdef WLAN_DFS_PRECAC_AUTO_CHAN_SUPPORT 1127 #ifdef CONFIG_CHAN_FREQ_API 1128 uint16_t dfs_precac_inter_chan_freq; 1129 uint16_t dfs_autoswitch_des_chan_freq; 1130 #endif 1131 #endif 1132 uint8_t dfs_pre_cac_timeout_channel_change:1; 1133 qdf_timer_t wlan_dfs_task_timer; 1134 int dur_multiplier; 1135 uint16_t wlan_dfs_isdfsregdomain; 1136 int wlan_dfs_false_rssi_thres; 1137 int wlan_dfs_peak_mag; 1138 struct dfs_event_log radar_log[DFS_EVENT_LOG_SIZE]; 1139 int dfs_event_log_count; 1140 int dfs_event_log_on; 1141 int dfs_phyerr_count; 1142 int dfs_phyerr_reject_count; 1143 int dfs_phyerr_queued_count; 1144 int dfs_phyerr_freq_min; 1145 int dfs_phyerr_freq_max; 1146 int dfs_phyerr_w53_counter; 1147 int dfs_pri_multiplier; 1148 int wlan_dfs_nol_timeout; 1149 bool update_nol; 1150 uint32_t dfs_seq_num; 1151 int dfs_nol_event[DFS_CHAN_MAX]; 1152 qdf_timer_t dfs_nol_timer; 1153 1154 TAILQ_HEAD(, dfs_nolelem) dfs_nol_free_list; 1155 qdf_work_t dfs_nol_elem_free_work; 1156 1157 qdf_timer_t dfs_cac_timer; 1158 qdf_timer_t dfs_cac_valid_timer; 1159 int dfs_cac_timeout_override; 1160 uint8_t dfs_enable:1, 1161 dfs_cac_timer_running:1, 1162 dfs_ignore_dfs:1, 1163 dfs_ignore_cac:1, 1164 dfs_cac_valid:1; 1165 uint32_t dfs_cac_valid_time; 1166 int dfs_precac_timeout_override; 1167 uint8_t dfs_num_precac_freqs; 1168 #if defined(WLAN_DFS_FULL_OFFLOAD) && defined(QCA_DFS_NOL_OFFLOAD) 1169 uint8_t dfs_disable_radar_marking; 1170 #endif 1171 TAILQ_HEAD(, dfs_precac_entry) dfs_precac_list; 1172 enum phy_ch_width dfs_precac_chwidth; 1173 1174 struct dfs_channel *dfs_curchan; 1175 struct dfs_channel *dfs_prevchan; 1176 struct dfs_channel dfs_cac_started_chan; 1177 struct wlan_objmgr_pdev *dfs_pdev_obj; 1178 struct dfs_soc_priv_obj *dfs_soc_obj; 1179 #if defined(QCA_SUPPORT_AGILE_DFS) || defined(ATH_SUPPORT_ZERO_CAC_DFS) 1180 uint8_t dfs_psoc_idx; 1181 #endif 1182 #ifdef CONFIG_CHAN_NUM_API 1183 uint8_t dfs_agile_precac_freq; 1184 #endif 1185 #ifdef CONFIG_CHAN_FREQ_API 1186 uint16_t dfs_agile_precac_freq_mhz; 1187 #endif 1188 bool dfs_is_offload_enabled; 1189 int dfs_use_nol; 1190 qdf_spinlock_t dfs_nol_lock; 1191 uint16_t tx_leakage_threshold; 1192 bool dfs_use_nol_subchannel_marking; 1193 uint8_t dfs_spoof_test_done:1; 1194 #if defined(WLAN_DFS_PARTIAL_OFFLOAD) && defined(HOST_DFS_SPOOF_TEST) 1195 qdf_timer_t dfs_host_wait_timer; 1196 uint32_t dfs_average_pri; 1197 uint32_t dfs_average_duration; 1198 uint32_t dfs_average_sidx; 1199 uint8_t dfs_is_host_wait_running:1, 1200 dfs_average_params_sent:1, 1201 dfs_no_res_from_fw:1, 1202 dfs_spoof_check_failed:1; 1203 struct dfs_channel dfs_radar_found_chan; 1204 int dfs_status_timeout_override; 1205 #endif 1206 bool dfs_is_stadfs_enabled; 1207 int32_t dfs_min_sidx; 1208 int32_t dfs_max_sidx; 1209 uint8_t dfs_seg_id; 1210 uint8_t dfs_is_chirp; 1211 bool dfs_bw_reduced; 1212 int32_t dfs_freq_offset; 1213 bool dfs_cac_aborted; 1214 qdf_spinlock_t dfs_data_struct_lock; 1215 uint8_t dfs_nol_ie_bandwidth; 1216 uint16_t dfs_nol_ie_startfreq; 1217 uint8_t dfs_nol_ie_bitmap; 1218 bool dfs_is_rcsa_ie_sent; 1219 bool dfs_is_nol_ie_sent; 1220 uint8_t dfs_legacy_precac_ucfg:1, 1221 dfs_agile_precac_ucfg:1, 1222 dfs_fw_adfs_support_non_160:1, 1223 dfs_fw_adfs_support_160:1; 1224 #if defined(WLAN_DFS_PARTIAL_OFFLOAD) && defined(WLAN_DFS_SYNTHETIC_RADAR) 1225 bool dfs_allow_hw_pulses; 1226 #endif 1227 }; 1228 1229 #if defined(QCA_SUPPORT_AGILE_DFS) || defined(ATH_SUPPORT_ZERO_CAC_DFS) 1230 /** 1231 * struct wlan_dfs_priv - dfs private struct with agile capability info 1232 * @wlan_dfs: pointer to wlan_dfs object. 1233 * @agile_precac_active: agile precac active information for wlan_dfs_priv obj 1234 */ 1235 struct wlan_dfs_priv { 1236 struct wlan_dfs *dfs; 1237 bool agile_precac_active; 1238 }; 1239 #endif 1240 1241 /** 1242 * struct dfs_soc_priv_obj - dfs private data 1243 * @psoc: pointer to PSOC object information 1244 * @pdev: pointer to PDEV object information 1245 * @dfs_is_phyerr_filter_offload: For some chip like Rome indicates too many 1246 * phyerr packets in a short time, which causes 1247 * OS hang. If this feild is configured as true, 1248 * FW will do the pre-check, filter out some 1249 * kinds of invalid phyerrors and indicate 1250 * radar detection related information to host. 1251 * @dfs_priv: array of dfs private structs with agile capability info 1252 * @num_dfs_privs: array size of dfs private structs for given psoc. 1253 * @cur_precac_dfs_index: current precac dfs index 1254 * @dfs_precac_timer: agile precac timer 1255 * @dfs_precac_timer_running: precac timer running flag 1256 * @ocac_status: Off channel CAC complete status 1257 */ 1258 struct dfs_soc_priv_obj { 1259 struct wlan_objmgr_psoc *psoc; 1260 struct wlan_objmgr_pdev *pdev; 1261 bool dfs_is_phyerr_filter_offload; 1262 #if defined(QCA_SUPPORT_AGILE_DFS) || defined(ATH_SUPPORT_ZERO_CAC_DFS) 1263 struct wlan_dfs_priv dfs_priv[WLAN_UMAC_MAX_PDEVS]; 1264 uint8_t num_dfs_privs; 1265 uint8_t cur_precac_dfs_index; 1266 qdf_timer_t dfs_precac_timer; 1267 uint8_t dfs_precac_timer_running; 1268 bool precac_state_started; 1269 bool ocac_status; 1270 #endif 1271 }; 1272 1273 /** 1274 * enum DFS debug - This should match the table from if_ath.c. 1275 * @WLAN_DEBUG_DFS: Minimal DFS debug. 1276 * @WLAN_DEBUG_DFS1: Normal DFS debug. 1277 * @WLAN_DEBUG_DFS2: Maximal DFS debug. 1278 * @WLAN_DEBUG_DFS3: Matched filterID display. 1279 * @WLAN_DEBUG_DFS_PHYERR: Phy error parsing. 1280 * @WLAN_DEBUG_DFS_NOL: NOL related entries. 1281 * @WLAN_DEBUG_DFS_PHYERR_SUM: PHY error summary. 1282 * @WLAN_DEBUG_DFS_PHYERR_PKT: PHY error payload. 1283 * @WLAN_DEBUG_DFS_BIN5: BIN5 checks. 1284 * @WLAN_DEBUG_DFS_BIN5_FFT: BIN5 FFT check. 1285 * @WLAN_DEBUG_DFS_BIN5_PULSE: BIN5 pulse check. 1286 * @WLAN_DEBUG_DFS_FALSE_DET: False detection debug related prints. 1287 * @WLAN_DEBUG_DFS_FALSE_DET2: Second level check to confirm poisitive 1288 * detection. 1289 * @WLAN_DEBUG_DFS_RANDOM_CHAN: Random channel selection. 1290 */ 1291 enum { 1292 WLAN_DEBUG_DFS = 0x00000100, 1293 WLAN_DEBUG_DFS1 = 0x00000200, 1294 WLAN_DEBUG_DFS2 = 0x00000400, 1295 WLAN_DEBUG_DFS3 = 0x00000800, 1296 WLAN_DEBUG_DFS_PHYERR = 0x00001000, 1297 WLAN_DEBUG_DFS_NOL = 0x00002000, 1298 WLAN_DEBUG_DFS_PHYERR_SUM = 0x00004000, 1299 WLAN_DEBUG_DFS_PHYERR_PKT = 0x00008000, 1300 WLAN_DEBUG_DFS_BIN5 = 0x00010000, 1301 WLAN_DEBUG_DFS_BIN5_FFT = 0x00020000, 1302 WLAN_DEBUG_DFS_BIN5_PULSE = 0x00040000, 1303 WLAN_DEBUG_DFS_FALSE_DET = 0x00080000, 1304 WLAN_DEBUG_DFS_FALSE_DET2 = 0x00100000, 1305 WLAN_DEBUG_DFS_RANDOM_CHAN = 0x00200000, 1306 WLAN_DEBUG_DFS_MAX = 0x80000000, 1307 WLAN_DEBUG_DFS_ALWAYS = WLAN_DEBUG_DFS_MAX 1308 }; 1309 1310 /** 1311 * enum host dfs spoof check status. 1312 * @HOST_DFS_CHECK_PASSED: Host indicates RADAR detected and the FW 1313 * confirms it to be spoof radar to host. 1314 * @HOST_DFS_CHECK_FAILED: Host doesn't indicate RADAR detected or spoof 1315 * radar parameters by 1316 * WMI_HOST_DFS_RADAR_FOUND_CMDID doesn't match. 1317 * @HOST_DFS_STATUS_CHECK_HW_RADAR: Host indicates RADAR detected and the 1318 * FW confirms it to be real HW radar to host. 1319 */ 1320 #if defined(WLAN_DFS_PARTIAL_OFFLOAD) && defined(HOST_DFS_SPOOF_TEST) 1321 enum { 1322 HOST_DFS_STATUS_CHECK_PASSED = 0, 1323 HOST_DFS_STATUS_CHECK_FAILED = 1, 1324 HOST_DFS_STATUS_CHECK_HW_RADAR = 2 1325 }; 1326 #endif 1327 1328 /** 1329 * struct dfs_phy_err - DFS phy error. 1330 * @fulltsf: 64-bit TSF as read from MAC. 1331 * @is_pri: Detected on primary channel. 1332 * @is_ext: Detected on extension channel. 1333 * @is_dc: Detected at DC. 1334 * @is_early: Early detect. 1335 * @do_check_chirp: Whether to check hw_chirp/sw_chirp. 1336 * @is_hw_chirp: Hardware-detected chirp. 1337 * @is_sw_chirp: Software detected chirp. 1338 * @rs_tstamp: 32 bit TSF from RX descriptor (event). 1339 * @freq: Centre frequency of event - KHz. 1340 * @freq_lo: Lower bounds of frequency - KHz. 1341 * @freq_hi: Upper bounds of frequency - KHz. 1342 * @rssi: Pulse RSSI. 1343 * @dur: Pulse duration, raw (not uS). 1344 * @seg_id: HT80_80/HT160 use. 1345 * @sidx: Seg index. 1346 * @freq_offset_khz: Freq offset in KHz. 1347 * @peak_mag: Peak mag. 1348 * @total_gain: Total gain. 1349 * @mb_gain: Mb gain. 1350 * @relpwr_db: Relpower in DB. 1351 * @pulse_delta_diff: Pulse delta diff. 1352 * @pulse_delta_peak: Pulse delta peak. 1353 * @pulse_psidx_diff: Pulse psidx diff. 1354 * 1355 * Chirp notes! 1356 * 1357 * Pre-Sowl chips don't do FFT reports, so chirp pulses simply show up 1358 * as long duration pulses. 1359 * 1360 * The bin5 checking code would simply look for a chirp pulse of the correct 1361 * duration (within MIN_BIN5_DUR and MAX_BIN5_DUR) and add it to the "chirp" 1362 * pattern. 1363 * 1364 * For Sowl and later, an FFT was done on longer duration frames. If those 1365 * frames looked like a chirp, their duration was adjusted to fall within 1366 * the chirp duration limits. If the pulse failed the chirp test (it had 1367 * no FFT data or the FFT didn't meet the chirping requirements) then the 1368 * pulse duration was adjusted to be greater than MAX_BIN5_DUR, so it 1369 * would always fail chirp detection. 1370 * 1371 * This is pretty horrible. 1372 * 1373 * The eventual goal for chirp handling is thus: 1374 * 1375 * 1)In case someone ever wants to do chirp detection with this code on 1376 * chips that don't support chirp detection, you can still do it based 1377 * on pulse duration. That's your problem to solve. 1378 * 1379 * 2)For chips that do hardware chirp detection or FFT, the "do_check_chirp" 1380 * bit should be set. 1381 * 1382 * 3)Then, either is_hw_chirp or is_sw_chirp is set, indicating that 1383 * the hardware or software post-processing of the chirp event found 1384 * that indeed it was a chirp. 1385 * 1386 * 4)Finally, the bin5 code should just check whether the chirp bits are 1387 * set and behave appropriately, falling back onto the duration checks 1388 * if someone wishes to use this on older hardware (or with disabled 1389 * FFTs, for whatever reason.) 1390 * 1391 * XXX TODO: 1392 * 1393 * 1)add duration in uS and raw duration, so the PHY error parsing 1394 * code is responsible for doing the duration calculation; 1395 * 2)add ts in raw and corrected, so the PHY error parsing 1396 * code is responsible for doing the offsetting, not the radar 1397 * event code. 1398 */ 1399 struct dfs_phy_err { 1400 uint64_t fulltsf; 1401 uint32_t is_pri:1, 1402 is_ext:1, 1403 is_dc:1, 1404 is_early:1, 1405 do_check_chirp:1, 1406 is_hw_chirp:1, 1407 is_sw_chirp:1; 1408 uint32_t rs_tstamp; 1409 uint32_t freq; 1410 uint32_t freq_lo; 1411 uint32_t freq_hi; 1412 uint8_t rssi; 1413 uint8_t dur; 1414 uint8_t seg_id; 1415 int sidx; 1416 u_int freq_offset_khz; 1417 int peak_mag; 1418 int total_gain; 1419 int mb_gain; 1420 int relpwr_db; 1421 uint8_t pulse_delta_diff; 1422 int8_t pulse_delta_peak; 1423 int16_t pulse_psidx_diff; 1424 }; 1425 1426 /** 1427 * struct rx_radar_status - Parsed radar status 1428 * @raw_tsf: Raw tsf 1429 * @tsf_offset: TSF offset. 1430 * @rssi: RSSI. 1431 * @pulse_duration: Pulse duration. 1432 * @is_chirp: Is chirp. 1433 * @delta_peak: Delta peak. 1434 * @delta_diff: Delta diff. 1435 * @sidx: Starting frequency. 1436 * @freq_offset: Frequency offset. 1437 * @agc_total_gain: AGC total gain. 1438 * @agc_mb_gain: AGC MB gain. 1439 */ 1440 struct rx_radar_status { 1441 uint32_t raw_tsf; 1442 uint32_t tsf_offset; 1443 int rssi; 1444 int pulse_duration; 1445 int is_chirp:1; 1446 int delta_peak; 1447 int delta_diff; 1448 int sidx; 1449 int freq_offset; /* in KHz */ 1450 int agc_total_gain; 1451 int agc_mb_gain; 1452 }; 1453 1454 /** 1455 * struct rx_search_fft_report - FFT report. 1456 * @total_gain_db: Total gain in Db. 1457 * @base_pwr_db: Base power in Db. 1458 * @fft_chn_idx: FFT channel index. 1459 * @peak_sidx: Peak sidx. 1460 * @relpwr_db: Real power in Db. 1461 * @avgpwr_db: Average power in Db. 1462 * @peak_mag: Peak Mag. 1463 * @num_str_bins_ib: Num dtr BINs IB 1464 * @seg_id: Segment ID 1465 */ 1466 struct rx_search_fft_report { 1467 uint32_t total_gain_db; 1468 uint32_t base_pwr_db; 1469 int fft_chn_idx; 1470 int peak_sidx; 1471 int relpwr_db; 1472 int avgpwr_db; 1473 int peak_mag; 1474 int num_str_bins_ib; 1475 int seg_id; 1476 }; 1477 1478 /** 1479 * dfs_process_radarevent() - process the radar event generated for a pulse. 1480 * @dfs: Pointer to wlan_dfs structure. 1481 * @chan: Current channel. 1482 * 1483 * There is currently no way to specify that a radar event has occurred on 1484 * a specific channel, so the current methodology is to mark both the pri 1485 * and ext channels as being unavailable. This should be fixed for 802.11ac 1486 * or we'll quickly run out of valid channels to use. 1487 * 1488 * If Radar found, this marks the channel (and the extension channel, if HT40) 1489 * as having seen a radar event. It marks CHAN_INTERFERENCE and will add it to 1490 * the local NOL implementation. This is only done for 'usenol=1', as the other 1491 * two modes don't do radar notification or CAC/CSA/NOL; it just notes there 1492 * was a radar. 1493 */ 1494 void dfs_process_radarevent(struct wlan_dfs *dfs, 1495 struct dfs_channel *chan); 1496 1497 /** 1498 * dfs_nol_addchan() - Add channel to NOL. 1499 * @dfs: Pointer to wlan_dfs structure. 1500 * @freq: frequency to add to NOL. 1501 * @dfs_nol_timeout: NOL timeout. 1502 */ 1503 void dfs_nol_addchan(struct wlan_dfs *dfs, 1504 uint16_t freq, 1505 uint32_t dfs_nol_timeout); 1506 1507 /** 1508 * dfs_get_nol() - Get NOL. 1509 * @dfs: Pointer to wlan_dfs structure. 1510 * @dfs_nol: Pointer to dfsreq_nolelem structure to save the channels from NOL. 1511 * @nchan: Number of channels. 1512 */ 1513 void dfs_get_nol(struct wlan_dfs *dfs, 1514 struct dfsreq_nolelem *dfs_nol, 1515 int *nchan); 1516 1517 /** 1518 * dfs_set_nol() - Set NOL. 1519 * @dfs: Pointer to wlan_dfs structure. 1520 * @dfs_nol: Pointer to dfsreq_nolelem structure. 1521 * @nchan: Number of channels. 1522 */ 1523 void dfs_set_nol(struct wlan_dfs *dfs, 1524 struct dfsreq_nolelem *dfs_nol, 1525 int nchan); 1526 1527 /** 1528 * dfs_nol_update() - NOL update 1529 * @dfs: Pointer to wlan_dfs structure. 1530 * 1531 * Notify the driver/umac that it should update the channel radar/NOL flags 1532 * based on the current NOL list. 1533 */ 1534 void dfs_nol_update(struct wlan_dfs *dfs); 1535 1536 /** 1537 * dfs_nol_timer_cleanup() - NOL timer cleanup. 1538 * @dfs: Pointer to wlan_dfs structure. 1539 * 1540 * Cancels the NOL timer and frees the NOL elements. 1541 */ 1542 void dfs_nol_timer_cleanup(struct wlan_dfs *dfs); 1543 1544 /** 1545 * dfs_nol_timer_detach() - Free NOL timer. 1546 * @dfs: Pointer to wlan_dfs structure. 1547 */ 1548 void dfs_nol_timer_detach(struct wlan_dfs *dfs); 1549 1550 /** 1551 * dfs_nol_workqueue_cleanup() - Flushes NOL workqueue. 1552 * @dfs: Pointer to wlan_dfs structure. 1553 * 1554 * Flushes the NOL workqueue. 1555 */ 1556 void dfs_nol_workqueue_cleanup(struct wlan_dfs *dfs); 1557 1558 /** 1559 * dfs_retain_bin5_burst_pattern() - Retain the BIN5 burst pattern. 1560 * @dfs: Pointer to wlan_dfs structure. 1561 * @diff_ts: Timestamp diff. 1562 * @old_dur: Old duration. 1563 */ 1564 uint8_t dfs_retain_bin5_burst_pattern(struct wlan_dfs *dfs, 1565 uint32_t diff_ts, 1566 uint8_t old_dur); 1567 1568 /** 1569 * dfs_bin5_check_pulse() - BIN5 check pulse. 1570 * @dfs: Pointer to wlan_dfs structure. 1571 * @re: Pointer to dfs_event structure. 1572 * @br: Pointer to dfs_bin5radars structure. 1573 * 1574 * Reject the pulse if: 1575 * 1) It's outside the RSSI threshold; 1576 * 2) It's outside the pulse duration; 1577 * 3) It's been verified by HW/SW chirp checking 1578 * and neither of those found a chirp. 1579 */ 1580 int dfs_bin5_check_pulse(struct wlan_dfs *dfs, 1581 struct dfs_event *re, 1582 struct dfs_bin5radars *br); 1583 1584 /** 1585 * dfs_bin5_addpulse() - BIN5 add pulse. 1586 * @dfs: Pointer to wlan_dfs structure. 1587 * @br: Pointer to dfs_bin5radars structure. 1588 * @re: Pointer to dfs_event structure. 1589 * @thists: Timestamp. 1590 */ 1591 int dfs_bin5_addpulse(struct wlan_dfs *dfs, 1592 struct dfs_bin5radars *br, 1593 struct dfs_event *re, 1594 uint64_t thists); 1595 1596 /** 1597 * dfs_bin5_check() - BIN5 check. 1598 * @dfs: Pointer to wlan_dfs structure. 1599 * 1600 * If the dfs structure is NULL (which should be illegal if everyting is working 1601 * properly, then signify that a bin5 radar was found. 1602 */ 1603 int dfs_bin5_check(struct wlan_dfs *dfs); 1604 1605 /** 1606 * dfs_check_chirping() - Check chirping. 1607 * @dfs: Pointer to wlan_dfs structure. 1608 * @buf: Phyerr buffer 1609 * @datalen: Phyerr buf length 1610 * @is_ctl: detected on primary channel. 1611 * @is_ext: detected on extension channel. 1612 * @slope: Slope 1613 * @is_dc: DC found 1614 * 1615 * This examines the FFT data contained in the PHY error information to figure 1616 * out whether the pulse is moving across frequencies. 1617 */ 1618 int dfs_check_chirping(struct wlan_dfs *dfs, 1619 void *buf, 1620 uint16_t datalen, 1621 int is_ctl, 1622 int is_ext, 1623 int *slope, 1624 int *is_dc); 1625 1626 /** 1627 * dfs_get_random_bin5_dur() - Get random BIN5 duration. 1628 * @dfs: Pointer to wlan_dfs structure. 1629 * @tstamp: Timestamp. 1630 * 1631 * Chirping pulses may get cut off at DC and report lower durations. 1632 * This function will compute a suitable random duration for each pulse. 1633 * Duration must be between 50 and 100 us, but remember that in 1634 * wlan_process_phyerr() which calls this function, we are dealing with the 1635 * HW reported duration (unconverted). dfs_process_radarevent() will 1636 * actually convert the duration into the correct value. 1637 * This function doesn't take into account whether the hardware 1638 * is operating in 5GHz fast clock mode or not. 1639 * And this function doesn't take into account whether the hardware 1640 * is peregrine or not. 1641 */ 1642 int dfs_get_random_bin5_dur(struct wlan_dfs *dfs, 1643 uint64_t tstamp); 1644 1645 /** 1646 * dfs_print_delayline() - Prints delayline. 1647 * @dfs: Pointer to wlan_dfs structure. 1648 * @dl: Pointer to dfs_delayline structure. 1649 */ 1650 void dfs_print_delayline(struct wlan_dfs *dfs, 1651 struct dfs_delayline *dl); 1652 1653 /** 1654 * dfs_print_nol() - Print NOL elements. 1655 * @dfs: Pointer to wlan_dfs structure. 1656 */ 1657 void dfs_print_nol(struct wlan_dfs *dfs); 1658 1659 /** 1660 * dfs_print_filter() - Prints the filter. 1661 * @dfs: Pointer to wlan_dfs structure. 1662 * @rf: Pointer to dfs_filter structure. 1663 */ 1664 void dfs_print_filter(struct wlan_dfs *dfs, 1665 struct dfs_filter *rf); 1666 1667 /** 1668 * dfs_getchanstate() - Get chan state. 1669 * @dfs: Pointer to wlan_dfs structure. 1670 * @index: To save the index of dfs_radar[] 1671 * @ext_chan_flag: Extension channel flag; 1672 */ 1673 struct dfs_state *dfs_getchanstate(struct wlan_dfs *dfs, 1674 uint8_t *index, 1675 int ext_ch_flag); 1676 1677 /** 1678 * dfs_round() - DFS found. 1679 * @val: Convert durations to TSF ticks. 1680 * 1681 * Return: TSF ticks. 1682 */ 1683 uint32_t dfs_round(int32_t val); 1684 1685 /** 1686 * dfs_reset_alldelaylines() - Reset alldelaylines. 1687 * @dfs: Pointer to wlan_dfs structure. 1688 */ 1689 #if defined(WLAN_DFS_DIRECT_ATTACH) || defined(WLAN_DFS_PARTIAL_OFFLOAD) 1690 void dfs_reset_alldelaylines(struct wlan_dfs *dfs); 1691 #else 1692 static inline void dfs_reset_alldelaylines(struct wlan_dfs *dfs) 1693 { 1694 } 1695 #endif 1696 1697 /** 1698 * dfs_reset_delayline() - Clear only a single delay line. 1699 * @dl: Pointer to dfs_delayline structure. 1700 */ 1701 void dfs_reset_delayline(struct dfs_delayline *dl); 1702 1703 /** 1704 * dfs_reset_filter_delaylines() - Reset filter delaylines. 1705 * @dft: Pointer to dfs_filtertype structure. 1706 */ 1707 void dfs_reset_filter_delaylines(struct dfs_filtertype *dft); 1708 1709 /** 1710 * dfs_reset_radarq() - Reset radar queue. 1711 * @dfs: Pointer to wlan_dfs structure. 1712 */ 1713 #if defined(WLAN_DFS_DIRECT_ATTACH) || defined(WLAN_DFS_PARTIAL_OFFLOAD) 1714 void dfs_reset_radarq(struct wlan_dfs *dfs); 1715 #else 1716 static inline void dfs_reset_radarq(struct wlan_dfs *dfs) 1717 { 1718 } 1719 #endif 1720 1721 /** 1722 * dfs_add_pulse() - Adds pulse to the queue. 1723 * @dfs: Pointer to wlan_dfs structure. 1724 * @rf: Pointer to dfs_filter structure. 1725 * @re: Pointer to dfs_event structure. 1726 * @deltaT: deltaT value. 1727 * @this_ts: Last time stamp. 1728 */ 1729 void dfs_add_pulse(struct wlan_dfs *dfs, 1730 struct dfs_filter *rf, 1731 struct dfs_event *re, 1732 uint32_t deltaT, 1733 uint64_t this_ts); 1734 1735 /** 1736 * dfs_bin_check() - BIN check 1737 * @dfs: Pointer to wlan_dfs structure. 1738 * @rf: Pointer to dfs_filter structure. 1739 * @deltaT: deltaT value. 1740 * @width: Width 1741 * @ext_chan_flag: Extension channel flag. 1742 */ 1743 int dfs_bin_check(struct wlan_dfs *dfs, 1744 struct dfs_filter *rf, 1745 uint32_t deltaT, 1746 uint32_t dur, 1747 int ext_chan_flag); 1748 1749 /** 1750 * dfs_bin_pri_check() - BIN PRI check 1751 * @dfs: Pointer to wlan_dfs structure. 1752 * @rf: Pointer to dfs_filter structure. 1753 * @dl: Pointer to dfs_delayline structure. 1754 * @score: Primary score. 1755 * @refpri: Current "filter" time for start of pulse in usecs. 1756 * @refdur: Duration value. 1757 * @ext_chan_flag: Extension channel flag. 1758 * @fundamentalpri: Highest PRI. 1759 */ 1760 int dfs_bin_pri_check(struct wlan_dfs *dfs, 1761 struct dfs_filter *rf, 1762 struct dfs_delayline *dl, 1763 uint32_t score, 1764 uint32_t refpri, 1765 uint32_t refdur, 1766 int ext_chan_flag, 1767 int fundamentalpri); 1768 1769 /** 1770 * dfs_staggered_check() - Detection implementation for staggered PRIs. 1771 * @dfs: Pointer to wlan_dfs structure. 1772 * @rf: Pointer to dfs_filter structure. 1773 * @deltaT: Delta of the Timestamp. 1774 * @width: Duration of radar pulse. 1775 * 1776 * Return: 1 on success and 0 on failure. 1777 */ 1778 int dfs_staggered_check(struct wlan_dfs *dfs, 1779 struct dfs_filter *rf, 1780 uint32_t deltaT, 1781 uint32_t width); 1782 1783 /** 1784 * dfs_get_pri_margin() - Get Primary margin. 1785 * @dfs: Pointer to wlan_dfs structure. 1786 * @is_extchan_detect: Extension channel detect. 1787 * @is_fixed_pattern: Fixed pattern. 1788 * 1789 * For the extension channel, if legacy traffic is present, we see a lot of 1790 * false alarms, so make the PRI margin narrower depending on the busy % for 1791 * the extension channel. 1792 * 1793 * Return: Returns pri_margin. 1794 */ 1795 int dfs_get_pri_margin(struct wlan_dfs *dfs, 1796 int is_extchan_detect, 1797 int is_fixed_pattern); 1798 1799 /** 1800 * dfs_get_filter_threshold() - Get filter threshold. 1801 * @dfs: Pointer to wlan_dfs structure. 1802 * @rf: Pointer to dfs_filter structure. 1803 * @is_extchan_detect: Extension channel detect. 1804 * 1805 * For the extension channel, if legacy traffic is present, we see a lot of 1806 * false alarms, so make the thresholds higher depending on the busy % for the 1807 * extension channel. 1808 * 1809 * Return: Returns threshold. 1810 */ 1811 int dfs_get_filter_threshold(struct wlan_dfs *dfs, 1812 struct dfs_filter *rf, 1813 int is_extchan_detect); 1814 1815 #if defined(QCA_MCL_DFS_SUPPORT) 1816 /** 1817 * dfs_process_ar_event() - Process the ar event. 1818 * @dfs: Pointer to wlan_dfs structure. 1819 * @chan: Current channel structure. 1820 */ 1821 static inline void dfs_process_ar_event(struct wlan_dfs *dfs, 1822 struct dfs_channel *chan) 1823 { 1824 } 1825 1826 /** 1827 * dfs_reset_ar() - resets the ar state. 1828 * @dfs: pointer to wlan_dfs structure. 1829 */ 1830 static inline void dfs_reset_ar(struct wlan_dfs *dfs) 1831 { 1832 } 1833 1834 /** 1835 * dfs_reset_arq() - resets the ar queue. 1836 * @dfs: pointer to wlan_dfs structure. 1837 */ 1838 static inline void dfs_reset_arq(struct wlan_dfs *dfs) 1839 { 1840 } 1841 1842 #else 1843 void dfs_process_ar_event(struct wlan_dfs *dfs, 1844 struct dfs_channel *chan); 1845 1846 void dfs_reset_ar(struct wlan_dfs *dfs); 1847 void dfs_reset_arq(struct wlan_dfs *dfs); 1848 #endif 1849 1850 /** 1851 * dfs_is_radar_enabled() - check if radar detection is enabled. 1852 * @dfs: Pointer to wlan_dfs structure. 1853 * @ignore_dfs: if 1 then radar detection is disabled.. 1854 */ 1855 #if defined(WLAN_DFS_DIRECT_ATTACH) || defined(WLAN_DFS_PARTIAL_OFFLOAD) 1856 void dfs_is_radar_enabled(struct wlan_dfs *dfs, 1857 int *ignore_dfs); 1858 #else 1859 static inline void dfs_is_radar_enabled(struct wlan_dfs *dfs, 1860 int *ignore_dfs) 1861 { 1862 } 1863 #endif 1864 1865 /** 1866 * dfs_process_phyerr_bb_tlv() - Parses the PHY error and populates the 1867 * dfs_phy_err struct. 1868 * @dfs: Pointer to wlan_dfs structure. 1869 * @buf: Phyerr buffer 1870 * @datalen: Phyerr buf len 1871 * @rssi: RSSI 1872 * @ext_rssi: Extension RSSI. 1873 * @rs_tstamp: Time stamp. 1874 * @fulltsf: TSF64. 1875 * @e: Pointer to dfs_phy_err structure. 1876 * 1877 * Return: Returns 1. 1878 */ 1879 int dfs_process_phyerr_bb_tlv(struct wlan_dfs *dfs, 1880 void *buf, 1881 uint16_t datalen, 1882 uint8_t rssi, 1883 uint8_t ext_rssi, 1884 uint32_t rs_tstamp, 1885 uint64_t fulltsf, 1886 struct dfs_phy_err *e); 1887 1888 /** 1889 * dfs_reset() - DFS reset 1890 * @dfs: Pointer to wlan_dfs structure. 1891 */ 1892 void dfs_reset(struct wlan_dfs *dfs); 1893 1894 /** 1895 * dfs_radar_enable() - Enables the radar. 1896 * @dfs: Pointer to wlan_dfs structure. 1897 * @no_cac: If no_cac is 0, it cancels the CAC. 1898 */ 1899 #if defined(WLAN_DFS_DIRECT_ATTACH) || defined(WLAN_DFS_PARTIAL_OFFLOAD) 1900 void dfs_radar_enable(struct wlan_dfs *dfs, 1901 int no_cac, uint32_t opmode); 1902 #else 1903 static inline void dfs_radar_enable(struct wlan_dfs *dfs, 1904 int no_cac, uint32_t opmode) 1905 { 1906 } 1907 #endif 1908 1909 /** 1910 * dfs_process_phyerr() - Process phyerr. 1911 * @dfs: Pointer to wlan_dfs structure. 1912 * @buf: Phyerr buffer. 1913 * @datalen: phyerr buffer length. 1914 * @r_rssi: RSSI. 1915 * @r_ext_rssi: Extension channel RSSI. 1916 * @r_rs_tstamp: Timestamp. 1917 * @r_fulltsf: TSF64. 1918 */ 1919 #if defined(WLAN_DFS_DIRECT_ATTACH) || defined(WLAN_DFS_PARTIAL_OFFLOAD) 1920 void dfs_process_phyerr(struct wlan_dfs *dfs, 1921 void *buf, 1922 uint16_t datalen, 1923 uint8_t r_rssi, 1924 uint8_t r_ext_rssi, 1925 uint32_t r_rs_tstamp, 1926 uint64_t r_fulltsf); 1927 #else 1928 static inline void dfs_process_phyerr(struct wlan_dfs *dfs, 1929 void *buf, 1930 uint16_t datalen, 1931 uint8_t r_rssi, 1932 uint8_t r_ext_rssi, 1933 uint32_t r_rs_tstamp, 1934 uint64_t r_fulltsf) 1935 { 1936 } 1937 #endif 1938 1939 #ifdef QCA_MCL_DFS_SUPPORT 1940 /** 1941 * dfs_process_phyerr_filter_offload() - Process radar event. 1942 * @dfs: Pointer to wlan_dfs structure. 1943 * @wlan_radar_event: Pointer to radar_event_info structure. 1944 * 1945 * Return: None 1946 */ 1947 #if defined(WLAN_DFS_PARTIAL_OFFLOAD) 1948 void dfs_process_phyerr_filter_offload(struct wlan_dfs *dfs, 1949 struct radar_event_info *wlan_radar_event); 1950 #else 1951 static inline void dfs_process_phyerr_filter_offload( 1952 struct wlan_dfs *dfs, 1953 struct radar_event_info *wlan_radar_event) 1954 { 1955 } 1956 #endif 1957 #endif 1958 1959 /** 1960 * dfs_get_radars() - Based on the chipset, calls init radar table functions. 1961 * @dfs: Pointer to wlan_dfs structure. 1962 */ 1963 #if defined(WLAN_DFS_DIRECT_ATTACH) || defined(WLAN_DFS_PARTIAL_OFFLOAD) 1964 void dfs_get_radars(struct wlan_dfs *dfs); 1965 #else 1966 static inline void dfs_get_radars(struct wlan_dfs *dfs) 1967 { 1968 } 1969 #endif 1970 1971 /** 1972 * dfs_attach() - Wrapper function to allocate memory for wlan_dfs members. 1973 * @dfs: Pointer to wlan_dfs structure. 1974 */ 1975 int dfs_attach(struct wlan_dfs *dfs); 1976 1977 1978 /** 1979 * dfs_create_object() - Creates DFS object. 1980 * @dfs: Pointer to wlan_dfs structure. 1981 */ 1982 int dfs_create_object(struct wlan_dfs **dfs); 1983 1984 /** 1985 * dfs_destroy_object() - Destroys the DFS object. 1986 * @dfs: Pointer to wlan_dfs structure. 1987 */ 1988 void dfs_destroy_object(struct wlan_dfs *dfs); 1989 1990 /** 1991 * dfs_detach() - Wrapper function to free dfs variables. 1992 * @dfs: Pointer to wlan_dfs structure. 1993 */ 1994 void dfs_detach(struct wlan_dfs *dfs); 1995 1996 /** 1997 * dfs_cac_valid_reset() - Cancels the dfs_cac_valid_timer timer. 1998 * @dfs: Pointer to wlan_dfs structure. 1999 * @prevchan_ieee: Prevchan number. 2000 * @prevchan_flags: Prevchan flags. 2001 */ 2002 #ifdef CONFIG_CHAN_NUM_API 2003 void dfs_cac_valid_reset(struct wlan_dfs *dfs, 2004 uint8_t prevchan_ieee, 2005 uint32_t prevchan_flags); 2006 #endif 2007 2008 /** 2009 * dfs_cac_valid_reset_for_freq() - Cancels the dfs_cac_valid_timer timer. 2010 * @dfs: Pointer to wlan_dfs structure. 2011 * @prevchan_chan: Prevchan frequency 2012 * @prevchan_flags: Prevchan flags. 2013 */ 2014 #ifdef CONFIG_CHAN_FREQ_API 2015 void dfs_cac_valid_reset_for_freq(struct wlan_dfs *dfs, 2016 uint16_t prevchan_freq, 2017 uint32_t prevchan_flags); 2018 #endif 2019 2020 /** 2021 * dfs_cac_stop() - Clear the AP CAC timer. 2022 * @dfs: Pointer to wlan_dfs structure. 2023 */ 2024 void dfs_cac_stop(struct wlan_dfs *dfs); 2025 2026 /** 2027 * dfs_cancel_cac_timer() - Cancels the CAC timer. 2028 * @dfs: Pointer to wlan_dfs structure. 2029 */ 2030 void dfs_cancel_cac_timer(struct wlan_dfs *dfs); 2031 2032 /** 2033 * dfs_start_cac_timer() - Starts the CAC timer. 2034 * @dfs: Pointer to wlan_dfs structure. 2035 */ 2036 void dfs_start_cac_timer(struct wlan_dfs *dfs); 2037 2038 /** 2039 * dfs_set_update_nol_flag() - Sets update_nol flag. 2040 * @dfs: Pointer to wlan_dfs structure. 2041 * @val: update_nol flag. 2042 */ 2043 void dfs_set_update_nol_flag(struct wlan_dfs *dfs, 2044 bool val); 2045 2046 /** 2047 * dfs_get_update_nol_flag() - Returns update_nol flag. 2048 * @dfs: Pointer to wlan_dfs structure. 2049 */ 2050 bool dfs_get_update_nol_flag(struct wlan_dfs *dfs); 2051 2052 /** 2053 * dfs_get_use_nol() - Get usenol. 2054 * @dfs: Pointer to wlan_dfs structure. 2055 */ 2056 int dfs_get_use_nol(struct wlan_dfs *dfs); 2057 2058 /** 2059 * dfs_get_nol_timeout() - Get NOL timeout. 2060 * @dfs: Pointer to wlan_dfs structure. 2061 */ 2062 int dfs_get_nol_timeout(struct wlan_dfs *dfs); 2063 2064 /** 2065 * dfs_is_ap_cac_timer_running() - Returns the dfs cac timer. 2066 * @dfs: Pointer to wlan_dfs structure. 2067 */ 2068 int dfs_is_ap_cac_timer_running(struct wlan_dfs *dfs); 2069 2070 /** 2071 * dfs_control()- Used to process ioctls related to DFS. 2072 * @dfs: Pointer to wlan_dfs structure. 2073 * @id: Command type. 2074 * @indata: Input buffer. 2075 * @insize: size of the input buffer. 2076 * @outdata: A buffer for the results. 2077 * @outsize: Size of the output buffer. 2078 */ 2079 int dfs_control(struct wlan_dfs *dfs, 2080 u_int id, 2081 void *indata, 2082 uint32_t insize, 2083 void *outdata, 2084 uint32_t *outsize); 2085 2086 /** 2087 * dfs_getnol() - Wrapper function for dfs_get_nol() 2088 * @dfs: Pointer to wlan_dfs structure. 2089 * @dfs_nolinfo: Pointer to dfsreq_nolinfo structure. 2090 */ 2091 void dfs_getnol(struct wlan_dfs *dfs, 2092 void *dfs_nolinfo); 2093 2094 /** 2095 * dfs_get_override_cac_timeout() - Get override CAC timeout value. 2096 * @dfs: Pointer to DFS object. 2097 * @cac_timeout: Pointer to save the CAC timeout value. 2098 */ 2099 int dfs_get_override_cac_timeout(struct wlan_dfs *dfs, 2100 int *cac_timeout); 2101 2102 /** 2103 * dfs_override_cac_timeout() - Override the default CAC timeout. 2104 * @dfs: Pointer to DFS object. 2105 * @cac_timeout: CAC timeout value. 2106 */ 2107 int dfs_override_cac_timeout(struct wlan_dfs *dfs, 2108 int cac_timeout); 2109 2110 /** 2111 * dfs_clear_nolhistory() - unmarks WLAN_CHAN_CLR_HISTORY_RADAR flag for 2112 * all the channels in dfs_ch_channels. 2113 * @dfs: Pointer to wlan_dfs structure. 2114 */ 2115 void dfs_clear_nolhistory(struct wlan_dfs *dfs); 2116 2117 /** 2118 * ol_if_dfs_configure() - Initialize the RADAR table for offload chipsets. 2119 * @dfs: Pointer to wlan_dfs structure. 2120 * 2121 * This is called during a channel change or regulatory domain 2122 * reset; in order to fetch the new configuration information and 2123 * program the DFS pattern matching module. 2124 * 2125 * Eventually this should be split into "fetch config" (which can 2126 * happen at regdomain selection time) and "configure DFS" (which 2127 * can happen at channel config time) so as to minimise overheads 2128 * when doing channel changes. However, this'll do for now. 2129 */ 2130 void ol_if_dfs_configure(struct wlan_dfs *dfs); 2131 2132 /** 2133 * dfs_init_radar_filters() - Init Radar filters. 2134 * @dfs: Pointer to wlan_dfs structure. 2135 * @radar_info: Pointer to wlan_dfs_radar_tab_info structure. 2136 */ 2137 int dfs_init_radar_filters(struct wlan_dfs *dfs, 2138 struct wlan_dfs_radar_tab_info *radar_info); 2139 2140 /** 2141 * dfs_get_radars_for_ar5212() - Initialize radar table for AR5212 chipsets. 2142 * @dfs: Pointer to wlan_dfs structure. 2143 */ 2144 void dfs_get_radars_for_ar5212(struct wlan_dfs *dfs); 2145 2146 /** 2147 * dfs_get_radars_for_ar5416() - Initialize radar table for AR5416 chipsets. 2148 * @dfs: Pointer to wlan_dfs structure. 2149 */ 2150 void dfs_get_radars_for_ar5416(struct wlan_dfs *dfs); 2151 2152 /** 2153 * dfs_get_radars_for_ar9300() - Initialize radar table for AR9300 chipsets. 2154 * @dfs: Pointer to wlan_dfs structure. 2155 */ 2156 void dfs_get_radars_for_ar9300(struct wlan_dfs *dfs); 2157 2158 /** 2159 * dfs_print_filters() - Print the filters. 2160 * @dfs: Pointer to wlan_dfs structure. 2161 */ 2162 void dfs_print_filters(struct wlan_dfs *dfs); 2163 2164 /** 2165 * dfs_clear_stats() - Clear stats. 2166 * @dfs: Pointer to wlan_dfs structure. 2167 */ 2168 void dfs_clear_stats(struct wlan_dfs *dfs); 2169 2170 /** 2171 * dfs_radar_disable() - Disables the radar. 2172 * @dfs: Pointer to wlan_dfs structure. 2173 */ 2174 #if defined(WLAN_DFS_DIRECT_ATTACH) || defined(WLAN_DFS_PARTIAL_OFFLOAD) 2175 int dfs_radar_disable(struct wlan_dfs *dfs); 2176 #else 2177 static inline int dfs_radar_disable(struct wlan_dfs *dfs) 2178 { 2179 return 0; 2180 } 2181 #endif 2182 2183 /** 2184 * dfs_get_debug_info() - Get debug info. 2185 * @dfs: Pointer to wlan_dfs structure. 2186 * @data: void pointer to the data to save dfs_proc_phyerr. 2187 */ 2188 int dfs_get_debug_info(struct wlan_dfs *dfs, 2189 void *data); 2190 2191 /** 2192 * dfs_cac_timer_attach() - Initialize cac timers. 2193 * @dfs: Pointer to wlan_dfs structure. 2194 */ 2195 void dfs_cac_timer_attach(struct wlan_dfs *dfs); 2196 2197 /** 2198 * dfs_cac_timer_reset() - Cancel dfs cac timers. 2199 * @dfs: Pointer to wlan_dfs structure. 2200 */ 2201 void dfs_cac_timer_reset(struct wlan_dfs *dfs); 2202 2203 /** 2204 * dfs_cac_timer_detach() - Free dfs cac timers. 2205 * @dfs: Pointer to wlan_dfs structure. 2206 */ 2207 void dfs_cac_timer_detach(struct wlan_dfs *dfs); 2208 2209 /** 2210 * dfs_nol_timer_init() - Initialize NOL timers. 2211 * @dfs: Pointer to wlan_dfs structure. 2212 */ 2213 void dfs_nol_timer_init(struct wlan_dfs *dfs); 2214 2215 /** 2216 * dfs_nol_attach() - Initialize NOL variables. 2217 * @dfs: Pointer to wlan_dfs structure. 2218 */ 2219 void dfs_nol_attach(struct wlan_dfs *dfs); 2220 2221 /** 2222 * dfs_nol_detach() - Detach NOL variables. 2223 * @dfs: Pointer to wlan_dfs structure. 2224 */ 2225 void dfs_nol_detach(struct wlan_dfs *dfs); 2226 2227 /** 2228 * dfs_print_nolhistory() - Print NOL history. 2229 * @dfs: Pointer to wlan_dfs structure. 2230 */ 2231 void dfs_print_nolhistory(struct wlan_dfs *dfs); 2232 2233 /** 2234 * dfs_stacac_stop() - Clear the STA CAC timer. 2235 * @dfs: Pointer to wlan_dfs structure. 2236 */ 2237 void dfs_stacac_stop(struct wlan_dfs *dfs); 2238 2239 /** 2240 * dfs_find_precac_secondary_vht80_chan() - Get a VHT80 channel with the 2241 * precac primary center frequency. 2242 * @dfs: Pointer to wlan_dfs structure. 2243 * @chan: Pointer to dfs channel structure. 2244 */ 2245 void dfs_find_precac_secondary_vht80_chan(struct wlan_dfs *dfs, 2246 struct dfs_channel *chan); 2247 2248 #ifdef WLAN_DFS_PRECAC_AUTO_CHAN_SUPPORT 2249 /** 2250 * dfs_precac_csa() - Automatically switch the channel to the DFS channel 2251 * on which PreCAC was completed without finding a RADAR. 2252 * Use CSA with TBTT_COUNT to switch the channel. 2253 * @dfs: Pointer to dfs handler. 2254 * 2255 * Return: Void 2256 */ 2257 void dfs_precac_csa(struct wlan_dfs *dfs); 2258 #endif 2259 2260 /** 2261 * dfs_phyerr_param_copy() - Function to copy src buf to dest buf. 2262 * @dst: dest buf. 2263 * @src: src buf. 2264 */ 2265 void dfs_phyerr_param_copy(struct wlan_dfs_phyerr_param *dst, 2266 struct wlan_dfs_phyerr_param *src); 2267 2268 /** 2269 * dfs_get_thresholds() - Get the threshold value. 2270 * @dfs: Pointer to wlan_dfs structure. 2271 * @param: Pointer to wlan_dfs_phyerr_param structure. 2272 */ 2273 #if defined(WLAN_DFS_DIRECT_ATTACH) || defined(WLAN_DFS_PARTIAL_OFFLOAD) 2274 int dfs_get_thresholds(struct wlan_dfs *dfs, 2275 struct wlan_dfs_phyerr_param *param); 2276 #else 2277 static inline int dfs_get_thresholds(struct wlan_dfs *dfs, 2278 struct wlan_dfs_phyerr_param *param) 2279 { 2280 return 0; 2281 } 2282 #endif 2283 2284 /** 2285 * dfs_set_thresholds() - Sets the threshold value. 2286 * @dfs: Pointer to wlan_dfs structure. 2287 * @threshtype: DFS ioctl param type. 2288 * @value: Threshold value. 2289 */ 2290 #if defined(WLAN_DFS_DIRECT_ATTACH) || defined(WLAN_DFS_PARTIAL_OFFLOAD) 2291 int dfs_set_thresholds(struct wlan_dfs *dfs, 2292 const uint32_t threshtype, 2293 const uint32_t value); 2294 #else 2295 static inline int dfs_set_thresholds(struct wlan_dfs *dfs, 2296 const uint32_t threshtype, 2297 const uint32_t value) 2298 { 2299 return 0; 2300 } 2301 #endif 2302 2303 /** 2304 * dfs_check_intersect_excl() - Check whether curfreq falls within lower_freq 2305 * and upper_freq, exclusively. 2306 * @low_freq : lower bound frequency value. 2307 * @high_freq: upper bound frequency value. 2308 * @chan_freq: Current frequency value to be checked. 2309 * 2310 * Return: returns true if overlap found, else returns false. 2311 */ 2312 #if defined(WLAN_DFS_DIRECT_ATTACH) || defined(WLAN_DFS_PARTIAL_OFFLOAD) 2313 bool dfs_check_intersect_excl(int low_freq, int high_freq, int chan_freq); 2314 #else 2315 static inline bool dfs_check_intersect_excl(int low_freq, int high_freq, 2316 int chan_freq) 2317 { 2318 return false; 2319 } 2320 #endif 2321 2322 /** 2323 * dfs_check_etsi_overlap() - Check whether given frequency centre/channel 2324 * width entry overlap with frequency spread in any way. 2325 * @center_freq : current channel centre frequency. 2326 * @chan_width : current channel width. 2327 * @en302_502_freq_low : overlap frequency lower bound. 2328 * @en302_502_freq_high : overlap frequency upper bound. 2329 * 2330 * Return: returns 1 if overlap found, else returns 0. 2331 */ 2332 #if defined(WLAN_DFS_DIRECT_ATTACH) || defined(WLAN_DFS_PARTIAL_OFFLOAD) 2333 int dfs_check_etsi_overlap(int center_freq, int chan_width, 2334 int en302_502_freq_low, int en302_502_freq_high); 2335 #else 2336 static inline int dfs_check_etsi_overlap(int center_freq, int chan_width, 2337 int en302_502_freq_low, 2338 int en302_502_freq_high) 2339 { 2340 return 0; 2341 } 2342 #endif 2343 2344 /** 2345 * dfs_is_en302_502_applicable() - Check whether current channel frequecy spread 2346 * overlaps with EN 302 502 radar type 2347 * frequency range. 2348 *@dfs: Pointer to wlan_dfs structure. 2349 * 2350 * Return: returns true if overlap found, else returns false. 2351 */ 2352 #if defined(WLAN_DFS_DIRECT_ATTACH) || defined(WLAN_DFS_PARTIAL_OFFLOAD) 2353 bool dfs_is_en302_502_applicable(struct wlan_dfs *dfs); 2354 #else 2355 static inline bool dfs_is_en302_502_applicable(struct wlan_dfs *dfs) 2356 { 2357 return false; 2358 } 2359 #endif 2360 2361 /** 2362 * dfs_set_current_channel() - Set DFS current channel. 2363 * @dfs: Pointer to wlan_dfs structure. 2364 * @dfs_ch_freq: Frequency in Mhz. 2365 * @dfs_ch_flags: Channel flags. 2366 * @dfs_ch_flagext: Extended channel flags. 2367 * @dfs_ch_ieee: IEEE channel number. 2368 * @dfs_ch_vhtop_ch_freq_seg1: Channel Center frequency1. 2369 * @dfs_ch_vhtop_ch_freq_seg2: Channel Center frequency2. 2370 */ 2371 #ifdef CONFIG_CHAN_NUM_API 2372 void dfs_set_current_channel(struct wlan_dfs *dfs, 2373 uint16_t dfs_ch_freq, 2374 uint64_t dfs_ch_flags, 2375 uint16_t dfs_ch_flagext, 2376 uint8_t dfs_ch_ieee, 2377 uint8_t dfs_ch_vhtop_ch_freq_seg1, 2378 uint8_t dfs_ch_vhtop_ch_freq_seg2); 2379 #endif 2380 2381 #ifdef CONFIG_CHAN_FREQ_API 2382 /** 2383 * dfs_set_current_channel_for_freq() - Set DFS current channel. 2384 * @dfs: Pointer to wlan_dfs structure. 2385 * @dfs_chan_freq: Frequency in Mhz. 2386 * @dfs_chan_flags: Channel flags. 2387 * @dfs_chan_flagext: Extended channel flags. 2388 * @dfs_chan_ieee: IEEE channel number. 2389 * @dfs_chan_vhtop_freq_seg1: Channel Center frequency1. 2390 * @dfs_chan_vhtop_freq_seg2: Channel Center frequency2. 2391 * @dfs_chan_mhz_freq_seg1: Channel center frequency of primary segment in MHZ. 2392 * @dfs_chan_mhz_freq_seg2: Channel center frequency of secondary segment in MHZ 2393 * applicable only for 80+80MHZ mode of operation. 2394 */ 2395 void dfs_set_current_channel_for_freq(struct wlan_dfs *dfs, 2396 uint16_t dfs_chan_freq, 2397 uint64_t dfs_chan_flags, 2398 uint16_t dfs_chan_flagext, 2399 uint8_t dfs_chan_ieee, 2400 uint8_t dfs_chan_vhtop_freq_seg1, 2401 uint8_t dfs_chan_vhtop_freq_seg2, 2402 uint16_t dfs_chan_mhz_freq_seg1, 2403 uint16_t dfs_chan_mhz_freq_seg2); 2404 2405 #endif 2406 /** 2407 * dfs_get_nol_chfreq_and_chwidth() - Get channel freq and width from NOL list. 2408 * @dfs_nol: Pointer to NOL channel entry. 2409 * @nol_chfreq: Pointer to save channel frequency. 2410 * @nol_chwidth: Pointer to save channel width. 2411 * @index: Index to dfs_nol list. 2412 */ 2413 void dfs_get_nol_chfreq_and_chwidth(struct dfsreq_nolelem *dfs_nol, 2414 uint32_t *nol_chfreq, 2415 uint32_t *nol_chwidth, 2416 int index); 2417 2418 /** 2419 * dfs_process_phyerr_owl() - Process an Owl-style phy error. 2420 * @dfs: Pointer to wlan_dfs structure. 2421 * @buf: Phyerr buffer 2422 * @datalen: Phyerr buf len 2423 * @rssi: RSSI 2424 * @ext_rssi: Extension RSSI. 2425 * @rs_tstamp: Time stamp. 2426 * @fulltsf: TSF64. 2427 * @e: Pointer to dfs_phy_err structure. 2428 * 2429 * Return: Returns 1. 2430 */ 2431 int dfs_process_phyerr_owl(struct wlan_dfs *dfs, 2432 void *buf, 2433 uint16_t datalen, 2434 uint8_t rssi, 2435 uint8_t ext_rssi, 2436 uint32_t rs_tstamp, 2437 uint64_t fulltsf, 2438 struct dfs_phy_err *e); 2439 2440 /** 2441 * dfs_process_phyerr_sowl() -Process a Sowl/Howl style phy error. 2442 * @dfs: Pointer to wlan_dfs structure. 2443 * @buf: Phyerr buffer 2444 * @datalen: Phyerr buf len 2445 * @rssi: RSSI 2446 * @ext_rssi: Extension RSSI. 2447 * @rs_tstamp: Time stamp. 2448 * @fulltsf: TSF64. 2449 * @e: Pointer to dfs_phy_err structure. 2450 * 2451 * Return: Returns 1. 2452 */ 2453 int dfs_process_phyerr_sowl(struct wlan_dfs *dfs, 2454 void *buf, 2455 uint16_t datalen, 2456 uint8_t rssi, 2457 uint8_t ext_rssi, 2458 uint32_t rs_tstamp, 2459 uint64_t fulltsf, 2460 struct dfs_phy_err *e); 2461 2462 /** 2463 * dfs_process_phyerr_merlin() - Process a Merlin/Osprey style phy error. 2464 * dfs_phy_err struct. 2465 * @dfs: Pointer to wlan_dfs structure. 2466 * @buf: Phyerr buffer 2467 * @datalen: Phyerr buf len 2468 * @rssi: RSSI 2469 * @ext_rssi: Extension RSSI. 2470 * @rs_tstamp: Time stamp. 2471 * @fulltsf: TSF64. 2472 * @e: Pointer to dfs_phy_err structure. 2473 * 2474 * Return: Returns 1. 2475 */ 2476 int dfs_process_phyerr_merlin(struct wlan_dfs *dfs, 2477 void *buf, 2478 uint16_t datalen, 2479 uint8_t rssi, 2480 uint8_t ext_rssi, 2481 uint32_t rs_tstamp, 2482 uint64_t fulltsf, 2483 struct dfs_phy_err *e); 2484 2485 /* 2486 * __dfs_process_radarevent() - Continuation of process a radar event function. 2487 * @dfs: Pointer to wlan_dfs structure. 2488 * @ft: Pointer to dfs_filtertype structure. 2489 * @re: Pointer to dfs_event structure. 2490 * @this_ts: Timestamp. 2491 * 2492 * There is currently no way to specify that a radar event has occurred on 2493 * a specific channel, so the current methodology is to mark both the pri 2494 * and ext channels as being unavailable. This should be fixed for 802.11ac 2495 * or we'll quickly run out of valid channels to use. 2496 * 2497 * Return: If a radar event is found, return 1. Otherwise, return 0. 2498 */ 2499 void __dfs_process_radarevent(struct wlan_dfs *dfs, 2500 struct dfs_filtertype *ft, 2501 struct dfs_event *re, 2502 uint64_t this_ts, 2503 int *found, 2504 int *false_radar_found); 2505 2506 /** 2507 * dfs_radar_found_action() - Radar found action 2508 * @dfs: Pointer to wlan_dfs structure. 2509 * @bangradar: true if radar is due to bangradar command. 2510 * @seg_id: Segment id. 2511 */ 2512 void dfs_radar_found_action(struct wlan_dfs *dfs, 2513 bool bangradar, 2514 uint8_t seg_id); 2515 2516 /** 2517 * bin5_rules_check_internal() - This is a extension of dfs_bin5_check(). 2518 * @dfs: Pointer to wlan_dfs structure. 2519 * @br: Pointer to dfs_bin5radars structure. 2520 * @bursts: Bursts. 2521 * @numevents: Number of events. 2522 * @prev: prev index. 2523 * @i: Index. 2524 * @this: index to br_elems[] 2525 */ 2526 void bin5_rules_check_internal(struct wlan_dfs *dfs, 2527 struct dfs_bin5radars *br, 2528 uint32_t *bursts, 2529 uint32_t *numevents, 2530 uint32_t prev, 2531 uint32_t i, 2532 uint32_t this, 2533 int *index); 2534 2535 /** 2536 * dfs_main_task_testtimer_init() - Initialize dfs task testtimer. 2537 * @dfs: Pointer to wlan_dfs structure. 2538 */ 2539 void dfs_main_task_testtimer_init(struct wlan_dfs *dfs); 2540 2541 /** 2542 * dfs_stop() - Clear dfs timers. 2543 * @dfs: Pointer to wlan_dfs structure. 2544 */ 2545 void dfs_stop(struct wlan_dfs *dfs); 2546 2547 /** 2548 * dfs_update_cur_chan_flags() - Update DFS channel flag and flagext. 2549 * @dfs: Pointer to wlan_dfs structure. 2550 * @flags: New channel flags 2551 * @flagext: New Extended flags 2552 */ 2553 void dfs_update_cur_chan_flags(struct wlan_dfs *dfs, 2554 uint64_t flags, 2555 uint16_t flagext); 2556 2557 /** 2558 * dfs_radarevent_basic_sanity() - Check basic sanity of the radar event 2559 * @dfs: Pointer to wlan_dfs structure. 2560 * @chan: Current channel. 2561 * 2562 * Return: If a radar event found on NON-DFS channel return 0. Otherwise, 2563 * return 1. 2564 */ 2565 int dfs_radarevent_basic_sanity(struct wlan_dfs *dfs, 2566 struct dfs_channel *chan); 2567 2568 /** 2569 * wlan_psoc_get_dfs_txops() - Get dfs_tx_ops pointer 2570 * @psoc: Pointer to psoc structure. 2571 * 2572 * Return: Pointer to dfs_tx_ops. 2573 */ 2574 struct wlan_lmac_if_dfs_tx_ops * 2575 wlan_psoc_get_dfs_txops(struct wlan_objmgr_psoc *psoc); 2576 2577 /** 2578 * dfs_nol_free_list() - Free NOL elements. 2579 * @dfs: Pointer to wlan_dfs structure. 2580 */ 2581 void dfs_nol_free_list(struct wlan_dfs *dfs); 2582 2583 /** 2584 * dfs_second_segment_radar_disable() - Disables the second segment radar. 2585 * @dfs: Pointer to wlan_dfs structure. 2586 * 2587 * This is called when AP detects the radar, to (potentially) disable 2588 * the radar code. 2589 * 2590 * Return: returns 0. 2591 */ 2592 int dfs_second_segment_radar_disable(struct wlan_dfs *dfs); 2593 2594 /** 2595 * dfs_fetch_nol_ie_info() - Fill NOL information to be sent with RCSA. 2596 * @dfs - Pointer to wlan_dfs structure. 2597 * @nol_ie_bandwidth - Minimum subchannel bandwidth. 2598 * @nol_ie_startfreq - Radar affected channel list's first subchannel's 2599 * - centre frequency. 2600 * @nol_ie_bitmap - NOL bitmap denoting affected subchannels. 2601 */ 2602 void dfs_fetch_nol_ie_info(struct wlan_dfs *dfs, uint8_t *nol_ie_bandwidth, 2603 uint16_t *nol_ie_startfreq, uint8_t *nol_ie_bitmap); 2604 2605 /** 2606 * dfs_set_rcsa_flags() - Set flags that are required for sending RCSA and 2607 * NOL IE. 2608 * @dfs: Pointer to wlan_dfs structure. 2609 * @is_rcsa_ie_sent: Boolean to check if RCSA IE should be sent or not. 2610 * @is_nol_ie_sent: Boolean to check if NOL IE should be sent or not. 2611 */ 2612 void dfs_set_rcsa_flags(struct wlan_dfs *dfs, bool is_rcsa_ie_sent, 2613 bool is_nol_ie_sent); 2614 2615 /** 2616 * dfs_get_rcsa_flags() - Get flags that are required for sending RCSA and 2617 * NOL IE. 2618 * @dfs: Pointer to wlan_dfs structure. 2619 * @is_rcsa_ie_sent: Boolean to check if RCSA IE should be sent or not. 2620 * @is_nol_ie_sent: Boolean to check if NOL IE should be sent or not. 2621 */ 2622 void dfs_get_rcsa_flags(struct wlan_dfs *dfs, bool *is_rcsa_ie_sent, 2623 bool *is_nol_ie_sent); 2624 2625 /** 2626 * dfs_process_nol_ie_bitmap() - Update NOL with external radar information. 2627 * @dfs - Pointer to wlan_dfs structure. 2628 * @nol_ie_bandwidth - Minimum subchannel bandwidth. 2629 * @nol_ie_starfreq - Radar affected channel list's first subchannel's 2630 * - centre frequency. 2631 * @nol_ie_bitmap - Bitmap denoting radar affected subchannels. 2632 * 2633 * Return: True if NOL IE should be propagated, else false. 2634 */ 2635 bool dfs_process_nol_ie_bitmap(struct wlan_dfs *dfs, uint8_t nol_ie_bandwidth, 2636 uint16_t nol_ie_startfreq, 2637 uint8_t nol_ie_bitmap); 2638 2639 /** 2640 * dfs_is_cac_required() - Check if DFS CAC is required for the current channel. 2641 * @dfs: Pointer to wlan_dfs structure. 2642 * @cur_chan: Pointer to current channel of dfs_channel structure. 2643 * @prev_chan: Pointer to previous channel of dfs_channel structure. 2644 * @continue_current_cac: If AP can start CAC then this variable indicates 2645 * whether to continue with the current CAC or restart the CAC. This variable 2646 * is valid only if this function returns true. 2647 * 2648 * Return: true if AP requires CAC or can continue current CAC, else false. 2649 */ 2650 bool dfs_is_cac_required(struct wlan_dfs *dfs, 2651 struct dfs_channel *cur_chan, 2652 struct dfs_channel *prev_chan, 2653 bool *continue_current_cac); 2654 2655 /** 2656 * dfs_task_testtimer_reset() - stop dfs test timer. 2657 * @dfs: Pointer to wlan_dfs structure. 2658 */ 2659 void dfs_task_testtimer_reset(struct wlan_dfs *dfs); 2660 2661 /** 2662 * dfs_is_freq_in_nol() - check if given channel in nol list 2663 * @dfs: Pointer to wlan_dfs structure 2664 * @freq: channel frequency 2665 * 2666 * check if given channel in nol list. 2667 * 2668 * Return: true if channel in nol, false else 2669 */ 2670 bool dfs_is_freq_in_nol(struct wlan_dfs *dfs, uint32_t freq); 2671 2672 /** 2673 * dfs_task_testtimer_detach() - Free dfs test timer. 2674 * @dfs: Pointer to wlan_dfs structure. 2675 */ 2676 void dfs_task_testtimer_detach(struct wlan_dfs *dfs); 2677 2678 /** 2679 * dfs_timer_detach() - Free dfs timers. 2680 * @dfs: Pointer to wlan_dfs structure. 2681 */ 2682 void dfs_timer_detach(struct wlan_dfs *dfs); 2683 2684 /** 2685 * dfs_is_disable_radar_marking_set() - Check if radar marking is set on 2686 * NOL chan. 2687 * @dfs: Pointer to wlan_dfs structure. 2688 */ 2689 #if defined(WLAN_DFS_FULL_OFFLOAD) && defined(QCA_DFS_NOL_OFFLOAD) 2690 int dfs_is_disable_radar_marking_set(struct wlan_dfs *dfs, 2691 bool *disable_radar_marking); 2692 #else 2693 static inline int dfs_is_disable_radar_marking_set(struct wlan_dfs *dfs, 2694 bool *disable_radar_marking) 2695 { 2696 return QDF_STATUS_SUCCESS; 2697 } 2698 #endif 2699 /** 2700 * dfs_get_disable_radar_marking() - Get the value of disable radar marking. 2701 * @dfs: Pointer to wlan_dfs structure. 2702 */ 2703 #if defined(WLAN_DFS_FULL_OFFLOAD) && defined(QCA_DFS_NOL_OFFLOAD) 2704 bool dfs_get_disable_radar_marking(struct wlan_dfs *dfs); 2705 #endif 2706 2707 /** 2708 * dfs_reset_agile_config() - Reset the ADFS config variables. 2709 * @dfs: Pointer to dfs_soc_priv_obj. 2710 */ 2711 #ifdef QCA_SUPPORT_AGILE_DFS 2712 void dfs_reset_agile_config(struct dfs_soc_priv_obj *dfs_soc); 2713 #endif 2714 2715 /** 2716 * dfs_reinit_timers() - Reinit timers in DFS. 2717 * @dfs: Pointer to wlan_dfs. 2718 */ 2719 int dfs_reinit_timers(struct wlan_dfs *dfs); 2720 2721 /** 2722 * dfs_reset_dfs_prevchan() - Reset DFS previous channel structure. 2723 * @dfs: Pointer to wlan_dfs object. 2724 * 2725 * Return: None. 2726 */ 2727 void dfs_reset_dfs_prevchan(struct wlan_dfs *dfs); 2728 #endif /* _DFS_H_ */ 2729