cdp_txrx_ctrl.h 37 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431
  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. /**
  258. * cdp_peer_get_authorize Get per authorize status
  259. *
  260. * @soc - pointer to the soc
  261. * @vdev_id - id of the pointer to vdev
  262. * @peer_mac - mac address of the node's object
  263. *
  264. * Return: true is peer is authorized, false otherwise
  265. */
  266. static inline bool
  267. cdp_peer_get_authorize(ol_txrx_soc_handle soc, uint8_t vdev_id,
  268. uint8_t *peer_mac)
  269. {
  270. if (!soc || !soc->ops) {
  271. dp_cdp_debug("Invalid Instance:");
  272. QDF_BUG(0);
  273. return false;
  274. }
  275. if (!soc->ops->ctrl_ops ||
  276. !soc->ops->ctrl_ops->txrx_peer_get_authorize)
  277. return false;
  278. return soc->ops->ctrl_ops->txrx_peer_get_authorize
  279. (soc, vdev_id, peer_mac);
  280. }
  281. static inline void cdp_tx_flush_buffers
  282. (ol_txrx_soc_handle soc, uint8_t vdev_id)
  283. {
  284. if (!soc || !soc->ops) {
  285. dp_cdp_debug("Invalid Instance:");
  286. QDF_BUG(0);
  287. return;
  288. }
  289. if (!soc->ops->ctrl_ops ||
  290. !soc->ops->ctrl_ops->tx_flush_buffers)
  291. return;
  292. soc->ops->ctrl_ops->tx_flush_buffers(soc, vdev_id);
  293. }
  294. static inline QDF_STATUS cdp_txrx_get_vdev_param(ol_txrx_soc_handle soc,
  295. uint8_t vdev_id,
  296. enum cdp_vdev_param_type type,
  297. cdp_config_param_type *val)
  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->ctrl_ops ||
  305. !soc->ops->ctrl_ops->txrx_get_vdev_param) {
  306. dp_cdp_debug("callback not registered:");
  307. return QDF_STATUS_E_FAILURE;
  308. }
  309. return soc->ops->ctrl_ops->txrx_get_vdev_param(soc, vdev_id,
  310. type, val);
  311. }
  312. static inline QDF_STATUS
  313. cdp_txrx_set_vdev_param(ol_txrx_soc_handle soc,
  314. uint8_t vdev_id, enum cdp_vdev_param_type type,
  315. cdp_config_param_type val)
  316. {
  317. if (!soc || !soc->ops) {
  318. dp_cdp_debug("Invalid Instance:");
  319. QDF_BUG(0);
  320. return QDF_STATUS_E_FAILURE;
  321. }
  322. if (!soc->ops->ctrl_ops ||
  323. !soc->ops->ctrl_ops->txrx_set_vdev_param) {
  324. dp_cdp_nofl_debug("NULL vdev params callback");
  325. return QDF_STATUS_E_FAILURE;
  326. }
  327. return soc->ops->ctrl_ops->txrx_set_vdev_param(soc, vdev_id,
  328. type, val);
  329. }
  330. static inline QDF_STATUS
  331. cdp_txrx_set_psoc_param(ol_txrx_soc_handle soc,
  332. enum cdp_psoc_param_type type,
  333. cdp_config_param_type val)
  334. {
  335. if (!soc || !soc->ops) {
  336. dp_cdp_debug("Invalid Instance:");
  337. QDF_BUG(0);
  338. return QDF_STATUS_E_FAILURE;
  339. }
  340. if (!soc->ops->ctrl_ops ||
  341. !soc->ops->ctrl_ops->txrx_set_psoc_param)
  342. return QDF_STATUS_E_FAILURE;
  343. return soc->ops->ctrl_ops->txrx_set_psoc_param(soc, type, val);
  344. }
  345. static inline QDF_STATUS
  346. cdp_txrx_get_psoc_param(ol_txrx_soc_handle soc,
  347. enum cdp_psoc_param_type type,
  348. cdp_config_param_type *val)
  349. {
  350. if (!soc || !soc->ops) {
  351. dp_cdp_debug("Invalid Instance:");
  352. QDF_BUG(0);
  353. return QDF_STATUS_E_FAILURE;
  354. }
  355. if (!soc->ops->ctrl_ops ||
  356. !soc->ops->ctrl_ops->txrx_get_psoc_param)
  357. return QDF_STATUS_E_FAILURE;
  358. return soc->ops->ctrl_ops->txrx_get_psoc_param(soc, type, val);
  359. }
  360. static inline
  361. QDF_STATUS cdp_vdev_alloc_vdev_stats_id(ol_txrx_soc_handle soc,
  362. uint8_t *vdev_stats_id)
  363. {
  364. if (!soc || !soc->ops) {
  365. dp_cdp_debug("Invalid Instance:");
  366. QDF_BUG(0);
  367. return QDF_STATUS_E_FAILURE;
  368. }
  369. if (!soc->ops->host_stats_ops ||
  370. !soc->ops->host_stats_ops->txrx_alloc_vdev_stats_id)
  371. return QDF_STATUS_E_FAILURE;
  372. return soc->ops->host_stats_ops->txrx_alloc_vdev_stats_id
  373. (soc, vdev_stats_id);
  374. }
  375. static inline
  376. void cdp_vdev_reset_vdev_stats_id(ol_txrx_soc_handle soc,
  377. uint8_t vdev_stats_id)
  378. {
  379. if (!soc || !soc->ops) {
  380. dp_cdp_debug("Invalid Instance:");
  381. QDF_BUG(0);
  382. return;
  383. }
  384. if (!soc->ops->host_stats_ops ||
  385. !soc->ops->host_stats_ops->txrx_reset_vdev_stats_id)
  386. return;
  387. soc->ops->host_stats_ops->txrx_reset_vdev_stats_id(soc, vdev_stats_id);
  388. }
  389. #ifdef VDEV_PEER_PROTOCOL_COUNT
  390. /**
  391. * cdp_set_vdev_peer_protocol_count() - set per-peer protocol count tracking
  392. *
  393. * @soc - pointer to the soc
  394. * @vdev - the data virtual device object
  395. * @enable - enable per-peer protocol count
  396. *
  397. * Set per-peer protocol count feature enable
  398. *
  399. * Return: void
  400. */
  401. static inline
  402. void cdp_set_vdev_peer_protocol_count(ol_txrx_soc_handle soc, int8_t vdev_id,
  403. bool enable)
  404. {
  405. if (!soc || !soc->ops) {
  406. dp_cdp_debug("Invalid Instance:");
  407. QDF_BUG(0);
  408. return;
  409. }
  410. if (!soc->ops->ctrl_ops ||
  411. !soc->ops->ctrl_ops->txrx_enable_peer_protocol_count)
  412. return;
  413. soc->ops->ctrl_ops->txrx_enable_peer_protocol_count(soc, vdev_id,
  414. enable);
  415. }
  416. /**
  417. * cdp_set_vdev_peer_protocol_drop_mask() - set per-peer protocol drop mask
  418. *
  419. * @soc - pointer to the soc
  420. * @vdev - the data virtual device object
  421. * @drop_mask - drop_mask
  422. *
  423. * Set per-peer protocol drop_mask
  424. *
  425. * Return - void
  426. */
  427. static inline
  428. void cdp_set_vdev_peer_protocol_drop_mask(ol_txrx_soc_handle soc,
  429. int8_t vdev_id, int drop_mask)
  430. {
  431. if (!soc || !soc->ops) {
  432. dp_cdp_debug("Invalid Instance:");
  433. QDF_BUG(0);
  434. return;
  435. }
  436. if (!soc->ops->ctrl_ops ||
  437. !soc->ops->ctrl_ops->txrx_set_peer_protocol_drop_mask)
  438. return;
  439. soc->ops->ctrl_ops->txrx_set_peer_protocol_drop_mask(soc, vdev_id,
  440. drop_mask);
  441. }
  442. /**
  443. * cdp_is_vdev_peer_protocol_count_enabled() - whether peer-protocol tracking
  444. * enabled
  445. *
  446. * @soc - pointer to the soc
  447. * @vdev - the data virtual device object
  448. *
  449. * Get whether peer protocol count feature enabled or not
  450. *
  451. * Return: whether feature enabled or not
  452. */
  453. static inline
  454. int cdp_is_vdev_peer_protocol_count_enabled(ol_txrx_soc_handle soc,
  455. int8_t vdev_id)
  456. {
  457. if (!soc || !soc->ops) {
  458. dp_cdp_debug("Invalid Instance:");
  459. QDF_BUG(0);
  460. return 0;
  461. }
  462. if (!soc->ops->ctrl_ops ||
  463. !soc->ops->ctrl_ops->txrx_is_peer_protocol_count_enabled)
  464. return 0;
  465. return soc->ops->ctrl_ops->txrx_is_peer_protocol_count_enabled(soc,
  466. vdev_id);
  467. }
  468. /**
  469. * cdp_get_peer_protocol_drop_mask() - get per-peer protocol count drop-mask
  470. *
  471. * @soc - pointer to the soc
  472. * @vdev - the data virtual device object
  473. *
  474. * Get peer-protocol-count drop-mask
  475. *
  476. * Return: peer-protocol-count drop-mask
  477. */
  478. static inline
  479. int cdp_get_peer_protocol_drop_mask(ol_txrx_soc_handle soc, int8_t vdev_id)
  480. {
  481. if (!soc || !soc->ops) {
  482. dp_cdp_debug("Invalid Instance:");
  483. QDF_BUG(0);
  484. return 0;
  485. }
  486. if (!soc->ops->ctrl_ops ||
  487. !soc->ops->ctrl_ops->txrx_get_peer_protocol_drop_mask)
  488. return 0;
  489. return soc->ops->ctrl_ops->txrx_get_peer_protocol_drop_mask(soc,
  490. vdev_id);
  491. }
  492. /*
  493. * Rx-Ingress and Tx-Egress are in the lower level DP layer
  494. * Rx-Egress and Tx-ingress are handled in osif layer for DP
  495. * So
  496. * Rx-Ingress and Tx-Egress definitions are in DP layer
  497. * Rx-Egress and Tx-ingress mask definitions are here below
  498. */
  499. #define VDEV_PEER_PROTOCOL_RX_INGRESS_MASK 1
  500. #define VDEV_PEER_PROTOCOL_TX_INGRESS_MASK 2
  501. #define VDEV_PEER_PROTOCOL_RX_EGRESS_MASK 4
  502. #define VDEV_PEER_PROTOCOL_TX_EGRESS_MASK 8
  503. #else
  504. #define cdp_set_vdev_peer_protocol_count(soc, vdev_id, enable)
  505. #define cdp_set_vdev_peer_protocol_drop_mask(soc, vdev_id, drop_mask)
  506. #define cdp_is_vdev_peer_protocol_count_enabled(soc, vdev_id) 0
  507. #define cdp_get_peer_protocol_drop_mask(soc, vdev_id) 0
  508. #endif
  509. /**
  510. * cdp_txrx_set_pdev_param() - set pdev parameter
  511. * @soc: opaque soc handle
  512. * @pdev_id: id of data path pdev handle
  513. * @type: param type
  514. * @val: value
  515. *
  516. * Return: status: 0 - Success, non-zero: Failure
  517. */
  518. static inline QDF_STATUS cdp_txrx_set_pdev_param(ol_txrx_soc_handle soc,
  519. uint8_t pdev_id,
  520. enum cdp_pdev_param_type type,
  521. cdp_config_param_type val)
  522. {
  523. if (!soc || !soc->ops) {
  524. dp_cdp_debug("Invalid Instance:");
  525. QDF_BUG(0);
  526. return QDF_STATUS_E_FAILURE;
  527. }
  528. if (!soc->ops->ctrl_ops ||
  529. !soc->ops->ctrl_ops->txrx_set_pdev_param)
  530. return QDF_STATUS_E_FAILURE;
  531. return soc->ops->ctrl_ops->txrx_set_pdev_param
  532. (soc, pdev_id, type, val);
  533. }
  534. /**
  535. * cdp_txrx_set_peer_param() - set pdev parameter
  536. * @soc: opaque soc handle
  537. * @vdev_id: id of data path vdev handle
  538. * @peer_mac: peer mac address
  539. * @type: param type
  540. * @val: value
  541. *
  542. * Return: status: 0 - Success, non-zero: Failure
  543. */
  544. static inline QDF_STATUS cdp_txrx_set_peer_param(ol_txrx_soc_handle soc,
  545. uint8_t vdev_id,
  546. uint8_t *peer_mac,
  547. enum cdp_peer_param_type type,
  548. cdp_config_param_type val)
  549. {
  550. if (!soc || !soc->ops) {
  551. dp_cdp_debug("Invalid Instance:");
  552. QDF_BUG(0);
  553. return QDF_STATUS_E_FAILURE;
  554. }
  555. if (!soc->ops->ctrl_ops ||
  556. !soc->ops->ctrl_ops->txrx_set_peer_param)
  557. return QDF_STATUS_E_FAILURE;
  558. return soc->ops->ctrl_ops->txrx_set_peer_param
  559. (soc, vdev_id, peer_mac, type, val);
  560. }
  561. /**
  562. * cdp_txrx_get_peer_param() - set pdev parameter
  563. * @soc: opaque soc handle
  564. * @vdev_id: id of data path vdev handle
  565. * @peer_mac: peer mac address
  566. * @type: param type
  567. * @val: address of buffer
  568. *
  569. * Return: status
  570. */
  571. static inline QDF_STATUS cdp_txrx_get_peer_param(ol_txrx_soc_handle soc,
  572. uint8_t vdev_id,
  573. uint8_t *peer_mac,
  574. enum cdp_peer_param_type type,
  575. cdp_config_param_type *val)
  576. {
  577. if (!soc || !soc->ops) {
  578. dp_cdp_debug("Invalid Instance:");
  579. QDF_BUG(0);
  580. return QDF_STATUS_E_FAILURE;
  581. }
  582. if (!soc->ops->ctrl_ops ||
  583. !soc->ops->ctrl_ops->txrx_get_peer_param)
  584. return QDF_STATUS_E_FAILURE;
  585. return soc->ops->ctrl_ops->txrx_get_peer_param
  586. (soc, vdev_id, peer_mac, type, val);
  587. }
  588. #ifdef QCA_MULTIPASS_SUPPORT
  589. static inline void
  590. cdp_peer_set_vlan_id(ol_txrx_soc_handle soc, uint8_t vdev_id,
  591. uint8_t *peer_mac, uint16_t vlan_id)
  592. {
  593. if (!soc || !soc->ops) {
  594. dp_cdp_debug("Invalid Instance:");
  595. QDF_BUG(0);
  596. return;
  597. }
  598. if (!soc->ops->ctrl_ops ||
  599. !soc->ops->ctrl_ops->txrx_peer_set_vlan_id)
  600. return;
  601. soc->ops->ctrl_ops->txrx_peer_set_vlan_id(soc, vdev_id, peer_mac,
  602. vlan_id);
  603. }
  604. #endif
  605. /**
  606. * cdp_txrx_get_pdev_param() - get pdev parameter
  607. * @soc: opaque soc handle
  608. * @pdev_id: id of data path pdev handle
  609. * @type: param type
  610. * @value: address of value buffer
  611. *
  612. * Return: status
  613. */
  614. static inline QDF_STATUS cdp_txrx_get_pdev_param(ol_txrx_soc_handle soc,
  615. uint8_t pdev_id,
  616. enum cdp_pdev_param_type type,
  617. cdp_config_param_type *value)
  618. {
  619. if (!soc || !soc->ops) {
  620. dp_cdp_debug("Invalid Instance:");
  621. QDF_BUG(0);
  622. return QDF_STATUS_E_FAILURE;
  623. }
  624. if (!soc->ops->ctrl_ops ||
  625. !soc->ops->ctrl_ops->txrx_get_pdev_param)
  626. return QDF_STATUS_E_FAILURE;
  627. return soc->ops->ctrl_ops->txrx_get_pdev_param
  628. (soc, pdev_id, type, value);
  629. }
  630. /**
  631. * cdp_txrx_peer_protocol_cnt() - set peer protocol count
  632. * @soc: opaque soc handle
  633. * @vdev: opaque vdev handle
  634. * @nbuf: data packet
  635. * @is_egress: whether egress or ingress
  636. * @is_rx: whether tx or rx
  637. *
  638. * Return: void
  639. */
  640. #ifdef VDEV_PEER_PROTOCOL_COUNT
  641. static inline void
  642. cdp_txrx_peer_protocol_cnt(ol_txrx_soc_handle soc,
  643. int8_t vdev_id,
  644. qdf_nbuf_t nbuf,
  645. enum vdev_peer_protocol_enter_exit is_egress,
  646. enum vdev_peer_protocol_tx_rx is_rx)
  647. {
  648. if (!soc || !soc->ops) {
  649. dp_cdp_debug("Invalid Instance:");
  650. QDF_BUG(0);
  651. return;
  652. }
  653. if (!soc->ops->ctrl_ops ||
  654. !soc->ops->ctrl_ops->txrx_peer_protocol_cnt)
  655. return;
  656. soc->ops->ctrl_ops->txrx_peer_protocol_cnt(soc, vdev_id, nbuf,
  657. is_egress, is_rx);
  658. }
  659. #else
  660. #define cdp_txrx_peer_protocol_cnt(soc, vdev_id, nbuf, is_egress, is_rx)
  661. #endif
  662. /**
  663. * cdp_enable_peer_based_pktlog()- Set flag in peer structure
  664. *
  665. * @soc: pointer to the soc
  666. * @pdev_id: id of the data physical device object
  667. * @enable: enable or disable peer based filter based pktlog
  668. * @peer_macaddr: Mac address of peer which needs to be
  669. * filtered
  670. *
  671. * This function will set flag in peer structure if peer based filtering
  672. * is enabled for pktlog
  673. *
  674. * Return: int
  675. */
  676. static inline int
  677. cdp_enable_peer_based_pktlog(ol_txrx_soc_handle soc, uint8_t pdev_id,
  678. char *peer_macaddr,
  679. uint8_t enable)
  680. {
  681. if (!soc || !soc->ops) {
  682. QDF_TRACE_ERROR(QDF_MODULE_ID_DP,
  683. "%s invalid instance", __func__);
  684. QDF_BUG(0);
  685. return 0;
  686. }
  687. if (!soc->ops->ctrl_ops ||
  688. !soc->ops->ctrl_ops->enable_peer_based_pktlog)
  689. return 0;
  690. return soc->ops->ctrl_ops->enable_peer_based_pktlog
  691. (soc, pdev_id, peer_macaddr, enable);
  692. }
  693. /**
  694. * cdp_calculate_delay_stats()- get rx delay stats
  695. *
  696. * @soc: pointer to the soc
  697. * @vdev_id: id of vdev handle
  698. * @nbuf: nbuf which is passed
  699. *
  700. * This function will calculate rx delay statistics.
  701. */
  702. static inline QDF_STATUS
  703. cdp_calculate_delay_stats(ol_txrx_soc_handle soc, uint8_t vdev_id,
  704. qdf_nbuf_t nbuf)
  705. {
  706. if (!soc || !soc->ops) {
  707. dp_cdp_debug("Invalid Instance:");
  708. QDF_BUG(0);
  709. return QDF_STATUS_E_FAILURE;
  710. }
  711. if (!soc->ops->ctrl_ops ||
  712. !soc->ops->ctrl_ops->calculate_delay_stats) {
  713. dp_cdp_debug("callback not registered:");
  714. return QDF_STATUS_E_FAILURE;
  715. }
  716. return soc->ops->ctrl_ops->calculate_delay_stats(soc, vdev_id, nbuf);
  717. }
  718. /**
  719. * @brief Subscribe to a specified WDI event.
  720. * @details
  721. * This function adds the provided wdi_event_subscribe object to a list of
  722. * subscribers for the specified WDI event.
  723. * When the event in question happens, each subscriber for the event will
  724. * have their callback function invoked.
  725. * The order in which callback functions from multiple subscribers are
  726. * invoked is unspecified.
  727. *
  728. * @param soc - pointer to the soc
  729. * @param pdev_id - id of the data physical device object
  730. * @param event_cb_sub - the callback and context for the event subscriber
  731. * @param event - which event's notifications are being subscribed to
  732. * @return - int
  733. */
  734. static inline int
  735. cdp_wdi_event_sub(ol_txrx_soc_handle soc, uint8_t pdev_id,
  736. wdi_event_subscribe *event_cb_sub, uint32_t event)
  737. {
  738. if (!soc || !soc->ops) {
  739. dp_cdp_debug("invalid instance");
  740. QDF_BUG(0);
  741. return 0;
  742. }
  743. if (!soc->ops->ctrl_ops ||
  744. !soc->ops->ctrl_ops->txrx_wdi_event_sub)
  745. return 0;
  746. return soc->ops->ctrl_ops->txrx_wdi_event_sub
  747. (soc, pdev_id, event_cb_sub, event);
  748. }
  749. /**
  750. * @brief Unsubscribe from a specified WDI event.
  751. * @details
  752. * This function removes the provided event subscription object from the
  753. * list of subscribers for its event.
  754. * This function shall only be called if there was a successful prior call
  755. * to event_sub() on the same wdi_event_subscribe object.
  756. *
  757. * @param soc - pointer to the soc
  758. * @param pdev_id - id of the data physical device object
  759. * @param event_cb_sub - the callback and context for the event subscriber
  760. * @param event - which event's notifications are being subscribed to
  761. * @return - int
  762. */
  763. static inline int
  764. cdp_wdi_event_unsub(ol_txrx_soc_handle soc,
  765. uint8_t pdev_id, wdi_event_subscribe *event_cb_sub,
  766. uint32_t event)
  767. {
  768. if (!soc || !soc->ops) {
  769. dp_cdp_debug("invalid instance");
  770. QDF_BUG(0);
  771. return 0;
  772. }
  773. if (!soc->ops->ctrl_ops ||
  774. !soc->ops->ctrl_ops->txrx_wdi_event_unsub)
  775. return 0;
  776. return soc->ops->ctrl_ops->txrx_wdi_event_unsub
  777. (soc, pdev_id, event_cb_sub, event);
  778. }
  779. /**
  780. * @brief Get security type from the from peer.
  781. * @details
  782. * This function gets the Security information from the peer handler.
  783. * The security information is got from the rx descriptor and filled in
  784. * to the peer handler.
  785. *
  786. * @param soc - pointer to the soc
  787. * @param vdev_id - id of vdev handle
  788. * @param peer mac - peer mac address
  789. * @param sec_idx - mcast or ucast frame type.
  790. * @return - int
  791. */
  792. static inline int
  793. cdp_get_sec_type(ol_txrx_soc_handle soc, uint8_t vdev_id, uint8_t *peer_mac,
  794. uint8_t sec_idx)
  795. {
  796. if (!soc || !soc->ops) {
  797. dp_cdp_debug("invalid instance");
  798. QDF_BUG(0);
  799. return A_ERROR;
  800. }
  801. if (!soc->ops->ctrl_ops ||
  802. !soc->ops->ctrl_ops->txrx_get_sec_type)
  803. return A_ERROR;
  804. return soc->ops->ctrl_ops->txrx_get_sec_type
  805. (soc, vdev_id, peer_mac, sec_idx);
  806. }
  807. /**
  808. * cdp_set_mgmt_tx_power(): function to set tx power for mgmt frames
  809. * @param soc - pointer to the soc
  810. * @vdev_id : id of vdev handle
  811. * @subtype_index: subtype
  812. * @tx_power: Tx power
  813. * Return: QDF_STATUS
  814. */
  815. static inline QDF_STATUS
  816. cdp_set_mgmt_tx_power(ol_txrx_soc_handle soc,
  817. uint8_t vdev_id, uint8_t subtype, uint8_t tx_power)
  818. {
  819. if (!soc || !soc->ops) {
  820. dp_cdp_debug("Invalid Instance:");
  821. QDF_BUG(0);
  822. return QDF_STATUS_E_FAILURE;
  823. }
  824. if (!soc->ops->ctrl_ops ||
  825. !soc->ops->ctrl_ops->txrx_update_mgmt_txpow_vdev)
  826. return QDF_STATUS_E_FAILURE;
  827. return soc->ops->ctrl_ops->txrx_update_mgmt_txpow_vdev(soc, vdev_id,
  828. subtype, tx_power);
  829. }
  830. /**
  831. * cdp_get_pldev() - function to get pktlog device handle
  832. * @soc: datapath soc handle
  833. * @pdev_id: physical device id
  834. *
  835. * Return: pktlog device handle or NULL
  836. */
  837. static inline void *
  838. cdp_get_pldev(ol_txrx_soc_handle soc, uint8_t pdev_id)
  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 NULL;
  845. }
  846. if (!soc->ops->ctrl_ops || !soc->ops->ctrl_ops->txrx_get_pldev)
  847. return NULL;
  848. return soc->ops->ctrl_ops->txrx_get_pldev(soc, pdev_id);
  849. }
  850. #if defined(WLAN_CFR_ENABLE) && defined(WLAN_ENH_CFR_ENABLE)
  851. /**
  852. * cdp_cfr_filter() - Configure Host RX monitor status ring for CFR
  853. * @soc: SOC TXRX handle
  854. * @pdev_id: ID of the physical device object
  855. * @enable: Enable or disable CFR
  856. * @filter_val: Flag to select filter for monitor mode
  857. */
  858. static inline void
  859. cdp_cfr_filter(ol_txrx_soc_handle soc,
  860. uint8_t pdev_id,
  861. bool enable,
  862. struct cdp_monitor_filter *filter_val)
  863. {
  864. if (!soc || !soc->ops) {
  865. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
  866. "%s invalid instance", __func__);
  867. QDF_BUG(0);
  868. return;
  869. }
  870. if (!soc->ops->cfr_ops || !soc->ops->cfr_ops->txrx_cfr_filter)
  871. return;
  872. soc->ops->cfr_ops->txrx_cfr_filter(soc, pdev_id, enable, filter_val);
  873. }
  874. /**
  875. * cdp_get_cfr_rcc() - get cfr rcc config
  876. * @soc: Datapath soc handle
  877. * @pdev_id: id of objmgr pdev
  878. *
  879. * Return: true/false based on cfr mode setting
  880. */
  881. static inline
  882. bool cdp_get_cfr_rcc(ol_txrx_soc_handle soc, uint8_t pdev_id)
  883. {
  884. if (!soc || !soc->ops) {
  885. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
  886. "%s invalid instance", __func__);
  887. QDF_BUG(0);
  888. return 0;
  889. }
  890. if (!soc->ops->cfr_ops || !soc->ops->cfr_ops->txrx_get_cfr_rcc)
  891. return 0;
  892. return soc->ops->cfr_ops->txrx_get_cfr_rcc(soc, pdev_id);
  893. }
  894. /**
  895. * cdp_set_cfr_rcc() - enable/disable cfr rcc config
  896. * @soc: Datapath soc handle
  897. * @pdev_id: id of objmgr pdev
  898. * @enable: Enable/Disable cfr rcc mode
  899. *
  900. * Return: none
  901. */
  902. static inline
  903. void cdp_set_cfr_rcc(ol_txrx_soc_handle soc, uint8_t pdev_id, bool enable)
  904. {
  905. if (!soc || !soc->ops) {
  906. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
  907. "%s invalid instance", __func__);
  908. QDF_BUG(0);
  909. return;
  910. }
  911. if (!soc->ops->cfr_ops || !soc->ops->cfr_ops->txrx_set_cfr_rcc)
  912. return;
  913. return soc->ops->cfr_ops->txrx_set_cfr_rcc(soc, pdev_id, enable);
  914. }
  915. /**
  916. * cdp_get_cfr_dbg_stats() - Get debug statistics for CFR
  917. *
  918. * @soc: SOC TXRX handle
  919. * @pdev_id: ID of the physical device object
  920. * @buf: CFR RCC debug statistics buffer
  921. *
  922. * Return: None
  923. */
  924. static inline void
  925. cdp_get_cfr_dbg_stats(ol_txrx_soc_handle soc, uint8_t pdev_id,
  926. struct cdp_cfr_rcc_stats *buf)
  927. {
  928. if (!soc || !soc->ops) {
  929. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
  930. "%s invalid instance", __func__);
  931. QDF_BUG(0);
  932. return;
  933. }
  934. if (!soc->ops->cfr_ops || !soc->ops->cfr_ops->txrx_get_cfr_dbg_stats)
  935. return;
  936. soc->ops->cfr_ops->txrx_get_cfr_dbg_stats(soc, pdev_id, buf);
  937. }
  938. /**
  939. * cdp_cfr_clr_dbg_stats() - Clear debug statistics for CFR
  940. *
  941. * @soc: SOC TXRX handle
  942. * @pdev_id: ID of the physical device object
  943. */
  944. static inline void
  945. cdp_cfr_clr_dbg_stats(ol_txrx_soc_handle soc, uint8_t pdev_id)
  946. {
  947. if (!soc || !soc->ops) {
  948. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
  949. "%s invalid instance", __func__);
  950. QDF_BUG(0);
  951. return;
  952. }
  953. if (!soc->ops->cfr_ops || !soc->ops->cfr_ops->txrx_clear_cfr_dbg_stats)
  954. return;
  955. soc->ops->cfr_ops->txrx_clear_cfr_dbg_stats(soc, pdev_id);
  956. }
  957. /**
  958. * cdp_enable_mon_reap_timer() - enable/disable reap timer
  959. * @soc: Datapath soc handle
  960. * @pdev_id: id of objmgr pdev
  961. * @enable: enable/disable reap timer of monitor status ring
  962. *
  963. * Return: none
  964. */
  965. static inline void
  966. cdp_enable_mon_reap_timer(ol_txrx_soc_handle soc, uint8_t pdev_id,
  967. bool enable)
  968. {
  969. if (!soc || !soc->ops) {
  970. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
  971. "%s invalid instance", __func__);
  972. QDF_BUG(0);
  973. return;
  974. }
  975. if (!soc->ops->cfr_ops ||
  976. !soc->ops->cfr_ops->txrx_enable_mon_reap_timer)
  977. return;
  978. return soc->ops->cfr_ops->txrx_enable_mon_reap_timer(soc, pdev_id,
  979. enable);
  980. }
  981. #endif
  982. #if defined(WLAN_TX_PKT_CAPTURE_ENH) || defined(WLAN_RX_PKT_CAPTURE_ENH)
  983. /**
  984. * cdp_update_peer_pkt_capture_params() - Sets Rx & Tx Capture params for a peer
  985. * @soc: SOC TXRX handle
  986. * @pdev_id: id of CDP pdev pointer
  987. * @is_rx_pkt_cap_enable: enable/disable rx pkt capture for this peer
  988. * @is_tx_pkt_cap_enable: enable/disable tx pkt capture for this peer
  989. * @peer_mac: MAC address of peer for which pkt_cap is to be enabled/disabled
  990. *
  991. * Return: Success when matching peer is found & flags are set, error otherwise
  992. */
  993. static inline QDF_STATUS
  994. cdp_update_peer_pkt_capture_params(ol_txrx_soc_handle soc,
  995. uint8_t pdev_id,
  996. bool is_rx_pkt_cap_enable,
  997. uint8_t is_tx_pkt_cap_enable,
  998. uint8_t *peer_mac)
  999. {
  1000. if (!soc || !soc->ops) {
  1001. dp_err("Invalid SOC instance");
  1002. QDF_BUG(0);
  1003. return QDF_STATUS_E_FAILURE;
  1004. }
  1005. if (!soc->ops->ctrl_ops ||
  1006. !soc->ops->ctrl_ops->txrx_update_peer_pkt_capture_params)
  1007. return QDF_STATUS_E_FAILURE;
  1008. return soc->ops->ctrl_ops->txrx_update_peer_pkt_capture_params
  1009. (soc, pdev_id, is_rx_pkt_cap_enable,
  1010. is_tx_pkt_cap_enable, peer_mac);
  1011. }
  1012. #endif /* WLAN_TX_PKT_CAPTURE_ENH || WLAN_RX_PKT_CAPTURE_ENH */
  1013. #ifdef WLAN_SUPPORT_RX_PROTOCOL_TYPE_TAG
  1014. /**
  1015. * cdp_update_pdev_rx_protocol_tag() - wrapper function to set the protocol
  1016. * tag in CDP layer from cfg layer
  1017. * @soc: SOC TXRX handle
  1018. * @pdev_id: id of CDP pdev pointer
  1019. * @protocol_mask: Bitmap for protocol for which tagging is enabled
  1020. * @protocol_type: Protocol type for which the tag should be update
  1021. * @tag: Actual tag value for the given prototype
  1022. * Return: Returns QDF_STATUS_SUCCESS/FAILURE
  1023. */
  1024. static inline QDF_STATUS
  1025. cdp_update_pdev_rx_protocol_tag(ol_txrx_soc_handle soc,
  1026. uint8_t pdev_id, uint32_t protocol_mask,
  1027. uint16_t protocol_type, uint16_t tag)
  1028. {
  1029. if (!soc || !soc->ops) {
  1030. dp_err("Invalid SOC instance");
  1031. QDF_BUG(0);
  1032. return QDF_STATUS_E_FAILURE;
  1033. }
  1034. if (!soc->ops->ctrl_ops ||
  1035. !soc->ops->ctrl_ops->txrx_update_pdev_rx_protocol_tag)
  1036. return QDF_STATUS_E_FAILURE;
  1037. return soc->ops->ctrl_ops->txrx_update_pdev_rx_protocol_tag
  1038. (soc, pdev_id, protocol_mask, protocol_type, tag);
  1039. }
  1040. #ifdef WLAN_SUPPORT_RX_TAG_STATISTICS
  1041. /**
  1042. * cdp_dump_pdev_rx_protocol_tag_stats() - wrapper function to dump the protocol
  1043. tag statistics for given or all protocols
  1044. * @soc: SOC TXRX handle
  1045. * @pdev_id: id of CDP pdev pointer
  1046. * @protocol_type: Protocol type for which the tag should be update
  1047. * Return: Returns QDF_STATUS_SUCCESS/FAILURE
  1048. */
  1049. static inline QDF_STATUS
  1050. cdp_dump_pdev_rx_protocol_tag_stats(ol_txrx_soc_handle soc,
  1051. uint8_t pdev_id,
  1052. uint16_t protocol_type)
  1053. {
  1054. if (!soc || !soc->ops) {
  1055. dp_err("Invalid SOC instance");
  1056. QDF_BUG(0);
  1057. return QDF_STATUS_E_FAILURE;
  1058. }
  1059. if (!soc->ops->ctrl_ops ||
  1060. !soc->ops->ctrl_ops->txrx_dump_pdev_rx_protocol_tag_stats)
  1061. return QDF_STATUS_E_FAILURE;
  1062. soc->ops->ctrl_ops->txrx_dump_pdev_rx_protocol_tag_stats(soc, pdev_id,
  1063. protocol_type);
  1064. return QDF_STATUS_SUCCESS;
  1065. }
  1066. #endif /* WLAN_SUPPORT_RX_TAG_STATISTICS */
  1067. #endif /* WLAN_SUPPORT_RX_PROTOCOL_TYPE_TAG */
  1068. #ifdef ATH_SUPPORT_NAC_RSSI
  1069. /**
  1070. * cdp_vdev_config_for_nac_rssi(): To invoke dp callback for nac rssi config
  1071. * @soc: soc pointer
  1072. * @vdev_id: id of vdev
  1073. * @nac_cmd: specfies nac_rss config action add, del, list
  1074. * @bssid: Neighbour bssid
  1075. * @client_macaddr: Non-Associated client MAC
  1076. * @chan_num: channel number to scan
  1077. *
  1078. * Return: QDF_STATUS
  1079. */
  1080. static inline QDF_STATUS cdp_vdev_config_for_nac_rssi(ol_txrx_soc_handle soc,
  1081. uint8_t vdev_id, enum cdp_nac_param_cmd nac_cmd,
  1082. char *bssid, char *client_macaddr, uint8_t chan_num)
  1083. {
  1084. if (!soc || !soc->ops) {
  1085. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
  1086. "%s invalid instance", __func__);
  1087. QDF_BUG(0);
  1088. return QDF_STATUS_E_FAILURE;
  1089. }
  1090. if (!soc->ops->ctrl_ops ||
  1091. !soc->ops->ctrl_ops->txrx_vdev_config_for_nac_rssi)
  1092. return QDF_STATUS_E_FAILURE;
  1093. return soc->ops->ctrl_ops->txrx_vdev_config_for_nac_rssi(soc, vdev_id,
  1094. nac_cmd, bssid, client_macaddr, chan_num);
  1095. }
  1096. /*
  1097. * cdp_vdev_get_neighbour_rssi(): To invoke dp callback to get rssi value of nac
  1098. * @soc: soc pointer
  1099. * @vdev_id: id of vdev
  1100. * @macaddr: Non-Associated client MAC
  1101. * @rssi: rssi
  1102. *
  1103. * Return: QDF_STATUS
  1104. */
  1105. static inline QDF_STATUS cdp_vdev_get_neighbour_rssi(ol_txrx_soc_handle soc,
  1106. uint8_t vdev_id,
  1107. char *macaddr,
  1108. uint8_t *rssi)
  1109. {
  1110. if (!soc || !soc->ops) {
  1111. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
  1112. "%s invalid instance", __func__);
  1113. QDF_BUG(0);
  1114. return QDF_STATUS_E_FAILURE;
  1115. }
  1116. if (!soc->ops->ctrl_ops ||
  1117. !soc->ops->ctrl_ops->txrx_vdev_get_neighbour_rssi)
  1118. return QDF_STATUS_E_FAILURE;
  1119. return soc->ops->ctrl_ops->txrx_vdev_get_neighbour_rssi(soc, vdev_id,
  1120. macaddr,
  1121. rssi);
  1122. }
  1123. #endif
  1124. #ifdef WLAN_SUPPORT_RX_FLOW_TAG
  1125. /**
  1126. * cdp_set_rx_flow_tag() - wrapper function to set the flow
  1127. * tag in CDP layer from cfg layer
  1128. * @soc: SOC TXRX handle
  1129. * @pdev_id: id of CDP pdev pointer
  1130. * @flow_info: Flow 5-tuple, along with tag, if any, that needs to added/deleted
  1131. *
  1132. * Return: Success when add/del operation is successful, error otherwise
  1133. */
  1134. static inline QDF_STATUS
  1135. cdp_set_rx_flow_tag(ol_txrx_soc_handle soc, uint8_t pdev_id,
  1136. struct cdp_rx_flow_info *flow_info)
  1137. {
  1138. if (!soc || !soc->ops) {
  1139. dp_err("Invalid SOC instance");
  1140. QDF_BUG(0);
  1141. return QDF_STATUS_E_FAILURE;
  1142. }
  1143. if (!soc->ops->ctrl_ops ||
  1144. !soc->ops->ctrl_ops->txrx_set_rx_flow_tag)
  1145. return QDF_STATUS_E_FAILURE;
  1146. return soc->ops->ctrl_ops->txrx_set_rx_flow_tag(soc, pdev_id,
  1147. flow_info);
  1148. }
  1149. /**
  1150. * cdp_dump_rx_flow_tag_stats() - wrapper function to dump the flow
  1151. * tag statistics for given flow
  1152. * @soc: SOC TXRX handle
  1153. * @pdev_id: id of CDP pdev
  1154. * @flow_info: Flow tuple for which we want to print the statistics
  1155. *
  1156. * Return: Success when flow is found and stats are printed, error otherwise
  1157. */
  1158. static inline QDF_STATUS
  1159. cdp_dump_rx_flow_tag_stats(ol_txrx_soc_handle soc, uint8_t pdev_id,
  1160. struct cdp_rx_flow_info *flow_info)
  1161. {
  1162. if (!soc || !soc->ops) {
  1163. dp_err("Invalid SOC instance");
  1164. QDF_BUG(0);
  1165. return QDF_STATUS_E_FAILURE;
  1166. }
  1167. if (!soc->ops->ctrl_ops ||
  1168. !soc->ops->ctrl_ops->txrx_dump_rx_flow_tag_stats)
  1169. return QDF_STATUS_E_FAILURE;
  1170. return soc->ops->ctrl_ops->txrx_dump_rx_flow_tag_stats(soc,
  1171. pdev_id,
  1172. flow_info);
  1173. }
  1174. #endif /* WLAN_SUPPORT_RX_FLOW_TAG */
  1175. /**
  1176. * cdp_peer_flush_frags() - flush frags for peer
  1177. *
  1178. * @soc - pointer to the soc
  1179. * @vdev - the data virtual device object
  1180. *
  1181. * Get peer-protocol-count drop-mask
  1182. *
  1183. * Return: peer-protocol-count drop-mask
  1184. */
  1185. static inline
  1186. void cdp_txrx_peer_flush_frags(ol_txrx_soc_handle soc, uint8_t vdev_id,
  1187. uint8_t *peer_mac)
  1188. {
  1189. if (!soc || !soc->ops) {
  1190. dp_cdp_err("Invalid Instance:");
  1191. QDF_BUG(0);
  1192. return;
  1193. }
  1194. if (!soc->ops->ctrl_ops ||
  1195. !soc->ops->ctrl_ops->txrx_peer_flush_frags)
  1196. return;
  1197. return soc->ops->ctrl_ops->txrx_peer_flush_frags(soc, vdev_id,
  1198. peer_mac);
  1199. }
  1200. #ifdef WLAN_FEATURE_TSF_UPLINK_DELAY
  1201. /**
  1202. * cdp_set_delta_tsf() - wrapper function to set delta_tsf
  1203. * @soc: SOC TXRX handle
  1204. * @vdev_id: vdev id
  1205. * @delta_tsf: difference between TSF clock and qtimer
  1206. *
  1207. * Return: None
  1208. */
  1209. static inline void cdp_set_delta_tsf(ol_txrx_soc_handle soc, uint8_t vdev_id,
  1210. uint32_t delta_tsf)
  1211. {
  1212. if (!soc || !soc->ops) {
  1213. dp_cdp_err("Invalid instance");
  1214. QDF_BUG(0);
  1215. return;
  1216. }
  1217. if (!soc->ops->ctrl_ops ||
  1218. !soc->ops->ctrl_ops->txrx_set_delta_tsf)
  1219. return;
  1220. soc->ops->ctrl_ops->txrx_set_delta_tsf(soc, vdev_id, delta_tsf);
  1221. }
  1222. /**
  1223. * cdp_set_tsf_ul_delay_report() - Enable or disable reporting uplink delay
  1224. * @soc: SOC TXRX handle
  1225. * @vdev_id: vdev id
  1226. * @enable: true to enable and false to disable
  1227. *
  1228. * Return: QDF_STATUS
  1229. */
  1230. static inline QDF_STATUS cdp_set_tsf_ul_delay_report(ol_txrx_soc_handle soc,
  1231. uint8_t vdev_id,
  1232. bool enable)
  1233. {
  1234. if (!soc || !soc->ops) {
  1235. dp_cdp_err("Invalid SOC instance");
  1236. QDF_BUG(0);
  1237. return QDF_STATUS_E_FAILURE;
  1238. }
  1239. if (!soc->ops->ctrl_ops ||
  1240. !soc->ops->ctrl_ops->txrx_set_tsf_ul_delay_report)
  1241. return QDF_STATUS_E_FAILURE;
  1242. return soc->ops->ctrl_ops->txrx_set_tsf_ul_delay_report(soc, vdev_id,
  1243. enable);
  1244. }
  1245. /**
  1246. * cdp_get_uplink_delay() - Get uplink delay value
  1247. * @soc: SOC TXRX handle
  1248. * @vdev_id: vdev id
  1249. * @val: pointer to save uplink delay value
  1250. *
  1251. * Return: QDF_STATUS
  1252. */
  1253. static inline QDF_STATUS cdp_get_uplink_delay(ol_txrx_soc_handle soc,
  1254. uint32_t vdev_id, uint32_t *val)
  1255. {
  1256. if (!soc || !soc->ops) {
  1257. dp_cdp_err("Invalid SOC instance");
  1258. QDF_BUG(0);
  1259. return QDF_STATUS_E_FAILURE;
  1260. }
  1261. if (!val) {
  1262. dp_cdp_err("Invalid params val");
  1263. return QDF_STATUS_E_FAILURE;
  1264. }
  1265. if (!soc->ops->ctrl_ops ||
  1266. !soc->ops->ctrl_ops->txrx_get_uplink_delay)
  1267. return QDF_STATUS_E_FAILURE;
  1268. return soc->ops->ctrl_ops->txrx_get_uplink_delay(soc, vdev_id, val);
  1269. }
  1270. #endif /* WLAN_FEATURE_TSF_UPLINK_DELAY */
  1271. #endif /* _CDP_TXRX_CTRL_H_ */