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