cdp_txrx_cmn_struct.h 40 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448
  1. /*
  2. * Copyright (c) 2011-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. * @file cdp_txrx_cmn_struct.h
  20. * @brief Define the host data path converged API functions
  21. * called by the host control SW and the OS interface module
  22. */
  23. #ifndef _CDP_TXRX_CMN_STRUCT_H_
  24. #define _CDP_TXRX_CMN_STRUCT_H_
  25. /**
  26. * For WIN legacy header compilation
  27. * Temporary add dummy definitions
  28. * should be removed properly WIN legacy code handle
  29. */
  30. #include "htc_api.h"
  31. #include "qdf_types.h"
  32. #include "qdf_nbuf.h"
  33. #include "qdf_atomic.h"
  34. #ifndef CONFIG_WIN
  35. #include <cdp_txrx_mob_def.h>
  36. #endif /* CONFIG_WIN */
  37. #include <cdp_txrx_handle.h>
  38. #ifndef OL_TXRX_NUM_LOCAL_PEER_IDS
  39. #define OL_TXRX_NUM_LOCAL_PEER_IDS 33 /* default */
  40. #endif
  41. #define CDP_BA_256_BIT_MAP_SIZE_DWORDS 8
  42. #define CDP_BA_64_BIT_MAP_SIZE_DWORDS 2
  43. #define OL_TXRX_INVALID_LOCAL_PEER_ID 0xffff
  44. #define CDP_INVALID_VDEV_ID 0xff
  45. /* 1 additional MCS is for invalid values */
  46. #define MAX_MCS (12 + 1)
  47. #define MAX_MCS_11A 8
  48. #define MAX_MCS_11B 7
  49. #define MAX_MCS_11AC 12
  50. /* 1 additional GI is for invalid values */
  51. #define MAX_GI (4 + 1)
  52. #define SS_COUNT 8
  53. #define MAX_BW 7
  54. #define MAX_RECEPTION_TYPES 4
  55. /* Options for Dump Statistics */
  56. #define CDP_HDD_STATS 0
  57. #define CDP_TXRX_PATH_STATS 1
  58. #define CDP_TXRX_HIST_STATS 2
  59. #define CDP_TXRX_TSO_STATS 3
  60. #define CDP_HDD_NETIF_OPER_HISTORY 4
  61. #define CDP_DUMP_TX_FLOW_POOL_INFO 5
  62. #define CDP_TXRX_DESC_STATS 6
  63. #define CDP_HIF_STATS 7
  64. #define CDP_LRO_STATS 8
  65. #define CDP_NAPI_STATS 9
  66. #define CDP_WLAN_RX_BUF_DEBUG_STATS 10
  67. #define CDP_RX_RING_STATS 11
  68. #define CDP_DP_NAPI_STATS 12
  69. #define CDP_SCHEDULER_STATS 21
  70. #define CDP_TX_QUEUE_STATS 22
  71. #define CDP_BUNDLE_STATS 23
  72. #define CDP_CREDIT_STATS 24
  73. #define CDP_DISCONNECT_STATS 25
  74. /* WME stream classes */
  75. #define WME_AC_BE 0 /* best effort */
  76. #define WME_AC_BK 1 /* background */
  77. #define WME_AC_VI 2 /* video */
  78. #define WME_AC_VO 3 /* voice */
  79. #define WME_AC_MAX 4 /* MAX AC Value */
  80. #define WME_AC_TO_TID(_ac) ( \
  81. ((_ac) == WME_AC_VO) ? 6 : \
  82. ((_ac) == WME_AC_VI) ? 5 : \
  83. ((_ac) == WME_AC_BK) ? 1 : \
  84. 0)
  85. #define TID_TO_WME_AC(_tid) ( \
  86. (((_tid) == 0) || ((_tid) == 3)) ? WME_AC_BE : \
  87. (((_tid) == 1) || ((_tid) == 2)) ? WME_AC_BK : \
  88. (((_tid) == 4) || ((_tid) == 5)) ? WME_AC_VI : \
  89. WME_AC_VO)
  90. #define CDP_MAX_RX_RINGS 4
  91. #define CDP_MU_MAX_USERS 8
  92. #define CDP_MU_MAX_USER_INDEX (CDP_MU_MAX_USERS - 1)
  93. /*
  94. * advance rx monitor filter
  95. * */
  96. #define MON_FILTER_PASS 0x0001
  97. #define MON_FILTER_OTHER 0x0002
  98. #define MON_FILTER_ALL 0x0003
  99. #define FILTER_MGMT_ALL 0xFFFF
  100. #define FILTER_MGMT_ASSOC_REQ 0x0001
  101. #define FILTER_MGMT_ASSOC_RES 0x0002
  102. #define FILTER_MGMT_REASSOC_REQ 0x0004
  103. #define FILTER_MGMT_REASSOC_RES 0x0008
  104. #define FILTER_MGMT_PROBE_REQ 0x0010
  105. #define FILTER_MGMT_PROBE_RES 0x0020
  106. #define FILTER_MGMT_TIM_ADVT 0x0040
  107. #define FILTER_MGMT_RESERVED_7 0x0080
  108. #define FILTER_MGMT_BEACON 0x0100
  109. #define FILTER_MGMT_ATIM 0x0200
  110. #define FILTER_MGMT_DISASSOC 0x0400
  111. #define FILTER_MGMT_AUTH 0x0800
  112. #define FILTER_MGMT_DEAUTH 0x1000
  113. #define FILTER_MGMT_ACTION 0x2000
  114. #define FILTER_MGMT_ACT_NO_ACK 0x4000
  115. #define FILTER_MGMT_RESERVED_15 0x8000
  116. #define FILTER_CTRL_ALL 0xFFFF
  117. #define FILTER_CTRL_RESERVED_1 0x0001
  118. #define FILTER_CTRL_RESERVED_2 0x0002
  119. #define FILTER_CTRL_TRIGGER 0x0004
  120. #define FILTER_CTRL_RESERVED_4 0x0008
  121. #define FILTER_CTRL_BF_REP_POLL 0x0010
  122. #define FILTER_CTRL_VHT_NDP 0x0020
  123. #define FILTER_CTRL_FRAME_EXT 0x0040
  124. #define FILTER_CTRL_CTRLWRAP 0x0080
  125. #define FILTER_CTRL_BA_REQ 0x0100
  126. #define FILTER_CTRL_BA 0x0200
  127. #define FILTER_CTRL_PSPOLL 0x0400
  128. #define FILTER_CTRL_RTS 0x0800
  129. #define FILTER_CTRL_CTS 0x1000
  130. #define FILTER_CTRL_ACK 0x2000
  131. #define FILTER_CTRL_CFEND 0x4000
  132. #define FILTER_CTRL_CFEND_CFACK 0x8000
  133. #define FILTER_DATA_ALL 0xFFFF
  134. #define FILTER_DATA_MCAST 0x4000
  135. #define FILTER_DATA_UCAST 0x8000
  136. #define FILTER_DATA_DATA 0x0001
  137. #define FILTER_DATA_NULL 0x0008
  138. /*
  139. * DP configuration parameters
  140. */
  141. enum cdp_cfg_param_type {
  142. CDP_CFG_MAX_PEER_ID,
  143. CDP_CFG_CCE_DISABLE,
  144. CDP_CFG_NUM_PARAMS
  145. };
  146. /*
  147. * htt_dbg_stats_type -
  148. * bit positions for each stats type within a stats type bitmask
  149. * The bitmask contains 24 bits.
  150. */
  151. enum htt_cmn_dbg_stats_type {
  152. HTT_DBG_CMN_STATS_WAL_PDEV_TXRX = 0, /* bit 0 -> 0x1 */
  153. HTT_DBG_CMN_STATS_RX_REORDER = 1, /* bit 1 -> 0x2 */
  154. HTT_DBG_CMN_STATS_RX_RATE_INFO = 2, /* bit 2 -> 0x4 */
  155. HTT_DBG_CMN_STATS_TX_PPDU_LOG = 3, /* bit 3 -> 0x8 */
  156. HTT_DBG_CMN_STATS_TX_RATE_INFO = 4, /* bit 4 -> 0x10 */
  157. HTT_DBG_CMN_STATS_TIDQ = 5, /* bit 5 -> 0x20 */
  158. HTT_DBG_CMN_STATS_TXBF_INFO = 6, /* bit 6 -> 0x40 */
  159. HTT_DBG_CMN_STATS_SND_INFO = 7, /* bit 7 -> 0x80 */
  160. HTT_DBG_CMN_STATS_ERROR_INFO = 8, /* bit 8 -> 0x100 */
  161. HTT_DBG_CMN_STATS_TX_SELFGEN_INFO = 9, /* bit 9 -> 0x200 */
  162. HTT_DBG_CMN_STATS_TX_MU_INFO = 10, /* bit 10 -> 0x400 */
  163. HTT_DBG_CMN_STATS_SIFS_RESP_INFO = 11, /* bit 11 -> 0x800 */
  164. HTT_DBG_CMN_STATS_RESET_INFO = 12, /* bit 12 -> 0x1000 */
  165. HTT_DBG_CMN_STATS_MAC_WDOG_INFO = 13, /* bit 13 -> 0x2000 */
  166. HTT_DBG_CMN_STATS_TX_DESC_INFO = 14, /* bit 14 -> 0x4000 */
  167. HTT_DBG_CMN_STATS_TX_FETCH_MGR_INFO = 15, /* bit 15 -> 0x8000 */
  168. HTT_DBG_CMN_STATS_TX_PFSCHED_INFO = 16, /* bit 16 -> 0x10000 */
  169. HTT_DBG_CMN_STATS_TX_PATH_STATS_INFO = 17, /* bit 17 -> 0x20000 */
  170. /* bits 18-23 currently reserved */
  171. /* keep this last */
  172. HTT_DBG_CMN_NUM_STATS
  173. };
  174. /*
  175. * cdp_host_txrx_stats: Different types of host stats
  176. * @TXRX_HOST_STATS_INVALID: Invalid option
  177. * @TXRX_RX_RATE_STATS: Rx rate info
  178. * @TXRX_TX_RATE_STATS: Tx rate info
  179. * @TXRX_TX_HOST_STATS: Print Tx stats
  180. * @TXRX_RX_HOST_STATS: Print host Rx stats
  181. * @TXRX_CLEAR_STATS: clear all host stats
  182. * @TXRX_SRNG_PTR_STATS: Print SRNG pointer stats
  183. */
  184. enum cdp_host_txrx_stats {
  185. TXRX_HOST_STATS_INVALID = -1,
  186. TXRX_CLEAR_STATS = 0,
  187. TXRX_RX_RATE_STATS = 1,
  188. TXRX_TX_RATE_STATS = 2,
  189. TXRX_TX_HOST_STATS = 3,
  190. TXRX_RX_HOST_STATS = 4,
  191. TXRX_AST_STATS = 5,
  192. TXRX_SRNG_PTR_STATS = 6,
  193. TXRX_HOST_STATS_MAX,
  194. };
  195. /*
  196. * cdp_ppdu_ftype: PPDU Frame Type
  197. * @CDP_PPDU_FTYPE_DATA: SU or MU Data Frame
  198. * @CDP_PPDU_FTYPE_CTRL: Control/Management Frames
  199. */
  200. enum cdp_ppdu_ftype {
  201. CDP_PPDU_FTYPE_CTRL,
  202. CDP_PPDU_FTYPE_DATA,
  203. CDP_PPDU_FTYPE_MAX
  204. };
  205. /**
  206. * @brief General specification of the tx frame contents
  207. *
  208. * @details
  209. * for efficiency, the HTT packet type values correspond
  210. * to the bit positions of the WAL packet type values, so the
  211. * translation is a simple shift operation.
  212. */
  213. enum htt_cmn_pkt_type {
  214. htt_cmn_pkt_type_raw = 0,
  215. htt_cmn_pkt_type_native_wifi = 1,
  216. htt_cmn_pkt_type_ethernet = 2,
  217. /* keep this last */
  218. htt_cmn_pkt_num_types
  219. };
  220. enum cdp_host_reo_dest_ring {
  221. cdp_host_reo_dest_ring_unknown = 0,
  222. cdp_host_reo_dest_ring_1 = 1,
  223. cdp_host_reo_dest_ring_2 = 2,
  224. cdp_host_reo_dest_ring_3 = 3,
  225. cdp_host_reo_dest_ring_4 = 4,
  226. };
  227. enum htt_cmn_t2h_en_stats_type {
  228. /* keep this alwyas first */
  229. HTT_CMN_T2H_EN_STATS_TYPE_START = 0,
  230. /** ppdu_common_stats is the payload */
  231. HTT_CMN_T2H_EN_STATS_TYPE_COMMON = 1,
  232. /** ppdu_sant_stats is the payload */
  233. HTT_CMN_T2H_EN_STATS_TYPE_SANT = 2,
  234. /** ppdu_common_stats_v2 is the payload */
  235. HTT_CMN_T2H_EN_STATS_TYPE_COMMON_V2 = 3,
  236. /* Keep this last */
  237. HTT_CMN_T2H_EN_STATS_TYPE_END = 0x1f,
  238. };
  239. enum htt_cmn_t2h_en_stats_status {
  240. /* Keep this first always */
  241. HTT_CMN_T2H_EN_STATS_STATUS_PARTIAL = 0,
  242. HTT_CMN_T2H_EN_STATS_STATUS_PRESENT = 1,
  243. HTT_CMN_T2H_EN_STATS_STATUS_ERROR = 2,
  244. HTT_CMN_T2H_EN_STATS_STATUS_INVALID = 3,
  245. /* keep this always last */
  246. HTT_CMN_T2H_EN_STATS_STATUS_SERIES_DONE = 7,
  247. };
  248. /**
  249. * struct ol_txrx_peer_state - Peer state information
  250. */
  251. enum ol_txrx_peer_state {
  252. OL_TXRX_PEER_STATE_INVALID,
  253. OL_TXRX_PEER_STATE_DISC, /* initial state */
  254. OL_TXRX_PEER_STATE_CONN, /* authentication in progress */
  255. OL_TXRX_PEER_STATE_AUTH, /* authentication successful */
  256. };
  257. /**
  258. * struct ol_txrx_ast_type - AST entry type information
  259. */
  260. enum cdp_txrx_ast_entry_type {
  261. CDP_TXRX_AST_TYPE_NONE, /* static ast entry for connected peer */
  262. CDP_TXRX_AST_TYPE_STATIC,/* static ast entry for connected peer */
  263. CDP_TXRX_AST_TYPE_WDS, /* WDS peer ast entry type*/
  264. CDP_TXRX_AST_TYPE_MEC, /* Multicast echo ast entry type */
  265. CDP_TXRX_AST_TYPE_MAX
  266. };
  267. /**
  268. * struct cdp_sec_type - security type information
  269. */
  270. enum cdp_sec_type {
  271. cdp_sec_type_none,
  272. cdp_sec_type_wep128,
  273. cdp_sec_type_wep104,
  274. cdp_sec_type_wep40,
  275. cdp_sec_type_tkip,
  276. cdp_sec_type_tkip_nomic,
  277. cdp_sec_type_aes_ccmp,
  278. cdp_sec_type_wapi,
  279. cdp_sec_type_aes_ccmp_256,
  280. cdp_sec_type_aes_gcmp,
  281. cdp_sec_type_aes_gcmp_256,
  282. /* keep this last! */
  283. cdp_num_sec_types
  284. };
  285. typedef struct cdp_soc_t *ol_txrx_soc_handle;
  286. /**
  287. * ol_txrx_vdev_delete_cb - callback registered during vdev
  288. * detach
  289. */
  290. typedef void (*ol_txrx_vdev_delete_cb)(void *context);
  291. /**
  292. * ol_osif_vdev_handle - paque handle for OS shim virtual device
  293. * object
  294. */
  295. struct ol_osif_vdev_t;
  296. typedef struct ol_osif_vdev_t *ol_osif_vdev_handle;
  297. /**
  298. * wlan_op_mode - Virtual device operation mode
  299. * @wlan_op_mode_unknown: Unknown mode
  300. * @wlan_op_mode_ap: AP mode
  301. * @wlan_op_mode_ibss: IBSS mode
  302. * @wlan_op_mode_sta: STA (client) mode
  303. * @wlan_op_mode_monitor: Monitor mode
  304. * @wlan_op_mode_ocb: OCB mode
  305. */
  306. enum wlan_op_mode {
  307. wlan_op_mode_unknown,
  308. wlan_op_mode_ap,
  309. wlan_op_mode_ibss,
  310. wlan_op_mode_sta,
  311. wlan_op_mode_monitor,
  312. wlan_op_mode_ocb,
  313. wlan_op_mode_ndi,
  314. };
  315. /**
  316. * cdp_mgmt_tx_cb - tx management delivery notification
  317. * callback function
  318. */
  319. typedef void
  320. (*ol_txrx_mgmt_tx_cb)(void *ctxt, qdf_nbuf_t tx_mgmt_frm, int had_error);
  321. /**
  322. * ol_txrx_data_tx_cb - Function registered with the data path
  323. * that is called when tx frames marked as "no free" are
  324. * done being transmitted
  325. */
  326. typedef void
  327. (*ol_txrx_data_tx_cb)(void *ctxt, qdf_nbuf_t tx_frm, int had_error);
  328. /**
  329. * ol_txrx_tx_fp - top-level transmit function
  330. * @data_vdev - handle to the virtual device object
  331. * @msdu_list - list of network buffers
  332. */
  333. typedef qdf_nbuf_t (*ol_txrx_tx_fp)(void *data_vdev,
  334. qdf_nbuf_t msdu_list);
  335. /**
  336. * ol_txrx_tx_flow_control_fp - tx flow control notification
  337. * function from txrx to OS shim
  338. * @osif_dev - the virtual device's OS shim object
  339. * @tx_resume - tx os q should be resumed or not
  340. */
  341. typedef void (*ol_txrx_tx_flow_control_fp)(void *osif_dev,
  342. bool tx_resume);
  343. /**
  344. * ol_txrx_tx_flow_control_is_pause_fp - is tx paused by flow control
  345. * function from txrx to OS shim
  346. * @osif_dev - the virtual device's OS shim object
  347. *
  348. * Return: true if tx is paused by flow control
  349. */
  350. typedef bool (*ol_txrx_tx_flow_control_is_pause_fp)(void *osif_dev);
  351. /**
  352. * ol_txrx_rx_fp - receive function to hand batches of data
  353. * frames from txrx to OS shim
  354. * @data_vdev - handle to the OSIF virtual device object
  355. * @msdu_list - list of network buffers
  356. */
  357. typedef QDF_STATUS(*ol_txrx_rx_fp)(void *osif_dev, qdf_nbuf_t msdu_list);
  358. /**
  359. * ol_txrx_get_key_fp - function to gey key based on keyix and peer
  360. * mac address
  361. * @osif_dev - the virtual device's OS shim object
  362. * @key_buf - pointer to store key
  363. * @mac_addr - pointer to mac address
  364. * @keyix - key id
  365. */
  366. typedef QDF_STATUS(*ol_txrx_get_key_fp)(void *osif_dev, uint8_t *key_buf, uint8_t *mac_addr, uint8_t keyix);
  367. /**
  368. * ol_txrx_rsim_rx_decap_fp - raw mode simulation function to decap the
  369. * packets in receive path.
  370. * @osif_dev - the virtual device's OS shim object
  371. * @list_head - poniter to head of receive packet queue to decap
  372. * @list_tail - poniter to tail of receive packet queue to decap
  373. * @peer - Peer handler
  374. */
  375. typedef QDF_STATUS(*ol_txrx_rsim_rx_decap_fp)(void *osif_dev,
  376. qdf_nbuf_t *list_head,
  377. qdf_nbuf_t *list_tail,
  378. struct cdp_peer *peer);
  379. /* ol_txrx_rx_fp - external tx free function to read per packet stats and
  380. * free tx buffer externally
  381. * @netbuf - tx network buffer
  382. */
  383. typedef void (*ol_txrx_tx_free_ext_fp)(qdf_nbuf_t netbuf);
  384. /**
  385. * ol_txrx_rx_check_wai_fp - OSIF WAPI receive function
  386. */
  387. typedef bool (*ol_txrx_rx_check_wai_fp)(ol_osif_vdev_handle vdev,
  388. qdf_nbuf_t mpdu_head,
  389. qdf_nbuf_t mpdu_tail);
  390. /**
  391. * ol_txrx_rx_mon_fp - OSIF monitor mode receive function for single
  392. * MPDU (802.11 format)
  393. */
  394. typedef void (*ol_txrx_rx_mon_fp)(ol_osif_vdev_handle vdev,
  395. qdf_nbuf_t mpdu,
  396. void *rx_status);
  397. /**
  398. * ol_txrx_proxy_arp_fp - proxy arp function pointer
  399. */
  400. typedef int (*ol_txrx_proxy_arp_fp)(ol_osif_vdev_handle vdev,
  401. qdf_nbuf_t netbuf);
  402. /*
  403. * ol_txrx_mcast_me_fp - function pointer for multicast enhancement
  404. */
  405. typedef int (*ol_txrx_mcast_me_fp)(ol_osif_vdev_handle vdev,
  406. qdf_nbuf_t netbuf);
  407. /**
  408. * ol_txrx_stats_callback - statistics notify callback
  409. */
  410. typedef void (*ol_txrx_stats_callback)(void *ctxt,
  411. enum htt_cmn_dbg_stats_type type,
  412. uint8_t *buf, int bytes);
  413. /**
  414. * ol_txrx_ops - (pointers to) the functions used for tx and rx
  415. * data xfer
  416. *
  417. * There are two portions of these txrx operations.
  418. * The rx portion is filled in by OSIF SW before calling
  419. * ol_txrx_osif_vdev_register; inside the ol_txrx_osif_vdev_register
  420. * the txrx SW stores a copy of these rx function pointers, to use
  421. * as it delivers rx data frames to the OSIF SW.
  422. * The tx portion is filled in by the txrx SW inside
  423. * ol_txrx_osif_vdev_register; when the function call returns,
  424. * the OSIF SW stores a copy of these tx functions to use as it
  425. * delivers tx data frames to the txrx SW.
  426. *
  427. * @tx.std - the tx function pointer for standard data
  428. * frames This function pointer is set by the txrx SW
  429. * perform host-side transmit operations based on
  430. * whether a HL or LL host/target interface is in use.
  431. * @tx.flow_control_cb - the transmit flow control
  432. * function that is registered by the
  433. * OSIF which is called from txrx to
  434. * indicate whether the transmit OS
  435. * queues should be paused/resumed
  436. * @rx.std - the OS shim rx function to deliver rx data
  437. * frames to. This can have different values for
  438. * different virtual devices, e.g. so one virtual
  439. * device's OS shim directly hands rx frames to the OS,
  440. * but another virtual device's OS shim filters out P2P
  441. * messages before sending the rx frames to the OS. The
  442. * netbufs delivered to the osif_rx function are in the
  443. * format specified by the OS to use for tx and rx
  444. * frames (either 802.3 or native WiFi)
  445. * @rx.wai_check - the tx function pointer for WAPI frames
  446. * @rx.mon - the OS shim rx monitor function to deliver
  447. * monitor data to Though in practice, it is probable
  448. * that the same function will be used for delivering
  449. * rx monitor data for all virtual devices, in theory
  450. * each different virtual device can have a different
  451. * OS shim function for accepting rx monitor data. The
  452. * netbufs delivered to the osif_rx_mon function are in
  453. * 802.11 format. Each netbuf holds a 802.11 MPDU, not
  454. * an 802.11 MSDU. Depending on compile-time
  455. * configuration, each netbuf may also have a
  456. * monitor-mode encapsulation header such as a radiotap
  457. * header added before the MPDU contents.
  458. * @rx.std - the OS shim rx function to deliver rx data
  459. * @proxy_arp - proxy arp function pointer - specified by
  460. * OS shim, stored by txrx
  461. * @get_key - function pointer to get key of the peer with
  462. * specific key index
  463. */
  464. struct ol_txrx_ops {
  465. /* tx function pointers - specified by txrx, stored by OS shim */
  466. struct {
  467. ol_txrx_tx_fp tx;
  468. ol_txrx_tx_free_ext_fp tx_free_ext;
  469. } tx;
  470. /* rx function pointers - specified by OS shim, stored by txrx */
  471. struct {
  472. ol_txrx_rx_fp rx;
  473. ol_txrx_rx_check_wai_fp wai_check;
  474. ol_txrx_rx_mon_fp mon;
  475. ol_txrx_rsim_rx_decap_fp rsim_rx_decap;
  476. } rx;
  477. /* proxy arp function pointer - specified by OS shim, stored by txrx */
  478. ol_txrx_proxy_arp_fp proxy_arp;
  479. ol_txrx_mcast_me_fp me_convert;
  480. ol_txrx_get_key_fp get_key;
  481. };
  482. /**
  483. * ol_txrx_stats_req - specifications of the requested
  484. * statistics
  485. */
  486. struct ol_txrx_stats_req {
  487. uint32_t stats_type_upload_mask; /* which stats to upload */
  488. uint32_t stats_type_reset_mask; /* which stats to reset */
  489. /* stats will be printed if either print element is set */
  490. struct {
  491. int verbose; /* verbose stats printout */
  492. int concise; /* concise stats printout (takes precedence) */
  493. } print; /* print uploaded stats */
  494. /* stats notify callback will be invoked if fp is non-NULL */
  495. struct {
  496. ol_txrx_stats_callback fp;
  497. void *ctxt;
  498. } callback;
  499. /* stats will be copied into the specified buffer if buf is non-NULL */
  500. struct {
  501. uint8_t *buf;
  502. int byte_limit; /* don't copy more than this */
  503. } copy;
  504. /*
  505. * If blocking is true, the caller will take the specified semaphore
  506. * to wait for the stats to be uploaded, and the driver will release
  507. * the semaphore when the stats are done being uploaded.
  508. */
  509. struct {
  510. int blocking;
  511. /*Note: this needs to change to some qdf_* type */
  512. qdf_semaphore_t *sem_ptr;
  513. } wait;
  514. };
  515. /* DP soc struct definition */
  516. struct cdp_soc_t {
  517. struct cdp_ops *ops;
  518. struct ol_if_ops *ol_ops;
  519. };
  520. /*
  521. * cdp_pdev_param_type: different types of parameters
  522. * to set values in pdev
  523. * @CDP_CONFIG_DEBUG_SNIFFER: Enable debug sniffer feature
  524. */
  525. enum cdp_pdev_param_type {
  526. CDP_CONFIG_DEBUG_SNIFFER,
  527. };
  528. /*
  529. * cdp_vdev_param_type: different types of parameters
  530. * to set values in vdev
  531. * @CDP_ENABLE_NAWDS: set nawds enable/disable
  532. * @CDP_ENABLE_MCAST_EN: enable/disable multicast enhancement
  533. * @CDP_ENABLE_WDS: wds sta
  534. * @CDP_ENABLE_PROXYSTA: proxy sta
  535. * @CDP_UPDATE_TDLS_FLAGS: tdls link flags
  536. * @CDP_ENABLE_AP_BRIDGE: set ap_bridging enable/disable
  537. * @CDP_ENABLE_CIPHER : set cipher type based on security
  538. * @CDP_ENABLE_QWRAP_ISOLATION: qwrap isolation mode
  539. */
  540. enum cdp_vdev_param_type {
  541. CDP_ENABLE_NAWDS,
  542. CDP_ENABLE_MCAST_EN,
  543. CDP_ENABLE_WDS,
  544. CDP_ENABLE_PROXYSTA,
  545. CDP_UPDATE_TDLS_FLAGS,
  546. CDP_CFG_WDS_AGING_TIMER,
  547. CDP_ENABLE_AP_BRIDGE,
  548. CDP_ENABLE_CIPHER,
  549. CDP_ENABLE_QWRAP_ISOLATION
  550. };
  551. #define TXRX_FW_STATS_TXSTATS 1
  552. #define TXRX_FW_STATS_RXSTATS 2
  553. #define TXRX_FW_STATS_RX_RATE_INFO 3
  554. #define TXRX_FW_STATS_PHYSTATS 4
  555. #define TXRX_FW_STATS_PHYSTATS_CONCISE 5
  556. #define TXRX_FW_STATS_TX_RATE_INFO 6
  557. #define TXRX_FW_STATS_TID_STATE 7
  558. #define TXRX_FW_STATS_HOST_STATS 8
  559. #define TXRX_FW_STATS_CLEAR_HOST_STATS 9
  560. #define TXRX_FW_STATS_CE_STATS 10
  561. #define TXRX_FW_STATS_VOW_UMAC_COUNTER 11
  562. #define TXRX_FW_STATS_ME_STATS 12
  563. #define TXRX_FW_STATS_TXBF_INFO 13
  564. #define TXRX_FW_STATS_SND_INFO 14
  565. #define TXRX_FW_STATS_ERROR_INFO 15
  566. #define TXRX_FW_STATS_TX_SELFGEN_INFO 16
  567. #define TXRX_FW_STATS_TX_MU_INFO 17
  568. #define TXRX_FW_SIFS_RESP_INFO 18
  569. #define TXRX_FW_RESET_STATS 19
  570. #define TXRX_FW_MAC_WDOG_STATS 20
  571. #define TXRX_FW_MAC_DESC_STATS 21
  572. #define TXRX_FW_MAC_FETCH_MGR_STATS 22
  573. #define TXRX_FW_MAC_PREFETCH_MGR_STATS 23
  574. #define TXRX_FW_STATS_DURATION_INFO 24
  575. #define TXRX_FW_STATS_DURATION_INFO_RESET 25
  576. #define TXRX_FW_HALPHY_STATS 26
  577. #define TXRX_FW_STATS_HOST_RX_STATS 27
  578. #define PER_RADIO_FW_STATS_REQUEST 0
  579. #define PER_VDEV_FW_STATS_REQUEST 1
  580. /**
  581. * enum data_stall_log_event_indicator - Module triggering data stall
  582. * @DATA_STALL_LOG_INDICATOR_UNUSED: Unused
  583. * @DATA_STALL_LOG_INDICATOR_HOST_DRIVER: Host driver indicates data stall
  584. * @DATA_STALL_LOG_INDICATOR_FIRMWARE: FW indicates data stall
  585. * @DATA_STALL_LOG_INDICATOR_FRAMEWORK: Framework indicates data stall
  586. *
  587. * Enum indicating the module that indicates data stall event
  588. */
  589. enum data_stall_log_event_indicator {
  590. DATA_STALL_LOG_INDICATOR_UNUSED,
  591. DATA_STALL_LOG_INDICATOR_HOST_DRIVER,
  592. DATA_STALL_LOG_INDICATOR_FIRMWARE,
  593. DATA_STALL_LOG_INDICATOR_FRAMEWORK,
  594. };
  595. /**
  596. * enum data_stall_log_event_type - data stall event type
  597. * @DATA_STALL_LOG_NONE
  598. * @DATA_STALL_LOG_FW_VDEV_PAUSE
  599. * @DATA_STALL_LOG_HWSCHED_CMD_FILTER
  600. * @DATA_STALL_LOG_HWSCHED_CMD_FLUSH
  601. * @DATA_STALL_LOG_FW_RX_REFILL_FAILED
  602. * @DATA_STALL_LOG_FW_RX_FCS_LEN_ERROR
  603. * @DATA_STALL_LOG_FW_WDOG_ERRORS
  604. * @DATA_STALL_LOG_BB_WDOG_ERROR
  605. * @DATA_STALL_LOG_POST_TIM_NO_TXRX_ERROR
  606. * @DATA_STALL_LOG_HOST_STA_TX_TIMEOUT
  607. * @DATA_STALL_LOG_HOST_SOFTAP_TX_TIMEOUT
  608. * @DATA_STALL_LOG_NUD_FAILURE
  609. *
  610. * Enum indicating data stall event type
  611. */
  612. enum data_stall_log_event_type {
  613. DATA_STALL_LOG_NONE,
  614. DATA_STALL_LOG_FW_VDEV_PAUSE,
  615. DATA_STALL_LOG_HWSCHED_CMD_FILTER,
  616. DATA_STALL_LOG_HWSCHED_CMD_FLUSH,
  617. DATA_STALL_LOG_FW_RX_REFILL_FAILED,
  618. DATA_STALL_LOG_FW_RX_FCS_LEN_ERROR,
  619. DATA_STALL_LOG_FW_WDOG_ERRORS,
  620. DATA_STALL_LOG_BB_WDOG_ERROR,
  621. DATA_STALL_LOG_POST_TIM_NO_TXRX_ERROR,
  622. /* Stall events triggered by host/framework start from 0x100 onwards. */
  623. DATA_STALL_LOG_HOST_STA_TX_TIMEOUT = 0x100,
  624. DATA_STALL_LOG_HOST_SOFTAP_TX_TIMEOUT,
  625. DATA_STALL_LOG_NUD_FAILURE,
  626. };
  627. /**
  628. * enum data_stall_log_recovery_type - data stall recovery type
  629. * @DATA_STALL_LOG_RECOVERY_NONE,
  630. * @DATA_STALL_LOG_RECOVERY_CONNECT_DISCONNECT,
  631. * @DATA_STALL_LOG_RECOVERY_TRIGGER_PDR
  632. *
  633. * Enum indicating data stall recovery type
  634. */
  635. enum data_stall_log_recovery_type {
  636. DATA_STALL_LOG_RECOVERY_NONE = 0,
  637. DATA_STALL_LOG_RECOVERY_CONNECT_DISCONNECT,
  638. DATA_STALL_LOG_RECOVERY_TRIGGER_PDR,
  639. };
  640. /**
  641. * struct data_stall_event_info - data stall info
  642. * @indicator: Module triggering data stall
  643. * @data_stall_type: data stall event type
  644. * @vdev_id_bitmap: vdev_id_bitmap
  645. * @pdev_id: pdev id
  646. * @recovery_type: data stall recovery type
  647. */
  648. struct data_stall_event_info {
  649. uint32_t indicator;
  650. uint32_t data_stall_type;
  651. uint32_t vdev_id_bitmap;
  652. uint32_t pdev_id;
  653. uint32_t recovery_type;
  654. };
  655. typedef void (*data_stall_detect_cb)(struct data_stall_event_info *);
  656. /*
  657. * cdp_stats - options for host and firmware
  658. * statistics
  659. */
  660. enum cdp_stats {
  661. CDP_TXRX_STATS_0 = 0,
  662. CDP_TXRX_STATS_1,
  663. CDP_TXRX_STATS_2,
  664. CDP_TXRX_STATS_3,
  665. CDP_TXRX_STATS_4,
  666. CDP_TXRX_STATS_5,
  667. CDP_TXRX_STATS_6,
  668. CDP_TXRX_STATS_7,
  669. CDP_TXRX_STATS_8,
  670. CDP_TXRX_STATS_9,
  671. CDP_TXRX_STATS_10,
  672. CDP_TXRX_STATS_11,
  673. CDP_TXRX_STATS_12,
  674. CDP_TXRX_STATS_13,
  675. CDP_TXRX_STATS_14,
  676. CDP_TXRX_STATS_15,
  677. CDP_TXRX_STATS_16,
  678. CDP_TXRX_STATS_17,
  679. CDP_TXRX_STATS_18,
  680. CDP_TXRX_STATS_19,
  681. CDP_TXRX_STATS_20,
  682. CDP_TXRX_STATS_21,
  683. CDP_TXRX_STATS_22,
  684. CDP_TXRX_STATS_23,
  685. CDP_TXRX_STATS_24,
  686. CDP_TXRX_STATS_25,
  687. CDP_TXRX_STATS_26,
  688. CDP_TXRX_STATS_27,
  689. CDP_TXRX_STATS_HTT_MAX = 256,
  690. CDP_TXRX_MAX_STATS = 512,
  691. };
  692. /* Different Packet Types */
  693. enum cdp_packet_type {
  694. DOT11_A = 0,
  695. DOT11_B = 1,
  696. DOT11_N = 2,
  697. DOT11_AC = 3,
  698. DOT11_AX = 4,
  699. DOT11_MAX = 5,
  700. };
  701. /*
  702. * Different Stat update types sent to OL_IF
  703. * @UPDATE_PEER_STATS: update peer stats
  704. * @UPDATE_VDEV_STATS: update vdev stats
  705. * @UPDATE_PDE_STATS: Update pdev stats
  706. */
  707. enum cdp_stat_update_type {
  708. UPDATE_PEER_STATS = 0,
  709. UPDATE_VDEV_STATS = 1,
  710. UPDATE_PDEV_STATS = 2,
  711. };
  712. /* packet info */
  713. struct cdp_pkt_info {
  714. /*no of packets*/
  715. uint32_t num;
  716. /* total no of bytes */
  717. uint64_t bytes;
  718. };
  719. /* Tx Stats */
  720. struct cdp_tx_stats {
  721. /* Pkt Info for which completions were received */
  722. struct cdp_pkt_info comp_pkt;
  723. /* Unicast Packet Count */
  724. struct cdp_pkt_info ucast;
  725. /* Multicast Packet Count */
  726. struct cdp_pkt_info mcast;
  727. /*NAWDS Multicast Packet Count */
  728. struct cdp_pkt_info nawds_mcast;
  729. /*NAWDS Multicast Drop Count */
  730. uint32_t nawds_mcast_drop;
  731. /* Successful Tx Packets */
  732. struct cdp_pkt_info tx_success;
  733. /* Total Tx failure */
  734. uint32_t tx_failed;
  735. /* Total Packets as ofdma*/
  736. uint32_t ofdma;
  737. /* Packets in STBC */
  738. uint32_t stbc;
  739. /* Packets in LDPC */
  740. uint32_t ldpc;
  741. /* Packet retries */
  742. uint32_t retries;
  743. /* Number of MSDUs with no MSDU level aggregation */
  744. uint32_t non_amsdu_cnt;
  745. /* Number of MSDUs part of AMSDU*/
  746. uint32_t amsdu_cnt;
  747. /* Tx Rate */
  748. uint32_t tx_rate;
  749. /* RSSI of last packet */
  750. uint32_t last_ack_rssi;
  751. /* Packet Type */
  752. struct {
  753. /* MCS Count */
  754. uint32_t mcs_count[MAX_MCS];
  755. } pkt_type[DOT11_MAX];
  756. /* SGI count */
  757. uint32_t sgi_count[MAX_GI];
  758. /* Packet Count for different bandwidths */
  759. uint32_t bw[MAX_BW];
  760. /* Excess Retry Count */
  761. uint32_t excess_retries[WME_AC_MAX];
  762. /* Wireless Multimedia type Count */
  763. uint32_t wme_ac_type[WME_AC_MAX];
  764. /* Wireless Multimedia type Count */
  765. uint32_t excess_retries_ac[WME_AC_MAX];
  766. /* Packets dropped on the Tx side */
  767. struct {
  768. /* Discarded by firmware */
  769. uint32_t fw_rem;
  770. /* firmware_discard_untransmitted */
  771. uint32_t fw_rem_notx;
  772. /* firmware_discard_transmitted */
  773. uint32_t fw_rem_tx;
  774. /* aged out in mpdu/msdu queues*/
  775. uint32_t age_out;
  776. } dropped;
  777. };
  778. /* Rx Level Stats */
  779. struct cdp_rx_stats {
  780. /* Total packets sent up the stack */
  781. struct cdp_pkt_info to_stack;
  782. /* Packets received on the reo ring */
  783. struct cdp_pkt_info rcvd_reo[CDP_MAX_RX_RINGS];
  784. /* Total unicast packets */
  785. struct cdp_pkt_info unicast;
  786. /* Total multicast packets */
  787. struct cdp_pkt_info multicast;
  788. /* WDS packets received */
  789. struct cdp_pkt_info wds;
  790. /* Raw Pakets received */
  791. struct cdp_pkt_info raw;
  792. /* Total multicast packets */
  793. struct cdp_pkt_info nawds_mcast_drop;
  794. struct {
  795. /* Intra BSS packets received */
  796. struct cdp_pkt_info pkts;
  797. struct cdp_pkt_info fail;
  798. } intra_bss;
  799. /* Errors */
  800. struct {
  801. /* Rx MIC errors */
  802. uint32_t mic_err;
  803. /* Rx Decryption Errors */
  804. uint32_t decrypt_err;
  805. } err;
  806. /* Wireless Multimedia type Count */
  807. uint32_t wme_ac_type[WME_AC_MAX];
  808. /* Reception type os packets */
  809. uint32_t reception_type[MAX_RECEPTION_TYPES];
  810. /* Packet Type */
  811. struct {
  812. /* MCS Count */
  813. uint32_t mcs_count[MAX_MCS];
  814. } pkt_type[DOT11_MAX];
  815. /* SGI count */
  816. uint32_t sgi_count[MAX_GI];
  817. /* Packet count in spatiel Streams */
  818. uint32_t nss[SS_COUNT];
  819. /* Packet Count in different bandwidths */
  820. uint32_t bw[MAX_BW];
  821. /* Number of MSDUs with no MPDU level aggregation */
  822. uint32_t non_ampdu_cnt;
  823. /* Number of MSDUs part of AMSPU */
  824. uint32_t ampdu_cnt;
  825. /* Number of MSDUs with no MSDU level aggregation */
  826. uint32_t non_amsdu_cnt;
  827. /* Number of MSDUs part of AMSDU*/
  828. uint32_t amsdu_cnt;
  829. /* Number of bar received */
  830. uint32_t bar_recv_cnt;
  831. /* RSSI of received signal */
  832. uint32_t rssi;
  833. /*Rx rate */
  834. uint32_t rx_rate;
  835. };
  836. /* Tx ingress Stats */
  837. struct cdp_tx_ingress_stats {
  838. /* Total packets received for transmission */
  839. struct cdp_pkt_info rcvd;
  840. /* Tx packets processed*/
  841. struct cdp_pkt_info processed;
  842. /* Total packets passed Reinject handler */
  843. struct cdp_pkt_info reinject_pkts;
  844. /* Total packets passed to inspect handler */
  845. struct cdp_pkt_info inspect_pkts;
  846. /*NAWDS Multicast Packet Count */
  847. struct cdp_pkt_info nawds_mcast;
  848. struct {
  849. /* Total Raw packets */
  850. struct cdp_pkt_info raw_pkt;
  851. /* DMA map error */
  852. uint32_t dma_map_error;
  853. } raw;
  854. /* TSO packets info */
  855. struct {
  856. /* No of segments in TSO packets */
  857. uint32_t num_seg;
  858. /* total no of TSO packets */
  859. struct cdp_pkt_info tso_pkt;
  860. /* TSO packets dropped by host */
  861. uint32_t dropped_host;
  862. /* TSO packets dropped by target */
  863. uint32_t dropped_target;
  864. } tso;
  865. /* Scatter Gather packet info */
  866. struct {
  867. /* Total scatter gather packets */
  868. struct cdp_pkt_info sg_pkt;
  869. /* SG packets dropped by host */
  870. uint32_t dropped_host;
  871. /* SG packets dropped by target */
  872. uint32_t dropped_target;
  873. /* Dma map error */
  874. uint32_t dma_map_error;
  875. } sg;
  876. /* Multicast Enhancement packets info */
  877. struct {
  878. /* total no of multicast conversion packets */
  879. struct cdp_pkt_info mcast_pkt;
  880. /* packets dropped due to map error */
  881. uint32_t dropped_map_error;
  882. /* packets dropped due to self Mac address */
  883. uint32_t dropped_self_mac;
  884. /* Packets dropped due to send fail */
  885. uint32_t dropped_send_fail;
  886. /* total unicast packets transmitted */
  887. uint32_t ucast;
  888. /* Segment allocation failure */
  889. uint32_t fail_seg_alloc;
  890. /* NBUF clone failure */
  891. uint32_t clone_fail;
  892. } mcast_en;
  893. /* Packets dropped on the Tx side */
  894. struct {
  895. /* Total scatter gather packets */
  896. struct cdp_pkt_info dropped_pkt;
  897. /* Desc Not Available */
  898. uint32_t desc_na;
  899. /* Ring Full */
  900. uint32_t ring_full;
  901. /* Hwenqueue failed */
  902. uint32_t enqueue_fail;
  903. /* DMA failed */
  904. uint32_t dma_error;
  905. /* Resource Full: Congestion Control */
  906. uint32_t res_full;
  907. } dropped;
  908. /* Mesh packets info */
  909. struct {
  910. /* packets sent to fw */
  911. uint32_t exception_fw;
  912. /* packets completions received from fw */
  913. uint32_t completion_fw;
  914. } mesh;
  915. /*Number of packets classified by CCE*/
  916. uint32_t cce_classified;
  917. /*Number of raw packets classified by CCE*/
  918. uint32_t cce_classified_raw;
  919. };
  920. struct cdp_vdev_stats {
  921. /* Tx ingress stats */
  922. struct cdp_tx_ingress_stats tx_i;
  923. /* CDP Tx Stats */
  924. struct cdp_tx_stats tx;
  925. /* CDP Rx Stats */
  926. struct cdp_rx_stats rx;
  927. };
  928. struct cdp_peer_stats {
  929. /* CDP Tx Stats */
  930. struct cdp_tx_stats tx;
  931. /* CDP Rx Stats */
  932. struct cdp_rx_stats rx;
  933. };
  934. /* Tx completions per interrupt */
  935. struct cdp_hist_tx_comp {
  936. uint32_t pkts_1;
  937. uint32_t pkts_2_20;
  938. uint32_t pkts_21_40;
  939. uint32_t pkts_41_60;
  940. uint32_t pkts_61_80;
  941. uint32_t pkts_81_100;
  942. uint32_t pkts_101_200;
  943. uint32_t pkts_201_plus;
  944. };
  945. /* Rx ring descriptors reaped per interrupt */
  946. struct cdp_hist_rx_ind {
  947. uint32_t pkts_1;
  948. uint32_t pkts_2_20;
  949. uint32_t pkts_21_40;
  950. uint32_t pkts_41_60;
  951. uint32_t pkts_61_80;
  952. uint32_t pkts_81_100;
  953. uint32_t pkts_101_200;
  954. uint32_t pkts_201_plus;
  955. };
  956. struct cdp_pdev_stats {
  957. /* packets dropped on rx */
  958. struct {
  959. /* packets dropped because nsdu_done bit not set */
  960. uint32_t msdu_not_done;
  961. /* Multicast Echo check */
  962. uint32_t mec;
  963. /* Mesh Filtered packets */
  964. uint32_t mesh_filter;
  965. } dropped;
  966. struct {
  967. /* total packets replnished */
  968. struct cdp_pkt_info pkts;
  969. /* rxdma errors */
  970. uint32_t rxdma_err;
  971. /* nbuf alloc failed */
  972. uint32_t nbuf_alloc_fail;
  973. /* Mapping failure */
  974. uint32_t map_err;
  975. /* x86 failures */
  976. uint32_t x86_fail;
  977. /* low threshold interrupts */
  978. uint32_t low_thresh_intrs;
  979. } replenish;
  980. /* Rx Raw Packets */
  981. uint32_t rx_raw_pkts;
  982. /* Mesh Rx Stats Alloc fail */
  983. uint32_t mesh_mem_alloc;
  984. /* Rx errors */
  985. struct {
  986. /* desc alloc failed errors */
  987. uint32_t desc_alloc_fail;
  988. } err;
  989. /* buffers added back in freelist */
  990. uint32_t buf_freelist;
  991. /* Tx Ingress stats */
  992. struct cdp_tx_ingress_stats tx_i;
  993. /* CDP Tx Stats */
  994. struct cdp_tx_stats tx;
  995. /* CDP Rx Stats */
  996. struct cdp_rx_stats rx;
  997. /* Number of Tx completions per interrupt */
  998. struct cdp_hist_tx_comp tx_comp_histogram;
  999. /* Number of Rx ring descriptors reaped per interrupt */
  1000. struct cdp_hist_rx_ind rx_ind_histogram;
  1001. qdf_atomic_t cmd_complete;
  1002. };
  1003. /**
  1004. * struct cdp_tx_completion_ppdu_user - Tx PPDU completion per-user information
  1005. * @completion_status: completion status - OK/Filter/Abort/Timeout
  1006. * @tid: TID number
  1007. * @peer_id: Peer ID
  1008. * @frame_ctrl: frame control field in 802.11 header
  1009. * @qos_ctrl: QoS control field in 802.11 header
  1010. * @mpdu_tried: number of mpdus tried
  1011. * @mpdu_success: number of mpdus successfully transmitted
  1012. * @long_retries: long retries
  1013. * @short_retries: short retries
  1014. * @is_ampdu: mpdu aggregate or non-aggregate?
  1015. * @success_bytes: bytes successfully transmitted
  1016. * @retry_bytes: bytes retried
  1017. * @failed_msdus: MSDUs failed transmission
  1018. * @duration: user duration in ppdu
  1019. * @ltf_size: ltf_size
  1020. * @stbc: stbc
  1021. * @he_re: he_re (range extension)
  1022. * @txbf: txbf
  1023. * @bw: Transmission bandwidth
  1024. * <enum 2 transmit_bw_20_MHz>
  1025. * <enum 3 transmit_bw_40_MHz>
  1026. * <enum 4 transmit_bw_80_MHz>
  1027. * <enum 5 transmit_bw_160_MHz>
  1028. * @nss: NSS 1,2, ...8
  1029. * @mcs: MCS index
  1030. * @preamble: preamble
  1031. * @gi: guard interval 800/400/1600/3200 ns
  1032. * @dcm: dcm
  1033. * @ldpc: ldpc
  1034. * @ppdu_type: SU/MU_MIMO/MU_OFDMA/MU_MIMO_OFDMA/UL_TRIG/BURST_BCN/UL_BSR_RESP/
  1035. * UL_BSR_TRIG/UNKNOWN
  1036. * @ba_seq_no: Block Ack sequence number
  1037. * @ba_bitmap: Block Ack bitmap
  1038. * @start_seqa: Sequence number of first MPDU
  1039. * @enq_bitmap: Enqueue MPDU bitmap
  1040. * @is_mcast: MCAST or UCAST
  1041. * @tx_rate: Transmission Rate
  1042. */
  1043. struct cdp_tx_completion_ppdu_user {
  1044. uint32_t completion_status:8,
  1045. tid:8,
  1046. peer_id:16;
  1047. uint8_t mac_addr[6];
  1048. uint32_t frame_ctrl:16,
  1049. qos_ctrl:16;
  1050. uint32_t mpdu_tried_ucast:16,
  1051. mpdu_tried_mcast:16;
  1052. uint16_t mpdu_success:16;
  1053. uint32_t long_retries:4,
  1054. short_retries:4,
  1055. tx_ratecode:8,
  1056. is_ampdu:1,
  1057. ppdu_type:5;
  1058. uint32_t success_bytes;
  1059. uint32_t retry_bytes;
  1060. uint32_t failed_bytes;
  1061. uint32_t success_msdus:16,
  1062. retry_msdus:16;
  1063. uint32_t failed_msdus:16,
  1064. duration:16;
  1065. uint32_t ltf_size:2,
  1066. stbc:1,
  1067. he_re:1,
  1068. txbf:4,
  1069. bw:4,
  1070. nss:4,
  1071. mcs:4,
  1072. preamble:4,
  1073. gi:4,
  1074. dcm:1,
  1075. ldpc:1;
  1076. uint32_t ba_seq_no;
  1077. uint32_t ba_bitmap[CDP_BA_256_BIT_MAP_SIZE_DWORDS];
  1078. uint32_t start_seq;
  1079. uint32_t enq_bitmap[CDP_BA_256_BIT_MAP_SIZE_DWORDS];
  1080. uint32_t num_mpdu:9,
  1081. num_msdu:16;
  1082. uint32_t tx_duration;
  1083. uint16_t ru_tones;
  1084. bool is_mcast;
  1085. uint32_t tx_rate;
  1086. };
  1087. /**
  1088. * struct cdp_tx_completion_ppdu - Tx PPDU completion information
  1089. * @completion_status: completion status - OK/Filter/Abort/Timeout
  1090. * @ppdu_id: PPDU Id
  1091. * @vdev_id: VAP Id
  1092. * @num_users: Number of users
  1093. * @num_mpdu: Number of MPDUs in PPDU
  1094. * @num_msdu: Number of MSDUs in PPDU
  1095. * @channel: Channel informartion
  1096. * @ack_rssi: RSSI value of last ack packet (units=dB above noise floor)
  1097. * @tx_duration: PPDU airtime
  1098. * @ppdu_start_timestamp: TSF at PPDU start
  1099. * @ppdu_end_timestamp: TSF at PPDU end
  1100. * @ack_timestamp: TSF at the reception of ACK
  1101. * @user: per-User stats (array of per-user structures)
  1102. */
  1103. struct cdp_tx_completion_ppdu {
  1104. uint32_t ppdu_id;
  1105. uint16_t vdev_id;
  1106. uint32_t num_users;
  1107. uint32_t num_mpdu:9,
  1108. num_msdu:16;
  1109. uint16_t frame_type;
  1110. uint16_t channel;
  1111. uint16_t phy_mode;
  1112. uint32_t ack_rssi;
  1113. uint32_t tx_duration;
  1114. uint32_t ppdu_start_timestamp;
  1115. uint32_t ppdu_end_timestamp;
  1116. uint32_t ack_timestamp;
  1117. struct cdp_tx_completion_ppdu_user user[CDP_MU_MAX_USERS];
  1118. };
  1119. /**
  1120. * struct cdp_rate_stats - Tx/Rx Rate statistics
  1121. * @bw: Indicates the BW of the upcoming transmission -
  1122. * <enum 2 transmit_bw_20_MHz>
  1123. * <enum 3 transmit_bw_40_MHz>
  1124. * <enum 4 transmit_bw_80_MHz>
  1125. * <enum 5 transmit_bw_160_MHz>
  1126. * @pkt_type: Transmit Packet Type
  1127. * @stbc: When set, STBC transmission rate was used
  1128. * @ldpc: When set, use LDPC transmission rates
  1129. * @sgi: <enum 0 0_8_us_sgi > Legacy normal GI
  1130. * <enum 1 0_4_us_sgi > Legacy short GI
  1131. * <enum 2 1_6_us_sgi > HE related GI
  1132. * <enum 3 3_2_us_sgi > HE
  1133. * @mcs: Transmit MCS Rate
  1134. * @ofdma: Set when the transmission was an OFDMA transmission
  1135. * @tones_in_ru: The number of tones in the RU used.
  1136. * @tsf: Lower 32 bits of the TSF (timestamp when ppdu transmission finished)
  1137. * @peer_id: Peer ID of the flow or MPDU queue
  1138. * @tid: TID of the flow or MPDU queue
  1139. */
  1140. struct cdp_rate_stats {
  1141. uint32_t rate_stats_info_valid:1,
  1142. bw:2,
  1143. pkt_type:4,
  1144. stbc:1,
  1145. ldpc:1,
  1146. sgi:2,
  1147. mcs:4,
  1148. ofdma:1,
  1149. tones_in_ru:12,
  1150. resvd0:4;
  1151. uint32_t tsf;
  1152. uint16_t peer_id;
  1153. uint8_t tid;
  1154. };
  1155. /**
  1156. * struct cdp_tx_completion_msdu - Tx MSDU completion descriptor
  1157. * @ppdu_id: PPDU to which this MSDU belongs
  1158. * @transmit_cnt: Number of times this frame has been transmitted
  1159. * @ack_frame_rssi: RSSI of the received ACK or BA frame
  1160. * @first_msdu: Indicates this MSDU is the first MSDU in AMSDU
  1161. * @last_msdu: Indicates this MSDU is the last MSDU in AMSDU
  1162. * @msdu_part_of_amsdu : Indicates this MSDU was part of an A-MSDU in MPDU
  1163. * @extd: Extended structure containing rate statistics
  1164. */
  1165. struct cdp_tx_completion_msdu {
  1166. uint32_t ppdu_id;
  1167. uint8_t transmit_cnt;
  1168. uint32_t ack_frame_rssi:8,
  1169. resvd0:1,
  1170. first_msdu:1,
  1171. last_msdu:1,
  1172. msdu_part_of_amsdu:1,
  1173. resvd1:20;
  1174. struct cdp_rate_stats extd;
  1175. };
  1176. /**
  1177. * struct cdp_rx_indication_ppdu - Rx PPDU indication structure
  1178. * @ppdu_id: PPDU Id
  1179. * @is_ampdu: mpdu aggregate or non-aggregate?
  1180. * @num_mpdu: Number of MPDUs in PPDU
  1181. * @reserved: Reserved bits for future use
  1182. * @num_msdu: Number of MSDUs in PPDU
  1183. * @udp_msdu_count: Number of UDP MSDUs in PPDU
  1184. * @tcp_msdu_count: Number of TCP MSDUs in PPDU
  1185. * @other_msdu_count: Number of MSDUs other than UDP and TCP MSDUs in PPDU
  1186. * @duration: PPDU duration
  1187. * @tid: TID number
  1188. * @peer_id: Peer ID
  1189. * @vdev_id: VAP ID
  1190. * @mac_addr: Peer MAC Address
  1191. * @first_data_seq_ctrl: Sequence control field of first data frame
  1192. * @ltf_size: ltf_size
  1193. * @stbc: When set, STBC rate was used
  1194. * @he_re: he_re (range extension)
  1195. * @bw: Bandwidth
  1196. * <enum 0 bw_20_MHz>
  1197. * <enum 1 bw_40_MHz>
  1198. * <enum 2 bw_80_MHz>
  1199. * <enum 3 bw_160_MHz>
  1200. * @nss: NSS 1,2, ...8
  1201. * @mcs: MCS index
  1202. * @preamble: preamble
  1203. * @gi: <enum 0 0_8_us_sgi > Legacy normal GI
  1204. * <enum 1 0_4_us_sgi > Legacy short GI
  1205. * <enum 2 1_6_us_sgi > HE related GI
  1206. * <enum 3 3_2_us_sgi > HE
  1207. * @dcm: dcm
  1208. * @ldpc: ldpc
  1209. * @ppdu_type: SU/MU_MIMO/MU_OFDMA/MU_MIMO_OFDMA/UL_TRIG/BURST_BCN/UL_BSR_RESP/
  1210. * UL_BSR_TRIG/UNKNOWN
  1211. * @rssi: RSSI value (units = dB above noise floor)
  1212. * @timestamp: TSF at the reception of PPDU
  1213. * @channel: Channel informartion
  1214. * @lsig_A: L-SIG in 802.11 PHY header
  1215. */
  1216. struct cdp_rx_indication_ppdu {
  1217. uint32_t ppdu_id;
  1218. uint16_t is_ampdu:1,
  1219. num_mpdu:9,
  1220. reserved:6;
  1221. uint32_t num_msdu;
  1222. uint16_t udp_msdu_count;
  1223. uint16_t tcp_msdu_count;
  1224. uint16_t other_msdu_count;
  1225. uint16_t duration;
  1226. uint32_t tid:8,
  1227. peer_id:16;
  1228. uint8_t vdev_id;
  1229. uint8_t mac_addr[6];
  1230. uint16_t first_data_seq_ctrl;
  1231. union {
  1232. uint32_t rate_info;
  1233. struct {
  1234. uint32_t ltf_size:2,
  1235. stbc:1,
  1236. he_re:1,
  1237. bw:4,
  1238. nss:4,
  1239. mcs:4,
  1240. preamble:4,
  1241. gi:4,
  1242. dcm:1,
  1243. ldpc:1,
  1244. ppdu_type:2;
  1245. };
  1246. } u;
  1247. uint32_t lsig_a;
  1248. uint32_t rssi;
  1249. uint32_t timestamp;
  1250. uint8_t channel;
  1251. };
  1252. /**
  1253. * struct cdp_rx_indication_msdu - Rx MSDU info
  1254. * @ppdu_id: PPDU to which the MSDU belongs
  1255. * @msdu_len: Length of MSDU in bytes
  1256. * @ack_frame_rssi: RSSI of the received ACK or BA frame
  1257. * @first_msdu: Indicates this MSDU is the first MSDU in AMSDU
  1258. * @last_msdu: Indicates this MSDU is the last MSDU in AMSDU
  1259. * @msdu_part_of_amsdu : Indicates this MSDU was part of an A-MSDU in MPDU
  1260. * @extd: Extended structure containing rate statistics
  1261. */
  1262. struct cdp_rx_indication_msdu {
  1263. uint32_t ppdu_id;
  1264. uint16_t msdu_len;
  1265. uint32_t ack_frame_rssi:8,
  1266. resvd0:1,
  1267. first_msdu:1,
  1268. last_msdu:1,
  1269. msdu_part_of_amsdu:1,
  1270. msdu_part_of_ampdu:1,
  1271. resvd1:19;
  1272. struct cdp_rate_stats extd;
  1273. };
  1274. /**
  1275. * struct cdp_config_params - Propagate configuration parameters to datapath
  1276. * @tso_enable: Enable/Disable TSO
  1277. * @lro_enable: Enable/Disable LRO
  1278. * @flow_steering_enable: Enable/Disable Rx Hash
  1279. * @tcp_Udp_ChecksumOffload: Enable/Disable tcp-Udp checksum Offload
  1280. * @napi_enable: Enable/Disable Napi
  1281. * @tx_flow_stop_queue_threshold: Value to Pause tx queues
  1282. * @tx_flow_start_queue_offset: Available Tx descriptors to unpause
  1283. * tx queue
  1284. */
  1285. struct cdp_config_params {
  1286. unsigned int tso_enable:1;
  1287. unsigned int lro_enable:1;
  1288. unsigned int flow_steering_enable:1;
  1289. unsigned int tcp_udp_checksumoffload:1;
  1290. unsigned int napi_enable:1;
  1291. /* Set when QCA_LL_TX_FLOW_CONTROL_V2 is enabled */
  1292. uint8_t tx_flow_stop_queue_threshold;
  1293. uint8_t tx_flow_start_queue_offset;
  1294. };
  1295. /**
  1296. * cdp_txrx_stats_req: stats request wrapper
  1297. * used to pass request information to cdp layer
  1298. * @stats: type of stats requested
  1299. * @param0: opaque argument 0 to be passed to htt
  1300. * @param1: opaque argument 1 to be passed to htt
  1301. * @param2: opaque argument 2 to be passed to htt
  1302. * @param3: opaque argument 3 to be passed to htt
  1303. */
  1304. struct cdp_txrx_stats_req {
  1305. enum cdp_stats stats;
  1306. uint32_t param0;
  1307. uint32_t param1;
  1308. uint32_t param2;
  1309. uint32_t param3;
  1310. };
  1311. /**
  1312. * struct cdp_monitor_filter - monitor filter info
  1313. * @mode: set filter mode
  1314. * @fp_mgmt: set Filter Pass MGMT Configuration
  1315. * @fp_ctrl: set Filter Pass CTRL Configuration
  1316. * @fp_data: set Filter Pass DATA Configuration
  1317. * @mo_mgmt: set Monitor Other MGMT Configuration
  1318. * @mo_ctrl: set Monitor Other CTRL Configuration
  1319. * @mo_data: set Monitor other DATA Configuration
  1320. *
  1321. */
  1322. struct cdp_monitor_filter {
  1323. uint16_t mode;
  1324. uint16_t fp_mgmt;
  1325. uint16_t fp_ctrl;
  1326. uint16_t fp_data;
  1327. uint16_t mo_mgmt;
  1328. uint16_t mo_ctrl;
  1329. uint16_t mo_data;
  1330. };
  1331. #endif