target_if_cfr.c 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694
  1. /*
  2. * Copyright (c) 2019-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. #include <target_if_cfr.h>
  19. #include <wlan_tgt_def_config.h>
  20. #include <target_type.h>
  21. #include <hif_hw_version.h>
  22. #include <target_if.h>
  23. #include <wlan_lmac_if_def.h>
  24. #include <wlan_osif_priv.h>
  25. #include <init_deinit_lmac.h>
  26. #include <wlan_cfr_utils_api.h>
  27. #include <wlan_objmgr_pdev_obj.h>
  28. #include <target_if_cfr_enh.h>
  29. #ifdef CFR_USE_FIXED_FOLDER
  30. #include "target_if_cfr_6490.h"
  31. #include "target_if_cfr_adrastea.h"
  32. #include "wlan_reg_services_api.h"
  33. #else
  34. #include <target_if_cfr_8074v2.h>
  35. #endif
  36. int target_if_cfr_stop_capture(struct wlan_objmgr_pdev *pdev,
  37. struct wlan_objmgr_peer *peer)
  38. {
  39. struct peer_cfr *pe;
  40. struct peer_cfr_params param = {0};
  41. struct wmi_unified *pdev_wmi_handle = NULL;
  42. struct wlan_objmgr_vdev *vdev = {0};
  43. struct pdev_cfr *pdev_cfrobj;
  44. int retv = 0;
  45. pe = wlan_objmgr_peer_get_comp_private_obj(peer, WLAN_UMAC_COMP_CFR);
  46. if (pe == NULL)
  47. return -EINVAL;
  48. pdev_wmi_handle = lmac_get_pdev_wmi_handle(pdev);
  49. if (!pdev_wmi_handle) {
  50. cfr_err("pdev wmi handle NULL");
  51. return -EINVAL;
  52. }
  53. vdev = wlan_peer_get_vdev(peer);
  54. qdf_mem_set(&param, sizeof(param), 0);
  55. param.request = PEER_CFR_CAPTURE_DISABLE;
  56. param.macaddr = wlan_peer_get_macaddr(peer);
  57. param.vdev_id = wlan_vdev_get_id(vdev);
  58. param.periodicity = pe->period;
  59. param.bandwidth = pe->bandwidth;
  60. param.capture_method = pe->capture_method;
  61. retv = wmi_unified_send_peer_cfr_capture_cmd(pdev_wmi_handle, &param);
  62. pdev_cfrobj = wlan_objmgr_pdev_get_comp_private_obj(pdev,
  63. WLAN_UMAC_COMP_CFR);
  64. if (!pdev_cfrobj) {
  65. cfr_err("pdev object for CFR is null");
  66. return -EINVAL;
  67. }
  68. cfr_err("CFR capture stats for this capture:");
  69. cfr_err("DBR event count = %llu, Tx event count = %llu "
  70. "Release count = %llu",
  71. pdev_cfrobj->dbr_evt_cnt, pdev_cfrobj->tx_evt_cnt,
  72. pdev_cfrobj->release_cnt);
  73. cfr_err("tx_peer_status_cfr_fail = %llu",
  74. pdev_cfrobj->tx_peer_status_cfr_fail = 0);
  75. cfr_err("tx_evt_status_cfr_fail = %llu",
  76. pdev_cfrobj->tx_evt_status_cfr_fail);
  77. cfr_err("tx_dbr_cookie_lookup_fail = %llu",
  78. pdev_cfrobj->tx_dbr_cookie_lookup_fail);
  79. pdev_cfrobj->dbr_evt_cnt = 0;
  80. pdev_cfrobj->tx_evt_cnt = 0;
  81. pdev_cfrobj->release_cnt = 0;
  82. pdev_cfrobj->tx_peer_status_cfr_fail = 0;
  83. pdev_cfrobj->tx_evt_status_cfr_fail = 0;
  84. pdev_cfrobj->tx_dbr_cookie_lookup_fail = 0;
  85. return retv;
  86. }
  87. int target_if_cfr_start_capture(struct wlan_objmgr_pdev *pdev,
  88. struct wlan_objmgr_peer *peer,
  89. struct cfr_capture_params *cfr_params)
  90. {
  91. struct peer_cfr_params param = {0};
  92. struct wmi_unified *pdev_wmi_handle = NULL;
  93. struct wlan_objmgr_vdev *vdev;
  94. int retv = 0;
  95. pdev_wmi_handle = lmac_get_pdev_wmi_handle(pdev);
  96. if (!pdev_wmi_handle) {
  97. cfr_err("pdev wmi handle NULL");
  98. return -EINVAL;
  99. }
  100. vdev = wlan_peer_get_vdev(peer);
  101. qdf_mem_set(&param, sizeof(param), 0);
  102. param.request = PEER_CFR_CAPTURE_ENABLE;
  103. param.macaddr = wlan_peer_get_macaddr(peer);
  104. param.vdev_id = wlan_vdev_get_id(vdev);
  105. param.periodicity = cfr_params->period;
  106. param.bandwidth = cfr_params->bandwidth;
  107. param.capture_method = cfr_params->method;
  108. retv = wmi_unified_send_peer_cfr_capture_cmd(pdev_wmi_handle, &param);
  109. return retv;
  110. }
  111. #ifdef ENABLE_HOST_TO_TARGET_CONVERSION
  112. int target_if_cfr_periodic_peer_cfr_enable(struct wlan_objmgr_pdev *pdev,
  113. uint32_t param_value)
  114. {
  115. struct pdev_params pparam;
  116. uint32_t pdev_id;
  117. struct wmi_unified *pdev_wmi_handle = NULL;
  118. pdev_id = wlan_objmgr_pdev_get_pdev_id(pdev);
  119. if (pdev_id < 0)
  120. return -EINVAL;
  121. pdev_wmi_handle = lmac_get_pdev_wmi_handle(pdev);
  122. if (!pdev_wmi_handle) {
  123. cfr_err("pdev wmi handle NULL");
  124. return -EINVAL;
  125. }
  126. qdf_mem_set(&pparam, sizeof(pparam), 0);
  127. pparam.param_id = wmi_pdev_param_per_peer_prd_cfr_enable;
  128. pparam.param_value = param_value;
  129. return wmi_unified_pdev_param_send(pdev_wmi_handle,
  130. &pparam, pdev_id);
  131. }
  132. #else
  133. int target_if_cfr_periodic_peer_cfr_enable(struct wlan_objmgr_pdev *pdev,
  134. uint32_t param_value)
  135. {
  136. struct pdev_params pparam;
  137. uint32_t pdev_id;
  138. struct wmi_unified *pdev_wmi_handle = NULL;
  139. pdev_id = wlan_objmgr_pdev_get_pdev_id(pdev);
  140. if (pdev_id < 0)
  141. return -EINVAL;
  142. pdev_wmi_handle = lmac_get_pdev_wmi_handle(pdev);
  143. if (!pdev_wmi_handle) {
  144. cfr_err("pdev wmi handle NULL");
  145. return -EINVAL;
  146. }
  147. qdf_mem_set(&pparam, sizeof(pparam), 0);
  148. pparam.param_id = WMI_PDEV_PARAM_PER_PEER_PERIODIC_CFR_ENABLE;
  149. pparam.param_value = param_value;
  150. return wmi_unified_pdev_param_send(pdev_wmi_handle,
  151. &pparam, pdev_id);
  152. }
  153. #endif
  154. int target_if_cfr_enable_cfr_timer(struct wlan_objmgr_pdev *pdev,
  155. uint32_t cfr_timer)
  156. {
  157. struct pdev_cfr *pa;
  158. int retval;
  159. pa = wlan_objmgr_pdev_get_comp_private_obj(pdev, WLAN_UMAC_COMP_CFR);
  160. if (pa == NULL)
  161. return QDF_STATUS_E_FAILURE;
  162. if (!cfr_timer) {
  163. /* disable periodic cfr capture */
  164. retval =
  165. target_if_cfr_periodic_peer_cfr_enable(pdev,
  166. WMI_HOST_PEER_CFR_TIMER_DISABLE);
  167. if (retval == QDF_STATUS_SUCCESS)
  168. pa->cfr_timer_enable = 0;
  169. } else {
  170. /* enable periodic cfr capture (default base timer is 10ms ) */
  171. retval =
  172. target_if_cfr_periodic_peer_cfr_enable(pdev,
  173. WMI_HOST_PEER_CFR_TIMER_ENABLE);
  174. if (retval == QDF_STATUS_SUCCESS)
  175. pa->cfr_timer_enable = 1;
  176. }
  177. return retval;
  178. }
  179. int target_if_cfr_get_target_type(struct wlan_objmgr_psoc *psoc)
  180. {
  181. uint32_t target_type = 0;
  182. struct wlan_lmac_if_target_tx_ops *target_type_tx_ops;
  183. struct wlan_lmac_if_tx_ops *tx_ops;
  184. tx_ops = wlan_psoc_get_lmac_if_txops(psoc);
  185. if (!tx_ops) {
  186. cfr_err("tx_ops is NULL");
  187. return target_type;
  188. }
  189. target_type_tx_ops = &tx_ops->target_tx_ops;
  190. if (target_type_tx_ops->tgt_get_tgt_type)
  191. target_type = target_type_tx_ops->tgt_get_tgt_type(psoc);
  192. return target_type;
  193. }
  194. #ifdef CFR_USE_FIXED_FOLDER
  195. static QDF_STATUS target_if_cfr_init_target(struct wlan_objmgr_psoc *psoc,
  196. struct wlan_objmgr_pdev *pdev,
  197. uint32_t target)
  198. {
  199. struct pdev_cfr *cfr_pdev;
  200. struct psoc_cfr *cfr_psoc;
  201. struct wmi_unified *wmi_handle = NULL;
  202. bool cfr_capable;
  203. QDF_STATUS status;
  204. if (!psoc || !pdev) {
  205. cfr_err("null pdev or psoc");
  206. return QDF_STATUS_E_FAILURE;
  207. }
  208. cfr_pdev = wlan_objmgr_pdev_get_comp_private_obj(pdev,
  209. WLAN_UMAC_COMP_CFR);
  210. if (!cfr_pdev) {
  211. cfr_err("null pdev cfr");
  212. return QDF_STATUS_E_FAILURE;
  213. }
  214. cfr_psoc = wlan_objmgr_psoc_get_comp_private_obj(psoc,
  215. WLAN_UMAC_COMP_CFR);
  216. if (!cfr_psoc) {
  217. cfr_err("null psoc cfr");
  218. return QDF_STATUS_E_FAILURE;
  219. }
  220. wmi_handle = lmac_get_pdev_wmi_handle(pdev);
  221. if (!wmi_handle) {
  222. cfr_err("null wmi handle");
  223. return QDF_STATUS_E_FAILURE;
  224. }
  225. if (wlan_cfr_is_feature_disabled(pdev)) {
  226. cfr_pdev->is_cfr_capable = 0;
  227. cfr_psoc->is_cfr_capable = 0;
  228. cfr_info("cfr disabled");
  229. return QDF_STATUS_SUCCESS;
  230. }
  231. cfr_capable = wmi_service_enabled(wmi_handle,
  232. wmi_service_cfr_capture_support);
  233. cfr_pdev->is_cfr_capable = cfr_capable;
  234. cfr_psoc->is_cfr_capable = cfr_capable;
  235. if (!cfr_capable) {
  236. cfr_err("FW doesn't support CFR");
  237. return QDF_STATUS_SUCCESS;
  238. }
  239. status = cfr_enh_init_pdev(psoc, pdev);
  240. if (target == TARGET_TYPE_QCA6490)
  241. cfr_pdev->chip_type = CFR_CAPTURE_RADIO_HSP;
  242. else if (target == TARGET_TYPE_QCA6750)
  243. cfr_pdev->chip_type = CFR_CAPTURE_RADIO_MOSELLE;
  244. return status;
  245. }
  246. static QDF_STATUS target_if_cfr_deinit_target(struct wlan_objmgr_psoc *psoc,
  247. struct wlan_objmgr_pdev *pdev)
  248. {
  249. struct pdev_cfr *pcfr;
  250. if (!psoc || !pdev) {
  251. cfr_err("null pdev or psoc");
  252. return QDF_STATUS_E_FAILURE;
  253. }
  254. pcfr = wlan_objmgr_pdev_get_comp_private_obj(pdev,
  255. WLAN_UMAC_COMP_CFR);
  256. if (!pcfr) {
  257. cfr_err("null pdev cfr");
  258. return QDF_STATUS_E_FAILURE;
  259. }
  260. if (!pcfr->is_cfr_capable) {
  261. cfr_info("cfr disabled or FW not support");
  262. return QDF_STATUS_SUCCESS;
  263. }
  264. return cfr_enh_deinit_pdev(psoc, pdev);
  265. }
  266. QDF_STATUS
  267. target_if_cfr_init_pdev(struct wlan_objmgr_psoc *psoc,
  268. struct wlan_objmgr_pdev *pdev)
  269. {
  270. uint32_t target_type;
  271. QDF_STATUS status;
  272. target_type = target_if_cfr_get_target_type(psoc);
  273. if (target_type == TARGET_TYPE_QCA6490 ||
  274. target_type == TARGET_TYPE_QCA6750) {
  275. status = target_if_cfr_init_target(psoc,
  276. pdev, target_type);
  277. } else if (target_type == TARGET_TYPE_ADRASTEA) {
  278. status = cfr_adrastea_init_pdev(psoc, pdev);
  279. } else {
  280. cfr_info("unsupport chip");
  281. status = QDF_STATUS_SUCCESS;
  282. }
  283. return status;
  284. }
  285. QDF_STATUS
  286. target_if_cfr_deinit_pdev(struct wlan_objmgr_psoc *psoc,
  287. struct wlan_objmgr_pdev *pdev)
  288. {
  289. uint32_t target_type;
  290. QDF_STATUS status;
  291. target_type = target_if_cfr_get_target_type(psoc);
  292. if (target_type == TARGET_TYPE_QCA6490 ||
  293. target_type == TARGET_TYPE_QCA6750) {
  294. status = target_if_cfr_deinit_target(psoc, pdev);
  295. } else if (target_type == TARGET_TYPE_ADRASTEA) {
  296. status = cfr_adrastea_deinit_pdev(psoc, pdev);
  297. } else {
  298. cfr_info("unsupport chip");
  299. status = QDF_STATUS_SUCCESS;
  300. }
  301. return status;
  302. }
  303. #else
  304. QDF_STATUS
  305. target_if_cfr_init_pdev(struct wlan_objmgr_psoc *psoc,
  306. struct wlan_objmgr_pdev *pdev)
  307. {
  308. uint32_t target_type;
  309. struct pdev_cfr *pa;
  310. struct psoc_cfr *cfr_sc;
  311. if (wlan_cfr_is_feature_disabled(pdev)) {
  312. cfr_err("cfr is disabled");
  313. return QDF_STATUS_E_NOSUPPORT;
  314. }
  315. pa = wlan_objmgr_pdev_get_comp_private_obj(pdev, WLAN_UMAC_COMP_CFR);
  316. if (pa == NULL)
  317. return QDF_STATUS_E_FAILURE;
  318. /* Reset unassociated entries for every init */
  319. qdf_mem_zero(&pa->unassoc_pool[0], MAX_CFR_ENABLED_CLIENTS *
  320. sizeof(struct unassoc_pool_entry));
  321. cfr_sc = wlan_objmgr_psoc_get_comp_private_obj(psoc,
  322. WLAN_UMAC_COMP_CFR);
  323. if (cfr_sc == NULL)
  324. return QDF_STATUS_E_FAILURE;
  325. target_type = target_if_cfr_get_target_type(psoc);
  326. if (target_type == TARGET_TYPE_QCA8074V2) {
  327. pa->is_cfr_capable = cfr_sc->is_cfr_capable;
  328. return cfr_8074v2_init_pdev(psoc, pdev);
  329. } else if ((target_type == TARGET_TYPE_IPQ4019) ||
  330. (target_type == TARGET_TYPE_QCA9984) ||
  331. (target_type == TARGET_TYPE_QCA9888)) {
  332. pa->is_cfr_capable = cfr_sc->is_cfr_capable;
  333. return cfr_wifi2_0_init_pdev(psoc, pdev);
  334. } else if ((target_type == TARGET_TYPE_QCA6018) ||
  335. (target_type == TARGET_TYPE_QCN9000) ||
  336. (target_type == TARGET_TYPE_QCN6122) ||
  337. (target_type == TARGET_TYPE_QCA5018)) {
  338. pa->is_cfr_capable = cfr_sc->is_cfr_capable;
  339. return cfr_enh_init_pdev(psoc, pdev);
  340. } else
  341. return QDF_STATUS_E_NOSUPPORT;
  342. }
  343. QDF_STATUS
  344. target_if_cfr_deinit_pdev(struct wlan_objmgr_psoc *psoc,
  345. struct wlan_objmgr_pdev *pdev)
  346. {
  347. uint32_t target_type;
  348. if (wlan_cfr_is_feature_disabled(pdev)) {
  349. cfr_err("cfr is disabled");
  350. return QDF_STATUS_E_NOSUPPORT;
  351. }
  352. target_type = target_if_cfr_get_target_type(psoc);
  353. if (target_type == TARGET_TYPE_QCA8074V2) {
  354. return cfr_8074v2_deinit_pdev(psoc, pdev);
  355. } else if ((target_type == TARGET_TYPE_IPQ4019) ||
  356. (target_type == TARGET_TYPE_QCA9984) ||
  357. (target_type == TARGET_TYPE_QCA9888)) {
  358. return cfr_wifi2_0_deinit_pdev(psoc, pdev);
  359. } else if ((target_type == TARGET_TYPE_QCA6018) ||
  360. (target_type == TARGET_TYPE_QCN9000) ||
  361. (target_type == TARGET_TYPE_QCN6122) ||
  362. (target_type == TARGET_TYPE_QCA5018)) {
  363. return cfr_enh_deinit_pdev(psoc, pdev);
  364. } else
  365. return QDF_STATUS_E_NOSUPPORT;
  366. }
  367. #endif
  368. #ifdef WLAN_ENH_CFR_ENABLE
  369. #ifdef QCA_WIFI_QCA6490
  370. static uint8_t target_if_cfr_get_mac_id(struct wlan_objmgr_pdev *pdev)
  371. {
  372. struct wlan_objmgr_vdev *vdev;
  373. struct wlan_channel *bss_chan;
  374. struct pdev_cfr *pcfr;
  375. uint8_t mac_id = 0;
  376. if (!pdev) {
  377. cfr_err("null pdev");
  378. return mac_id;
  379. }
  380. mac_id = wlan_objmgr_pdev_get_pdev_id(pdev);
  381. pcfr = wlan_objmgr_pdev_get_comp_private_obj(pdev, WLAN_UMAC_COMP_CFR);
  382. if (!pcfr) {
  383. cfr_err("null pcfr");
  384. return mac_id;
  385. }
  386. if (pcfr->rcc_param.vdev_id == CFR_INVALID_VDEV_ID)
  387. return mac_id;
  388. vdev = wlan_objmgr_get_vdev_by_id_from_pdev(pdev,
  389. pcfr->rcc_param.vdev_id,
  390. WLAN_CFR_ID);
  391. if (!vdev) {
  392. cfr_err("null vdev");
  393. return mac_id;
  394. }
  395. bss_chan = wlan_vdev_mlme_get_bss_chan(vdev);
  396. if (!bss_chan) {
  397. cfr_info("null bss chan");
  398. wlan_objmgr_vdev_release_ref(vdev, WLAN_CFR_ID);
  399. return mac_id;
  400. }
  401. cfr_debug("bss freq %d", bss_chan->ch_freq);
  402. if (wlan_reg_is_24ghz_ch_freq(bss_chan->ch_freq))
  403. mac_id = CFR_MAC_ID_24G;
  404. else
  405. mac_id = CFR_MAC_ID_5G;
  406. pcfr->rcc_param.srng_id = mac_id;
  407. wlan_objmgr_vdev_release_ref(vdev, WLAN_CFR_ID);
  408. return mac_id;
  409. }
  410. static uint8_t target_if_cfr_get_pdev_id(struct wlan_objmgr_pdev *pdev)
  411. {
  412. return target_if_cfr_get_mac_id(pdev);
  413. }
  414. #else
  415. static uint8_t target_if_cfr_get_pdev_id(struct wlan_objmgr_pdev *pdev)
  416. {
  417. return wlan_objmgr_pdev_get_pdev_id(pdev);
  418. }
  419. #endif /* QCA_WIFI_QCA6490 */
  420. QDF_STATUS target_if_cfr_config_rcc(struct wlan_objmgr_pdev *pdev,
  421. struct cfr_rcc_param *rcc_info)
  422. {
  423. QDF_STATUS status;
  424. struct wmi_unified *pdev_wmi_handle = NULL;
  425. pdev_wmi_handle = lmac_get_pdev_wmi_handle(pdev);
  426. if (!pdev_wmi_handle) {
  427. cfr_err("pdev_wmi_handle is null");
  428. return QDF_STATUS_E_NULL_VALUE;
  429. }
  430. rcc_info->pdev_id = target_if_cfr_get_pdev_id(pdev);
  431. rcc_info->num_grp_tlvs =
  432. count_set_bits(rcc_info->modified_in_curr_session);
  433. status = wmi_unified_send_cfr_rcc_cmd(pdev_wmi_handle, rcc_info);
  434. return status;
  435. }
  436. void target_if_cfr_default_ta_ra_config(struct cfr_rcc_param *rcc_info,
  437. bool allvalid, uint16_t reset_cfg)
  438. {
  439. struct ta_ra_cfr_cfg *curr_cfg = NULL;
  440. int grp_id;
  441. unsigned long bitmap = reset_cfg;
  442. uint8_t def_mac[QDF_MAC_ADDR_SIZE] = {0xFF, 0xFF, 0xFF,
  443. 0xFF, 0xFF, 0xFF};
  444. uint8_t null_mac[QDF_MAC_ADDR_SIZE] = {0x00, 0x00, 0x00,
  445. 0x00, 0x00, 0x00};
  446. for (grp_id = 0; grp_id < MAX_TA_RA_ENTRIES; grp_id++) {
  447. if (qdf_test_bit(grp_id, &bitmap)) {
  448. curr_cfg = &rcc_info->curr[grp_id];
  449. qdf_mem_copy(curr_cfg->tx_addr,
  450. null_mac, QDF_MAC_ADDR_SIZE);
  451. qdf_mem_copy(curr_cfg->tx_addr_mask,
  452. def_mac, QDF_MAC_ADDR_SIZE);
  453. qdf_mem_copy(curr_cfg->rx_addr,
  454. null_mac, QDF_MAC_ADDR_SIZE);
  455. qdf_mem_copy(curr_cfg->rx_addr_mask,
  456. def_mac, QDF_MAC_ADDR_SIZE);
  457. curr_cfg->bw = 0xf;
  458. curr_cfg->nss = 0xff;
  459. curr_cfg->mgmt_subtype_filter = 0;
  460. curr_cfg->ctrl_subtype_filter = 0;
  461. curr_cfg->data_subtype_filter = 0;
  462. if (!allvalid) {
  463. curr_cfg->valid_ta = 0;
  464. curr_cfg->valid_ta_mask = 0;
  465. curr_cfg->valid_ra = 0;
  466. curr_cfg->valid_ra_mask = 0;
  467. curr_cfg->valid_bw_mask = 0;
  468. curr_cfg->valid_nss_mask = 0;
  469. curr_cfg->valid_mgmt_subtype = 0;
  470. curr_cfg->valid_ctrl_subtype = 0;
  471. curr_cfg->valid_data_subtype = 0;
  472. } else {
  473. curr_cfg->valid_ta = 1;
  474. curr_cfg->valid_ta_mask = 1;
  475. curr_cfg->valid_ra = 1;
  476. curr_cfg->valid_ra_mask = 1;
  477. curr_cfg->valid_bw_mask = 1;
  478. curr_cfg->valid_nss_mask = 1;
  479. curr_cfg->valid_mgmt_subtype = 1;
  480. curr_cfg->valid_ctrl_subtype = 1;
  481. curr_cfg->valid_data_subtype = 1;
  482. }
  483. }
  484. }
  485. }
  486. #endif
  487. #ifdef WLAN_ENH_CFR_ENABLE
  488. #ifdef CFR_USE_FIXED_FOLDER
  489. static void target_if_enh_cfr_add_ops(struct wlan_lmac_if_tx_ops *tx_ops)
  490. {
  491. tx_ops->cfr_tx_ops.cfr_subscribe_ppdu_desc =
  492. target_if_cfr_subscribe_ppdu_desc;
  493. }
  494. #else
  495. static void target_if_enh_cfr_add_ops(struct wlan_lmac_if_tx_ops *tx_ops)
  496. {
  497. }
  498. #endif /* CFR_USE_FIXED_FOLDER */
  499. static void target_if_enh_cfr_tx_ops(struct wlan_lmac_if_tx_ops *tx_ops)
  500. {
  501. tx_ops->cfr_tx_ops.cfr_config_rcc =
  502. target_if_cfr_config_rcc;
  503. tx_ops->cfr_tx_ops.cfr_start_lut_timer =
  504. target_if_cfr_start_lut_age_timer;
  505. tx_ops->cfr_tx_ops.cfr_stop_lut_timer =
  506. target_if_cfr_stop_lut_age_timer;
  507. tx_ops->cfr_tx_ops.cfr_default_ta_ra_cfg =
  508. target_if_cfr_default_ta_ra_config;
  509. tx_ops->cfr_tx_ops.cfr_dump_lut_enh =
  510. target_if_cfr_dump_lut_enh;
  511. tx_ops->cfr_tx_ops.cfr_rx_tlv_process =
  512. target_if_cfr_rx_tlv_process;
  513. tx_ops->cfr_tx_ops.cfr_update_global_cfg =
  514. target_if_cfr_update_global_cfg;
  515. target_if_enh_cfr_add_ops(tx_ops);
  516. }
  517. #else
  518. static void target_if_enh_cfr_tx_ops(struct wlan_lmac_if_tx_ops *tx_ops)
  519. {
  520. }
  521. #endif
  522. void target_if_cfr_tx_ops_register(struct wlan_lmac_if_tx_ops *tx_ops)
  523. {
  524. tx_ops->cfr_tx_ops.cfr_init_pdev =
  525. target_if_cfr_init_pdev;
  526. tx_ops->cfr_tx_ops.cfr_deinit_pdev =
  527. target_if_cfr_deinit_pdev;
  528. tx_ops->cfr_tx_ops.cfr_enable_cfr_timer =
  529. target_if_cfr_enable_cfr_timer;
  530. tx_ops->cfr_tx_ops.cfr_start_capture =
  531. target_if_cfr_start_capture;
  532. tx_ops->cfr_tx_ops.cfr_stop_capture =
  533. target_if_cfr_stop_capture;
  534. target_if_enh_cfr_tx_ops(tx_ops);
  535. }
  536. void target_if_cfr_set_cfr_support(struct wlan_objmgr_psoc *psoc,
  537. uint8_t value)
  538. {
  539. struct wlan_lmac_if_rx_ops *rx_ops;
  540. rx_ops = wlan_psoc_get_lmac_if_rxops(psoc);
  541. if (!rx_ops) {
  542. cfr_err("rx_ops is NULL");
  543. return;
  544. }
  545. if (rx_ops->cfr_rx_ops.cfr_support_set)
  546. rx_ops->cfr_rx_ops.cfr_support_set(psoc, value);
  547. }
  548. QDF_STATUS
  549. target_if_cfr_set_capture_count_support(struct wlan_objmgr_psoc *psoc,
  550. uint8_t value)
  551. {
  552. struct wlan_lmac_if_rx_ops *rx_ops;
  553. rx_ops = wlan_psoc_get_lmac_if_rxops(psoc);
  554. if (!rx_ops) {
  555. cfr_err("rx_ops is NULL");
  556. return QDF_STATUS_E_INVAL;
  557. }
  558. if (rx_ops->cfr_rx_ops.cfr_capture_count_support_set)
  559. return rx_ops->cfr_rx_ops.cfr_capture_count_support_set(
  560. psoc, value);
  561. return QDF_STATUS_E_INVAL;
  562. }
  563. QDF_STATUS
  564. target_if_cfr_set_mo_marking_support(struct wlan_objmgr_psoc *psoc,
  565. uint8_t value)
  566. {
  567. struct wlan_lmac_if_rx_ops *rx_ops;
  568. rx_ops = wlan_psoc_get_lmac_if_rxops(psoc);
  569. if (!rx_ops) {
  570. cfr_err("rx_ops is NULL");
  571. return QDF_STATUS_E_INVAL;
  572. }
  573. if (rx_ops->cfr_rx_ops.cfr_mo_marking_support_set)
  574. return rx_ops->cfr_rx_ops.cfr_mo_marking_support_set(
  575. psoc, value);
  576. return QDF_STATUS_E_INVAL;
  577. }
  578. void target_if_cfr_info_send(struct wlan_objmgr_pdev *pdev, void *head,
  579. size_t hlen, void *data, size_t dlen, void *tail,
  580. size_t tlen)
  581. {
  582. struct wlan_objmgr_psoc *psoc;
  583. struct wlan_lmac_if_rx_ops *rx_ops;
  584. psoc = wlan_pdev_get_psoc(pdev);
  585. rx_ops = wlan_psoc_get_lmac_if_rxops(psoc);
  586. if (!rx_ops) {
  587. cfr_err("rx_ops is NULL");
  588. return;
  589. }
  590. if (rx_ops->cfr_rx_ops.cfr_info_send)
  591. rx_ops->cfr_rx_ops.cfr_info_send(pdev, head, hlen, data, dlen,
  592. tail, tlen);
  593. }