cdp_txrx_cmn_struct.h 39 KB

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