cdp_txrx_cmn_struct.h 42 KB

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