aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/ath/dfs_pattern_detector.c
Commit message (Collapse)AuthorAgeFilesLines
* wifi: ath: dfs_pattern_detector: Use flex array to simplify codeChristophe JAILLET2023-10-021-13/+8
| | | | | | | | | | | | | | | | | At the time of the writing, the value of 'num_radar_types' is 7 or 9. So on a 64 bits system, only 56 or 72 bytes are allocated for the 'detectors' array. Turn it into a flex array, in order to simplify memory management and save an indirection when the array is used. Doing so, cd->detectors can't be NULL, and channel_detector_exit() can be simplified as well. Signed-off-by: Christophe JAILLET <[email protected]> Reviewed-by: Jeff Johnson <[email protected]> Signed-off-by: Kalle Valo <[email protected]> Link: https://lore.kernel.org/r/1920cc38db2e570633e13b37d50852f3202a7270.1695538105.git.christophe.jaillet@wanadoo.fr
* wifi: ath: dfs_pattern_detector: Fix a memory initialization issueChristophe JAILLET2023-10-021-1/+1
| | | | | | | | | | | | | | | If an error occurs and channel_detector_exit() is called, it relies on entries of the 'detectors' array to be NULL. Otherwise, it may access to un-initialized memory. Fix it and initialize the memory, as what was done before the commit in Fixes. Fixes: a063b650ce5d ("ath: dfs_pattern_detector: Avoid open coded arithmetic in memory allocation") Signed-off-by: Christophe JAILLET <[email protected]> Reviewed-by: Jeff Johnson <[email protected]> Signed-off-by: Kalle Valo <[email protected]> Link: https://lore.kernel.org/r/ad8c55b97ee4b330cb053ce2c448123c309cc91c.1695538105.git.christophe.jaillet@wanadoo.fr
* ath: dfs_pattern_detector: Avoid open coded arithmetic in memory allocationChristophe JAILLET2022-01-171-3/+3
| | | | | | | | | | | | | | | | kmalloc_array()/kcalloc() should be used to avoid potential overflow when a multiplication is needed to compute the size of the requested memory. kmalloc_array() can be used here instead of kcalloc() because the array is fully initialized in the next 'for' loop. Finally, 'cd->detectors' is defined as 'struct pri_detector **detectors;'. So 'cd->detectors' and '*cd->detectors' are both some pointer. So use a more logical 'sizeof(*cd->detectors)'. Signed-off-by: Christophe JAILLET <[email protected]> Signed-off-by: Kalle Valo <[email protected]> Link: https://lore.kernel.org/r/0fbcd32a0384ac1f87c5a3549e505e4becc60226.1640624216.git.christophe.jaillet@wanadoo.fr
* ath: dfs_pattern_detector: Fix possible null-pointer dereference in ↵Tuo Li2021-10-111-4/+6
| | | | | | | | | | | | | | | | | | | channel_detector_create() kzalloc() is used to allocate memory for cd->detectors, and if it fails, channel_detector_exit() behind the label fail will be called: channel_detector_exit(dpd, cd); In channel_detector_exit(), cd->detectors is dereferenced through: struct pri_detector *de = cd->detectors[i]; To fix this possible null-pointer dereference, check cd->detectors before the for loop to dereference cd->detectors. Reported-by: TOTE Robot <[email protected]> Signed-off-by: Tuo Li <[email protected]> Signed-off-by: Kalle Valo <[email protected]> Link: https://lore.kernel.org/r/[email protected]
* ath: dfs_pattern_detector: Fix some function kernel-doc headersLee Jones2020-11-071-6/+8
| | | | | | | | | | | | | | | | | | Fixes the following W=1 kernel build warning(s): drivers/net/wireless/ath/dfs_pattern_detector.c:34: warning: Function parameter or member 'region' not described in 'radar_types' drivers/net/wireless/ath/dfs_pattern_detector.c:141: warning: Function parameter or member 'region' not described in 'get_dfs_domain_radar_types' drivers/net/wireless/ath/dfs_pattern_detector.c:239: warning: Function parameter or member 'dpd' not described in 'channel_detector_get' drivers/net/wireless/ath/dfs_pattern_detector.c:239: warning: Function parameter or member 'freq' not described in 'channel_detector_get' Cc: Kalle Valo <[email protected]> Cc: "David S. Miller" <[email protected]> Cc: Jakub Kicinski <[email protected]> Cc: [email protected] Cc: [email protected] Signed-off-by: Lee Jones <[email protected]> Signed-off-by: Kalle Valo <[email protected]> Link: https://lore.kernel.org/r/[email protected]
* ath: drop unnecessary list_emptyJulia Lawall2020-08-141-9/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | list_for_each_entry{_safe} is able to handle an empty list. The only effect of avoiding the loop is not initializing the index variable. Drop list_empty tests in cases where these variables are not used. Note that list_for_each_entry{_safe} is defined in terms of list_first_entry, which indicates that it should not be used on an empty list. But in list_for_each_entry{_safe}, the element obtained by list_first_entry is not really accessed, only the address of its list_head field is compared to the address of the list head, so the list_first_entry is safe. The semantic patch that makes this change for the list_for_each_entry case is as follows: (http://coccinelle.lip6.fr/) <smpl> @@ expression x,e; statement S; identifier i; @@ -if (!(list_empty(x))) list_for_each_entry(i,x,...) S ... when != i ? i = e </smpl> Signed-off-by: Julia Lawall <[email protected]> Signed-off-by: Kalle Valo <[email protected]> Link: https://lore.kernel.org/r/[email protected]
* ath: DFS JP domain W56 fixed pulse type 3 RADAR detectionAnilkumar Kolli2019-04-291-1/+1
| | | | | | | | | | | | | | | | | | | Increase pulse width range from 1-2usec to 0-4usec. During data traffic HW occasionally fails detecting radar pulses, so that SW cannot get enough radar reports to achieve the success rate. Tested ath10k hw and fw: * QCA9888(10.4-3.5.1-00052) * QCA4019(10.4-3.2.1.1-00017) * QCA9984(10.4-3.6-00104) * QCA988X(10.2.4-1.0-00041) Tested ath9k hw: AR9300 Tested-by: Tamizh chelvam <[email protected]> Signed-off-by: Tamizh chelvam <[email protected]> Signed-off-by: Anilkumar Kolli <[email protected]> Signed-off-by: Kalle Valo <[email protected]>
* ath: add support to get the detected radar specificationsSriram R2018-05-251-1/+4
| | | | | | | | | | | | | | | | This enables ath10k/ath9k drivers to collect the specifications of the radar type once it is detected by the dfs pattern detector unit. Usage of the collected info is specific to driver implementation. For example, collected radar info could be used by the host driver to send to co-processors for additional processing/validation. Note: 'radar_detector_specs' data containing the specifications of different radar types which was private within dfs_pattern_detector/ dfs_pri_detector is now shared with drivers as well for making use of this information. Signed-off-by: Sriram R <[email protected]> Signed-off-by: Kalle Valo <[email protected]>
* ath: fix false radar detection in JP regionSriram R2018-03-261-1/+1
| | | | | | | | | This fixes false radar detection (of radar type 7) in Japan region by correcting the radar pulse type to Chirp as per specification. Signed-off-by: Sriram R <[email protected]> Signed-off-by: Kalle Valo <[email protected]>
* ath: constify local structuresJulia Lawall2016-09-141-1/+1
| | | | | | | | | | | | | | | | | | For structure types defined in the same file or local header files, find top-level static structure declarations that have the following properties: 1. Never reassigned. 2. Address never taken 3. Not passed to a top-level macro call 4. No pointer or array-typed field passed to a function or stored in a variable. Declare structures having all of these properties as const. Done using Coccinelle. Based on a suggestion by Joe Perches <[email protected]>. Signed-off-by: Julia Lawall <[email protected]> Signed-off-by: Kalle Valo <[email protected]>
* tree-wide: replace config_enabled() with IS_ENABLED()Masahiro Yamada2016-08-041-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The use of config_enabled() against config options is ambiguous. In practical terms, config_enabled() is equivalent to IS_BUILTIN(), but the author might have used it for the meaning of IS_ENABLED(). Using IS_ENABLED(), IS_BUILTIN(), IS_MODULE() etc. makes the intention clearer. This commit replaces config_enabled() with IS_ENABLED() where possible. This commit is only touching bool config options. I noticed two cases where config_enabled() is used against a tristate option: - config_enabled(CONFIG_HWMON) [ drivers/net/wireless/ath/ath10k/thermal.c ] - config_enabled(CONFIG_BACKLIGHT_CLASS_DEVICE) [ drivers/gpu/drm/gma500/opregion.c ] I did not touch them because they should be converted to IS_BUILTIN() in order to keep the logic, but I was not sure it was the authors' intention. Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Masahiro Yamada <[email protected]> Acked-by: Kees Cook <[email protected]> Cc: Stas Sergeev <[email protected]> Cc: Matt Redfearn <[email protected]> Cc: Joshua Kinard <[email protected]> Cc: Jiri Slaby <[email protected]> Cc: Bjorn Helgaas <[email protected]> Cc: Borislav Petkov <[email protected]> Cc: Markos Chandras <[email protected]> Cc: "Dmitry V. Levin" <[email protected]> Cc: yu-cheng yu <[email protected]> Cc: James Hogan <[email protected]> Cc: Brian Gerst <[email protected]> Cc: Johannes Berg <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Al Viro <[email protected]> Cc: Will Drewry <[email protected]> Cc: Nikolay Martynov <[email protected]> Cc: Huacai Chen <[email protected]> Cc: "H. Peter Anvin" <[email protected]> Cc: Thomas Gleixner <[email protected]> Cc: Daniel Borkmann <[email protected]> Cc: Leonid Yegoshin <[email protected]> Cc: Rafal Milecki <[email protected]> Cc: James Cowgill <[email protected]> Cc: Greg Kroah-Hartman <[email protected]> Cc: Ralf Baechle <[email protected]> Cc: Alex Smith <[email protected]> Cc: Adam Buchbinder <[email protected]> Cc: Qais Yousef <[email protected]> Cc: Jiang Liu <[email protected]> Cc: Mikko Rapeli <[email protected]> Cc: Paul Gortmaker <[email protected]> Cc: Denys Vlasenko <[email protected]> Cc: Brian Norris <[email protected]> Cc: Hidehiro Kawai <[email protected]> Cc: "Luis R. Rodriguez" <[email protected]> Cc: Andy Lutomirski <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Dave Hansen <[email protected]> Cc: "Kirill A. Shutemov" <[email protected]> Cc: Roland McGrath <[email protected]> Cc: Paul Burton <[email protected]> Cc: Kalle Valo <[email protected]> Cc: Viresh Kumar <[email protected]> Cc: Tony Wu <[email protected]> Cc: Huaitong Han <[email protected]> Cc: Sumit Semwal <[email protected]> Cc: Alexei Starovoitov <[email protected]> Cc: Juergen Gross <[email protected]> Cc: Jason Cooper <[email protected]> Cc: "David S. Miller" <[email protected]> Cc: Oleg Nesterov <[email protected]> Cc: Andrea Gelmini <[email protected]> Cc: David Woodhouse <[email protected]> Cc: Marc Zyngier <[email protected]> Cc: Rabin Vincent <[email protected]> Cc: "Maciej W. Rozycki" <[email protected]> Cc: David Daney <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
* ath: fix DFS timestamp wraparound reset conditionZefir Kurtisi2015-10-091-1/+1
| | | | | | | | | | | | | | | | | | | | | | The DFS pattern detector ought to reset the detector lines when a pulse is added with lower time stamp than the previous (which indicates a TSF restart). This did not work so far and is fixed with this patch. The modification does not change detection performance within the driver, since it only ensures early reset (which is later performed by the PRI detectors anyway). It is relevant for synthetic tests and statistical evaluations, where millions of pulse patterns are processed and an early reset helps reducing load. Signed-off-by: Zefir Kurtisi <[email protected]> Signed-off-by: Kalle Valo <[email protected]>
* ath: use PRI value given by spec for fixed PRIPeter Oh2015-09-271-6/+0
| | | | | | | | | | | | | | | | | | | PRI value is used as divider when DFS detector analyzes candidate radar pulses. If PRI deviation is big from its origin PRI, DFS detector could miss valid radar reports since HW often misses detecting radar pulses and causes long interval value of pulses. For instance from practical results, if runtime PRI is calculated as 1431 for fixed PRI value of 1428 and delta timestamp logs 15719, the modular remainder will be 1409 and the delta between the remainder and runtime PRI is 22 that is bigger than PRI tolerance which is 16. As a result this radar report will be ignored even though it's valid. By using spec defined PRI for fixed PRI, we can correct this error. Signed-off-by: Peter Oh <[email protected]> Signed-off-by: Kalle Valo <[email protected]>
* ath: fix incorrect PPB on JAPAN chirp radarPeter Oh2015-09-271-1/+1
| | | | | | | | | | | | The number of pulses per burst on Japan chirp radar is between 1 and 3. The previous value, 20, is representing number of bursts, but since current DFS detector is using pulse detection other than bursts, use the pulse number for correct radar detection. Also using the highest number helps to avoid false detection. Signed-off-by: Peter Oh <[email protected]> Signed-off-by: Kalle Valo <[email protected]>
* Merge ath-next from ath.gitKalle Valo2015-04-281-28/+44
|\ | | | | | | | | | | | | | | | | | | | | | | | | Major changes in ath10k: * enable channel 144 on 5 GHz * enable Adaptive Noise Immunity (ANI) by default * add Wake on Wireless LAN (WOW) patterns support * add basic Tunneled Direct Link Setup (TDLS) support * add multi-channel support for QCA6174 * enable IBSS RSN support * enable Bluetooth Coexistance whenever firmware supports it * add more versatile way to set bitrates used by the firmware
| * ath: lower JP W53 band DFS detection threshold around 30%Peter Oh2015-04-151-2/+2
| | | | | | | | | | | | | | | | | | | | | | Japan's W53 band requires 50% data traffic during its DFS test, but WLAN baseband used by ath9k and ath10k is not able to achieve current threshold rate, 50%, under the data traffic rate. In other words, HW occasionally fails detecting radar pulses, so that SW cannot get enough radar reports to achieve the rate. Signed-off-by: Peter Oh <[email protected]> Signed-off-by: Kalle Valo <[email protected]>
| * ath: define JP DFS patterns separated from FCCPeter Oh2015-04-151-11/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Separate Japan's DFS pattern from FCC to control PPB threshold. Currently all the radar detectors use the same threshold rate at 50%, but it's not able to achieve if data traffic rate is higher than 40% because WLAN baseband used by ath9k and ath10k often fails detecting radar pulses, so that SW cannot get enough radar reports to achieve the rate. Since Japan's W53 band requires 50% data traffic during its DFS test we need to apply different threshold rate than others on it. Hence define its own pattern to give flexibility to threshold rate. Signed-off-by: Peter Oh <[email protected]> Signed-off-by: Kalle Valo <[email protected]>
| * ath: support new FCC DFS Radar Type 1Peter Oh2015-04-151-5/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add support for new FCC DFS rules released on August 14, 2014. FCC has added a new radar type named Radar Type 1 and original Radar Type 1 is renamed to Radar Type 0 in consequence. During the certificate test, Type 1 PRI values are randomly selected within the range of 518 and 3066 and we divide it to 3 groups based on practical test result data collected for more than a year. For about Radar type ID, it does nothing to functionalities. In other words, even if we re-order the IDs, DFS detection will work as well, but we give the ID with matching to FCC doc. By adding this support, the drivers using this DFS function are able to support both of old and new FCC DFS rules simultaneously without any other changes. Signed-off-by: Peter Oh <[email protected]> Signed-off-by: Kalle Valo <[email protected]>
| * ath: introduce chirp parameter used by DFSPeter Oh2015-03-051-26/+26
| | | | | | | | | | | | | | | | | | Some of radar types such as FCC radar type 5 require to look up chirp in pulse to detect genuine radar and it will prevent DFS channels from false radar detection. Signed-off-by: Peter Oh <[email protected]> Signed-off-by: Kalle Valo <[email protected]>
* | ath9k: restart only triggering DFS detector lineZefir Kurtisi2015-03-161-1/+1
|/ | | | | | | | To support HT40 DFS mode, a triggering detector must reset only itself but not other detector lines. Signed-off-by: Zefir Kurtisi <[email protected]> Signed-off-by: Kalle Valo <[email protected]>
* ath: fix incorrect PPB on FCC radar type 5Peter Oh2014-12-241-1/+1
| | | | | | | | The minimum number of pulses per burst on FCC radar type 5 is 1. Use this number for correct radar detection. Signed-off-by: Peter Oh <[email protected]> Signed-off-by: Kalle Valo <[email protected]>
* ath: Fix a false radar detection patternVivek Natarajan2014-11-241-2/+2
| | | | | | | | For FCC and JP, in one of the radar patterns, PPB and PRF seems to be interchanged leading to frequent incorrect radar detections. Signed-off-by: Vivek Natarajan <[email protected]> Signed-off-by: John W. Linville <[email protected]>
* ath: add JP DFS pattern detectorJanusz Dziedzic2014-05-161-0/+20
| | | | | | | Add initial values for JP DFS pattern detector. Signed-off-by: Janusz Dziedzic <[email protected]> Signed-off-by: John W. Linville <[email protected]>
* ath: add DFS FCC pattern detectorJanusz Dziedzic2014-05-161-1/+24
| | | | | | | | Add initial values for DFS FCC pattern detector. Signed-off-by: Janusz Dziedzic <[email protected]> Tested-by: Bartosz Markowski <[email protected]> Signed-off-by: John W. Linville <[email protected]>
* ath9k/ath: move dfs pattern detector to athJanusz Dziedzic2013-10-181-0/+320
Move the DFS pattern detector code to the ath module so the other Atheros drivers can make us of it. This makes no functional changes. Signed-off-by: Janusz Dziedzic <[email protected]> Reviewed-by: Luis R. Rodriguez <[email protected]> Signed-off-by: John W. Linville <[email protected]>