1 /* 2 * Copyright (c) 2016-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 #ifndef __CDP_TXRX_MOB_DEF_H 20 #define __CDP_TXRX_MOB_DEF_H 21 #include <sir_types.h> 22 #include <htt.h> 23 24 #define TX_WMM_AC_NUM 4 25 26 #define OL_TXQ_PAUSE_REASON_FW (1 << 0) 27 #define OL_TXQ_PAUSE_REASON_PEER_UNAUTHORIZED (1 << 1) 28 #define OL_TXQ_PAUSE_REASON_TX_ABORT (1 << 2) 29 #define OL_TXQ_PAUSE_REASON_VDEV_STOP (1 << 3) 30 #define OL_TXQ_PAUSE_REASON_THERMAL_MITIGATION (1 << 4) 31 32 #define OL_TXRX_INVALID_NUM_PEERS (-1) 33 34 #define OL_TXRX_MAC_ADDR_LEN 6 35 36 37 /* Maximum number of station supported by data path, including BC. */ 38 #define WLAN_MAX_STA_COUNT (HAL_NUM_STA) 39 40 /* The symbolic station ID return to HDD to specify the packet is bc/mc */ 41 #define WLAN_RX_BCMC_STA_ID (WLAN_MAX_STA_COUNT + 1) 42 43 /* The symbolic station ID return to HDD to specify the packet is 44 to soft-AP itself */ 45 #define WLAN_RX_SAP_SELF_STA_ID (WLAN_MAX_STA_COUNT + 2) 46 47 /* is 802.11 address multicast/broadcast? */ 48 #define IEEE80211_IS_MULTICAST(_a) (*(_a) & 0x01) 49 50 #define MAX_PEERS 32 51 52 /* 53 * Bins used for reporting delay histogram: 54 * bin 0: 0 - 10 ms delay 55 * bin 1: 10 - 20 ms delay 56 * bin 2: 20 - 40 ms delay 57 * bin 3: 40 - 80 ms delay 58 * bin 4: 80 - 160 ms delay 59 * bin 5: > 160 ms delay 60 */ 61 #define QCA_TX_DELAY_HIST_REPORT_BINS 6 62 63 /* BA actions */ 64 #define IEEE80211_ACTION_BA_ADDBA_REQUEST 0 /* ADDBA request */ 65 #define IEEE80211_ACTION_BA_ADDBA_RESPONSE 1 /* ADDBA response */ 66 #define IEEE80211_ACTION_BA_DELBA 2 /* DELBA */ 67 68 #define IEEE80211_BA_POLICY_DELAYED 0 69 #define IEEE80211_BA_POLICY_IMMEDIATE 1 70 #define IEEE80211_BA_AMSDU_SUPPORTED 1 71 72 /** 73 * enum netif_action_type - Type of actions on netif queues 74 * @WLAN_STOP_ALL_NETIF_QUEUE: stop all netif queues 75 * @WLAN_START_ALL_NETIF_QUEUE: start all netif queues 76 * @WLAN_WAKE_ALL_NETIF_QUEUE: wake all netif queues 77 * @WLAN_STOP_ALL_NETIF_QUEUE_N_CARRIER: stop all queues and off carrier 78 * @WLAN_START_ALL_NETIF_QUEUE_N_CARRIER: start all queues and on carrier 79 * @WLAN_NETIF_TX_DISABLE: disable tx 80 * @WLAN_NETIF_TX_DISABLE_N_CARRIER: disable tx and off carrier 81 * @WLAN_NETIF_CARRIER_ON: on carrier 82 * @WLAN_NETIF_CARRIER_OFF: off carrier 83 * @WLAN_NETIF_PRIORITY_QUEUE_ON: start priority netif queues 84 * @WLAN_NETIF_PRIORITY_QUEUE_OFF: stop priority netif queues 85 * @WLAN_WAKE_NON_PRIORITY_QUEUE: wake non priority netif queues 86 * @WLAN_STOP_NON_PRIORITY_QUEUE: stop non priority netif queues 87 */ 88 enum netif_action_type { 89 WLAN_STOP_ALL_NETIF_QUEUE = 1, 90 WLAN_START_ALL_NETIF_QUEUE, 91 WLAN_WAKE_ALL_NETIF_QUEUE, 92 WLAN_STOP_ALL_NETIF_QUEUE_N_CARRIER, 93 WLAN_START_ALL_NETIF_QUEUE_N_CARRIER, 94 WLAN_NETIF_TX_DISABLE, 95 WLAN_NETIF_TX_DISABLE_N_CARRIER, 96 WLAN_NETIF_CARRIER_ON, 97 WLAN_NETIF_CARRIER_OFF, 98 WLAN_NETIF_PRIORITY_QUEUE_ON, 99 WLAN_NETIF_PRIORITY_QUEUE_OFF, 100 WLAN_WAKE_NON_PRIORITY_QUEUE, 101 WLAN_STOP_NON_PRIORITY_QUEUE, 102 WLAN_NETIF_ACTION_TYPE_MAX, 103 }; 104 105 /** 106 * enum netif_reason_type - reason for netif queue action 107 * @WLAN_CONTROL_PATH: action from control path 108 * @WLAN_DATA_FLOW_CONTROL: because of flow control 109 * @WLAN_FW_PAUSE: because of firmware pause 110 * @WLAN_TX_ABORT: because of tx abort 111 * @WLAN_VDEV_STOP: because of vdev stop 112 * @WLAN_PEER_UNAUTHORISED: because of peer is unauthorised 113 * @WLAN_THERMAL_MITIGATION: because of thermal mitigation 114 */ 115 enum netif_reason_type { 116 WLAN_CONTROL_PATH = 1, 117 WLAN_DATA_FLOW_CONTROL, 118 WLAN_FW_PAUSE, 119 WLAN_TX_ABORT, 120 WLAN_VDEV_STOP, 121 WLAN_PEER_UNAUTHORISED, 122 WLAN_THERMAL_MITIGATION, 123 WLAN_DATA_FLOW_CONTROL_PRIORITY, 124 WLAN_REASON_TYPE_MAX, 125 }; 126 127 enum ol_rx_err_type { 128 OL_RX_ERR_DEFRAG_MIC, 129 OL_RX_ERR_PN, 130 OL_RX_ERR_UNKNOWN_PEER, 131 OL_RX_ERR_MALFORMED, 132 OL_RX_ERR_TKIP_MIC, 133 OL_RX_ERR_DECRYPT, 134 OL_RX_ERR_MPDU_LENGTH, 135 OL_RX_ERR_ENCRYPT_REQUIRED, 136 OL_RX_ERR_DUP, 137 OL_RX_ERR_UNKNOWN, 138 OL_RX_ERR_FCS, 139 OL_RX_ERR_PRIVACY, 140 OL_RX_ERR_NONE_FRAG, 141 OL_RX_ERR_NONE = 0xFF 142 }; 143 144 enum throttle_level { 145 THROTTLE_LEVEL_0, 146 THROTTLE_LEVEL_1, 147 THROTTLE_LEVEL_2, 148 THROTTLE_LEVEL_3, 149 /* Invalid */ 150 THROTTLE_LEVEL_MAX, 151 }; 152 153 enum { 154 OL_TX_WMM_AC_BE, 155 OL_TX_WMM_AC_BK, 156 OL_TX_WMM_AC_VI, 157 OL_TX_WMM_AC_VO, 158 OL_TX_NUM_WMM_AC 159 }; 160 161 /** 162 * @enum ol_tx_spec 163 * @brief indicate what non-standard transmission actions to apply 164 * @details 165 * Indicate one or more of the following: 166 * - The tx frame already has a complete 802.11 header. 167 * Thus, skip 802.3/native-WiFi to 802.11 header encapsulation and 168 * A-MSDU aggregation. 169 * - The tx frame should not be aggregated (A-MPDU or A-MSDU) 170 * - The tx frame is already encrypted - don't attempt encryption. 171 * - The tx frame is a segment of a TCP jumbo frame. 172 * - This tx frame should not be unmapped and freed by the txrx layer 173 * after transmission, but instead given to a registered tx completion 174 * callback. 175 * More than one of these specification can apply, though typically 176 * only a single specification is applied to a tx frame. 177 * A compound specification can be created, as a bit-OR of these 178 * specifications. 179 */ 180 enum ol_tx_spec { 181 OL_TX_SPEC_STD = 0x0, /* do regular processing */ 182 OL_TX_SPEC_RAW = 0x1, /* skip encap + A-MSDU aggr */ 183 OL_TX_SPEC_NO_AGGR = 0x2, /* skip encap + all aggr */ 184 OL_TX_SPEC_NO_ENCRYPT = 0x4, /* skip encap + encrypt */ 185 OL_TX_SPEC_TSO = 0x8, /* TCP segmented */ 186 OL_TX_SPEC_NWIFI_NO_ENCRYPT = 0x10, /* skip encrypt for nwifi */ 187 OL_TX_SPEC_NO_FREE = 0x20, /* give to cb rather than free */ 188 }; 189 190 /** 191 * @enum peer_debug_id_type: debug ids to track peer get_ref and release_ref 192 * @brief Unique peer debug IDs to track the callers. Each new usage can add to 193 * this enum list to create a new "PEER_DEBUG_ID_". 194 * @PEER_DEBUG_ID_OL_INTERNAL: debug id for OL internal usage 195 * @PEER_DEBUG_ID_WMA_PKT_DROP: debug id for wma_is_pkt_drop_candidate API 196 * @PEER_DEBUG_ID_WMA_ADDBA_REQ: debug id for ADDBA request 197 * @PEER_DEBUG_ID_WMA_DELBA_REQ: debug id for DELBA request 198 * @PEER_DEBUG_ID_LIM_SEND_ADDBA_RESP: debug id for send ADDBA response 199 * @PEER_DEBUG_ID_OL_RX_THREAD: debug id for rx thread 200 * @PEER_DEBUG_ID_MAX: debug id MAX 201 */ 202 enum peer_debug_id_type { 203 PEER_DEBUG_ID_OL_INTERNAL = 0, 204 PEER_DEBUG_ID_WMA_PKT_DROP = 1, 205 PEER_DEBUG_ID_WMA_ADDBA_REQ = 2, 206 PEER_DEBUG_ID_WMA_DELBA_REQ = 3, 207 PEER_DEBUG_ID_LIM_SEND_ADDBA_RESP = 4, 208 PEER_DEBUG_ID_OL_RX_THREAD = 5, 209 PEER_DEBUG_ID_MAX 210 }; 211 212 /** 213 * struct ol_txrx_desc_type - txrx descriptor type 214 * @sta_id: sta id 215 * @is_qos_enabled: is station qos enabled 216 * @is_wapi_supported: is station wapi supported 217 */ 218 struct ol_txrx_desc_type { 219 uint8_t sta_id; 220 uint8_t is_qos_enabled; 221 uint8_t is_wapi_supported; 222 }; 223 224 /** 225 * struct ol_tx_sched_wrr_ac_specs_t - the wrr ac specs params structure 226 * @wrr_skip_weight: map to ol_tx_sched_wrr_adv_category_info_t.specs. 227 * wrr_skip_weight 228 * @credit_threshold: map to ol_tx_sched_wrr_adv_category_info_t.specs. 229 * credit_threshold 230 * @send_limit: map to ol_tx_sched_wrr_adv_category_info_t.specs. 231 * send_limit 232 * @credit_reserve: map to ol_tx_sched_wrr_adv_category_info_t.specs. 233 * credit_reserve 234 * @discard_weight: map to ol_tx_sched_wrr_adv_category_info_t.specs. 235 * discard_weight 236 * 237 * This structure is for wrr ac specs params set from user, it will update 238 * its content corresponding to the ol_tx_sched_wrr_adv_category_info_t.specs. 239 */ 240 struct ol_tx_sched_wrr_ac_specs_t { 241 int wrr_skip_weight; 242 uint32_t credit_threshold; 243 uint16_t send_limit; 244 int credit_reserve; 245 int discard_weight; 246 }; 247 248 /** 249 * struct txrx_pdev_cfg_param_t - configuration information 250 * passed to the data path 251 */ 252 struct txrx_pdev_cfg_param_t { 253 uint8_t is_full_reorder_offload; 254 /* IPA Micro controller data path offload enable flag */ 255 uint8_t is_uc_offload_enabled; 256 /* IPA Micro controller data path offload TX buffer count */ 257 uint32_t uc_tx_buffer_count; 258 /* IPA Micro controller data path offload TX buffer size */ 259 uint32_t uc_tx_buffer_size; 260 /* IPA Micro controller data path offload RX indication ring count */ 261 uint32_t uc_rx_indication_ring_count; 262 /* IPA Micro controller data path offload TX partition base */ 263 uint32_t uc_tx_partition_base; 264 /* IP, TCP and UDP checksum offload */ 265 bool ip_tcp_udp_checksum_offload; 266 /* Rx processing in thread from TXRX */ 267 bool enable_rxthread; 268 /* CE classification enabled through INI */ 269 bool ce_classify_enabled; 270 #ifdef QCA_LL_TX_FLOW_CONTROL_V2 271 /* Threshold to stop queue in percentage */ 272 uint32_t tx_flow_stop_queue_th; 273 /* Start queue offset in percentage */ 274 uint32_t tx_flow_start_queue_offset; 275 #endif 276 277 struct ol_tx_sched_wrr_ac_specs_t ac_specs[TX_WMM_AC_NUM]; 278 }; 279 280 #ifdef IPA_OFFLOAD 281 /** 282 * ol_txrx_ipa_resources - Resources needed for IPA 283 */ 284 struct ol_txrx_ipa_resources { 285 qdf_dma_addr_t ce_sr_base_paddr; 286 uint32_t ce_sr_ring_size; 287 qdf_dma_addr_t ce_reg_paddr; 288 289 qdf_dma_addr_t tx_comp_ring_base_paddr; 290 uint32_t tx_comp_ring_size; 291 uint32_t tx_num_alloc_buffer; 292 293 qdf_dma_addr_t rx_rdy_ring_base_paddr; 294 uint32_t rx_rdy_ring_size; 295 qdf_dma_addr_t rx_proc_done_idx_paddr; 296 void *rx_proc_done_idx_vaddr; 297 298 qdf_dma_addr_t rx2_rdy_ring_base_paddr; 299 uint32_t rx2_rdy_ring_size; 300 qdf_dma_addr_t rx2_proc_done_idx_paddr; 301 void *rx2_proc_done_idx_vaddr; 302 303 /* IPA UC doorbell registers paddr */ 304 qdf_dma_addr_t tx_comp_doorbell_paddr; 305 qdf_dma_addr_t rx_ready_doorbell_paddr; 306 307 uint32_t tx_pipe_handle; 308 uint32_t rx_pipe_handle; 309 }; 310 #endif 311 312 struct ol_txrx_ocb_chan_info { 313 uint32_t chan_freq; 314 uint16_t disable_rx_stats_hdr:1; 315 }; 316 317 /** 318 * ol_mic_error_info - carries the information associated with 319 * a MIC error 320 * @vdev_id: virtual device ID 321 * @key_id: Key ID 322 * @pn: packet number 323 * @sa: source address 324 * @da: destination address 325 * @ta: transmitter address 326 */ 327 struct ol_mic_error_info { 328 uint8_t vdev_id; 329 uint32_t key_id; 330 uint64_t pn; 331 uint8_t sa[OL_TXRX_MAC_ADDR_LEN]; 332 uint8_t da[OL_TXRX_MAC_ADDR_LEN]; 333 uint8_t ta[OL_TXRX_MAC_ADDR_LEN]; 334 }; 335 336 /** 337 * ol_error_info - carries the information associated with an 338 * error indicated by the firmware 339 * @mic_err: MIC error information 340 */ 341 struct ol_error_info { 342 union { 343 struct ol_mic_error_info mic_err; 344 } u; 345 }; 346 347 348 /** 349 * struct ol_txrx_ocb_set_chan - txrx OCB channel info 350 * @ocb_channel_count: Channel count 351 * @ocb_channel_info: OCB channel info 352 */ 353 struct ol_txrx_ocb_set_chan { 354 uint32_t ocb_channel_count; 355 struct ol_txrx_ocb_chan_info *ocb_channel_info; 356 }; 357 358 /** 359 * @brief Parameter type to pass WMM setting to ol_txrx_set_wmm_param 360 * @details 361 * The struct is used to specify informaiton to update TX WMM scheduler. 362 */ 363 struct ol_tx_ac_param_t { 364 uint32_t aifs; 365 uint32_t cwmin; 366 uint32_t cwmax; 367 }; 368 369 struct ol_tx_wmm_param_t { 370 struct ol_tx_ac_param_t ac[OL_TX_NUM_WMM_AC]; 371 }; 372 373 struct ieee80211_ba_parameterset { 374 #if _BYTE_ORDER == _BIG_ENDIAN 375 uint16_t buffersize:10, /* B6-15 buffer size */ 376 tid:4, /* B2-5 TID */ 377 bapolicy:1, /* B1 block ack policy */ 378 amsdusupported:1; /* B0 amsdu supported */ 379 #else 380 uint16_t amsdusupported:1, /* B0 amsdu supported */ 381 bapolicy:1, /* B1 block ack policy */ 382 tid:4, /* B2-5 TID */ 383 buffersize:10; /* B6-15 buffer size */ 384 #endif 385 } __packed; 386 387 struct ieee80211_ba_seqctrl { 388 #if _BYTE_ORDER == _BIG_ENDIAN 389 uint16_t startseqnum:12, /* B4-15 starting sequence number */ 390 fragnum:4; /* B0-3 fragment number */ 391 #else 392 uint16_t fragnum:4, /* B0-3 fragment number */ 393 startseqnum:12; /* B4-15 starting sequence number */ 394 #endif 395 } __packed; 396 397 struct ieee80211_delba_parameterset { 398 #if _BYTE_ORDER == _BIG_ENDIAN 399 uint16_t tid:4, /* B12-15 tid */ 400 initiator:1, /* B11 initiator */ 401 reserved0:11; /* B0-10 reserved */ 402 #else 403 uint16_t reserved0:11, /* B0-10 reserved */ 404 initiator:1, /* B11 initiator */ 405 tid:4; /* B12-15 tid */ 406 #endif 407 } __packed; 408 409 /** 410 * ol_txrx_vdev_peer_remove_cb - wma_remove_peer callback 411 */ 412 typedef void (*ol_txrx_vdev_peer_remove_cb)(void *handle, uint8_t *bssid, 413 uint8_t vdev_id, void *peer); 414 415 /** 416 * ol_txrx_tx_flow_control_fp - tx flow control notification 417 * function from txrx to OS shim 418 * @osif_dev - the virtual device's OS shim object 419 * @tx_resume - tx os q should be resumed or not 420 */ 421 typedef void (*ol_txrx_tx_flow_control_fp)(void *osif_dev, bool tx_resume); 422 423 /** 424 * ol_txrx_tx_flow_control_is_pause_fp - is tx paused by flow control 425 * function from txrx to OS shim 426 * @osif_dev - the virtual device's OS shim object 427 * 428 * Return: true if tx is paused by flow control 429 */ 430 typedef bool (*ol_txrx_tx_flow_control_is_pause_fp)(void *osif_dev); 431 432 /** 433 * ol_txrx_tx_flow_control_fp - tx flow control notification 434 * function from txrx to OS shim 435 * @osif_dev - the virtual device's OS shim object 436 * @tx_resume - tx os q should be resumed or not 437 */ 438 typedef void (*tx_flow_control_fp)(void *osif_dev, 439 bool tx_resume); 440 441 /** 442 * @typedef tx_pause_callback 443 * @brief OSIF function registered with the data path 444 */ 445 typedef void (*tx_pause_callback)(uint8_t vdev_id, 446 enum netif_action_type action, 447 enum netif_reason_type reason); 448 449 typedef void (*ipa_uc_op_cb_type)(uint8_t *op_msg, 450 void *osif_ctxt); 451 452 #endif /* __CDP_TXRX_MOB_DEF_H */ 453