Mukul Sharma | d75a667 | 2017-06-22 15:40:53 +0530 | [diff] [blame] | 1 | /* |
Dustin Brown | f2e2fac | 2018-03-02 15:34:22 -0800 | [diff] [blame] | 2 | * Copyright (c) 2017-2018 The Linux Foundation. All rights reserved. |
Jeff Johnson | b4c2996 | 2017-10-07 19:35:14 -0700 | [diff] [blame] | 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 | * DOC: Declare various struct, macros which shall be used in |
| 20 | * pmo wow related features. |
| 21 | * |
| 22 | * Note: This file shall not contain public API's prototype/declarations. |
| 23 | * |
| 24 | */ |
Mukul Sharma | d75a667 | 2017-06-22 15:40:53 +0530 | [diff] [blame] | 25 | |
| 26 | #ifndef _WLAN_PMO_WOW_PUBLIC_STRUCT_H_ |
| 27 | #include "wlan_pmo_lphb_public_struct.h" |
| 28 | |
| 29 | #define _WLAN_PMO_WOW_PUBLIC_STRUCT_H_ |
| 30 | |
Rachit Kankane | 8863cba | 2018-06-05 17:31:48 +0530 | [diff] [blame^] | 31 | #ifndef PMO_WOW_FILTERS_MAX |
Wu Gao | ffb9c72 | 2018-05-31 10:37:11 +0800 | [diff] [blame] | 32 | #define PMO_WOW_FILTERS_MAX 22 |
Rachit Kankane | 8863cba | 2018-06-05 17:31:48 +0530 | [diff] [blame^] | 33 | #endif |
Wu Gao | ffb9c72 | 2018-05-31 10:37:11 +0800 | [diff] [blame] | 34 | |
Mukul Sharma | d75a667 | 2017-06-22 15:40:53 +0530 | [diff] [blame] | 35 | #define PMO_WOWL_PTRN_MAX_SIZE 146 |
| 36 | #define PMO_WOWL_PTRN_MASK_MAX_SIZE 19 |
Mukul Sharma | d75a667 | 2017-06-22 15:40:53 +0530 | [diff] [blame] | 37 | #define PMO_WOWL_BCAST_PATTERN_MAX_SIZE 146 |
| 38 | |
| 39 | #define PMO_WOW_INTER_PTRN_TOKENIZER ';' |
| 40 | #define PMO_WOW_INTRA_PTRN_TOKENIZER ':' |
| 41 | |
Mukul Sharma | 0c1c379 | 2017-11-02 17:08:23 +0530 | [diff] [blame] | 42 | #define PMO_WOW_PTRN_MASK_VALID 0xFF |
| 43 | #define PMO_NUM_BITS_IN_BYTE 8 |
| 44 | |
Mukul Sharma | d75a667 | 2017-06-22 15:40:53 +0530 | [diff] [blame] | 45 | |
| 46 | /* Action frame categories */ |
| 47 | |
| 48 | #define PMO_MAC_ACTION_SPECTRUM_MGMT 0 |
| 49 | #define PMO_MAC_ACTION_QOS_MGMT 1 |
| 50 | #define PMO_MAC_ACTION_DLP 2 |
| 51 | #define PMO_MAC_ACTION_BLKACK 3 |
| 52 | #define PMO_MAC_ACTION_PUBLIC_USAGE 4 |
| 53 | #define PMO_MAC_ACTION_RRM 5 |
| 54 | #define PMO_MAC_ACTION_FAST_BSS_TRNST 6 |
| 55 | #define PMO_MAC_ACTION_HT 7 |
| 56 | #define PMO_MAC_ACTION_SA_QUERY 8 |
| 57 | #define PMO_MAC_ACTION_PROT_DUAL_PUB 9 |
| 58 | #define PMO_MAC_ACTION_WNM 10 |
| 59 | #define PMO_MAC_ACTION_UNPROT_WNM 11 |
| 60 | #define PMO_MAC_ACTION_TDLS 12 |
| 61 | #define PMO_MAC_ACITON_MESH 13 |
| 62 | #define PMO_MAC_ACTION_MHF 14 |
| 63 | #define PMO_MAC_SELF_PROTECTED 15 |
| 64 | #define PMO_MAC_ACTION_WME 17 |
| 65 | #define PMO_MAC_ACTION_FST 18 |
| 66 | #define PMO_MAC_ACTION_VHT 21 |
| 67 | #define PMO_MAC_ACTION_MAX 256 |
| 68 | |
Sridhar Selvaraj | 53166d7 | 2017-08-04 11:49:19 +0530 | [diff] [blame] | 69 | #define PMO_MAC_ACTION_MEASURE_REQUEST_ID 0 |
| 70 | #define PMO_MAC_ACTION_TPC_REQUEST_ID 2 |
Mukul Sharma | d75a667 | 2017-06-22 15:40:53 +0530 | [diff] [blame] | 71 | /* |
| 72 | * ALLOWED_ACTION_FRAMES_BITMAP |
| 73 | * |
| 74 | * Bitmask is based on the below. The frames with 0's |
| 75 | * set to their corresponding bit can be dropped in FW. |
| 76 | * |
| 77 | * -----------------------------+-----+-------+ |
| 78 | * Type | Bit | Allow | |
| 79 | * -----------------------------+-----+-------+ |
| 80 | * PMO_ACTION_SPECTRUM_MGMT 0 1 |
| 81 | * PMO_ACTION_QOS_MGMT 1 1 |
| 82 | * PMO_ACTION_DLP 2 0 |
| 83 | * PMO_ACTION_BLKACK 3 0 |
| 84 | * PMO_ACTION_PUBLIC_USAGE 4 1 |
Srinivas Girigowda | 31cef19 | 2017-10-09 17:31:49 -0700 | [diff] [blame] | 85 | * PMO_ACTION_RRM 5 0 |
Mukul Sharma | d75a667 | 2017-06-22 15:40:53 +0530 | [diff] [blame] | 86 | * PMO_ACTION_FAST_BSS_TRNST 6 0 |
| 87 | * PMO_ACTION_HT 7 0 |
| 88 | * PMO_ACTION_SA_QUERY 8 1 |
| 89 | * PMO_ACTION_PROT_DUAL_PUB 9 1 |
| 90 | * PMO_ACTION_WNM 10 1 |
| 91 | * PMO_ACTION_UNPROT_WNM 11 0 |
| 92 | * PMO_ACTION_TDLS 12 0 |
| 93 | * PMO_ACITON_MESH 13 0 |
| 94 | * PMO_ACTION_MHF 14 0 |
| 95 | * PMO_SELF_PROTECTED 15 0 |
| 96 | * PMO_ACTION_WME 17 1 |
| 97 | * PMO_ACTION_FST 18 1 |
| 98 | * PMO_ACTION_VHT 21 1 |
| 99 | * ----------------------------+------+-------+ |
| 100 | */ |
| 101 | #define ALLOWED_ACTION_FRAMES_BITMAP0 \ |
| 102 | ((1 << PMO_MAC_ACTION_SPECTRUM_MGMT) | \ |
| 103 | (1 << PMO_MAC_ACTION_QOS_MGMT) | \ |
| 104 | (1 << PMO_MAC_ACTION_PUBLIC_USAGE) | \ |
Mukul Sharma | d75a667 | 2017-06-22 15:40:53 +0530 | [diff] [blame] | 105 | (1 << PMO_MAC_ACTION_SA_QUERY) | \ |
| 106 | (1 << PMO_MAC_ACTION_PROT_DUAL_PUB) | \ |
| 107 | (1 << PMO_MAC_ACTION_WNM) | \ |
| 108 | (1 << PMO_MAC_ACTION_WME) | \ |
| 109 | (1 << PMO_MAC_ACTION_FST) | \ |
| 110 | (1 << PMO_MAC_ACTION_VHT)) |
| 111 | |
| 112 | #define ALLOWED_ACTION_FRAMES_BITMAP1 0x0 |
| 113 | #define ALLOWED_ACTION_FRAMES_BITMAP2 0x0 |
| 114 | #define ALLOWED_ACTION_FRAMES_BITMAP3 0x0 |
| 115 | #define ALLOWED_ACTION_FRAMES_BITMAP4 0x0 |
| 116 | #define ALLOWED_ACTION_FRAMES_BITMAP5 0x0 |
| 117 | #define ALLOWED_ACTION_FRAMES_BITMAP6 0x0 |
| 118 | #define ALLOWED_ACTION_FRAMES_BITMAP7 0x0 |
| 119 | |
| 120 | #define ALLOWED_ACTION_FRAME_MAP_WORDS (PMO_MAC_ACTION_MAX / 32) |
| 121 | |
Srinivas Girigowda | 244c3f6 | 2017-11-28 17:57:59 -0800 | [diff] [blame] | 122 | /* Public Action for 20/40 BSS Coexistence */ |
| 123 | #define PMO_MAC_ACTION_MEASUREMENT_PILOT 7 |
| 124 | |
| 125 | #define DROP_PUBLIC_ACTION_FRAME_BITMAP \ |
| 126 | (1 << PMO_MAC_ACTION_MEASUREMENT_PILOT) |
| 127 | |
Sridhar Selvaraj | 53166d7 | 2017-08-04 11:49:19 +0530 | [diff] [blame] | 128 | #ifndef ANI_SUPPORT_11H |
| 129 | /* |
| 130 | * DROP_SPEC_MGMT_ACTION_FRAME_BITMAP |
| 131 | * |
| 132 | * Bitmask is based on the below. The frames with 1's |
| 133 | * set to their corresponding bit can be dropped in FW. |
| 134 | * |
| 135 | * ----------------------------------+-----+------+ |
| 136 | * Type | Bit | Drop | |
| 137 | * ----------------------------------+-----+------+ |
| 138 | * SIR_MAC_ACTION_MEASURE_REQUEST_ID 0 1 |
Srinivas Girigowda | 244c3f6 | 2017-11-28 17:57:59 -0800 | [diff] [blame] | 139 | * SIR_MAC_ACTION_TPC_REQUEST_ID 2 1 |
Sridhar Selvaraj | 53166d7 | 2017-08-04 11:49:19 +0530 | [diff] [blame] | 140 | * ----------------------------------+-----+------+ |
| 141 | */ |
| 142 | #define DROP_SPEC_MGMT_ACTION_FRAME_BITMAP \ |
| 143 | ((1 << PMO_MAC_ACTION_MEASURE_REQUEST_ID) |\ |
| 144 | (1 << PMO_MAC_ACTION_TPC_REQUEST_ID)) |
| 145 | #else |
| 146 | /* |
| 147 | * If 11H support is defined, dont drop the above action category of |
| 148 | * spectrum mgmt action frames as host driver is processing them. |
| 149 | */ |
| 150 | #define DROP_SPEC_MGMT_ACTION_FRAME_BITMAP 0 |
| 151 | #endif /* ANI_SUPPORT_11H */ |
Mukul Sharma | d75a667 | 2017-06-22 15:40:53 +0530 | [diff] [blame] | 152 | |
| 153 | #define PMO_SUPPORTED_ACTION_CATE 256 |
| 154 | #define PMO_SUPPORTED_ACTION_CATE_ELE_LIST (PMO_SUPPORTED_ACTION_CATE/32) |
| 155 | |
| 156 | /** |
| 157 | * struct pmo_action_wakeup_set_params - action wakeup set params |
| 158 | * @vdev_id: virtual device id |
| 159 | * @operation: 0 reset to fw default, 1 set the bits, |
| 160 | * 2 add the setting bits, 3 delete the setting bits |
| 161 | * @action_category_map: bit mapping. |
Sridhar Selvaraj | 53166d7 | 2017-08-04 11:49:19 +0530 | [diff] [blame] | 162 | * @action_per_category: bitmap per action category |
Mukul Sharma | d75a667 | 2017-06-22 15:40:53 +0530 | [diff] [blame] | 163 | */ |
| 164 | struct pmo_action_wakeup_set_params { |
| 165 | uint32_t vdev_id; |
| 166 | uint32_t operation; |
| 167 | uint32_t action_category_map[PMO_SUPPORTED_ACTION_CATE_ELE_LIST]; |
Sridhar Selvaraj | 53166d7 | 2017-08-04 11:49:19 +0530 | [diff] [blame] | 168 | uint32_t action_per_category[PMO_SUPPORTED_ACTION_CATE]; |
Mukul Sharma | d75a667 | 2017-06-22 15:40:53 +0530 | [diff] [blame] | 169 | }; |
| 170 | |
| 171 | /** |
| 172 | * enum pmo_wow_action_wakeup_opertion: describe action wakeup operation |
| 173 | * @pmo_action_wakeup_reset: reset |
| 174 | * @pmo_action_wakeup_set: set |
| 175 | * @pmo_action_wakeup_add_set: add and set |
| 176 | * @pmo_action_wakeup_del_set: delete and set |
| 177 | */ |
| 178 | enum pmo_wow_action_wakeup_opertion { |
| 179 | pmo_action_wakeup_reset = 0, |
| 180 | pmo_action_wakeup_set, |
| 181 | pmo_action_wakeup_add_set, |
| 182 | pmo_action_wakeup_del_set, |
| 183 | }; |
| 184 | |
| 185 | /** |
Will Huang | 3cd2b7c | 2017-11-17 13:16:56 +0800 | [diff] [blame] | 186 | * enum pmo_wow_state: enumeration of wow state |
| 187 | * @pmo_wow_state_none: not in wow state |
| 188 | * @pmo_wow_state_legacy_d0: in d0 wow state trigger by legacy d0 wow command |
| 189 | * @pmo_wow_state_unified_d0: in d0 wow state trigger by unified wow command |
| 190 | * @pmo_wow_state_unified_d3: in d3 wow state trigger by unified wow command |
| 191 | */ |
| 192 | enum pmo_wow_state { |
| 193 | pmo_wow_state_none = 0, |
| 194 | pmo_wow_state_legacy_d0, |
| 195 | pmo_wow_state_unified_d0, |
| 196 | pmo_wow_state_unified_d3, |
| 197 | }; |
| 198 | |
| 199 | /** |
Mukul Sharma | d75a667 | 2017-06-22 15:40:53 +0530 | [diff] [blame] | 200 | * struct pmo_wow - store wow patterns |
| 201 | * @wow_enable: wow enable/disable |
| 202 | * @wow_enable_cmd_sent: is wow enable command sent to fw |
| 203 | * @is_wow_bus_suspended: true if bus is suspended |
Will Huang | 3cd2b7c | 2017-11-17 13:16:56 +0800 | [diff] [blame] | 204 | * @wow_state: state of wow |
Mukul Sharma | d75a667 | 2017-06-22 15:40:53 +0530 | [diff] [blame] | 205 | * @target_suspend: target suspend event |
| 206 | * @target_resume: target resume event |
| 207 | * @wow_nack: wow negative ack flag |
| 208 | * @wow_initial_wake_up: target initial wake up is received |
| 209 | * @wow_wake_lock: wow wake lock |
| 210 | * @lphb_cache: lphb cache |
| 211 | * @lphb_cb_ctx: callback context for lphb, kept as void* as |
| 212 | * osif structures are opaque to pmo. |
| 213 | * @pmo_lphb_callback: registered os if calllback function |
Will Huang | fe64917 | 2017-09-06 16:52:18 +0800 | [diff] [blame] | 214 | * @ptrn_id_def: default pattern id counter for legacy firmware |
| 215 | * @ptrn_id_usr: user pattern id counter for legacy firmware |
Mukul Sharma | d75a667 | 2017-06-22 15:40:53 +0530 | [diff] [blame] | 216 | * |
| 217 | * This structure stores wow patterns and |
| 218 | * wow related parameters in host. |
| 219 | */ |
| 220 | struct pmo_wow { |
| 221 | bool wow_enable; |
| 222 | bool wow_enable_cmd_sent; |
| 223 | bool is_wow_bus_suspended; |
Will Huang | 3cd2b7c | 2017-11-17 13:16:56 +0800 | [diff] [blame] | 224 | enum pmo_wow_state wow_state; |
Mukul Sharma | d75a667 | 2017-06-22 15:40:53 +0530 | [diff] [blame] | 225 | qdf_event_t target_suspend; |
| 226 | qdf_event_t target_resume; |
| 227 | int wow_nack; |
| 228 | bool wow_initial_wake_up; |
| 229 | qdf_wake_lock_t wow_wake_lock; |
| 230 | /* |
| 231 | * currently supports only vdev 0. |
| 232 | * cache has two entries: one for TCP and one for UDP. |
| 233 | */ |
| 234 | struct pmo_lphb_req lphb_cache[2]; |
| 235 | void *lphb_cb_ctx; |
| 236 | pmo_lphb_callback lphb_cb; |
Will Huang | fe64917 | 2017-09-06 16:52:18 +0800 | [diff] [blame] | 237 | |
| 238 | uint8_t ptrn_id_def; |
| 239 | uint8_t ptrn_id_usr; |
Mukul Sharma | d75a667 | 2017-06-22 15:40:53 +0530 | [diff] [blame] | 240 | }; |
| 241 | |
| 242 | /* WOW related structures */ |
| 243 | /** |
| 244 | * struct pmo_wow_add_pattern - wow pattern add structure |
| 245 | * @pattern_id: pattern id |
| 246 | * @pattern_byte_offset: pattern byte offset from beginning of the 802.11 |
| 247 | * packet to start of the wake-up pattern |
| 248 | * @pattern_size: pattern size |
| 249 | * @pattern: pattern byte stream |
| 250 | * @pattern_mask_size: pattern mask size |
| 251 | * @pattern_mask: pattern mask |
| 252 | * @session_id: session id |
| 253 | */ |
| 254 | struct pmo_wow_add_pattern { |
| 255 | uint8_t pattern_id; |
| 256 | uint8_t pattern_byte_offset; |
| 257 | uint8_t pattern_size; |
| 258 | uint8_t pattern[PMO_WOWL_BCAST_PATTERN_MAX_SIZE]; |
| 259 | uint8_t pattern_mask_size; |
| 260 | uint8_t pattern_mask[PMO_WOWL_BCAST_PATTERN_MAX_SIZE]; |
| 261 | uint8_t session_id; |
| 262 | }; |
| 263 | |
| 264 | /** |
Mukul Sharma | d75a667 | 2017-06-22 15:40:53 +0530 | [diff] [blame] | 265 | * struct pmo_wow_cmd_params - wow cmd parameter |
| 266 | * @enable: wow enable or disable flag |
| 267 | * @can_suspend_link: flag to indicate if link can be suspended |
| 268 | * @pause_iface_config: interface config |
| 269 | */ |
| 270 | struct pmo_wow_cmd_params { |
| 271 | bool enable; |
| 272 | bool can_suspend_link; |
| 273 | uint8_t pause_iface_config; |
| 274 | uint32_t flags; |
| 275 | }; |
| 276 | |
| 277 | /** |
| 278 | * struct pmo_suspend_params - suspend cmd parameter |
| 279 | * @disable_target_intr: disable target interrupt |
| 280 | */ |
| 281 | struct pmo_suspend_params { |
| 282 | uint8_t disable_target_intr; |
| 283 | }; |
| 284 | |
| 285 | #endif /* end of _WLAN_PMO_WOW_PUBLIC_STRUCT_H_ */ |