cdp_txrx_ctrl.h 32 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220
  1. /*
  2. * Copyright (c) 2016-2020 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_ctrl.h
  20. * @brief Define the host data path control API functions
  21. * called by the host control SW and the OS interface module
  22. */
  23. #ifndef _CDP_TXRX_CTRL_H_
  24. #define _CDP_TXRX_CTRL_H_
  25. #include "cdp_txrx_handle.h"
  26. #include "cdp_txrx_cmn_struct.h"
  27. #include "cdp_txrx_cmn.h"
  28. #include "cdp_txrx_ops.h"
  29. static inline int cdp_is_target_ar900b
  30. (ol_txrx_soc_handle soc)
  31. {
  32. if (!soc || !soc->ops) {
  33. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  34. "%s: Invalid Instance:", __func__);
  35. QDF_BUG(0);
  36. return 0;
  37. }
  38. if (!soc->ops->ctrl_ops ||
  39. !soc->ops->ctrl_ops->txrx_is_target_ar900b)
  40. return 0;
  41. return soc->ops->ctrl_ops->txrx_is_target_ar900b(soc);
  42. }
  43. /* WIN */
  44. static inline int
  45. cdp_mempools_attach(ol_txrx_soc_handle soc)
  46. {
  47. if (!soc || !soc->ops) {
  48. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  49. "%s: Invalid Instance:", __func__);
  50. QDF_BUG(0);
  51. return 0;
  52. }
  53. if (!soc->ops->ctrl_ops ||
  54. !soc->ops->ctrl_ops->txrx_mempools_attach)
  55. return 0;
  56. return soc->ops->ctrl_ops->txrx_mempools_attach(soc);
  57. }
  58. #if defined(ATH_SUPPORT_NAC) || defined(ATH_SUPPORT_NAC_RSSI)
  59. /**
  60. * @brief update the neighbour peer addresses
  61. * @details
  62. * This defines interface function to update neighbour peers addresses
  63. * which needs to be filtered
  64. *
  65. * @param soc - the pointer to soc object
  66. * @param vdev_id - id of the pointer to vdev
  67. * @param cmd - add/del entry into peer table
  68. * @param macaddr - the address of neighbour peer
  69. * @return - int
  70. */
  71. static inline int
  72. cdp_update_filter_neighbour_peers(ol_txrx_soc_handle soc,
  73. uint8_t vdev_id, uint32_t cmd, uint8_t *macaddr)
  74. {
  75. if (!soc || !soc->ops) {
  76. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  77. "%s: Invalid Instance:", __func__);
  78. QDF_BUG(0);
  79. return 0;
  80. }
  81. if (!soc->ops->ctrl_ops ||
  82. !soc->ops->ctrl_ops->txrx_update_filter_neighbour_peers)
  83. return 0;
  84. return soc->ops->ctrl_ops->txrx_update_filter_neighbour_peers
  85. (soc, vdev_id, cmd, macaddr);
  86. }
  87. #endif /* ATH_SUPPORT_NAC || ATH_SUPPORT_NAC_RSSI*/
  88. #ifdef WLAN_SUPPORT_MSCS
  89. /**
  90. * @brief record the MSCS data and send it to the Data path
  91. * @details
  92. * This defines interface function to record the MSCS procedure
  93. * based data parameters so that the data path layer can access it
  94. *
  95. * @param soc - the pointer to soc object
  96. * @param vdev_id - id of the pointer to vdev
  97. * @param macaddr - the address of neighbour peer
  98. * @param mscs_params - Structure having MSCS params
  99. * obtained from handshake
  100. * @return - QDF_STATUS
  101. */
  102. static inline QDF_STATUS
  103. cdp_record_vdev_mscs_params(ol_txrx_soc_handle soc, uint8_t
  104. *macaddr, uint8_t vdev_id, struct cdp_mscs_params *mscs_params,
  105. bool active)
  106. {
  107. if (!soc || !soc->ops) {
  108. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  109. "%s: Invalid Instance:",
  110. __func__);
  111. QDF_BUG(0);
  112. return QDF_STATUS_E_FAILURE;
  113. }
  114. if (!soc->ops->ctrl_ops ||
  115. !soc->ops->ctrl_ops->txrx_record_mscs_params)
  116. return QDF_STATUS_E_FAILURE;
  117. return soc->ops->ctrl_ops->txrx_record_mscs_params
  118. (soc, macaddr, vdev_id, mscs_params, active);
  119. }
  120. #endif
  121. /**
  122. * @brief set the Reo Destination ring for the pdev
  123. * @details
  124. * This will be used to configure the Reo Destination ring for this pdev.
  125. *
  126. * @param soc - pointer to the soc
  127. * @param pdev_id - id of the data physical device object
  128. * @param val - the Reo destination ring index (1 to 4)
  129. * @return - QDF_STATUS
  130. */
  131. static inline QDF_STATUS
  132. cdp_set_pdev_reo_dest(ol_txrx_soc_handle soc,
  133. uint8_t pdev_id, enum cdp_host_reo_dest_ring val)
  134. {
  135. if (!soc || !soc->ops) {
  136. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  137. "%s: Invalid Instance:", __func__);
  138. QDF_BUG(0);
  139. return QDF_STATUS_E_FAILURE;
  140. }
  141. if (!soc->ops->ctrl_ops ||
  142. !soc->ops->ctrl_ops->txrx_set_pdev_reo_dest)
  143. return QDF_STATUS_E_FAILURE;
  144. return soc->ops->ctrl_ops->txrx_set_pdev_reo_dest
  145. (soc, pdev_id, val);
  146. }
  147. /**
  148. * @brief get the Reo Destination ring for the pdev
  149. *
  150. * @param soc - pointer to the soc
  151. * @param pdev_id - id of physical device object
  152. * @return - the Reo destination ring index (1 to 4), 0 if not supported.
  153. */
  154. static inline enum cdp_host_reo_dest_ring
  155. cdp_get_pdev_reo_dest(ol_txrx_soc_handle soc, uint8_t pdev_id)
  156. {
  157. if (!soc || !soc->ops) {
  158. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  159. "%s: Invalid Instance:", __func__);
  160. QDF_BUG(0);
  161. return cdp_host_reo_dest_ring_unknown;
  162. }
  163. if (!soc->ops->ctrl_ops ||
  164. !soc->ops->ctrl_ops->txrx_get_pdev_reo_dest)
  165. return cdp_host_reo_dest_ring_unknown;
  166. return soc->ops->ctrl_ops->txrx_get_pdev_reo_dest(soc, pdev_id);
  167. }
  168. /* Is this similar to ol_txrx_peer_state_update() in MCL */
  169. /**
  170. * @brief Update the authorize peer object at association time
  171. * @details
  172. * For the host-based implementation of rate-control, it
  173. * updates the peer/node-related parameters within rate-control
  174. * context of the peer at association.
  175. *
  176. * @param soc - pointer to the soc
  177. * @param vdev_id - id of the pointer to vdev
  178. * @param peer_mac - mac address of the node's object
  179. * @authorize - either to authorize or unauthorize peer
  180. *
  181. * @return QDF_STATUS
  182. */
  183. static inline QDF_STATUS
  184. cdp_peer_authorize(ol_txrx_soc_handle soc, uint8_t vdev_id, uint8_t *peer_mac,
  185. u_int32_t authorize)
  186. {
  187. if (!soc || !soc->ops) {
  188. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  189. "%s: Invalid Instance:", __func__);
  190. QDF_BUG(0);
  191. return QDF_STATUS_E_FAILURE;
  192. }
  193. if (!soc->ops->ctrl_ops ||
  194. !soc->ops->ctrl_ops->txrx_peer_authorize)
  195. return QDF_STATUS_E_FAILURE;
  196. return soc->ops->ctrl_ops->txrx_peer_authorize
  197. (soc, vdev_id, peer_mac, authorize);
  198. }
  199. static inline void cdp_tx_flush_buffers
  200. (ol_txrx_soc_handle soc, uint8_t vdev_id)
  201. {
  202. if (!soc || !soc->ops) {
  203. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  204. "%s: Invalid Instance:", __func__);
  205. QDF_BUG(0);
  206. return;
  207. }
  208. if (!soc->ops->ctrl_ops ||
  209. !soc->ops->ctrl_ops->tx_flush_buffers)
  210. return;
  211. soc->ops->ctrl_ops->tx_flush_buffers(soc, vdev_id);
  212. }
  213. static inline QDF_STATUS cdp_txrx_get_vdev_param(ol_txrx_soc_handle soc,
  214. uint8_t vdev_id,
  215. enum cdp_vdev_param_type type,
  216. cdp_config_param_type *val)
  217. {
  218. if (!soc || !soc->ops) {
  219. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  220. "%s: Invalid Instance:", __func__);
  221. QDF_BUG(0);
  222. return QDF_STATUS_E_FAILURE;
  223. }
  224. if (!soc->ops->ctrl_ops ||
  225. !soc->ops->ctrl_ops->txrx_get_vdev_param) {
  226. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  227. "%s: callback not registered:", __func__);
  228. return QDF_STATUS_E_FAILURE;
  229. }
  230. return soc->ops->ctrl_ops->txrx_get_vdev_param(soc, vdev_id,
  231. type, val);
  232. }
  233. static inline QDF_STATUS
  234. cdp_txrx_set_vdev_param(ol_txrx_soc_handle soc,
  235. uint8_t vdev_id, enum cdp_vdev_param_type type,
  236. cdp_config_param_type val)
  237. {
  238. if (!soc || !soc->ops) {
  239. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  240. "%s: Invalid Instance:", __func__);
  241. QDF_BUG(0);
  242. return QDF_STATUS_E_FAILURE;
  243. }
  244. if (!soc->ops->ctrl_ops ||
  245. !soc->ops->ctrl_ops->txrx_set_vdev_param) {
  246. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  247. "NULL vdev params callback");
  248. return QDF_STATUS_E_FAILURE;
  249. }
  250. return soc->ops->ctrl_ops->txrx_set_vdev_param(soc, vdev_id,
  251. type, val);
  252. }
  253. static inline QDF_STATUS
  254. cdp_txrx_set_psoc_param(ol_txrx_soc_handle soc,
  255. enum cdp_psoc_param_type type,
  256. cdp_config_param_type val)
  257. {
  258. if (!soc || !soc->ops) {
  259. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  260. "%s: Invalid Instance:", __func__);
  261. QDF_BUG(0);
  262. return QDF_STATUS_E_FAILURE;
  263. }
  264. if (!soc->ops->ctrl_ops ||
  265. !soc->ops->ctrl_ops->txrx_set_psoc_param)
  266. return QDF_STATUS_E_FAILURE;
  267. return soc->ops->ctrl_ops->txrx_set_psoc_param(soc, type, val);
  268. }
  269. static inline QDF_STATUS
  270. cdp_txrx_get_psoc_param(ol_txrx_soc_handle soc,
  271. enum cdp_psoc_param_type type,
  272. cdp_config_param_type *val)
  273. {
  274. if (!soc || !soc->ops) {
  275. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  276. "%s: Invalid Instance:", __func__);
  277. QDF_BUG(0);
  278. return QDF_STATUS_E_FAILURE;
  279. }
  280. if (!soc->ops->ctrl_ops ||
  281. !soc->ops->ctrl_ops->txrx_get_psoc_param)
  282. return QDF_STATUS_E_FAILURE;
  283. return soc->ops->ctrl_ops->txrx_get_psoc_param(soc, type, val);
  284. }
  285. #ifdef VDEV_PEER_PROTOCOL_COUNT
  286. /**
  287. * cdp_set_vdev_peer_protocol_count() - set per-peer protocol count tracking
  288. *
  289. * @soc - pointer to the soc
  290. * @vdev - the data virtual device object
  291. * @enable - enable per-peer protocol count
  292. *
  293. * Set per-peer protocol count feature enable
  294. *
  295. * Return: void
  296. */
  297. static inline
  298. void cdp_set_vdev_peer_protocol_count(ol_txrx_soc_handle soc, int8_t vdev_id,
  299. bool enable)
  300. {
  301. if (!soc || !soc->ops) {
  302. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  303. "%s: Invalid Instance:", __func__);
  304. QDF_BUG(0);
  305. return;
  306. }
  307. if (!soc->ops->ctrl_ops ||
  308. !soc->ops->ctrl_ops->txrx_enable_peer_protocol_count)
  309. return;
  310. soc->ops->ctrl_ops->txrx_enable_peer_protocol_count(soc, vdev_id,
  311. enable);
  312. }
  313. /**
  314. * cdp_set_vdev_peer_protocol_drop_mask() - set per-peer protocol drop mask
  315. *
  316. * @soc - pointer to the soc
  317. * @vdev - the data virtual device object
  318. * @drop_mask - drop_mask
  319. *
  320. * Set per-peer protocol drop_mask
  321. *
  322. * Return - void
  323. */
  324. static inline
  325. void cdp_set_vdev_peer_protocol_drop_mask(ol_txrx_soc_handle soc,
  326. int8_t vdev_id, int drop_mask)
  327. {
  328. if (!soc || !soc->ops) {
  329. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  330. "%s: Invalid Instance:", __func__);
  331. QDF_BUG(0);
  332. return;
  333. }
  334. if (!soc->ops->ctrl_ops ||
  335. !soc->ops->ctrl_ops->txrx_set_peer_protocol_drop_mask)
  336. return;
  337. soc->ops->ctrl_ops->txrx_set_peer_protocol_drop_mask(soc, vdev_id,
  338. drop_mask);
  339. }
  340. /**
  341. * cdp_is_vdev_peer_protocol_count_enabled() - whether peer-protocol tracking
  342. * enabled
  343. *
  344. * @soc - pointer to the soc
  345. * @vdev - the data virtual device object
  346. *
  347. * Get whether peer protocol count feature enabled or not
  348. *
  349. * Return: whether feature enabled or not
  350. */
  351. static inline
  352. int cdp_is_vdev_peer_protocol_count_enabled(ol_txrx_soc_handle soc,
  353. int8_t vdev_id)
  354. {
  355. if (!soc || !soc->ops) {
  356. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  357. "%s: Invalid Instance:", __func__);
  358. QDF_BUG(0);
  359. return 0;
  360. }
  361. if (!soc->ops->ctrl_ops ||
  362. !soc->ops->ctrl_ops->txrx_is_peer_protocol_count_enabled)
  363. return 0;
  364. return soc->ops->ctrl_ops->txrx_is_peer_protocol_count_enabled(soc,
  365. vdev_id);
  366. }
  367. /**
  368. * cdp_get_peer_protocol_drop_mask() - get per-peer protocol count drop-mask
  369. *
  370. * @soc - pointer to the soc
  371. * @vdev - the data virtual device object
  372. *
  373. * Get peer-protocol-count drop-mask
  374. *
  375. * Return: peer-protocol-count drop-mask
  376. */
  377. static inline
  378. int cdp_get_peer_protocol_drop_mask(ol_txrx_soc_handle soc, int8_t vdev_id)
  379. {
  380. if (!soc || !soc->ops) {
  381. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  382. "%s: Invalid Instance:", __func__);
  383. QDF_BUG(0);
  384. return 0;
  385. }
  386. if (!soc->ops->ctrl_ops ||
  387. !soc->ops->ctrl_ops->txrx_get_peer_protocol_drop_mask)
  388. return 0;
  389. return soc->ops->ctrl_ops->txrx_get_peer_protocol_drop_mask(soc,
  390. vdev_id);
  391. }
  392. /*
  393. * Rx-Ingress and Tx-Egress are in the lower level DP layer
  394. * Rx-Egress and Tx-ingress are handled in osif layer for DP
  395. * So
  396. * Rx-Ingress and Tx-Egress definitions are in DP layer
  397. * Rx-Egress and Tx-ingress mask definitions are here below
  398. */
  399. #define VDEV_PEER_PROTOCOL_RX_INGRESS_MASK 1
  400. #define VDEV_PEER_PROTOCOL_TX_INGRESS_MASK 2
  401. #define VDEV_PEER_PROTOCOL_RX_EGRESS_MASK 4
  402. #define VDEV_PEER_PROTOCOL_TX_EGRESS_MASK 8
  403. #else
  404. #define cdp_set_vdev_peer_protocol_count(soc, vdev_id, enable)
  405. #define cdp_set_vdev_peer_protocol_drop_mask(soc, vdev_id, drop_mask)
  406. #define cdp_is_vdev_peer_protocol_count_enabled(soc, vdev_id) 0
  407. #define cdp_get_peer_protocol_drop_mask(soc, vdev_id) 0
  408. #endif
  409. /**
  410. * cdp_txrx_set_pdev_param() - set pdev parameter
  411. * @soc: opaque soc handle
  412. * @pdev_id: id of data path pdev handle
  413. * @type: param type
  414. * @val: value
  415. *
  416. * Return: status: 0 - Success, non-zero: Failure
  417. */
  418. static inline QDF_STATUS cdp_txrx_set_pdev_param(ol_txrx_soc_handle soc,
  419. uint8_t pdev_id,
  420. enum cdp_pdev_param_type type,
  421. cdp_config_param_type val)
  422. {
  423. if (!soc || !soc->ops) {
  424. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  425. "%s: Invalid Instance:", __func__);
  426. QDF_BUG(0);
  427. return QDF_STATUS_E_FAILURE;
  428. }
  429. if (!soc->ops->ctrl_ops ||
  430. !soc->ops->ctrl_ops->txrx_set_pdev_param)
  431. return QDF_STATUS_E_FAILURE;
  432. return soc->ops->ctrl_ops->txrx_set_pdev_param
  433. (soc, pdev_id, type, val);
  434. }
  435. /**
  436. * cdp_txrx_set_peer_param() - set pdev parameter
  437. * @soc: opaque soc handle
  438. * @vdev_id: id of data path vdev handle
  439. * @peer_mac: peer mac address
  440. * @type: param type
  441. * @val: value
  442. *
  443. * Return: status: 0 - Success, non-zero: Failure
  444. */
  445. static inline QDF_STATUS cdp_txrx_set_peer_param(ol_txrx_soc_handle soc,
  446. uint8_t vdev_id,
  447. uint8_t *peer_mac,
  448. enum cdp_peer_param_type type,
  449. cdp_config_param_type val)
  450. {
  451. if (!soc || !soc->ops) {
  452. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  453. "%s: Invalid Instance:", __func__);
  454. QDF_BUG(0);
  455. return QDF_STATUS_E_FAILURE;
  456. }
  457. if (!soc->ops->ctrl_ops ||
  458. !soc->ops->ctrl_ops->txrx_set_peer_param)
  459. return QDF_STATUS_E_FAILURE;
  460. return soc->ops->ctrl_ops->txrx_set_peer_param
  461. (soc, vdev_id, peer_mac, type, val);
  462. }
  463. /**
  464. * cdp_txrx_get_peer_param() - set pdev parameter
  465. * @soc: opaque soc handle
  466. * @vdev_id: id of data path vdev handle
  467. * @peer_mac: peer mac address
  468. * @type: param type
  469. * @val: address of buffer
  470. *
  471. * Return: status
  472. */
  473. static inline QDF_STATUS cdp_txrx_get_peer_param(ol_txrx_soc_handle soc,
  474. uint8_t vdev_id,
  475. uint8_t *peer_mac,
  476. enum cdp_peer_param_type type,
  477. cdp_config_param_type *val)
  478. {
  479. if (!soc || !soc->ops) {
  480. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  481. "%s: Invalid Instance:", __func__);
  482. QDF_BUG(0);
  483. return QDF_STATUS_E_FAILURE;
  484. }
  485. if (!soc->ops->ctrl_ops ||
  486. !soc->ops->ctrl_ops->txrx_get_peer_param)
  487. return QDF_STATUS_E_FAILURE;
  488. return soc->ops->ctrl_ops->txrx_get_peer_param
  489. (soc, vdev_id, peer_mac, type, val);
  490. }
  491. #ifdef QCA_MULTIPASS_SUPPORT
  492. static inline void
  493. cdp_peer_set_vlan_id(ol_txrx_soc_handle soc, uint8_t vdev_id,
  494. uint8_t *peer_mac, uint8_t vlan_id)
  495. {
  496. if (!soc || !soc->ops) {
  497. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  498. "%s: Invalid Instance:", __func__);
  499. QDF_BUG(0);
  500. return;
  501. }
  502. if (!soc->ops->ctrl_ops ||
  503. !soc->ops->ctrl_ops->txrx_peer_set_vlan_id)
  504. return;
  505. soc->ops->ctrl_ops->txrx_peer_set_vlan_id(soc, vdev_id, peer_mac,
  506. vlan_id);
  507. }
  508. #endif
  509. /**
  510. * cdp_txrx_get_pdev_param() - get pdev parameter
  511. * @soc: opaque soc handle
  512. * @pdev_id: id of data path pdev handle
  513. * @type: param type
  514. * @value: address of value buffer
  515. *
  516. * Return: status
  517. */
  518. static inline QDF_STATUS cdp_txrx_get_pdev_param(ol_txrx_soc_handle soc,
  519. uint8_t pdev_id,
  520. enum cdp_pdev_param_type type,
  521. cdp_config_param_type *value)
  522. {
  523. if (!soc || !soc->ops) {
  524. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  525. "%s: Invalid Instance:", __func__);
  526. QDF_BUG(0);
  527. return QDF_STATUS_E_FAILURE;
  528. }
  529. if (!soc->ops->ctrl_ops ||
  530. !soc->ops->ctrl_ops->txrx_get_pdev_param)
  531. return QDF_STATUS_E_FAILURE;
  532. return soc->ops->ctrl_ops->txrx_get_pdev_param
  533. (soc, pdev_id, type, value);
  534. }
  535. /**
  536. * cdp_txrx_peer_protocol_cnt() - set peer protocol count
  537. * @soc: opaque soc handle
  538. * @vdev: opaque vdev handle
  539. * @nbuf: data packet
  540. * @is_egress: whether egress or ingress
  541. * @is_rx: whether tx or rx
  542. *
  543. * Return: void
  544. */
  545. #ifdef VDEV_PEER_PROTOCOL_COUNT
  546. static inline void
  547. cdp_txrx_peer_protocol_cnt(ol_txrx_soc_handle soc,
  548. int8_t vdev_id,
  549. qdf_nbuf_t nbuf,
  550. enum vdev_peer_protocol_enter_exit is_egress,
  551. enum vdev_peer_protocol_tx_rx is_rx)
  552. {
  553. if (!soc || !soc->ops) {
  554. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  555. "%s: Invalid Instance:", __func__);
  556. QDF_BUG(0);
  557. return;
  558. }
  559. if (!soc->ops->ctrl_ops ||
  560. !soc->ops->ctrl_ops->txrx_peer_protocol_cnt)
  561. return;
  562. soc->ops->ctrl_ops->txrx_peer_protocol_cnt(soc, vdev_id, nbuf,
  563. is_egress, is_rx);
  564. }
  565. #else
  566. #define cdp_txrx_peer_protocol_cnt(soc, vdev_id, nbuf, is_egress, is_rx)
  567. #endif
  568. /**
  569. * cdp_enable_peer_based_pktlog()- Set flag in peer structure
  570. *
  571. * @soc: pointer to the soc
  572. * @pdev_id: id of the data physical device object
  573. * @enable: enable or disable peer based filter based pktlog
  574. * @peer_macaddr: Mac address of peer which needs to be
  575. * filtered
  576. *
  577. * This function will set flag in peer structure if peer based filtering
  578. * is enabled for pktlog
  579. *
  580. * Return: int
  581. */
  582. static inline int
  583. cdp_enable_peer_based_pktlog(ol_txrx_soc_handle soc, uint8_t pdev_id,
  584. char *peer_macaddr,
  585. uint8_t enable)
  586. {
  587. if (!soc || !soc->ops) {
  588. QDF_TRACE_ERROR(QDF_MODULE_ID_DP,
  589. "%s invalid instance", __func__);
  590. QDF_BUG(0);
  591. return 0;
  592. }
  593. if (!soc->ops->ctrl_ops ||
  594. !soc->ops->ctrl_ops->enable_peer_based_pktlog)
  595. return 0;
  596. return soc->ops->ctrl_ops->enable_peer_based_pktlog
  597. (soc, pdev_id, peer_macaddr, enable);
  598. }
  599. /**
  600. * cdp_calculate_delay_stats()- get rx delay stats
  601. *
  602. * @soc: pointer to the soc
  603. * @vdev_id: id of vdev handle
  604. * @nbuf: nbuf which is passed
  605. *
  606. * This function will calculate rx delay statistics.
  607. */
  608. static inline QDF_STATUS
  609. cdp_calculate_delay_stats(ol_txrx_soc_handle soc, uint8_t vdev_id,
  610. qdf_nbuf_t nbuf)
  611. {
  612. if (!soc || !soc->ops) {
  613. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  614. "%s: Invalid Instance:", __func__);
  615. QDF_BUG(0);
  616. return QDF_STATUS_E_FAILURE;
  617. }
  618. if (!soc->ops->ctrl_ops ||
  619. !soc->ops->ctrl_ops->calculate_delay_stats) {
  620. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  621. "%s: callback not registered:", __func__);
  622. return QDF_STATUS_E_FAILURE;
  623. }
  624. return soc->ops->ctrl_ops->calculate_delay_stats(soc, vdev_id, nbuf);
  625. }
  626. /**
  627. * @brief Subscribe to a specified WDI event.
  628. * @details
  629. * This function adds the provided wdi_event_subscribe object to a list of
  630. * subscribers for the specified WDI event.
  631. * When the event in question happens, each subscriber for the event will
  632. * have their callback function invoked.
  633. * The order in which callback functions from multiple subscribers are
  634. * invoked is unspecified.
  635. *
  636. * @param soc - pointer to the soc
  637. * @param pdev_id - id of the data physical device object
  638. * @param event_cb_sub - the callback and context for the event subscriber
  639. * @param event - which event's notifications are being subscribed to
  640. * @return - int
  641. */
  642. static inline int
  643. cdp_wdi_event_sub(ol_txrx_soc_handle soc, uint8_t pdev_id,
  644. wdi_event_subscribe *event_cb_sub, uint32_t event)
  645. {
  646. if (!soc || !soc->ops) {
  647. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_DEBUG,
  648. "%s invalid instance", __func__);
  649. QDF_BUG(0);
  650. return 0;
  651. }
  652. if (!soc->ops->ctrl_ops ||
  653. !soc->ops->ctrl_ops->txrx_wdi_event_sub)
  654. return 0;
  655. return soc->ops->ctrl_ops->txrx_wdi_event_sub
  656. (soc, pdev_id, event_cb_sub, event);
  657. }
  658. /**
  659. * @brief Unsubscribe from a specified WDI event.
  660. * @details
  661. * This function removes the provided event subscription object from the
  662. * list of subscribers for its event.
  663. * This function shall only be called if there was a successful prior call
  664. * to event_sub() on the same wdi_event_subscribe object.
  665. *
  666. * @param soc - pointer to the soc
  667. * @param pdev_id - id of the data physical device object
  668. * @param event_cb_sub - the callback and context for the event subscriber
  669. * @param event - which event's notifications are being subscribed to
  670. * @return - int
  671. */
  672. static inline int
  673. cdp_wdi_event_unsub(ol_txrx_soc_handle soc,
  674. uint8_t pdev_id, wdi_event_subscribe *event_cb_sub,
  675. uint32_t event)
  676. {
  677. if (!soc || !soc->ops) {
  678. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_DEBUG,
  679. "%s invalid instance", __func__);
  680. QDF_BUG(0);
  681. return 0;
  682. }
  683. if (!soc->ops->ctrl_ops ||
  684. !soc->ops->ctrl_ops->txrx_wdi_event_unsub)
  685. return 0;
  686. return soc->ops->ctrl_ops->txrx_wdi_event_unsub
  687. (soc, pdev_id, event_cb_sub, event);
  688. }
  689. /**
  690. * @brief Get security type from the from peer.
  691. * @details
  692. * This function gets the Security information from the peer handler.
  693. * The security information is got from the rx descriptor and filled in
  694. * to the peer handler.
  695. *
  696. * @param soc - pointer to the soc
  697. * @param vdev_id - id of vdev handle
  698. * @param peer mac - peer mac address
  699. * @param sec_idx - mcast or ucast frame type.
  700. * @return - int
  701. */
  702. static inline int
  703. cdp_get_sec_type(ol_txrx_soc_handle soc, uint8_t vdev_id, uint8_t *peer_mac,
  704. uint8_t sec_idx)
  705. {
  706. if (!soc || !soc->ops) {
  707. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_DEBUG,
  708. "%s invalid instance", __func__);
  709. QDF_BUG(0);
  710. return A_ERROR;
  711. }
  712. if (!soc->ops->ctrl_ops ||
  713. !soc->ops->ctrl_ops->txrx_get_sec_type)
  714. return A_ERROR;
  715. return soc->ops->ctrl_ops->txrx_get_sec_type
  716. (soc, vdev_id, peer_mac, sec_idx);
  717. }
  718. /**
  719. * cdp_set_mgmt_tx_power(): function to set tx power for mgmt frames
  720. * @param soc - pointer to the soc
  721. * @vdev_id : id of vdev handle
  722. * @subtype_index: subtype
  723. * @tx_power: Tx power
  724. * Return: QDF_STATUS
  725. */
  726. static inline QDF_STATUS
  727. cdp_set_mgmt_tx_power(ol_txrx_soc_handle soc,
  728. uint8_t vdev_id, uint8_t subtype, uint8_t tx_power)
  729. {
  730. if (!soc || !soc->ops) {
  731. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  732. "%s: Invalid Instance:", __func__);
  733. QDF_BUG(0);
  734. return QDF_STATUS_E_FAILURE;
  735. }
  736. if (!soc->ops->ctrl_ops ||
  737. !soc->ops->ctrl_ops->txrx_update_mgmt_txpow_vdev)
  738. return QDF_STATUS_E_FAILURE;
  739. return soc->ops->ctrl_ops->txrx_update_mgmt_txpow_vdev(soc, vdev_id,
  740. subtype, tx_power);
  741. }
  742. /**
  743. * cdp_get_pldev() - function to get pktlog device handle
  744. * @soc: datapath soc handle
  745. * @pdev_id: physical device id
  746. *
  747. * Return: pktlog device handle or NULL
  748. */
  749. static inline void *
  750. cdp_get_pldev(ol_txrx_soc_handle soc, uint8_t pdev_id)
  751. {
  752. if (!soc || !soc->ops) {
  753. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
  754. "%s invalid instance", __func__);
  755. QDF_BUG(0);
  756. return NULL;
  757. }
  758. if (!soc->ops->ctrl_ops || !soc->ops->ctrl_ops->txrx_get_pldev)
  759. return NULL;
  760. return soc->ops->ctrl_ops->txrx_get_pldev(soc, pdev_id);
  761. }
  762. #if defined(WLAN_CFR_ENABLE) && defined(WLAN_ENH_CFR_ENABLE)
  763. /**
  764. * cdp_cfr_filter() - Configure Host RX monitor status ring for CFR
  765. * @soc: SOC TXRX handle
  766. * @pdev_id: ID of the physical device object
  767. * @enable: Enable or disable CFR
  768. * @filter_val: Flag to select filter for monitor mode
  769. */
  770. static inline void
  771. cdp_cfr_filter(ol_txrx_soc_handle soc,
  772. uint8_t pdev_id,
  773. bool enable,
  774. struct cdp_monitor_filter *filter_val)
  775. {
  776. if (!soc || !soc->ops) {
  777. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
  778. "%s invalid instance", __func__);
  779. QDF_BUG(0);
  780. return;
  781. }
  782. if (!soc->ops->cfr_ops || !soc->ops->cfr_ops->txrx_cfr_filter)
  783. return;
  784. soc->ops->cfr_ops->txrx_cfr_filter(soc, pdev_id, enable, filter_val);
  785. }
  786. /**
  787. * cdp_get_cfr_rcc() - get cfr rcc config
  788. * @soc: Datapath soc handle
  789. * @pdev_id: id of objmgr pdev
  790. *
  791. * Return: true/false based on cfr mode setting
  792. */
  793. static inline
  794. bool cdp_get_cfr_rcc(ol_txrx_soc_handle soc, uint8_t pdev_id)
  795. {
  796. if (!soc || !soc->ops) {
  797. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
  798. "%s invalid instance", __func__);
  799. QDF_BUG(0);
  800. return 0;
  801. }
  802. if (!soc->ops->cfr_ops || !soc->ops->cfr_ops->txrx_get_cfr_rcc)
  803. return 0;
  804. return soc->ops->cfr_ops->txrx_get_cfr_rcc(soc, pdev_id);
  805. }
  806. /**
  807. * cdp_set_cfr_rcc() - enable/disable cfr rcc config
  808. * @soc: Datapath soc handle
  809. * @pdev_id: id of objmgr pdev
  810. * @enable: Enable/Disable cfr rcc mode
  811. *
  812. * Return: none
  813. */
  814. static inline
  815. void cdp_set_cfr_rcc(ol_txrx_soc_handle soc, uint8_t pdev_id, bool enable)
  816. {
  817. if (!soc || !soc->ops) {
  818. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
  819. "%s invalid instance", __func__);
  820. QDF_BUG(0);
  821. return;
  822. }
  823. if (!soc->ops->cfr_ops || !soc->ops->cfr_ops->txrx_set_cfr_rcc)
  824. return;
  825. return soc->ops->cfr_ops->txrx_set_cfr_rcc(soc, pdev_id, enable);
  826. }
  827. /**
  828. * cdp_get_cfr_dbg_stats() - Get debug statistics for CFR
  829. *
  830. * @soc: SOC TXRX handle
  831. * @pdev_id: ID of the physical device object
  832. * @buf: CFR RCC debug statistics buffer
  833. *
  834. * Return: None
  835. */
  836. static inline void
  837. cdp_get_cfr_dbg_stats(ol_txrx_soc_handle soc, uint8_t pdev_id,
  838. struct cdp_cfr_rcc_stats *buf)
  839. {
  840. if (!soc || !soc->ops) {
  841. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
  842. "%s invalid instance", __func__);
  843. QDF_BUG(0);
  844. return;
  845. }
  846. if (!soc->ops->cfr_ops || !soc->ops->cfr_ops->txrx_get_cfr_dbg_stats)
  847. return;
  848. soc->ops->cfr_ops->txrx_get_cfr_dbg_stats(soc, pdev_id, buf);
  849. }
  850. /**
  851. * cdp_cfr_clr_dbg_stats() - Clear debug statistics for CFR
  852. *
  853. * @soc: SOC TXRX handle
  854. * @pdev_id: ID of the physical device object
  855. */
  856. static inline void
  857. cdp_cfr_clr_dbg_stats(ol_txrx_soc_handle soc, uint8_t pdev_id)
  858. {
  859. if (!soc || !soc->ops) {
  860. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
  861. "%s invalid instance", __func__);
  862. QDF_BUG(0);
  863. return;
  864. }
  865. if (!soc->ops->cfr_ops || !soc->ops->cfr_ops->txrx_clear_cfr_dbg_stats)
  866. return;
  867. soc->ops->cfr_ops->txrx_clear_cfr_dbg_stats(soc, pdev_id);
  868. }
  869. /**
  870. * cdp_enable_mon_reap_timer() - enable/disable reap timer
  871. * @soc: Datapath soc handle
  872. * @pdev_id: id of objmgr pdev
  873. * @enable: enable/disable reap timer of monitor status ring
  874. *
  875. * Return: none
  876. */
  877. static inline void
  878. cdp_enable_mon_reap_timer(ol_txrx_soc_handle soc, uint8_t pdev_id,
  879. bool enable)
  880. {
  881. if (!soc || !soc->ops) {
  882. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
  883. "%s invalid instance", __func__);
  884. QDF_BUG(0);
  885. return;
  886. }
  887. if (!soc->ops->cfr_ops ||
  888. !soc->ops->cfr_ops->txrx_enable_mon_reap_timer)
  889. return;
  890. return soc->ops->cfr_ops->txrx_enable_mon_reap_timer(soc, pdev_id,
  891. enable);
  892. }
  893. #endif
  894. #if defined(WLAN_TX_PKT_CAPTURE_ENH) || defined(WLAN_RX_PKT_CAPTURE_ENH)
  895. /**
  896. * cdp_update_peer_pkt_capture_params() - Sets Rx & Tx Capture params for a peer
  897. * @soc: SOC TXRX handle
  898. * @pdev_id: id of CDP pdev pointer
  899. * @is_rx_pkt_cap_enable: enable/disable rx pkt capture for this peer
  900. * @is_tx_pkt_cap_enable: enable/disable tx pkt capture for this peer
  901. * @peer_mac: MAC address of peer for which pkt_cap is to be enabled/disabled
  902. *
  903. * Return: Success when matching peer is found & flags are set, error otherwise
  904. */
  905. static inline QDF_STATUS
  906. cdp_update_peer_pkt_capture_params(ol_txrx_soc_handle soc,
  907. uint8_t pdev_id,
  908. bool is_rx_pkt_cap_enable,
  909. uint8_t is_tx_pkt_cap_enable,
  910. uint8_t *peer_mac)
  911. {
  912. if (!soc || !soc->ops) {
  913. dp_err("Invalid SOC instance");
  914. QDF_BUG(0);
  915. return QDF_STATUS_E_FAILURE;
  916. }
  917. if (!soc->ops->ctrl_ops ||
  918. !soc->ops->ctrl_ops->txrx_update_peer_pkt_capture_params)
  919. return QDF_STATUS_E_FAILURE;
  920. return soc->ops->ctrl_ops->txrx_update_peer_pkt_capture_params
  921. (soc, pdev_id, is_rx_pkt_cap_enable,
  922. is_tx_pkt_cap_enable, peer_mac);
  923. }
  924. #endif /* WLAN_TX_PKT_CAPTURE_ENH || WLAN_RX_PKT_CAPTURE_ENH */
  925. #ifdef WLAN_SUPPORT_RX_PROTOCOL_TYPE_TAG
  926. /**
  927. * cdp_update_pdev_rx_protocol_tag() - wrapper function to set the protocol
  928. * tag in CDP layer from cfg layer
  929. * @soc: SOC TXRX handle
  930. * @pdev_id: id of CDP pdev pointer
  931. * @protocol_mask: Bitmap for protocol for which tagging is enabled
  932. * @protocol_type: Protocol type for which the tag should be update
  933. * @tag: Actual tag value for the given prototype
  934. * Return: Returns QDF_STATUS_SUCCESS/FAILURE
  935. */
  936. static inline QDF_STATUS
  937. cdp_update_pdev_rx_protocol_tag(ol_txrx_soc_handle soc,
  938. uint8_t pdev_id, uint32_t protocol_mask,
  939. uint16_t protocol_type, uint16_t tag)
  940. {
  941. if (!soc || !soc->ops) {
  942. dp_err("Invalid SOC instance");
  943. QDF_BUG(0);
  944. return QDF_STATUS_E_FAILURE;
  945. }
  946. if (!soc->ops->ctrl_ops ||
  947. !soc->ops->ctrl_ops->txrx_update_pdev_rx_protocol_tag)
  948. return QDF_STATUS_E_FAILURE;
  949. return soc->ops->ctrl_ops->txrx_update_pdev_rx_protocol_tag
  950. (soc, pdev_id, protocol_mask, protocol_type, tag);
  951. }
  952. #ifdef WLAN_SUPPORT_RX_TAG_STATISTICS
  953. /**
  954. * cdp_dump_pdev_rx_protocol_tag_stats() - wrapper function to dump the protocol
  955. tag statistics for given or all protocols
  956. * @soc: SOC TXRX handle
  957. * @pdev_id: id of CDP pdev pointer
  958. * @protocol_type: Protocol type for which the tag should be update
  959. * Return: Returns QDF_STATUS_SUCCESS/FAILURE
  960. */
  961. static inline QDF_STATUS
  962. cdp_dump_pdev_rx_protocol_tag_stats(ol_txrx_soc_handle soc,
  963. uint8_t pdev_id,
  964. uint16_t protocol_type)
  965. {
  966. if (!soc || !soc->ops) {
  967. dp_err("Invalid SOC instance");
  968. QDF_BUG(0);
  969. return QDF_STATUS_E_FAILURE;
  970. }
  971. if (!soc->ops->ctrl_ops ||
  972. !soc->ops->ctrl_ops->txrx_dump_pdev_rx_protocol_tag_stats)
  973. return QDF_STATUS_E_FAILURE;
  974. soc->ops->ctrl_ops->txrx_dump_pdev_rx_protocol_tag_stats(soc, pdev_id,
  975. protocol_type);
  976. return QDF_STATUS_SUCCESS;
  977. }
  978. #endif /* WLAN_SUPPORT_RX_TAG_STATISTICS */
  979. #endif /* WLAN_SUPPORT_RX_PROTOCOL_TYPE_TAG */
  980. #ifdef ATH_SUPPORT_NAC_RSSI
  981. /**
  982. * cdp_vdev_config_for_nac_rssi(): To invoke dp callback for nac rssi config
  983. * @soc: soc pointer
  984. * @vdev_id: id of vdev
  985. * @nac_cmd: specfies nac_rss config action add, del, list
  986. * @bssid: Neighbour bssid
  987. * @client_macaddr: Non-Associated client MAC
  988. * @chan_num: channel number to scan
  989. *
  990. * Return: QDF_STATUS
  991. */
  992. static inline QDF_STATUS cdp_vdev_config_for_nac_rssi(ol_txrx_soc_handle soc,
  993. uint8_t vdev_id, enum cdp_nac_param_cmd nac_cmd,
  994. char *bssid, char *client_macaddr, uint8_t chan_num)
  995. {
  996. if (!soc || !soc->ops) {
  997. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
  998. "%s invalid instance", __func__);
  999. QDF_BUG(0);
  1000. return QDF_STATUS_E_FAILURE;
  1001. }
  1002. if (!soc->ops->ctrl_ops ||
  1003. !soc->ops->ctrl_ops->txrx_vdev_config_for_nac_rssi)
  1004. return QDF_STATUS_E_FAILURE;
  1005. return soc->ops->ctrl_ops->txrx_vdev_config_for_nac_rssi(soc, vdev_id,
  1006. nac_cmd, bssid, client_macaddr, chan_num);
  1007. }
  1008. /*
  1009. * cdp_vdev_get_neighbour_rssi(): To invoke dp callback to get rssi value of nac
  1010. * @soc: soc pointer
  1011. * @vdev_id: id of vdev
  1012. * @macaddr: Non-Associated client MAC
  1013. * @rssi: rssi
  1014. *
  1015. * Return: QDF_STATUS
  1016. */
  1017. static inline QDF_STATUS cdp_vdev_get_neighbour_rssi(ol_txrx_soc_handle soc,
  1018. uint8_t vdev_id,
  1019. char *macaddr,
  1020. uint8_t *rssi)
  1021. {
  1022. if (!soc || !soc->ops) {
  1023. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
  1024. "%s invalid instance", __func__);
  1025. QDF_BUG(0);
  1026. return QDF_STATUS_E_FAILURE;
  1027. }
  1028. if (!soc->ops->ctrl_ops ||
  1029. !soc->ops->ctrl_ops->txrx_vdev_get_neighbour_rssi)
  1030. return QDF_STATUS_E_FAILURE;
  1031. return soc->ops->ctrl_ops->txrx_vdev_get_neighbour_rssi(soc, vdev_id,
  1032. macaddr,
  1033. rssi);
  1034. }
  1035. #endif
  1036. #ifdef WLAN_SUPPORT_RX_FLOW_TAG
  1037. /**
  1038. * cdp_set_rx_flow_tag() - wrapper function to set the flow
  1039. * tag in CDP layer from cfg layer
  1040. * @soc: SOC TXRX handle
  1041. * @pdev_id: id of CDP pdev pointer
  1042. * @flow_info: Flow 5-tuple, along with tag, if any, that needs to added/deleted
  1043. *
  1044. * Return: Success when add/del operation is successful, error otherwise
  1045. */
  1046. static inline QDF_STATUS
  1047. cdp_set_rx_flow_tag(ol_txrx_soc_handle soc, uint8_t pdev_id,
  1048. struct cdp_rx_flow_info *flow_info)
  1049. {
  1050. if (!soc || !soc->ops) {
  1051. dp_err("Invalid SOC instance");
  1052. QDF_BUG(0);
  1053. return QDF_STATUS_E_FAILURE;
  1054. }
  1055. if (!soc->ops->ctrl_ops ||
  1056. !soc->ops->ctrl_ops->txrx_set_rx_flow_tag)
  1057. return QDF_STATUS_E_FAILURE;
  1058. return soc->ops->ctrl_ops->txrx_set_rx_flow_tag(soc, pdev_id,
  1059. flow_info);
  1060. }
  1061. /**
  1062. * cdp_dump_rx_flow_tag_stats() - wrapper function to dump the flow
  1063. * tag statistics for given flow
  1064. * @soc: SOC TXRX handle
  1065. * @pdev_id: id of CDP pdev
  1066. * @flow_info: Flow tuple for which we want to print the statistics
  1067. *
  1068. * Return: Success when flow is found and stats are printed, error otherwise
  1069. */
  1070. static inline QDF_STATUS
  1071. cdp_dump_rx_flow_tag_stats(ol_txrx_soc_handle soc, uint8_t pdev_id,
  1072. struct cdp_rx_flow_info *flow_info)
  1073. {
  1074. if (!soc || !soc->ops) {
  1075. dp_err("Invalid SOC instance");
  1076. QDF_BUG(0);
  1077. return QDF_STATUS_E_FAILURE;
  1078. }
  1079. if (!soc->ops->ctrl_ops ||
  1080. !soc->ops->ctrl_ops->txrx_dump_rx_flow_tag_stats)
  1081. return QDF_STATUS_E_FAILURE;
  1082. return soc->ops->ctrl_ops->txrx_dump_rx_flow_tag_stats(soc,
  1083. pdev_id,
  1084. flow_info);
  1085. }
  1086. #endif /* WLAN_SUPPORT_RX_FLOW_TAG */
  1087. #endif /* _CDP_TXRX_CTRL_H_ */