xref: /wlan-dirver/qca-wifi-host-cmn/umac/dfs/core/src/dfs_process_radar_found_ind.h (revision 3149adf58a329e17232a4c0e58d460d025edd55a)
1 /*
2  * Copyright (c) 2017-2018 The Linux Foundation. All rights reserved.
3  *
4  * Permission to use, copy, modify, and/or distribute this software for
5  * any purpose with or without fee is hereby granted, provided that the
6  * above copyright notice and this permission notice appear in all
7  * copies.
8  *
9  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
10  * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
11  * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
12  * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
13  * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
14  * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
15  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
16  * PERFORMANCE OF THIS SOFTWARE.
17  */
18 
19 /**
20  * DOC: dfs_process_radar_found_ind.h
21  * This file provides prototypes of the routines needed for the
22  * external components to utilize the services provided by the
23  * DFS component.
24  */
25 
26 /* Number of channel marking offsets */
27 #define DFS_NUM_FREQ_OFFSET   3
28 
29 /* Lower channel from 20 Mhz center channel */
30 #define DFS_20MHZ_LOWER_CHANNEL(_f)    ((_f) - 20)
31 /* Upper channel from 20 Mhz center channel */
32 #define DFS_20MHZ_UPPER_CHANNEL(_f)    ((_f) + 20)
33 /* 1st lower channel from center channel of bandwidth 40/80/160Mhz */
34 #define DFS_FIRST_LOWER_CHANNEL(_f)    ((_f) - 10)
35 /* 2nd lower channel from center channel of bandwidth 40/80/160Mhz */
36 #define DFS_SECOND_LOWER_CHANNEL(_f)   ((_f) - 30)
37 /* 3rd lower channel from center channel of bandwidth 80/160Mhz */
38 #define DFS_THIRD_LOWER_CHANNEL(_f)    ((_f) - 50)
39 /* 1st upper channel from center channel of bandwidth 40/80/160Mhz */
40 #define DFS_FIRST_UPPER_CHANNEL(_f)    ((_f) + 10)
41 /* 2nd upper channel from center channel of bandwidth 40/80/160Mhz */
42 #define DFS_SECOND_UPPER_CHANNEL(_f)   ((_f) + 30)
43 /* 3rd upper channel from center channel of bandwidth 80/160Mhz */
44 #define DFS_THIRD_UPPER_CHANNEL(_f)    ((_f) + 50)
45 
46 /* 20 Mhz freq_offset lower */
47 #define DFS_20MZ_OFFSET_LOWER    (-10)
48 /* 20 Mhz freq_offset upper */
49 #define DFS_20MZ_OFFSET_UPPER     (10)
50 /* 40/80 Mhz freq_offset first lower */
51 #define DFS_OFFET_FIRST_LOWER    (-20)
52 /* 40/80 Mhz freq_offset second lower */
53 #define DFS_OFFET_SECOND_LOWER   (-40)
54 /* 40/80 Mhz freq_offset first upper */
55 #define DFS_OFFET_FIRST_UPPER     (20)
56 /* 40/80 Mhz freq_offset second upper */
57 #define DFS_OFFET_SECOND_UPPER    (40)
58 
59 /* Frequency offset to sidx */
60 #define DFS_FREQ_OFFSET_TO_SIDX(_f)  ((32 * (_f)) / 10)
61 /* sidx offset boundary */
62 #define DFS_BOUNDARY_SIDX  32
63 /* freq offset for chirp */
64 #define DFS_CHIRP_OFFSET  10
65 /* second segment freq offset */
66 #define DFS_160MHZ_SECOND_SEG_OFFSET  40
67 
68 /* Frequency offset indices */
69 #define CENTER_CH 0
70 #define LEFT_CH   1
71 #define RIGHT_CH  2
72 
73 /* Next channel number offset's from center channel number */
74 #define DFS_5GHZ_NEXT_CHAN_OFFSET  2
75 #define DFS_5GHZ_2ND_CHAN_OFFSET   6
76 #define DFS_5GHZ_3RD_CHAN_OFFSET  10
77 #define DFS_5GHZ_4TH_CHAN_OFFSET  14
78 
79 /* Max number of bonding channels in 160 MHz segment */
80 #define NUM_CHANNELS_160MHZ 8
81 
82 /**
83  * struct freqs_offsets - frequency and offset information
84  * @freq: channel frequency in mhz.
85  * @offset: offset from center frequency.
86  *
87  * Index 0 - Center channel affected by RADAR.
88  * Index 1 - Left of Center channel affected by RADAR.
89  * Index 2 - Right of Center channel affected by RADAR.
90  *
91  * This information is needed to find and mark radar infected
92  * channels in NOL and regulatory database.
93  */
94 struct freqs_offsets {
95 	uint32_t freq[DFS_NUM_FREQ_OFFSET];
96 	int32_t offset[DFS_NUM_FREQ_OFFSET];
97 };
98 
99 /**
100  * dfs_process_radar_found_indication() - Process radar found indication
101  * @dfs: Pointer to wlan_dfs structure.
102  * @radar_found: radar found info.
103  *
104  * Process radar found indication and update radar effected channel in NOL
105  * and regulatory.
106  *
107  * Return: None
108  */
109 void dfs_process_radar_found_indication(struct wlan_dfs *dfs,
110 		struct radar_found_info *radar_found);
111 
112 /**
113  * dfs_process_radar_ind() - Process radar indication event
114  * @dfs: Pointer to wlan_dfs structure.
115  * @radar_found: Pointer to radar_found_info structure.
116  *
117  * Wrapper function of dfs_process_radar_found_indication().
118  *
119  * Return: QDF_STATUS
120  */
121 QDF_STATUS dfs_process_radar_ind(struct wlan_dfs *dfs,
122 		struct radar_found_info *radar_found);
123