cdp_txrx_mob_def.h 14 KB

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