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 #ifndef _DFS_PROCESS_RADAR_FOUND_IND_H_ 27 #define _DFS_PROCESS_RADAR_FOUND_IND_H_ 28 29 /* Number of channel marking offsets */ 30 #define DFS_NUM_FREQ_OFFSET 3 31 32 /* Lower channel from 20 Mhz center channel */ 33 #define DFS_20MHZ_LOWER_CHANNEL(_f) ((_f) - 20) 34 /* Upper channel from 20 Mhz center channel */ 35 #define DFS_20MHZ_UPPER_CHANNEL(_f) ((_f) + 20) 36 /* 1st lower channel from center channel of bandwidth 40/80/160Mhz */ 37 #define DFS_FIRST_LOWER_CHANNEL(_f) ((_f) - 10) 38 /* 2nd lower channel from center channel of bandwidth 40/80/160Mhz */ 39 #define DFS_SECOND_LOWER_CHANNEL(_f) ((_f) - 30) 40 /* 3rd lower channel from center channel of bandwidth 80/160Mhz */ 41 #define DFS_THIRD_LOWER_CHANNEL(_f) ((_f) - 50) 42 /* 1st upper channel from center channel of bandwidth 40/80/160Mhz */ 43 #define DFS_FIRST_UPPER_CHANNEL(_f) ((_f) + 10) 44 /* 2nd upper channel from center channel of bandwidth 40/80/160Mhz */ 45 #define DFS_SECOND_UPPER_CHANNEL(_f) ((_f) + 30) 46 /* 3rd upper channel from center channel of bandwidth 80/160Mhz */ 47 #define DFS_THIRD_UPPER_CHANNEL(_f) ((_f) + 50) 48 49 /* 20 Mhz freq_offset lower */ 50 #define DFS_20MZ_OFFSET_LOWER (-10) 51 /* 20 Mhz freq_offset upper */ 52 #define DFS_20MZ_OFFSET_UPPER (10) 53 /* 40/80 Mhz freq_offset first lower */ 54 #define DFS_OFFSET_FIRST_LOWER (-20) 55 /* 40/80 Mhz freq_offset second lower */ 56 #define DFS_OFFSET_SECOND_LOWER (-40) 57 /* 40/80 Mhz freq_offset first upper */ 58 #define DFS_OFFSET_FIRST_UPPER (20) 59 /* 40/80 Mhz freq_offset second upper */ 60 #define DFS_OFFSET_SECOND_UPPER (40) 61 62 /* Frequency offset to sidx */ 63 #define DFS_FREQ_OFFSET_TO_SIDX(_f) ((32 * (_f)) / 10) 64 /* Sidx to frequency offset */ 65 #define DFS_SIDX_TO_FREQ_OFFSET(_s) ((10 * (_s)) / 32) 66 /* sidx offset boundary */ 67 #define DFS_BOUNDARY_SIDX 32 68 /* freq offset for chirp */ 69 #define DFS_CHIRP_OFFSET 10 70 /* second segment freq offset */ 71 #define DFS_160MHZ_SECOND_SEG_OFFSET 40 72 73 /* Frequency offset indices */ 74 #define CENTER_CH 0 75 #define LEFT_CH 1 76 #define RIGHT_CH 2 77 78 /* Next channel number offset's from center channel number */ 79 #define DFS_5GHZ_NEXT_CHAN_OFFSET 2 80 #define DFS_5GHZ_2ND_CHAN_OFFSET 6 81 #define DFS_5GHZ_3RD_CHAN_OFFSET 10 82 #define DFS_5GHZ_4TH_CHAN_OFFSET 14 83 84 /* Max number of bonding channels in 160 MHz segment */ 85 #define NUM_CHANNELS_160MHZ 8 86 87 /** 88 * struct freqs_offsets - frequency and offset information 89 * @freq: channel frequency in mhz. 90 * @offset: offset from center frequency. 91 * 92 * Index 0 - Center channel affected by RADAR. 93 * Index 1 - Left of Center channel affected by RADAR. 94 * Index 2 - Right of Center channel affected by RADAR. 95 * 96 * This information is needed to find and mark radar infected 97 * channels in NOL and regulatory database. 98 */ 99 struct freqs_offsets { 100 uint32_t freq[DFS_NUM_FREQ_OFFSET]; 101 int32_t offset[DFS_NUM_FREQ_OFFSET]; 102 }; 103 104 /** 105 * dfs_process_radar_found_indication() - Process radar found indication 106 * @dfs: Pointer to wlan_dfs structure. 107 * @radar_found: radar found info. 108 * 109 * Process radar found indication and update radar effected channel in NOL 110 * and regulatory. 111 * 112 * Return: None 113 */ 114 void dfs_process_radar_found_indication(struct wlan_dfs *dfs, 115 struct radar_found_info *radar_found); 116 117 /** 118 * dfs_process_radar_ind() - Process radar indication event 119 * @dfs: Pointer to wlan_dfs structure. 120 * @radar_found: Pointer to radar_found_info structure. 121 * 122 * Wrapper function of dfs_process_radar_found_indication(). 123 * 124 * Return: QDF_STATUS 125 */ 126 QDF_STATUS dfs_process_radar_ind(struct wlan_dfs *dfs, 127 struct radar_found_info *radar_found); 128 129 /** 130 * dfs_radarfound_action_generic() - The dfs action on radar detection by host 131 * for domains other than FCC. 132 * @dfs: Pointer to wlan_dfs structure. 133 * @seg_id: segment id. 134 * 135 * Return: None 136 */ 137 void dfs_radarfound_action_generic(struct wlan_dfs *dfs, uint8_t seg_id); 138 139 /** 140 * dfs_get_bonding_channels() - Get bonding channels. 141 * @curchan: Pointer to dfs_channels to know width and primary channel. 142 * @segment_id: Segment id, useful for 80+80/160 MHz operating band. 143 * @channels: Pointer to save radar affected channels. 144 * 145 * Return: Number of channels. 146 */ 147 uint8_t dfs_get_bonding_channels(struct dfs_channel *curchan, 148 uint32_t segment_id, 149 uint8_t *channels); 150 151 /** 152 * dfs_get_bonding_channels_without_seg_info() - Get bonding channels in chan 153 * @chan: Pointer to dfs_channel structure. 154 * @channels: channel array holding list of bonded channels. 155 * 156 * Return: number of sub channels in the input channel. 157 */ 158 uint8_t dfs_get_bonding_channels_without_seg_info(struct dfs_channel *chan, 159 uint8_t *channels); 160 #endif /*_DFS_PROCESS_RADAR_FOUND_IND_H_ */ 161