cdp_txrx_ctrl.h 37 KB

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