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