cdp_txrx_ctrl.h 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251
  1. /*
  2. * Copyright (c) 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_ctrl.h
  28. * @brief Define the host data path control API functions
  29. * called by the host control SW and the OS interface module
  30. */
  31. #ifndef _CDP_TXRX_CTRL_H_
  32. #define _CDP_TXRX_CTRL_H_
  33. /* TODO: adf need to be replaced with qdf */
  34. /*
  35. * Cleanups -- Might need cleanup
  36. */
  37. #if !QCA_OL_TX_PDEV_LOCK && QCA_NSS_PLATFORM || \
  38. (defined QCA_PARTNER_PLATFORM && QCA_PARTNER_SUPPORT_FAST_TX)
  39. #define VAP_TX_SPIN_LOCK(_x) spin_lock(_x)
  40. #define VAP_TX_SPIN_UNLOCK(_x) spin_unlock(_x)
  41. #else /* QCA_OL_TX_PDEV_LOCK */
  42. #define VAP_TX_SPIN_LOCK(_x)
  43. #define VAP_TX_SPIN_UNLOCK(_x)
  44. #endif /* QCA_OL_TX_PDEV_LOCK */
  45. #if QCA_OL_TX_PDEV_LOCK
  46. void ol_ll_pdev_tx_lock(void *);
  47. void ol_ll_pdev_tx_unlock(void *);
  48. #define OL_TX_LOCK(_x) ol_ll_pdev_tx_lock(_x)
  49. #define OL_TX_UNLOCK(_x) ol_ll_pdev_tx_unlock(_x)
  50. #define OL_TX_PDEV_LOCK(_x) qdf_spin_lock_bh(_x)
  51. #define OL_TX_PDEV_UNLOCK(_x) qdf_spin_unlock_bh(_x)
  52. #else
  53. #define OL_TX_PDEV_LOCK(_x)
  54. #define OL_TX_PDEV_UNLOCK(_x)
  55. #define OL_TX_LOCK(_x)
  56. #define OL_TX_UNLOCK(_x)
  57. #endif /* QCA_OL_TX_PDEV_LOCK */
  58. #if !QCA_OL_TX_PDEV_LOCK
  59. #define OL_TX_FLOW_CTRL_LOCK(_x) qdf_spin_lock_bh(_x)
  60. #define OL_TX_FLOW_CTRL_UNLOCK(_x) qdf_spin_unlock_bh(_x)
  61. #define OL_TX_DESC_LOCK(_x) qdf_spin_lock_bh(_x)
  62. #define OL_TX_DESC_UNLOCK(_x) qdf_spin_unlock_bh(_x)
  63. #define OSIF_VAP_TX_LOCK(_x) spin_lock(&((_x)->tx_lock))
  64. #define OSIF_VAP_TX_UNLOCK(_x) spin_unlock(&((_x)->tx_lock))
  65. #define OL_TX_PEER_LOCK(_x, _id) qdf_spin_lock_bh(&((_x)->peer_lock[_id]))
  66. #define OL_TX_PEER_UNLOCK(_x, _id) qdf_spin_unlock_bh(&((_x)->peer_lock[_id]))
  67. #define OL_TX_PEER_UPDATE_LOCK(_x, _id) \
  68. qdf_spin_lock_bh(&((_x)->peer_lock[_id]))
  69. #define OL_TX_PEER_UPDATE_UNLOCK(_x, _id) \
  70. qdf_spin_unlock_bh(&((_x)->peer_lock[_id]))
  71. #else
  72. #define OSIF_VAP_TX_LOCK(_x) ol_ll_pdev_tx_lock((_x)->iv_txrx_handle)
  73. #define OSIF_VAP_TX_UNLOCK(_x) ol_ll_pdev_tx_unlock((_x)->iv_txrx_handle)
  74. #define OL_TX_FLOW_CTRL_LOCK(_x)
  75. #define OL_TX_FLOW_CTRL_UNLOCK(_x)
  76. #define OL_TX_DESC_LOCK(_x)
  77. #define OL_TX_DESC_UNLOCK(_x)
  78. #define OL_TX_PEER_LOCK(_x, _id)
  79. #define OL_TX_PEER_UNLOCK(_x, _id)
  80. #define OL_TX_PEER_UPDATE_LOCK(_x, _id) qdf_spin_lock_bh(&((_x)->tx_lock))
  81. #define OL_TX_PEER_UPDATE_UNLOCK(_x, _id) qdf_spin_unlock_bh(&((_x)->tx_lock))
  82. #endif /* !QCA_OL_TX_PDEV_LOCK */
  83. extern int ol_txrx_is_target_ar900b(ol_txrx_vdev_handle vdev);
  84. #define OL_TXRX_IS_TARGET_AR900B(vdev) ol_txrx_is_target_ar900b(vdev)
  85. /* WIN */
  86. int
  87. ol_txrx_mempools_attach(ol_pdev_handle ctrl_pdev);
  88. int
  89. ol_txrx_set_filter_neighbour_peers(
  90. ol_txrx_pdev_handle pdev,
  91. u_int32_t val);
  92. /**
  93. * @brief set the safemode of the device
  94. * @details
  95. * This flag is used to bypass the encrypt and decrypt processes when send and
  96. * receive packets. It works like open AUTH mode, HW will treate all packets
  97. * as non-encrypt frames because no key installed. For rx fragmented frames,
  98. * it bypasses all the rx defragmentaion.
  99. *
  100. * @param vdev - the data virtual device object
  101. * @param val - the safemode state
  102. * @return - void
  103. */
  104. void
  105. ol_txrx_set_safemode(
  106. ol_txrx_vdev_handle vdev,
  107. u_int32_t val);
  108. /**
  109. * @brief configure the drop unencrypted frame flag
  110. * @details
  111. * Rx related. When set this flag, all the unencrypted frames
  112. * received over a secure connection will be discarded
  113. *
  114. * @param vdev - the data virtual device object
  115. * @param val - flag
  116. * @return - void
  117. */
  118. void
  119. ol_txrx_set_drop_unenc(
  120. ol_txrx_vdev_handle vdev,
  121. u_int32_t val);
  122. /**
  123. * @brief set the Tx encapsulation type of the VDEV
  124. * @details
  125. * This will be used to populate the HTT desc packet type field during Tx
  126. *
  127. * @param vdev - the data virtual device object
  128. * @param val - the Tx encap type (htt_pkt_type)
  129. * @return - void
  130. */
  131. void
  132. ol_txrx_set_tx_encap_type(
  133. ol_txrx_vdev_handle vdev,
  134. uint32_t val);
  135. /**
  136. * @brief set the Rx decapsulation type of the VDEV
  137. * @details
  138. * This will be used to configure into firmware and hardware which format to
  139. * decap all Rx packets into, for all peers under the VDEV.
  140. *
  141. * @param vdev - the data virtual device object
  142. * @param val - the Rx decap mode (htt_pkt_type)
  143. * @return - void
  144. */
  145. void
  146. ol_txrx_set_vdev_rx_decap_type(
  147. ol_txrx_vdev_handle vdev,
  148. uint32_t val);
  149. /**
  150. * @brief get the Rx decapsulation type of the VDEV
  151. *
  152. * @param vdev - the data virtual device object
  153. * @return - the Rx decap type (htt_pkt_type)
  154. */
  155. uint32_t
  156. ol_txrx_get_vdev_rx_decap_type(ol_txrx_vdev_handle vdev);
  157. /* Is this similar to ol_txrx_peer_state_update() in MCL */
  158. /**
  159. * @brief Update the authorize peer object at association time
  160. * @details
  161. * For the host-based implementation of rate-control, it
  162. * updates the peer/node-related parameters within rate-control
  163. * context of the peer at association.
  164. *
  165. * @param peer - pointer to the node's object
  166. * @authorize - either to authorize or unauthorize peer
  167. *
  168. * @return none
  169. */
  170. void
  171. ol_txrx_peer_authorize(struct ol_txrx_peer_t *peer, u_int32_t authorize);
  172. bool
  173. ol_txrx_set_inact_params(ol_txrx_pdev_handle pdev,
  174. u_int16_t inact_check_interval,
  175. u_int16_t inact_normal,
  176. u_int16_t inact_overload);
  177. bool
  178. ol_txrx_start_inact_timer(
  179. ol_txrx_pdev_handle pdev,
  180. bool enable);
  181. /**
  182. * @brief Set the overload status of the radio
  183. * @details
  184. * Set the overload status of the radio, updating the inactivity
  185. * threshold and inactivity count for each node.
  186. *
  187. * @param pdev - the data physical device object
  188. * @param overload - whether the radio is overloaded or not
  189. */
  190. void
  191. ol_txrx_set_overload(
  192. ol_txrx_pdev_handle pdev,
  193. bool overload);
  194. /**
  195. * @brief Check the inactivity status of the peer/node
  196. *
  197. * @param peer - pointer to the node's object
  198. * @return true if the node is inactive; otherwise return false
  199. */
  200. bool
  201. ol_txrx_peer_is_inact(ol_txrx_peer_handle peer);
  202. /**
  203. * @brief Mark inactivity status of the peer/node
  204. * @details
  205. * If it becomes active, reset inactivity count to reload value;
  206. * if the inactivity status changed, notify umac band steering.
  207. *
  208. * @param peer - pointer to the node's object
  209. * @param inactive - whether the node is inactive or not
  210. */
  211. void
  212. ol_txrx_mark_peer_inact(
  213. ol_txrx_peer_handle peer,
  214. bool inactive);
  215. /* Should be ol_txrx_ctrl_api.h */
  216. void ol_txrx_set_mesh_mode(ol_txrx_vdev_handle vdev, u_int32_t val);
  217. void ol_tx_flush_buffers(struct ol_txrx_vdev_t *vdev);
  218. #endif