1 /* 2 * Copyright (c) 2019-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 #include <target_if_cfr.h> 21 #include <wlan_tgt_def_config.h> 22 #include <target_type.h> 23 #include <hif_hw_version.h> 24 #include <target_if.h> 25 #include <wlan_lmac_if_def.h> 26 #include <wlan_osif_priv.h> 27 #include <init_deinit_lmac.h> 28 #include <wlan_cfr_utils_api.h> 29 #include <wlan_objmgr_pdev_obj.h> 30 #include <target_if_cfr_enh.h> 31 #ifdef CFR_USE_FIXED_FOLDER 32 #include "target_if_cfr_6490.h" 33 #include "target_if_cfr_adrastea.h" 34 #include "wlan_reg_services_api.h" 35 #else 36 #include <target_if_cfr_dbr.h> 37 #endif 38 39 int target_if_cfr_stop_capture(struct wlan_objmgr_pdev *pdev, 40 struct wlan_objmgr_peer *peer) 41 { 42 struct peer_cfr *pe; 43 struct peer_cfr_params param = {0}; 44 struct wmi_unified *pdev_wmi_handle = NULL; 45 struct wlan_objmgr_vdev *vdev = {0}; 46 struct pdev_cfr *pdev_cfrobj; 47 int retv = 0; 48 49 pe = wlan_objmgr_peer_get_comp_private_obj(peer, WLAN_UMAC_COMP_CFR); 50 if (pe == NULL) 51 return -EINVAL; 52 53 pdev_wmi_handle = lmac_get_pdev_wmi_handle(pdev); 54 if (!pdev_wmi_handle) { 55 cfr_err("pdev wmi handle NULL"); 56 return -EINVAL; 57 } 58 vdev = wlan_peer_get_vdev(peer); 59 60 qdf_mem_set(¶m, sizeof(param), 0); 61 62 param.request = PEER_CFR_CAPTURE_DISABLE; 63 param.macaddr = wlan_peer_get_macaddr(peer); 64 param.vdev_id = wlan_vdev_get_id(vdev); 65 66 param.periodicity = pe->period; 67 param.bandwidth = pe->bandwidth; 68 param.capture_method = pe->capture_method; 69 70 retv = wmi_unified_send_peer_cfr_capture_cmd(pdev_wmi_handle, ¶m); 71 72 pdev_cfrobj = wlan_objmgr_pdev_get_comp_private_obj(pdev, 73 WLAN_UMAC_COMP_CFR); 74 if (!pdev_cfrobj) { 75 cfr_err("pdev object for CFR is null"); 76 return -EINVAL; 77 } 78 cfr_err("CFR capture stats for this capture:"); 79 cfr_err("DBR event count = %llu, Tx event count = %llu " 80 "Release count = %llu", 81 pdev_cfrobj->dbr_evt_cnt, pdev_cfrobj->tx_evt_cnt, 82 pdev_cfrobj->release_cnt); 83 cfr_err("tx_peer_status_cfr_fail = %llu", 84 pdev_cfrobj->tx_peer_status_cfr_fail = 0); 85 cfr_err("tx_evt_status_cfr_fail = %llu", 86 pdev_cfrobj->tx_evt_status_cfr_fail); 87 cfr_err("tx_dbr_cookie_lookup_fail = %llu", 88 pdev_cfrobj->tx_dbr_cookie_lookup_fail); 89 90 pdev_cfrobj->dbr_evt_cnt = 0; 91 pdev_cfrobj->tx_evt_cnt = 0; 92 pdev_cfrobj->release_cnt = 0; 93 pdev_cfrobj->tx_peer_status_cfr_fail = 0; 94 pdev_cfrobj->tx_evt_status_cfr_fail = 0; 95 pdev_cfrobj->tx_dbr_cookie_lookup_fail = 0; 96 97 return retv; 98 } 99 100 int target_if_cfr_start_capture(struct wlan_objmgr_pdev *pdev, 101 struct wlan_objmgr_peer *peer, 102 struct cfr_capture_params *cfr_params) 103 { 104 struct peer_cfr_params param = {0}; 105 struct wmi_unified *pdev_wmi_handle = NULL; 106 struct wlan_objmgr_vdev *vdev; 107 int retv = 0; 108 109 pdev_wmi_handle = lmac_get_pdev_wmi_handle(pdev); 110 if (!pdev_wmi_handle) { 111 cfr_err("pdev wmi handle NULL"); 112 return -EINVAL; 113 } 114 vdev = wlan_peer_get_vdev(peer); 115 qdf_mem_set(¶m, sizeof(param), 0); 116 117 param.request = PEER_CFR_CAPTURE_ENABLE; 118 param.macaddr = wlan_peer_get_macaddr(peer); 119 param.vdev_id = wlan_vdev_get_id(vdev); 120 121 param.periodicity = cfr_params->period; 122 param.bandwidth = cfr_params->bandwidth; 123 param.capture_method = cfr_params->method; 124 125 retv = wmi_unified_send_peer_cfr_capture_cmd(pdev_wmi_handle, ¶m); 126 return retv; 127 } 128 129 int target_if_cfr_periodic_peer_cfr_enable(struct wlan_objmgr_pdev *pdev, 130 uint32_t param_value) 131 { 132 struct pdev_params pparam; 133 uint32_t pdev_id; 134 struct wmi_unified *pdev_wmi_handle = NULL; 135 136 pdev_id = wlan_objmgr_pdev_get_pdev_id(pdev); 137 if (pdev_id < 0) 138 return -EINVAL; 139 140 pdev_wmi_handle = lmac_get_pdev_wmi_handle(pdev); 141 if (!pdev_wmi_handle) { 142 cfr_err("pdev wmi handle NULL"); 143 return -EINVAL; 144 } 145 qdf_mem_set(&pparam, sizeof(pparam), 0); 146 pparam.param_id = wmi_pdev_param_per_peer_prd_cfr_enable; 147 pparam.param_value = param_value; 148 149 return wmi_unified_pdev_param_send(pdev_wmi_handle, 150 &pparam, pdev_id); 151 } 152 153 int target_if_cfr_enable_cfr_timer(struct wlan_objmgr_pdev *pdev, 154 uint32_t cfr_timer) 155 { 156 struct pdev_cfr *pa; 157 int retval; 158 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 163 if (!cfr_timer) { 164 /* disable periodic cfr capture */ 165 retval = 166 target_if_cfr_periodic_peer_cfr_enable(pdev, 167 WMI_HOST_PEER_CFR_TIMER_DISABLE); 168 169 if (retval == QDF_STATUS_SUCCESS) 170 pa->cfr_timer_enable = 0; 171 } else { 172 /* enable periodic cfr capture (default base timer is 10ms ) */ 173 retval = 174 target_if_cfr_periodic_peer_cfr_enable(pdev, 175 WMI_HOST_PEER_CFR_TIMER_ENABLE); 176 177 if (retval == QDF_STATUS_SUCCESS) 178 pa->cfr_timer_enable = 1; 179 } 180 181 return retval; 182 } 183 184 int target_if_cfr_get_target_type(struct wlan_objmgr_psoc *psoc) 185 { 186 uint32_t target_type = 0; 187 struct wlan_lmac_if_target_tx_ops *target_type_tx_ops; 188 struct wlan_lmac_if_tx_ops *tx_ops; 189 190 tx_ops = wlan_psoc_get_lmac_if_txops(psoc); 191 if (!tx_ops) { 192 cfr_err("tx_ops is NULL"); 193 return target_type; 194 } 195 target_type_tx_ops = &tx_ops->target_tx_ops; 196 197 if (target_type_tx_ops->tgt_get_tgt_type) 198 target_type = target_type_tx_ops->tgt_get_tgt_type(psoc); 199 200 return target_type; 201 } 202 203 void target_if_cfr_fill_header(struct csi_cfr_header *hdr, 204 bool is_wifi_2_0, 205 uint32_t target_type, 206 bool is_rcc) 207 { 208 hdr->cmn.start_magic_num = 0xDEADBEAF; 209 hdr->cmn.vendorid = 0x8cfdf0; 210 hdr->cmn.pltform_type = CFR_PLATFORM_TYPE_ARM; 211 hdr->cmn.cfr_metadata_len = CFR_META_DATA_LEN; 212 hdr->cmn.cfr_data_version = CFR_DATA_VERSION_1; 213 hdr->cmn.host_real_ts = qdf_ktime_to_ns(qdf_ktime_real_get()); 214 215 if (target_type == TARGET_TYPE_QCA8074V2) { 216 hdr->cmn.cfr_metadata_version = CFR_META_VERSION_8; 217 hdr->cmn.chip_type = CFR_CAPTURE_RADIO_HKV2; 218 } else if (target_type == TARGET_TYPE_QCA9574) { 219 hdr->cmn.cfr_metadata_version = CFR_META_VERSION_8; 220 hdr->cmn.chip_type = CFR_CAPTURE_RADIO_ALDER; 221 } else { 222 if (target_type == TARGET_TYPE_QCN9000) 223 hdr->cmn.cfr_metadata_version = CFR_META_VERSION_9; 224 else if (target_type == TARGET_TYPE_QCN9224 || 225 target_type == TARGET_TYPE_QCA5332 || 226 target_type == TARGET_TYPE_QCA6490 || 227 target_type == TARGET_TYPE_QCA6750 || 228 target_type == TARGET_TYPE_KIWI || 229 target_type == TARGET_TYPE_MANGO) 230 hdr->cmn.cfr_metadata_version = CFR_META_VERSION_7; 231 else if ((target_type == TARGET_TYPE_QCA6018) || 232 ((target_type == TARGET_TYPE_QCA5018) && (!is_rcc))) 233 hdr->cmn.cfr_metadata_version = CFR_META_VERSION_5; 234 else 235 hdr->cmn.cfr_metadata_version = CFR_META_VERSION_3; 236 237 if (target_type == TARGET_TYPE_QCN9000) 238 hdr->cmn.chip_type = CFR_CAPTURE_RADIO_PINE; 239 else if (target_type == TARGET_TYPE_QCA5018) 240 hdr->cmn.chip_type = CFR_CAPTURE_RADIO_MAPLE; 241 else if (target_type == TARGET_TYPE_QCN6122) 242 hdr->cmn.chip_type = CFR_CAPTURE_RADIO_SPRUCE; 243 else if (target_type == TARGET_TYPE_QCN9160) 244 hdr->cmn.chip_type = CFR_CAPTURE_RADIO_YORK; 245 else if (target_type == TARGET_TYPE_QCN9224) 246 hdr->cmn.chip_type = CFR_CAPTURE_RADIO_WAIKIKI; 247 else if (target_type == TARGET_TYPE_QCA5332) 248 hdr->cmn.chip_type = CFR_CAPTURE_RADIO_MIAMI; 249 else if (target_type == TARGET_TYPE_QCA6490) 250 hdr->cmn.chip_type = CFR_CAPTURE_RADIO_HSP; 251 else if (target_type == TARGET_TYPE_QCA6750) 252 hdr->cmn.chip_type = CFR_CAPTURE_RADIO_MOSELLE; 253 else if (target_type == TARGET_TYPE_KIWI) 254 hdr->cmn.chip_type = CFR_CAPTURE_RADIO_KIWI; 255 else if (target_type == TARGET_TYPE_MANGO) 256 hdr->cmn.chip_type = CFR_CAPTURE_RADIO_MANGO; 257 else 258 hdr->cmn.chip_type = CFR_CAPTURE_RADIO_CYP; 259 } 260 } 261 262 #ifdef CFR_USE_FIXED_FOLDER 263 static QDF_STATUS target_if_cfr_init_target(struct wlan_objmgr_psoc *psoc, 264 struct wlan_objmgr_pdev *pdev, 265 uint32_t target) 266 { 267 struct pdev_cfr *cfr_pdev; 268 struct psoc_cfr *cfr_psoc; 269 struct wmi_unified *wmi_handle = NULL; 270 bool cfr_capable; 271 QDF_STATUS status; 272 273 if (!psoc || !pdev) { 274 cfr_err("null pdev or psoc"); 275 return QDF_STATUS_E_FAILURE; 276 } 277 278 cfr_pdev = wlan_objmgr_pdev_get_comp_private_obj(pdev, 279 WLAN_UMAC_COMP_CFR); 280 if (!cfr_pdev) { 281 cfr_err("null pdev cfr"); 282 return QDF_STATUS_E_FAILURE; 283 } 284 285 cfr_psoc = wlan_objmgr_psoc_get_comp_private_obj(psoc, 286 WLAN_UMAC_COMP_CFR); 287 288 if (!cfr_psoc) { 289 cfr_err("null psoc cfr"); 290 return QDF_STATUS_E_FAILURE; 291 } 292 293 wmi_handle = lmac_get_pdev_wmi_handle(pdev); 294 if (!wmi_handle) { 295 cfr_err("null wmi handle"); 296 return QDF_STATUS_E_FAILURE; 297 } 298 299 if (wlan_cfr_is_feature_disabled(pdev)) { 300 cfr_pdev->is_cfr_capable = 0; 301 cfr_psoc->is_cfr_capable = 0; 302 cfr_info("cfr disabled"); 303 return QDF_STATUS_SUCCESS; 304 } 305 306 cfr_capable = wmi_service_enabled(wmi_handle, 307 wmi_service_cfr_capture_support); 308 cfr_pdev->is_cfr_capable = cfr_capable; 309 cfr_psoc->is_cfr_capable = cfr_capable; 310 if (!cfr_capable) { 311 cfr_err("FW doesn't support CFR"); 312 return QDF_STATUS_SUCCESS; 313 } 314 315 status = cfr_enh_init_pdev(psoc, pdev); 316 if (target == TARGET_TYPE_QCA6490) 317 cfr_pdev->chip_type = CFR_CAPTURE_RADIO_HSP; 318 else if (target == TARGET_TYPE_QCA6750) 319 cfr_pdev->chip_type = CFR_CAPTURE_RADIO_MOSELLE; 320 else if (target == TARGET_TYPE_KIWI) 321 cfr_pdev->chip_type = CFR_CAPTURE_RADIO_KIWI; 322 else if (target == TARGET_TYPE_MANGO) 323 cfr_pdev->chip_type = CFR_CAPTURE_RADIO_MANGO; 324 325 return status; 326 } 327 328 static QDF_STATUS target_if_cfr_deinit_target(struct wlan_objmgr_psoc *psoc, 329 struct wlan_objmgr_pdev *pdev) 330 { 331 struct pdev_cfr *pcfr; 332 333 if (!psoc || !pdev) { 334 cfr_err("null pdev or psoc"); 335 return QDF_STATUS_E_FAILURE; 336 } 337 338 pcfr = wlan_objmgr_pdev_get_comp_private_obj(pdev, 339 WLAN_UMAC_COMP_CFR); 340 if (!pcfr) { 341 cfr_err("null pdev cfr"); 342 return QDF_STATUS_E_FAILURE; 343 } 344 345 if (!pcfr->is_cfr_capable) { 346 cfr_info("cfr disabled or FW not support"); 347 return QDF_STATUS_SUCCESS; 348 } 349 350 return cfr_enh_deinit_pdev(psoc, pdev); 351 } 352 353 QDF_STATUS 354 target_if_cfr_init_pdev(struct wlan_objmgr_psoc *psoc, 355 struct wlan_objmgr_pdev *pdev) 356 { 357 uint32_t target_type; 358 QDF_STATUS status; 359 360 target_type = target_if_cfr_get_target_type(psoc); 361 362 if (target_type == TARGET_TYPE_QCA6490 || 363 target_type == TARGET_TYPE_QCA6750 || 364 target_type == TARGET_TYPE_KIWI || 365 target_type == TARGET_TYPE_MANGO) { 366 status = target_if_cfr_init_target(psoc, 367 pdev, target_type); 368 } else if (target_type == TARGET_TYPE_ADRASTEA) { 369 status = cfr_adrastea_init_pdev(psoc, pdev); 370 } else { 371 cfr_info("unsupported chip"); 372 status = QDF_STATUS_SUCCESS; 373 } 374 375 return status; 376 } 377 378 QDF_STATUS 379 target_if_cfr_deinit_pdev(struct wlan_objmgr_psoc *psoc, 380 struct wlan_objmgr_pdev *pdev) 381 { 382 uint32_t target_type; 383 QDF_STATUS status; 384 385 target_type = target_if_cfr_get_target_type(psoc); 386 387 if (target_type == TARGET_TYPE_QCA6490 || 388 target_type == TARGET_TYPE_QCA6750 || 389 target_type == TARGET_TYPE_KIWI || 390 target_type == TARGET_TYPE_MANGO) { 391 status = target_if_cfr_deinit_target(psoc, pdev); 392 } else if (target_type == TARGET_TYPE_ADRASTEA) { 393 status = cfr_adrastea_deinit_pdev(psoc, pdev); 394 } else { 395 cfr_info("unsupported chip"); 396 status = QDF_STATUS_SUCCESS; 397 } 398 399 return status; 400 } 401 #else 402 QDF_STATUS 403 target_if_cfr_init_pdev(struct wlan_objmgr_psoc *psoc, 404 struct wlan_objmgr_pdev *pdev) 405 { 406 uint32_t target_type; 407 struct pdev_cfr *pa; 408 struct psoc_cfr *cfr_sc; 409 410 if (wlan_cfr_is_feature_disabled(pdev)) { 411 cfr_err("cfr is disabled"); 412 return QDF_STATUS_E_NOSUPPORT; 413 } 414 415 pa = wlan_objmgr_pdev_get_comp_private_obj(pdev, WLAN_UMAC_COMP_CFR); 416 if (pa == NULL) 417 return QDF_STATUS_E_FAILURE; 418 419 /* Reset unassociated entries for every init */ 420 qdf_mem_zero(&pa->unassoc_pool[0], MAX_CFR_ENABLED_CLIENTS * 421 sizeof(struct unassoc_pool_entry)); 422 423 cfr_sc = wlan_objmgr_psoc_get_comp_private_obj(psoc, 424 WLAN_UMAC_COMP_CFR); 425 426 if (cfr_sc == NULL) 427 return QDF_STATUS_E_FAILURE; 428 429 target_type = target_if_cfr_get_target_type(psoc); 430 431 if ((target_type == TARGET_TYPE_QCA8074V2) || 432 (target_type == TARGET_TYPE_QCA9574)) { 433 pa->is_cfr_capable = cfr_sc->is_cfr_capable; 434 return cfr_dbr_init_pdev(psoc, pdev); 435 } else if ((target_type == TARGET_TYPE_QCA6018) || 436 (target_type == TARGET_TYPE_QCN9000) || 437 (target_type == TARGET_TYPE_QCN6122) || 438 (target_type == TARGET_TYPE_QCA5018) || 439 (target_type == TARGET_TYPE_QCA5332) || 440 (target_type == TARGET_TYPE_QCN9224) || 441 (target_type == TARGET_TYPE_QCN9160)) { 442 pa->is_cfr_capable = cfr_sc->is_cfr_capable; 443 return cfr_enh_init_pdev(psoc, pdev); 444 } else 445 return QDF_STATUS_E_NOSUPPORT; 446 } 447 448 QDF_STATUS 449 target_if_cfr_deinit_pdev(struct wlan_objmgr_psoc *psoc, 450 struct wlan_objmgr_pdev *pdev) 451 { 452 uint32_t target_type; 453 454 if (wlan_cfr_is_feature_disabled(pdev)) { 455 cfr_err("cfr is disabled"); 456 return QDF_STATUS_E_NOSUPPORT; 457 } 458 459 target_type = target_if_cfr_get_target_type(psoc); 460 461 if ((target_type == TARGET_TYPE_QCA8074V2) || 462 (target_type == TARGET_TYPE_QCA9574)) { 463 return cfr_dbr_deinit_pdev(psoc, pdev); 464 } else if ((target_type == TARGET_TYPE_QCA6018) || 465 (target_type == TARGET_TYPE_QCN9000) || 466 (target_type == TARGET_TYPE_QCN6122) || 467 (target_type == TARGET_TYPE_QCA5018) || 468 (target_type == TARGET_TYPE_QCA5332) || 469 (target_type == TARGET_TYPE_QCN9224) || 470 (target_type == TARGET_TYPE_QCN9160)) { 471 return cfr_enh_deinit_pdev(psoc, pdev); 472 } else 473 return QDF_STATUS_E_NOSUPPORT; 474 } 475 #endif 476 477 #ifdef WLAN_ENH_CFR_ENABLE 478 #if defined(QCA_WIFI_QCA6490) || defined(QCA_WIFI_KIWI) 479 static uint8_t target_if_cfr_get_mac_id(struct wlan_objmgr_pdev *pdev) 480 { 481 struct wlan_objmgr_vdev *vdev; 482 struct wlan_channel *bss_chan; 483 struct pdev_cfr *pcfr; 484 uint8_t mac_id = 0; 485 486 if (!pdev) { 487 cfr_err("null pdev"); 488 return mac_id; 489 } 490 491 mac_id = wlan_objmgr_pdev_get_pdev_id(pdev); 492 pcfr = wlan_objmgr_pdev_get_comp_private_obj(pdev, WLAN_UMAC_COMP_CFR); 493 if (!pcfr) { 494 cfr_err("null pcfr"); 495 return mac_id; 496 } 497 498 if (pcfr->rcc_param.vdev_id == CFR_INVALID_VDEV_ID) 499 return mac_id; 500 501 vdev = wlan_objmgr_get_vdev_by_id_from_pdev(pdev, 502 pcfr->rcc_param.vdev_id, 503 WLAN_CFR_ID); 504 if (!vdev) { 505 cfr_err("null vdev"); 506 return mac_id; 507 } 508 509 bss_chan = wlan_vdev_mlme_get_bss_chan(vdev); 510 if (!bss_chan) { 511 cfr_info("null bss chan"); 512 wlan_objmgr_vdev_release_ref(vdev, WLAN_CFR_ID); 513 return mac_id; 514 } 515 516 cfr_debug("bss freq %d", bss_chan->ch_freq); 517 if (wlan_reg_is_24ghz_ch_freq(bss_chan->ch_freq)) 518 mac_id = CFR_MAC_ID_24G; 519 else 520 mac_id = CFR_MAC_ID_5G; 521 522 pcfr->rcc_param.srng_id = mac_id; 523 wlan_objmgr_vdev_release_ref(vdev, WLAN_CFR_ID); 524 525 return mac_id; 526 } 527 528 static uint8_t target_if_cfr_get_pdev_id(struct wlan_objmgr_pdev *pdev) 529 { 530 return target_if_cfr_get_mac_id(pdev); 531 } 532 #elif defined(QCA_WIFI_QCA6750) 533 static uint8_t target_if_cfr_get_pdev_id(struct wlan_objmgr_pdev *pdev) 534 { 535 /* Host and FW have agreement about using fixed pdev id for 536 * CFR on HMT, FW will get correct mac id if host pass soc 537 * pdev id when start CFR. Since mac id in FW side is 538 * different to legacy chip if it's concurrency case or 2.4GHz 539 * band only case or 5/6GHz band only case. 540 */ 541 return WMI_HOST_PDEV_ID_SOC; 542 } 543 #else 544 static uint8_t target_if_cfr_get_pdev_id(struct wlan_objmgr_pdev *pdev) 545 { 546 return wlan_objmgr_pdev_get_pdev_id(pdev); 547 } 548 #endif /* QCA_WIFI_QCA6490 || QCA_WIFI_KIWI */ 549 550 QDF_STATUS target_if_cfr_config_rcc(struct wlan_objmgr_pdev *pdev, 551 struct cfr_rcc_param *rcc_info) 552 { 553 QDF_STATUS status; 554 struct wmi_unified *pdev_wmi_handle = NULL; 555 556 pdev_wmi_handle = lmac_get_pdev_wmi_handle(pdev); 557 if (!pdev_wmi_handle) { 558 cfr_err("pdev_wmi_handle is null"); 559 return QDF_STATUS_E_NULL_VALUE; 560 } 561 562 rcc_info->pdev_id = target_if_cfr_get_pdev_id(pdev); 563 rcc_info->num_grp_tlvs = 564 count_set_bits(rcc_info->modified_in_curr_session); 565 566 status = wmi_unified_send_cfr_rcc_cmd(pdev_wmi_handle, rcc_info); 567 return status; 568 } 569 570 void target_if_cfr_default_ta_ra_config(struct cfr_rcc_param *rcc_info, 571 bool allvalid, uint16_t reset_cfg) 572 { 573 struct ta_ra_cfr_cfg *curr_cfg = NULL; 574 int grp_id; 575 unsigned long bitmap = reset_cfg; 576 uint8_t def_mac[QDF_MAC_ADDR_SIZE] = {0xFF, 0xFF, 0xFF, 577 0xFF, 0xFF, 0xFF}; 578 uint8_t null_mac[QDF_MAC_ADDR_SIZE] = {0x00, 0x00, 0x00, 579 0x00, 0x00, 0x00}; 580 581 for (grp_id = 0; grp_id < MAX_TA_RA_ENTRIES; grp_id++) { 582 if (qdf_test_bit(grp_id, &bitmap)) { 583 curr_cfg = &rcc_info->curr[grp_id]; 584 qdf_mem_copy(curr_cfg->tx_addr, 585 null_mac, QDF_MAC_ADDR_SIZE); 586 qdf_mem_copy(curr_cfg->tx_addr_mask, 587 def_mac, QDF_MAC_ADDR_SIZE); 588 qdf_mem_copy(curr_cfg->rx_addr, 589 null_mac, QDF_MAC_ADDR_SIZE); 590 qdf_mem_copy(curr_cfg->rx_addr_mask, 591 def_mac, QDF_MAC_ADDR_SIZE); 592 curr_cfg->bw = 0xf; 593 curr_cfg->nss = 0xff; 594 curr_cfg->mgmt_subtype_filter = 0; 595 curr_cfg->ctrl_subtype_filter = 0; 596 curr_cfg->data_subtype_filter = 0; 597 if (!allvalid) { 598 curr_cfg->valid_ta = 0; 599 curr_cfg->valid_ta_mask = 0; 600 curr_cfg->valid_ra = 0; 601 curr_cfg->valid_ra_mask = 0; 602 curr_cfg->valid_bw_mask = 0; 603 curr_cfg->valid_nss_mask = 0; 604 curr_cfg->valid_mgmt_subtype = 0; 605 curr_cfg->valid_ctrl_subtype = 0; 606 curr_cfg->valid_data_subtype = 0; 607 } else { 608 curr_cfg->valid_ta = 1; 609 curr_cfg->valid_ta_mask = 1; 610 curr_cfg->valid_ra = 1; 611 curr_cfg->valid_ra_mask = 1; 612 curr_cfg->valid_bw_mask = 1; 613 curr_cfg->valid_nss_mask = 1; 614 curr_cfg->valid_mgmt_subtype = 1; 615 curr_cfg->valid_ctrl_subtype = 1; 616 curr_cfg->valid_data_subtype = 1; 617 } 618 } 619 } 620 } 621 #endif 622 623 #ifdef WLAN_ENH_CFR_ENABLE 624 #ifdef CFR_USE_FIXED_FOLDER 625 static void target_if_enh_cfr_add_ops(struct wlan_lmac_if_tx_ops *tx_ops) 626 { 627 tx_ops->cfr_tx_ops.cfr_subscribe_ppdu_desc = 628 target_if_cfr_subscribe_ppdu_desc; 629 } 630 #else 631 static void target_if_enh_cfr_add_ops(struct wlan_lmac_if_tx_ops *tx_ops) 632 { 633 } 634 #endif /* CFR_USE_FIXED_FOLDER */ 635 static void target_if_enh_cfr_tx_ops(struct wlan_lmac_if_tx_ops *tx_ops) 636 { 637 tx_ops->cfr_tx_ops.cfr_config_rcc = 638 target_if_cfr_config_rcc; 639 tx_ops->cfr_tx_ops.cfr_start_lut_timer = 640 target_if_cfr_start_lut_age_timer; 641 tx_ops->cfr_tx_ops.cfr_stop_lut_timer = 642 target_if_cfr_stop_lut_age_timer; 643 tx_ops->cfr_tx_ops.cfr_default_ta_ra_cfg = 644 target_if_cfr_default_ta_ra_config; 645 tx_ops->cfr_tx_ops.cfr_dump_lut_enh = 646 target_if_cfr_dump_lut_enh; 647 tx_ops->cfr_tx_ops.cfr_rx_tlv_process = 648 target_if_cfr_rx_tlv_process; 649 tx_ops->cfr_tx_ops.cfr_update_global_cfg = 650 target_if_cfr_update_global_cfg; 651 target_if_enh_cfr_add_ops(tx_ops); 652 } 653 #else 654 static void target_if_enh_cfr_tx_ops(struct wlan_lmac_if_tx_ops *tx_ops) 655 { 656 } 657 #endif 658 659 void target_if_cfr_tx_ops_register(struct wlan_lmac_if_tx_ops *tx_ops) 660 { 661 tx_ops->cfr_tx_ops.cfr_init_pdev = 662 target_if_cfr_init_pdev; 663 tx_ops->cfr_tx_ops.cfr_deinit_pdev = 664 target_if_cfr_deinit_pdev; 665 tx_ops->cfr_tx_ops.cfr_enable_cfr_timer = 666 target_if_cfr_enable_cfr_timer; 667 tx_ops->cfr_tx_ops.cfr_start_capture = 668 target_if_cfr_start_capture; 669 tx_ops->cfr_tx_ops.cfr_stop_capture = 670 target_if_cfr_stop_capture; 671 target_if_enh_cfr_tx_ops(tx_ops); 672 } 673 674 void target_if_cfr_set_cfr_support(struct wlan_objmgr_psoc *psoc, 675 uint8_t value) 676 { 677 struct wlan_lmac_if_rx_ops *rx_ops; 678 679 rx_ops = wlan_psoc_get_lmac_if_rxops(psoc); 680 if (!rx_ops) { 681 cfr_err("rx_ops is NULL"); 682 return; 683 } 684 if (rx_ops->cfr_rx_ops.cfr_support_set) 685 rx_ops->cfr_rx_ops.cfr_support_set(psoc, value); 686 } 687 688 QDF_STATUS 689 target_if_cfr_set_capture_count_support(struct wlan_objmgr_psoc *psoc, 690 uint8_t value) 691 { 692 struct wlan_lmac_if_rx_ops *rx_ops; 693 694 rx_ops = wlan_psoc_get_lmac_if_rxops(psoc); 695 if (!rx_ops) { 696 cfr_err("rx_ops is NULL"); 697 return QDF_STATUS_E_INVAL; 698 } 699 700 if (rx_ops->cfr_rx_ops.cfr_capture_count_support_set) 701 return rx_ops->cfr_rx_ops.cfr_capture_count_support_set( 702 psoc, value); 703 704 return QDF_STATUS_E_INVAL; 705 } 706 707 QDF_STATUS 708 target_if_cfr_set_mo_marking_support(struct wlan_objmgr_psoc *psoc, 709 uint8_t value) 710 { 711 struct wlan_lmac_if_rx_ops *rx_ops; 712 713 rx_ops = wlan_psoc_get_lmac_if_rxops(psoc); 714 if (!rx_ops) { 715 cfr_err("rx_ops is NULL"); 716 return QDF_STATUS_E_INVAL; 717 } 718 719 if (rx_ops->cfr_rx_ops.cfr_mo_marking_support_set) 720 return rx_ops->cfr_rx_ops.cfr_mo_marking_support_set( 721 psoc, value); 722 723 return QDF_STATUS_E_INVAL; 724 } 725 726 QDF_STATUS 727 target_if_cfr_set_aoa_for_rcc_support(struct wlan_objmgr_psoc *psoc, 728 uint8_t value) 729 { 730 struct wlan_lmac_if_rx_ops *rx_ops; 731 732 rx_ops = wlan_psoc_get_lmac_if_rxops(psoc); 733 if (!rx_ops) { 734 cfr_err("rx_ops is NULL"); 735 return QDF_STATUS_E_INVAL; 736 } 737 738 if (rx_ops->cfr_rx_ops.cfr_aoa_for_rcc_support_set) 739 return rx_ops->cfr_rx_ops.cfr_aoa_for_rcc_support_set( 740 psoc, value); 741 742 return QDF_STATUS_E_INVAL; 743 } 744 745 void target_if_cfr_info_send(struct wlan_objmgr_pdev *pdev, void *head, 746 size_t hlen, void *data, size_t dlen, void *tail, 747 size_t tlen) 748 { 749 struct wlan_objmgr_psoc *psoc; 750 struct wlan_lmac_if_rx_ops *rx_ops; 751 752 psoc = wlan_pdev_get_psoc(pdev); 753 754 rx_ops = wlan_psoc_get_lmac_if_rxops(psoc); 755 if (!rx_ops) { 756 cfr_err("rx_ops is NULL"); 757 return; 758 } 759 if (rx_ops->cfr_rx_ops.cfr_info_send) 760 rx_ops->cfr_rx_ops.cfr_info_send(pdev, head, hlen, data, dlen, 761 tail, tlen); 762 } 763