diff --git a/target_if/wifi_pos/src/target_if_wifi_pos.c b/target_if/wifi_pos/src/target_if_wifi_pos.c index 0de46cd09b78..0ba62fbdb634 100644 --- a/target_if/wifi_pos/src/target_if_wifi_pos.c +++ b/target_if/wifi_pos/src/target_if_wifi_pos.c @@ -169,7 +169,7 @@ static int target_if_wifi_pos_oem_rsp_ev_handler(ol_scn_t scn, (WMI_OEM_RESPONSE_EVENTID_param_tlvs *)data_buf; if (!psoc) { - wifi_pos_err("psoc is null"); + target_if_err("psoc is null"); return QDF_STATUS_NOT_INITIALIZED; } @@ -280,15 +280,15 @@ static QDF_STATUS wifi_pos_oem_data_req(struct wlan_objmgr_psoc *psoc, QDF_STATUS status; void *wmi_hdl = GET_WMI_HDL_FROM_PSOC(psoc); - wifi_pos_debug("Send oem data req to target"); + target_if_debug("Send oem data req to target"); if (!req || !req->data) { - wifi_pos_err("oem_data_req is null"); + target_if_err("oem_data_req is null"); return QDF_STATUS_E_INVAL; } if (!wmi_hdl) { - wifi_pos_err(FL("WMA closed, can't send oem data req cmd")); + target_if_err("WMA closed, can't send oem data req cmd"); return QDF_STATUS_E_INVAL; } @@ -296,7 +296,7 @@ static QDF_STATUS wifi_pos_oem_data_req(struct wlan_objmgr_psoc *psoc, req->data); if (!QDF_IS_STATUS_SUCCESS(status)) - wifi_pos_err("wmi cmd send failed"); + target_if_err("wmi cmd send failed"); return status; } @@ -319,7 +319,7 @@ inline struct wlan_lmac_if_wifi_pos_tx_ops *target_if_wifi_pos_get_txops( struct wlan_objmgr_psoc *psoc) { if (!psoc) { - wifi_pos_err("passed psoc is NULL"); + target_if_err("passed psoc is NULL"); return NULL; } @@ -330,7 +330,7 @@ inline struct wlan_lmac_if_wifi_pos_rx_ops *target_if_wifi_pos_get_rxops( struct wlan_objmgr_psoc *psoc) { if (!psoc) { - wifi_pos_err("passed psoc is NULL"); + target_if_err("passed psoc is NULL"); return NULL; } @@ -342,7 +342,7 @@ QDF_STATUS target_if_wifi_pos_register_events(struct wlan_objmgr_psoc *psoc) int ret; if (!psoc || !psoc->tgt_if_handle) { - wifi_pos_err("psoc or psoc->tgt_if_handle is null"); + target_if_err("psoc or psoc->tgt_if_handle is null"); return QDF_STATUS_E_INVAL; } @@ -351,7 +351,7 @@ QDF_STATUS target_if_wifi_pos_register_events(struct wlan_objmgr_psoc *psoc) target_if_wifi_pos_oem_rsp_ev_handler, WMI_RX_WORK_CTX); if (ret) { - wifi_pos_err("register_event_handler failed: err %d", ret); + target_if_err("register_event_handler failed: err %d", ret); return QDF_STATUS_E_INVAL; } @@ -360,7 +360,7 @@ QDF_STATUS target_if_wifi_pos_register_events(struct wlan_objmgr_psoc *psoc) wifi_pos_oem_cap_ev_handler, WMI_RX_WORK_CTX); if (ret) { - wifi_pos_err("register_event_handler failed: err %d", ret); + target_if_err("register_event_handler failed: err %d", ret); return QDF_STATUS_E_INVAL; } @@ -369,7 +369,7 @@ QDF_STATUS target_if_wifi_pos_register_events(struct wlan_objmgr_psoc *psoc) wifi_pos_oem_meas_rpt_ev_handler, WMI_RX_WORK_CTX); if (ret) { - wifi_pos_err("register_event_handler failed: err %d", ret); + target_if_err("register_event_handler failed: err %d", ret); return QDF_STATUS_E_INVAL; } @@ -378,7 +378,7 @@ QDF_STATUS target_if_wifi_pos_register_events(struct wlan_objmgr_psoc *psoc) wifi_pos_oem_err_rpt_ev_handler, WMI_RX_WORK_CTX); if (ret) { - wifi_pos_err("register_event_handler failed: err %d", ret); + target_if_err("register_event_handler failed: err %d", ret); return QDF_STATUS_E_INVAL; } @@ -388,7 +388,7 @@ QDF_STATUS target_if_wifi_pos_register_events(struct wlan_objmgr_psoc *psoc) QDF_STATUS target_if_wifi_pos_deregister_events(struct wlan_objmgr_psoc *psoc) { if (!psoc || !psoc->tgt_if_handle) { - wifi_pos_err("psoc or psoc->tgt_if_handle is null"); + target_if_err("psoc or psoc->tgt_if_handle is null"); return QDF_STATUS_E_INVAL; } @@ -570,7 +570,41 @@ static QDF_STATUS target_if_wifi_pos_deinit_srngs( static QDF_STATUS target_if_wifi_pos_cfg_fw(struct wlan_objmgr_psoc *psoc, struct wifi_pos_psoc_priv_obj *priv) { - return QDF_STATUS_SUCCESS; + uint8_t i; + QDF_STATUS status; + void *wmi_hdl = GET_WMI_HDL_FROM_PSOC(psoc); + wmi_oem_dma_ring_cfg_req_fixed_param cfg = {0}; + + if (!wmi_hdl) { + target_if_err("WMA closed, can't send oem data req cmd"); + return QDF_STATUS_E_INVAL; + } + + target_if_debug("Sending oem dma ring cfg to target"); + + for (i = 0; i < priv->num_rings; i++) { + cfg.pdev_id = priv->dma_cfg[i].pdev_id; + cfg.base_addr_lo = (uint64_t)priv->dma_cfg[i].base_paddr_aligned + & 0xFFFFFFFF; + cfg.base_addr_hi = (uint64_t)priv->dma_cfg[i].base_paddr_aligned + & 0xFFFFFFFF00000000; + cfg.head_idx_addr_lo = (uint64_t)priv->dma_cfg[i].head_idx_addr + & 0xFFFFFFFF; + cfg.head_idx_addr_hi = (uint64_t)priv->dma_cfg[i].head_idx_addr + & 0xFFFFFFFF00000000; + cfg.tail_idx_addr_lo = (uint64_t)priv->dma_cfg[i].tail_idx_addr + & 0xFFFFFFFF; + cfg.tail_idx_addr_hi = (uint64_t)priv->dma_cfg[i].tail_idx_addr + & 0xFFFFFFFF00000000; + cfg.num_ptr = priv->dma_cfg[i].num_ptr; + status = wmi_unified_oem_dma_ring_cfg(wmi_hdl, &cfg); + if (!QDF_IS_STATUS_SUCCESS(status)) { + target_if_err("wmi cmd send failed"); + return status; + } + } + + return status; } QDF_STATUS target_if_wifi_pos_deinit_dma_rings(struct wlan_objmgr_psoc *psoc) diff --git a/wmi/inc/wmi_unified_api.h b/wmi/inc/wmi_unified_api.h index 504ecc03cf79..66d3de25c77b 100644 --- a/wmi/inc/wmi_unified_api.h +++ b/wmi/inc/wmi_unified_api.h @@ -719,6 +719,19 @@ QDF_STATUS wmi_unified_nat_keepalive_en_cmd(void *wmi_hdl, uint8_t vdev_id); QDF_STATUS wmi_unified_csa_offload_enable(void *wmi_hdl, uint8_t vdev_id); +#ifdef WLAN_FEATURE_CIF_CFR +/** + * wmi_unified_oem_dma_ring_cfg() - configure OEM DMA rings + * @wmi_handle: wmi handle + * @data_len: len of dma cfg req + * @data: dma cfg req + * + * Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure + */ +QDF_STATUS wmi_unified_oem_dma_ring_cfg(void *wmi_hdl, + wmi_oem_dma_ring_cfg_req_fixed_param *cfg); +#endif + QDF_STATUS wmi_unified_start_oem_data_cmd(void *wmi_hdl, uint32_t data_len, uint8_t *data); diff --git a/wmi/inc/wmi_unified_priv.h b/wmi/inc/wmi_unified_priv.h index a1547d2a566c..56c52a2395c5 100644 --- a/wmi/inc/wmi_unified_priv.h +++ b/wmi/inc/wmi_unified_priv.h @@ -593,6 +593,11 @@ QDF_STATUS (*send_fw_profiling_cmd)(wmi_unified_t wmi_handle, QDF_STATUS (*send_nat_keepalive_en_cmd)(wmi_unified_t wmi_handle, uint8_t vdev_id); +#ifdef WLAN_FEATURE_CIF_CFR +QDF_STATUS (*send_oem_dma_cfg_cmd)(wmi_unified_t wmi_handle, + wmi_oem_dma_ring_cfg_req_fixed_param *cfg); +#endif + QDF_STATUS (*send_start_oem_data_cmd)(wmi_unified_t wmi_handle, uint32_t data_len, uint8_t *data); diff --git a/wmi/src/wmi_unified_api.c b/wmi/src/wmi_unified_api.c index 3de36cc1be72..bf405cf4390b 100644 --- a/wmi/src/wmi_unified_api.c +++ b/wmi/src/wmi_unified_api.c @@ -2258,6 +2258,20 @@ QDF_STATUS wmi_unified_csa_offload_enable(void *wmi_hdl, uint8_t vdev_id) return QDF_STATUS_E_FAILURE; } + +#ifdef WLAN_FEATURE_CIF_CFR +QDF_STATUS wmi_unified_oem_dma_ring_cfg(void *wmi_hdl, + wmi_oem_dma_ring_cfg_req_fixed_param *cfg) +{ + wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl; + + if (wmi_handle->ops->send_start_oem_data_cmd) + return wmi_handle->ops->send_oem_dma_cfg_cmd(wmi_handle, cfg); + + return QDF_STATUS_E_FAILURE; +} +#endif + /** * wmi_unified_start_oem_data_cmd() - start OEM data request to target * @wmi_handle: wmi handle diff --git a/wmi/src/wmi_unified_tlv.c b/wmi/src/wmi_unified_tlv.c index c7b007d2e631..7b62eef2cfef 100644 --- a/wmi/src/wmi_unified_tlv.c +++ b/wmi/src/wmi_unified_tlv.c @@ -7915,6 +7915,47 @@ static QDF_STATUS send_csa_offload_enable_cmd_tlv(wmi_unified_t wmi_handle, return 0; } +#ifdef WLAN_FEATURE_CIF_CFR +/** + * send_oem_dma_cfg_cmd_tlv() - configure OEM DMA rings + * @wmi_handle: wmi handle + * @data_len: len of dma cfg req + * @data: dma cfg req + * + * Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure + */ +static QDF_STATUS send_oem_dma_cfg_cmd_tlv(wmi_unified_t wmi_handle, + wmi_oem_dma_ring_cfg_req_fixed_param *cfg) +{ + wmi_buf_t buf; + uint8_t *cmd; + QDF_STATUS ret; + + WMITLV_SET_HDR(cfg, + WMITLV_TAG_STRUC_wmi_oem_dma_ring_cfg_req_fixed_param, + (sizeof(*cfg) - WMI_TLV_HDR_SIZE)); + + buf = wmi_buf_alloc(wmi_handle, sizeof(*cfg)); + if (!buf) { + WMI_LOGE(FL("wmi_buf_alloc failed")); + return QDF_STATUS_E_FAILURE; + } + + cmd = (uint8_t *) wmi_buf_data(buf); + qdf_mem_copy(cmd, cfg, sizeof(*cfg)); + WMI_LOGI(FL("Sending OEM Data Request to target, data len %lu"), + sizeof(*cfg)); + ret = wmi_unified_cmd_send(wmi_handle, buf, sizeof(*cfg), + WMI_OEM_DMA_RING_CFG_REQ_CMDID); + if (QDF_IS_STATUS_ERROR(ret)) { + WMI_LOGE(FL(":wmi cmd send failed")); + wmi_buf_free(buf); + } + + return ret; +} +#endif + /** * send_start_oem_data_cmd_tlv() - start OEM data request to target * @wmi_handle: wmi handle @@ -17739,6 +17780,9 @@ struct wmi_ops tlv_ops = { .send_csa_offload_enable_cmd = send_csa_offload_enable_cmd_tlv, .send_nat_keepalive_en_cmd = send_nat_keepalive_en_cmd_tlv, .send_start_oem_data_cmd = send_start_oem_data_cmd_tlv, +#ifdef WLAN_FEATURE_CIF_CFR + .send_oem_dma_cfg_cmd = send_oem_dma_cfg_cmd_tlv, +#endif .send_dfs_phyerr_filter_offload_en_cmd = send_dfs_phyerr_filter_offload_en_cmd_tlv, .send_wow_delete_pattern_cmd = send_wow_delete_pattern_cmd_tlv,