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