cdp_txrx_cmn.h 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383
  1. /*
  2. * Copyright (c) 2011-2016 The Linux Foundation. All rights reserved.
  3. *
  4. * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  5. *
  6. *
  7. * Permission to use, copy, modify, and/or distribute this software for
  8. * any purpose with or without fee is hereby granted, provided that the
  9. * above copyright notice and this permission notice appear in all
  10. * copies.
  11. *
  12. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
  13. * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
  14. * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
  15. * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
  16. * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
  17. * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  18. * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  19. * PERFORMANCE OF THIS SOFTWARE.
  20. */
  21. /*
  22. * This file was originally distributed by Qualcomm Atheros, Inc.
  23. * under proprietary terms before Copyright ownership was assigned
  24. * to the Linux Foundation.
  25. */
  26. /**
  27. * @file cdp_txrx_cmn.h
  28. * @brief Define the host data path converged API functions
  29. * called by the host control SW and the OS interface module
  30. */
  31. #ifndef _CDP_TXRX_CMN_H_
  32. #define _CDP_TXRX_CMN_H_
  33. #include "qdf_types.h"
  34. #include "qdf_nbuf.h"
  35. #include "cdp_txrx_ops.h"
  36. /******************************************************************************
  37. *
  38. * Common Data Path Header File
  39. *
  40. *****************************************************************************/
  41. static inline int
  42. cdp_soc_attach_target(ol_txrx_soc_handle soc)
  43. {
  44. if (soc->ops->cmn_drv_ops->txrx_soc_attach_target)
  45. return soc->ops->cmn_drv_ops->txrx_soc_attach_target(soc);
  46. return 0;
  47. }
  48. static inline void *
  49. cdp_vdev_attach(ol_txrx_soc_handle soc, void *pdev,
  50. uint8_t *vdev_mac_addr, uint8_t vdev_id, enum wlan_op_mode op_mode)
  51. {
  52. if (soc->ops->cmn_drv_ops->txrx_vdev_attach)
  53. return soc->ops->cmn_drv_ops->txrx_vdev_attach(pdev,
  54. vdev_mac_addr, vdev_id, op_mode);
  55. return NULL;
  56. }
  57. static inline void
  58. cdp_vdev_detach(ol_txrx_soc_handle soc, void *vdev,
  59. ol_txrx_vdev_delete_cb callback, void *cb_context)
  60. {
  61. if (soc->ops->cmn_drv_ops->txrx_vdev_detach)
  62. return soc->ops->cmn_drv_ops->txrx_vdev_detach(vdev,
  63. callback, cb_context);
  64. return;
  65. }
  66. static inline int
  67. cdp_pdev_attach_target(ol_txrx_soc_handle soc, void *pdev)
  68. {
  69. if (soc->ops->cmn_drv_ops->txrx_pdev_attach_target)
  70. return soc->ops->cmn_drv_ops->txrx_pdev_attach_target(pdev);
  71. return 0;
  72. }
  73. static inline void *cdp_pdev_attach
  74. (ol_txrx_soc_handle soc, void *ctrl_pdev,
  75. HTC_HANDLE htc_pdev, qdf_device_t osdev, uint8_t pdev_id)
  76. {
  77. if (soc->ops->cmn_drv_ops->txrx_pdev_attach)
  78. return soc->ops->cmn_drv_ops->txrx_pdev_attach(soc, ctrl_pdev,
  79. htc_pdev, osdev, pdev_id);
  80. return NULL;
  81. }
  82. static inline int cdp_pdev_post_attach(ol_txrx_soc_handle soc, void *pdev)
  83. {
  84. if (soc->ops->cmn_drv_ops->txrx_pdev_post_attach)
  85. return soc->ops->cmn_drv_ops->txrx_pdev_post_attach(pdev);
  86. return 0;
  87. }
  88. static inline void
  89. cdp_pdev_detach(ol_txrx_soc_handle soc, void *pdev, int force)
  90. {
  91. if (soc->ops->cmn_drv_ops->txrx_pdev_detach)
  92. return soc->ops->cmn_drv_ops->txrx_pdev_detach(pdev, force);
  93. return;
  94. }
  95. static inline void *cdp_peer_create
  96. (ol_txrx_soc_handle soc, void *vdev,
  97. uint8_t *peer_mac_addr)
  98. {
  99. if (soc->ops->cmn_drv_ops->txrx_peer_create)
  100. return soc->ops->cmn_drv_ops->txrx_peer_create(vdev,
  101. peer_mac_addr);
  102. return NULL;
  103. }
  104. static inline void cdp_peer_setup
  105. (ol_txrx_soc_handle soc, void *vdev, void *peer)
  106. {
  107. if (soc->ops->cmn_drv_ops->txrx_peer_setup)
  108. return soc->ops->cmn_drv_ops->txrx_peer_setup(vdev,
  109. peer);
  110. return;
  111. }
  112. static inline void cdp_peer_teardown
  113. (ol_txrx_soc_handle soc, void *vdev, void *peer)
  114. {
  115. if (soc->ops->cmn_drv_ops->txrx_peer_teardown)
  116. return soc->ops->cmn_drv_ops->txrx_peer_teardown(vdev,
  117. peer);
  118. return;
  119. }
  120. static inline void
  121. cdp_peer_delete(ol_txrx_soc_handle soc, void *peer)
  122. {
  123. if (soc->ops->cmn_drv_ops->txrx_peer_delete)
  124. return soc->ops->cmn_drv_ops->txrx_peer_delete(peer);
  125. return;
  126. }
  127. static inline int
  128. cdp_set_monitor_mode(ol_txrx_soc_handle soc, void *vdev)
  129. {
  130. if (soc->ops->cmn_drv_ops->txrx_set_monitor_mode)
  131. return soc->ops->cmn_drv_ops->txrx_set_monitor_mode(vdev);
  132. return 0;
  133. }
  134. static inline void
  135. cdp_set_curchan(ol_txrx_soc_handle soc,
  136. void *pdev,
  137. uint32_t chan_mhz)
  138. {
  139. if (soc->ops->cmn_drv_ops->txrx_set_curchan)
  140. return soc->ops->cmn_drv_ops->txrx_set_curchan(pdev, chan_mhz);
  141. return;
  142. }
  143. static inline void
  144. cdp_set_privacy_filters(ol_txrx_soc_handle soc, void *vdev,
  145. void *filter, uint32_t num)
  146. {
  147. if (soc->ops->cmn_drv_ops->txrx_set_privacy_filters)
  148. return soc->ops->cmn_drv_ops->txrx_set_privacy_filters(vdev,
  149. filter, num);
  150. return;
  151. }
  152. /******************************************************************************
  153. * Data Interface (B Interface)
  154. *****************************************************************************/
  155. static inline void
  156. cdp_vdev_register(ol_txrx_soc_handle soc, void *vdev,
  157. void *osif_vdev, struct ol_txrx_ops *txrx_ops)
  158. {
  159. if (soc->ops->cmn_drv_ops->txrx_vdev_register)
  160. return soc->ops->cmn_drv_ops->txrx_vdev_register(vdev,
  161. osif_vdev, txrx_ops);
  162. return;
  163. }
  164. static inline int
  165. cdp_mgmt_send(ol_txrx_soc_handle soc, void *vdev,
  166. qdf_nbuf_t tx_mgmt_frm, uint8_t type)
  167. {
  168. if (soc->ops->cmn_drv_ops->txrx_mgmt_send)
  169. return soc->ops->cmn_drv_ops->txrx_mgmt_send(vdev,
  170. tx_mgmt_frm, type);
  171. return 0;
  172. }
  173. static inline int
  174. cdp_mgmt_send_ext(ol_txrx_soc_handle soc, void *vdev,
  175. qdf_nbuf_t tx_mgmt_frm, uint8_t type,
  176. uint8_t use_6mbps, uint16_t chanfreq)
  177. {
  178. if (soc->ops->cmn_drv_ops->txrx_mgmt_send_ext)
  179. return soc->ops->cmn_drv_ops->txrx_mgmt_send_ext
  180. (vdev, tx_mgmt_frm, type, use_6mbps, chanfreq);
  181. return 0;
  182. }
  183. static inline void
  184. cdp_mgmt_tx_cb_set(ol_txrx_soc_handle soc, void *pdev,
  185. uint8_t type,
  186. ol_txrx_mgmt_tx_cb download_cb,
  187. ol_txrx_mgmt_tx_cb ota_ack_cb, void *ctxt)
  188. {
  189. if (soc->ops->cmn_drv_ops->txrx_mgmt_tx_cb_set)
  190. return soc->ops->cmn_drv_ops->txrx_mgmt_tx_cb_set
  191. (pdev, type, download_cb, ota_ack_cb, ctxt);
  192. return;
  193. }
  194. static inline int cdp_get_tx_pending(ol_txrx_soc_handle soc,
  195. void *pdev)
  196. {
  197. if (soc->ops->cmn_drv_ops->txrx_get_tx_pending)
  198. return soc->ops->cmn_drv_ops->txrx_get_tx_pending(pdev);
  199. return 0;
  200. }
  201. static inline void
  202. cdp_data_tx_cb_set(ol_txrx_soc_handle soc, void *data_vdev,
  203. ol_txrx_data_tx_cb callback, void *ctxt)
  204. {
  205. if (soc->ops->cmn_drv_ops->txrx_data_tx_cb_set)
  206. return soc->ops->cmn_drv_ops->txrx_data_tx_cb_set(data_vdev,
  207. callback, ctxt);
  208. return;
  209. }
  210. /******************************************************************************
  211. * Statistics and Debugging Interface (C Inteface)
  212. *****************************************************************************/
  213. static inline int
  214. cdp_aggr_cfg(ol_txrx_soc_handle soc, void *vdev,
  215. int max_subfrms_ampdu,
  216. int max_subfrms_amsdu)
  217. {
  218. if (soc->ops->cmn_drv_ops->txrx_aggr_cfg)
  219. return soc->ops->cmn_drv_ops->txrx_aggr_cfg(vdev,
  220. max_subfrms_ampdu, max_subfrms_amsdu);
  221. return 0;
  222. }
  223. static inline int
  224. cdp_fw_stats_get(ol_txrx_soc_handle soc, void *vdev,
  225. struct ol_txrx_stats_req *req, bool per_vdev,
  226. bool response_expected)
  227. {
  228. if (soc->ops->cmn_drv_ops->txrx_fw_stats_get)
  229. return soc->ops->cmn_drv_ops->txrx_fw_stats_get(vdev, req,
  230. per_vdev, response_expected);
  231. return 0;
  232. }
  233. static inline int
  234. cdp_debug(ol_txrx_soc_handle soc, void *vdev, int debug_specs)
  235. {
  236. if (soc->ops->cmn_drv_ops->txrx_debug)
  237. return soc->ops->cmn_drv_ops->txrx_debug(vdev, debug_specs);
  238. return 0;
  239. }
  240. static inline void cdp_fw_stats_cfg(ol_txrx_soc_handle soc,
  241. void *vdev, uint8_t cfg_stats_type, uint32_t cfg_val)
  242. {
  243. if (soc->ops->cmn_drv_ops->txrx_fw_stats_cfg)
  244. return soc->ops->cmn_drv_ops->txrx_fw_stats_cfg(vdev,
  245. cfg_stats_type, cfg_val);
  246. return;
  247. }
  248. static inline void cdp_print_level_set(ol_txrx_soc_handle soc, unsigned level)
  249. {
  250. if (soc->ops->cmn_drv_ops->txrx_print_level_set)
  251. return soc->ops->cmn_drv_ops->txrx_print_level_set(level);
  252. return;
  253. }
  254. static inline uint8_t *
  255. cdp_get_vdev_mac_addr(ol_txrx_soc_handle soc, void *vdev)
  256. {
  257. if (soc->ops->cmn_drv_ops->txrx_get_vdev_mac_addr)
  258. return soc->ops->cmn_drv_ops->txrx_get_vdev_mac_addr(vdev);
  259. return NULL;
  260. }
  261. /**
  262. * cdp_get_vdev_struct_mac_addr() - Return handle to struct qdf_mac_addr of
  263. * vdev
  264. * @vdev: vdev handle
  265. *
  266. * Return: Handle to struct qdf_mac_addr
  267. */
  268. static inline struct qdf_mac_addr *cdp_get_vdev_struct_mac_addr
  269. (ol_txrx_soc_handle soc, void *vdev)
  270. {
  271. if (soc->ops->cmn_drv_ops->txrx_get_vdev_struct_mac_addr)
  272. return soc->ops->cmn_drv_ops->txrx_get_vdev_struct_mac_addr
  273. (vdev);
  274. return NULL;
  275. }
  276. /**
  277. * cdp_get_pdev_from_vdev() - Return handle to pdev of vdev
  278. * @vdev: vdev handle
  279. *
  280. * Return: Handle to pdev
  281. */
  282. static inline void *cdp_get_pdev_from_vdev
  283. (ol_txrx_soc_handle soc, void *vdev)
  284. {
  285. if (soc->ops->cmn_drv_ops->txrx_get_pdev_from_vdev)
  286. return soc->ops->cmn_drv_ops->txrx_get_pdev_from_vdev(vdev);
  287. return NULL;
  288. }
  289. /**
  290. * cdp_get_ctrl_pdev_from_vdev() - Return control pdev of vdev
  291. * @vdev: vdev handle
  292. *
  293. * Return: Handle to control pdev
  294. */
  295. static inline void *
  296. cdp_get_ctrl_pdev_from_vdev(ol_txrx_soc_handle soc, void *vdev)
  297. {
  298. if (soc->ops->cmn_drv_ops->txrx_get_ctrl_pdev_from_vdev)
  299. return soc->ops->cmn_drv_ops->txrx_get_ctrl_pdev_from_vdev
  300. (vdev);
  301. return NULL;
  302. }
  303. static inline void *
  304. cdp_get_vdev_from_vdev_id(ol_txrx_soc_handle soc, void *pdev,
  305. uint8_t vdev_id)
  306. {
  307. if (soc->ops->cmn_drv_ops->txrx_get_vdev_from_vdev_id)
  308. return soc->ops->cmn_drv_ops->txrx_get_vdev_from_vdev_id
  309. (pdev, vdev_id);
  310. return NULL;
  311. }
  312. static inline void
  313. cdp_soc_detach(ol_txrx_soc_handle soc)
  314. {
  315. if (soc->ops->cmn_drv_ops->txrx_soc_detach)
  316. return soc->ops->cmn_drv_ops->txrx_soc_detach((void *)soc);
  317. return;
  318. }
  319. static inline int cdp_addba_requestprocess(ol_txrx_soc_handle soc,
  320. void *peer_handle, uint8_t dialogtoken, uint16_t tid,
  321. uint16_t batimeout, uint16_t buffersize, uint16_t startseqnum)
  322. {
  323. if (soc->ops->cmn_drv_ops->addba_requestprocess)
  324. return soc->ops->cmn_drv_ops->addba_requestprocess(peer_handle,
  325. dialogtoken, tid, batimeout, buffersize, startseqnum);
  326. return 0;
  327. }
  328. static inline void cdp_addba_responsesetup(ol_txrx_soc_handle soc,
  329. void *peer_handle, uint8_t tid, uint8_t *dialogtoken,
  330. uint16_t *statuscode, uint16_t *buffersize, uint16_t *batimeout)
  331. {
  332. if (soc->ops->cmn_drv_ops->addba_responsesetup)
  333. soc->ops->cmn_drv_ops->addba_responsesetup(peer_handle, tid,
  334. dialogtoken, statuscode, buffersize, batimeout);
  335. }
  336. static inline int cdp_delba_process(ol_txrx_soc_handle soc,
  337. void *peer_handle, int tid, uint16_t reasoncode)
  338. {
  339. if (soc->ops->cmn_drv_ops->delba_process)
  340. return soc->ops->cmn_drv_ops->delba_process(peer_handle,
  341. tid, reasoncode);
  342. return 0;
  343. }
  344. #endif /* _CDP_TXRX_CMN_H_ */