cdp_txrx_ctrl.h 35 KB

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