cdp_txrx_ctrl.h 33 KB

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