diff --git a/umac/global_umac_dispatcher/lmac_if/inc/wlan_lmac_if_def.h b/umac/global_umac_dispatcher/lmac_if/inc/wlan_lmac_if_def.h index a9b895ee3a..2e8c7a8ab9 100644 --- a/umac/global_umac_dispatcher/lmac_if/inc/wlan_lmac_if_def.h +++ b/umac/global_umac_dispatcher/lmac_if/inc/wlan_lmac_if_def.h @@ -491,6 +491,12 @@ struct wlan_lmac_if_sa_api_tx_ops { * @cfr_enable_cfr_timer: Function to enable CFR timer * @cfr_start_capture: Function to start CFR capture * @cfr_stop_capture: Function to stop CFR capture + * @cfr_config_rcc: Function to set the Repetitive channel capture params + * @cfr_start_lut_timer: Function to start timer to flush aged-out LUT entries + * @cfr_stop_lut_timer: Function to stop timer to flush aged-out LUT entries + * @cfr_default_ta_ra_cfg: Function to configure default values for TA_RA mode + * @cfr_dump_lut_enh: Function to dump LUT entries + * @cfr_rx_tlv_process: Function to process PPDU status TLVs */ struct wlan_lmac_if_cfr_tx_ops { int (*cfr_init_pdev)(struct wlan_objmgr_psoc *psoc, @@ -504,6 +510,16 @@ struct wlan_lmac_if_cfr_tx_ops { struct cfr_capture_params *params); int (*cfr_stop_capture)(struct wlan_objmgr_pdev *pdev, struct wlan_objmgr_peer *peer); +#ifdef WLAN_ENH_CFR_ENABLE + QDF_STATUS (*cfr_config_rcc)(struct wlan_objmgr_pdev *pdev, + struct cfr_rcc_param *params); + QDF_STATUS (*cfr_start_lut_timer)(struct wlan_objmgr_pdev *pdev); + QDF_STATUS (*cfr_stop_lut_timer)(struct wlan_objmgr_pdev *pdev); + void (*cfr_default_ta_ra_cfg)(struct cfr_rcc_param *params, + bool allvalid, uint16_t reset_cfg); + void (*cfr_dump_lut_enh)(struct wlan_objmgr_pdev *pdev); + void (*cfr_rx_tlv_process)(struct wlan_objmgr_pdev *pdev, void *nbuf); +#endif }; #endif /* WLAN_CFR_ENABLE */ diff --git a/wmi/inc/wmi_unified_api.h b/wmi/inc/wmi_unified_api.h index d83c889e47..5c9ff53b03 100644 --- a/wmi/inc/wmi_unified_api.h +++ b/wmi/inc/wmi_unified_api.h @@ -3736,31 +3736,6 @@ QDF_STATUS wmi_unified_send_mws_coex_req_cmd(struct wmi_unified *wmi_handle, QDF_STATUS wmi_unified_send_idle_trigger_monitor(wmi_unified_t wmi_handle, uint8_t val); -#ifdef WLAN_CFR_ENABLE -/** - * wmi_unified_send_peer_cfr_capture_cmd() - WMI function to start CFR capture - * for a peer - * @wmi_handle: WMI handle - * @param: configuration params for capture - * - * Return: QDF_STATUS_SUCCESS if success, else returns proper error code. - */ -QDF_STATUS -wmi_unified_send_peer_cfr_capture_cmd(wmi_unified_t wmi_handle, - struct peer_cfr_params *param); -/** - * wmi_extract_cfr_peer_tx_event_param() - WMI function to extract cfr tx event - * for a peer - * @wmi_handle: WMI handle - * @evt_buf: Buffer holding event data - * @peer_tx_event: pointer to hold tx event data - * - * Return: QDF_STATUS_SUCCESS if success, else returns proper error code. - */ -QDF_STATUS -wmi_extract_cfr_peer_tx_event_param(wmi_unified_t wmi_handle, void *evt_buf, - wmi_cfr_peer_tx_event_param *peer_tx_event); -#endif /* WLAN_CFR_ENABLE */ #ifdef WIFI_POS_CONVERGED /** diff --git a/wmi/inc/wmi_unified_cfr_api.h b/wmi/inc/wmi_unified_cfr_api.h new file mode 100644 index 0000000000..aa457b905d --- /dev/null +++ b/wmi/inc/wmi_unified_cfr_api.h @@ -0,0 +1,60 @@ +/* + * Copyright (c) 2019, The Linux Foundation. All rights reserved. + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#ifndef _WMI_UNIFIED_CFR_API_H_ +#define _WMI_UNIFIED_CFR_API_H_ + +#include "wmi_unified_param.h" +#include "wmi_unified_cfr_param.h" + +#ifdef WLAN_CFR_ENABLE +/** + * wmi_unified_send_peer_cfr_capture_cmd() - WMI function to start CFR capture + * for a peer + * @wmi_handle: WMI handle + * @param: configuration params for capture + * + * Return: QDF_STATUS_SUCCESS if success, else returns proper error code. + */ +QDF_STATUS +wmi_unified_send_peer_cfr_capture_cmd(wmi_unified_t wmi_handle, + struct peer_cfr_params *param); +/** + * wmi_extract_cfr_peer_tx_event_param() - WMI function to extract cfr tx event + * for a peer + * @wmi_handle: WMI handle + * @evt_buf: Buffer holding event data + * @peer_tx_event: pointer to hold tx event data + * + * Return: QDF_STATUS_SUCCESS if success, else returns proper error code. + */ +QDF_STATUS +wmi_extract_cfr_peer_tx_event_param(wmi_unified_t wmi_handle, void *evt_buf, + wmi_cfr_peer_tx_event_param *peer_tx_event); + +#ifdef WLAN_ENH_CFR_ENABLE +/** + * wmi_unified_send_cfr_rcc_cmd() - WMI function to send CFR RCC param + * @wmi_handle: WMI handle + * @cfg: pointer to RCC param + * + * Return: QDF_STATUS_SUCCESS if success, else returns proper error code. + */ +QDF_STATUS wmi_unified_send_cfr_rcc_cmd(wmi_unified_t wmi_handle, + struct cfr_rcc_param *cfg); +#endif +#endif /* WLAN_CFR_ENABLE */ +#endif /* _WMI_UNIFIED_CFR_API_H_ */ diff --git a/wmi/inc/wmi_unified_cfr_param.h b/wmi/inc/wmi_unified_cfr_param.h new file mode 100644 index 0000000000..151d9f60b0 --- /dev/null +++ b/wmi/inc/wmi_unified_cfr_param.h @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2019, The Linux Foundation. All rights reserved. + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#ifndef _WMI_UNIFIED_CFR_PARAM_H_ +#define _WMI_UNIFIED_CFR_PARAM_H_ + +#ifdef WLAN_CFR_ENABLE + +#define WMI_HOST_PEER_CFR_TIMER_ENABLE 1 +#define WMI_HOST_PEER_CFR_TIMER_DISABLE 0 + + +/** + * struct peer_cfr_params - peer cfr capture cmd parameter + * @request: enable/disable cfr capture + * @macaddr: macaddr of the client + * @vdev_id: vdev id + * @periodicity: cfr capture period + * @bandwidth: bandwidth of cfr capture + * @capture_method: cfr capture method/type + */ +struct peer_cfr_params { + uint32_t request; + uint8_t *macaddr; + uint32_t vdev_id; + uint32_t periodicity; + uint32_t bandwidth; + uint32_t capture_method; +}; + + +#endif /* WLAN_CFR_ENABLE */ +#endif /* _WMI_UNIFIED_CFR_PARAM_H_ */ diff --git a/wmi/inc/wmi_unified_param.h b/wmi/inc/wmi_unified_param.h index c34017adc3..d8ff72e4e9 100644 --- a/wmi/inc/wmi_unified_param.h +++ b/wmi/inc/wmi_unified_param.h @@ -710,30 +710,6 @@ struct vdev_nss_chains { bool disable_tx_mrc[NSS_CHAINS_BAND_MAX]; }; -#ifdef WLAN_CFR_ENABLE - -#define WMI_HOST_PEER_CFR_TIMER_ENABLE 1 -#define WMI_HOST_PEER_CFR_TIMER_DISABLE 0 - -/** - * struct peer_cfr_params - peer cfr capture cmd parameter - * @request: enable/disable cfr capture - * @macaddr: macaddr of the client - * @vdev_id: vdev id - * @periodicity: cfr capture period - * @bandwidth: bandwidth of cfr capture - * @capture_method: cfr capture method/type - */ -struct peer_cfr_params { - uint32_t request; - uint8_t *macaddr; - uint32_t vdev_id; - uint32_t periodicity; - uint32_t bandwidth; - uint32_t capture_method; -}; - -#endif /* WLAN_CFR_ENABLE */ /** * struct peer_delete_params - peer delete cmd parameter diff --git a/wmi/inc/wmi_unified_priv.h b/wmi/inc/wmi_unified_priv.h index 9e572dcd42..4713a5e8c7 100644 --- a/wmi/inc/wmi_unified_priv.h +++ b/wmi/inc/wmi_unified_priv.h @@ -65,6 +65,10 @@ #include #endif +#ifdef WLAN_CFR_ENABLE +#include +#endif + #define WMI_UNIFIED_MAX_EVENT 0x100 #ifdef WMI_EXT_DBG @@ -2022,9 +2026,6 @@ QDF_STATUS (*extract_dfs_status_from_fw)(wmi_unified_t wmi_handle, uint32_t *dfs_status_check); #endif -QDF_STATUS -(*extract_cfr_peer_tx_event_param)(wmi_unified_t wmi_handle, void *evt_buf, - wmi_cfr_peer_tx_event_param * peer_tx_event); #ifdef OBSS_PD QDF_STATUS (*send_obss_spatial_reuse_set)(wmi_unified_t wmi_handle, @@ -2046,9 +2047,18 @@ QDF_STATUS (*send_peer_del_all_wds_entries_cmd)(wmi_unified_t wmi_handle, struct peer_del_all_wds_entries_params *param); #ifdef WLAN_CFR_ENABLE +QDF_STATUS +(*extract_cfr_peer_tx_event_param)(wmi_unified_t wmi_handle, void *evt_buf, + wmi_cfr_peer_tx_event_param *peer_tx_event); + QDF_STATUS (*send_peer_cfr_capture_cmd)(wmi_unified_t wmi_handle, struct peer_cfr_params *param); +#ifdef WLAN_ENH_CFR_ENABLE +QDF_STATUS (*send_cfr_rcc_cmd)(wmi_unified_t wmi_handle, + struct cfr_rcc_param *cfg); #endif +#endif + #ifdef WMI_AP_SUPPORT QDF_STATUS (*send_vdev_pcp_tid_map_cmd)(wmi_unified_t wmi_handle, struct vap_pcp_tid_map_params *param); @@ -2627,4 +2637,12 @@ static inline QDF_STATUS wmi_ext_dbgfs_deinit(struct wmi_unified *wmi_handle) } #endif /*WMI_EXT_DBG */ + +#ifdef WLAN_CFR_ENABLE +void wmi_cfr_attach_tlv(struct wmi_unified *wmi_handle); +#else +static inline void wmi_cfr_attach_tlv(struct wmi_unified *wmi_handle) +{ +} +#endif #endif diff --git a/wmi/src/wmi_unified_api.c b/wmi/src/wmi_unified_api.c index c1c4105ddb..1db3046e57 100644 --- a/wmi/src/wmi_unified_api.c +++ b/wmi/src/wmi_unified_api.c @@ -2997,33 +2997,6 @@ QDF_STATUS wmi_unified_extract_obss_color_collision_info( return QDF_STATUS_E_FAILURE; } -#ifdef WLAN_CFR_ENABLE -QDF_STATUS wmi_unified_send_peer_cfr_capture_cmd(wmi_unified_t wmi_handle, - struct peer_cfr_params *param) -{ - if (wmi_handle->ops->send_peer_cfr_capture_cmd) - return wmi_handle->ops->send_peer_cfr_capture_cmd(wmi_handle, - param); - - return QDF_STATUS_E_FAILURE; -} - -/** - * wmi_extract_cfr_peer_tx_event_param() - extract tx event params from event - */ -QDF_STATUS -wmi_extract_cfr_peer_tx_event_param(wmi_unified_t wmi_handle, void *evt_buf, - wmi_cfr_peer_tx_event_param *peer_tx_event) -{ - if (wmi_handle->ops->extract_cfr_peer_tx_event_param) - return wmi_handle->ops->extract_cfr_peer_tx_event_param( - wmi_handle, - evt_buf, - peer_tx_event); - return QDF_STATUS_E_FAILURE; -} -#endif /* WLAN_CFR_ENABLE */ - QDF_STATUS wmi_unified_send_mws_coex_req_cmd(struct wmi_unified *wmi_handle, uint32_t vdev_id, uint32_t cmd_id) diff --git a/wmi/src/wmi_unified_cfr_api.c b/wmi/src/wmi_unified_cfr_api.c new file mode 100644 index 0000000000..5a6f759c41 --- /dev/null +++ b/wmi/src/wmi_unified_cfr_api.c @@ -0,0 +1,55 @@ +/* + * Copyright (c) 2019, The Linux Foundation. All rights reserved. + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#include "wmi_unified_priv.h" + +#ifdef WLAN_CFR_ENABLE + +QDF_STATUS wmi_unified_send_peer_cfr_capture_cmd(wmi_unified_t wmi_handle, + struct peer_cfr_params *param) +{ + if (wmi_handle->ops->send_peer_cfr_capture_cmd) + return wmi_handle->ops->send_peer_cfr_capture_cmd(wmi_handle, + param); + + return QDF_STATUS_E_FAILURE; +} + +/** + * wmi_extract_cfr_peer_tx_event_param() - extract tx event params from event + */ +QDF_STATUS +wmi_extract_cfr_peer_tx_event_param(wmi_unified_t wmi_handle, void *evt_buf, + wmi_cfr_peer_tx_event_param *peer_tx_event) +{ + if (wmi_handle->ops->extract_cfr_peer_tx_event_param) + return wmi_handle->ops->extract_cfr_peer_tx_event_param( + wmi_handle, + evt_buf, + peer_tx_event); + return QDF_STATUS_E_FAILURE; +} + +#ifdef WLAN_ENH_CFR_ENABLE +QDF_STATUS wmi_unified_send_cfr_rcc_cmd(wmi_unified_t wmi_handle, + struct cfr_rcc_param *cfg) +{ + if (wmi_handle->ops->send_cfr_rcc_cmd) + return wmi_handle->ops->send_cfr_rcc_cmd(wmi_handle, cfg); + return QDF_STATUS_E_FAILURE; +} +#endif /* WLAN_ENH_CFR_ENABLE */ +#endif /* WLAN_CFR_ENABLE */ diff --git a/wmi/src/wmi_unified_cfr_tlv.c b/wmi/src/wmi_unified_cfr_tlv.c new file mode 100644 index 0000000000..fe953cafda --- /dev/null +++ b/wmi/src/wmi_unified_cfr_tlv.c @@ -0,0 +1,273 @@ +/* + * Copyright (c) 2019, The Linux Foundation. All rights reserved. + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#include +#include "wmi.h" +#include "wmi_unified_priv.h" +#include "wmi_unified_cfr_param.h" +#include "wmi_unified_cfr_api.h" + +#ifdef WLAN_CFR_ENABLE +static QDF_STATUS +extract_cfr_peer_tx_event_param_tlv(wmi_unified_t wmi_handle, void *evt_buf, + wmi_cfr_peer_tx_event_param *peer_tx_event) +{ + int idx; + WMI_PEER_CFR_CAPTURE_EVENTID_param_tlvs *param_buf; + wmi_peer_cfr_capture_event_fixed_param *peer_tx_event_ev; + wmi_peer_cfr_capture_event_phase_fixed_param *chain_phase_ev; + + param_buf = (WMI_PEER_CFR_CAPTURE_EVENTID_param_tlvs *)evt_buf; + if (!param_buf) { + WMI_LOGE("Invalid cfr capture buffer"); + return QDF_STATUS_E_INVAL; + } + + peer_tx_event_ev = param_buf->fixed_param; + if (!peer_tx_event_ev) { + WMI_LOGE("peer cfr capture buffer is null"); + return QDF_STATUS_E_NULL_VALUE; + } + + peer_tx_event->capture_method = peer_tx_event_ev->capture_method; + peer_tx_event->vdev_id = peer_tx_event_ev->vdev_id; + WMI_MAC_ADDR_TO_CHAR_ARRAY(&peer_tx_event_ev->mac_addr, + &peer_tx_event->peer_mac_addr.bytes[0]); + peer_tx_event->primary_20mhz_chan = + peer_tx_event_ev->chan_mhz; + peer_tx_event->bandwidth = peer_tx_event_ev->bandwidth; + peer_tx_event->phy_mode = peer_tx_event_ev->phy_mode; + peer_tx_event->band_center_freq1 = peer_tx_event_ev->band_center_freq1; + peer_tx_event->band_center_freq2 = peer_tx_event_ev->band_center_freq2; + peer_tx_event->spatial_streams = peer_tx_event_ev->sts_count; + peer_tx_event->correlation_info_1 = + peer_tx_event_ev->correlation_info_1; + peer_tx_event->correlation_info_2 = + peer_tx_event_ev->correlation_info_2; + peer_tx_event->status = peer_tx_event_ev->status; + peer_tx_event->timestamp_us = peer_tx_event_ev->timestamp_us; + peer_tx_event->counter = peer_tx_event_ev->counter; + qdf_mem_copy(peer_tx_event->chain_rssi, peer_tx_event_ev->chain_rssi, + sizeof(peer_tx_event->chain_rssi)); + + chain_phase_ev = param_buf->phase_param; + if (chain_phase_ev) { + for (idx = 0; idx < WMI_HOST_MAX_CHAINS; idx++) { + /* Due to FW's alignment rules, phase information being + * passed is 32-bit, out of which only 16 bits is valid. + * Remaining bits are all zeroed. So direct mem copy + * will not work as it will copy extra zeroes into host + * structures. + */ + peer_tx_event->chain_phase[idx] = + (0xffff & chain_phase_ev->chain_phase[idx]); + } + } + + return QDF_STATUS_SUCCESS; +} + +#ifdef WLAN_ENH_CFR_ENABLE +static void populate_wmi_cfr_param(uint8_t grp_id, struct cfr_rcc_param *rcc, + wmi_cfr_filter_group_config *param) +{ + struct ta_ra_cfr_cfg *tgt_cfg = NULL; + + WMITLV_SET_HDR(¶m->tlv_header, + WMITLV_TAG_STRUC_wmi_cfr_filter_group_config, + WMITLV_GET_STRUCT_TLVLEN + (wmi_cfr_filter_group_config)); + tgt_cfg = &rcc->curr[grp_id]; + + param->filter_group_id = grp_id; + WMI_CFR_GROUP_TA_ADDR_VALID_SET(param->filter_set_valid_mask, + tgt_cfg->valid_ta); + WMI_CFR_GROUP_TA_ADDR_MASK_VALID_SET(param->filter_set_valid_mask, + tgt_cfg->valid_ta_mask); + WMI_CFR_GROUP_RA_ADDR_VALID_SET(param->filter_set_valid_mask, + tgt_cfg->valid_ra); + WMI_CFR_GROUP_RA_ADDR_MASK_VALID_SET(param->filter_set_valid_mask, + tgt_cfg->valid_ra_mask); + WMI_CFR_GROUP_BW_VALID_SET(param->filter_set_valid_mask, + tgt_cfg->valid_bw_mask); + WMI_CFR_GROUP_NSS_VALID_SET(param->filter_set_valid_mask, + tgt_cfg->valid_nss_mask); + WMI_CFR_GROUP_MGMT_SUBTYPE_VALID_SET(param->filter_set_valid_mask, + tgt_cfg->valid_mgmt_subtype); + WMI_CFR_GROUP_CTRL_SUBTYPE_VALID_SET(param->filter_set_valid_mask, + tgt_cfg->valid_ctrl_subtype); + WMI_CFR_GROUP_DATA_SUBTYPE_VALID_SET(param->filter_set_valid_mask, + tgt_cfg->valid_data_subtype); + WMI_CHAR_ARRAY_TO_MAC_ADDR(tgt_cfg->tx_addr, + ¶m->ta_addr); + WMI_CHAR_ARRAY_TO_MAC_ADDR(tgt_cfg->tx_addr_mask, + ¶m->ta_addr_mask); + WMI_CHAR_ARRAY_TO_MAC_ADDR(tgt_cfg->rx_addr, + ¶m->ra_addr); + WMI_CHAR_ARRAY_TO_MAC_ADDR(tgt_cfg->rx_addr_mask, + ¶m->ra_addr_mask); + WMI_CFR_GROUP_BW_SET(param->bw_nss_filter, + tgt_cfg->bw); + WMI_CFR_GROUP_NSS_SET(param->bw_nss_filter, + tgt_cfg->nss); + param->mgmt_subtype_filter = tgt_cfg->mgmt_subtype_filter; + param->ctrl_subtype_filter = tgt_cfg->ctrl_subtype_filter; + param->data_subtype_filter = tgt_cfg->data_subtype_filter; +} + +static QDF_STATUS send_cfr_rcc_cmd_tlv(wmi_unified_t wmi_handle, + struct cfr_rcc_param *rcc) +{ + wmi_cfr_capture_filter_cmd_fixed_param *cmd; + wmi_cfr_filter_group_config *param; + uint8_t *buf_ptr, grp_id; + wmi_buf_t buf; + uint32_t len; + QDF_STATUS status = QDF_STATUS_SUCCESS; + struct wmi_ops *ops = wmi_handle->ops; + + len = sizeof(*cmd) + WMI_TLV_HDR_SIZE; + len += rcc->num_grp_tlvs * sizeof(wmi_cfr_filter_group_config); + buf = wmi_buf_alloc(wmi_handle, len); + + if (!buf) { + WMI_LOGE("%s:wmi_buf_alloc failed\n", __func__); + return QDF_STATUS_E_NOMEM; + } + + buf_ptr = wmi_buf_data(buf); + cmd = (wmi_cfr_capture_filter_cmd_fixed_param *)buf_ptr; + + WMITLV_SET_HDR(&cmd->tlv_header, + WMITLV_TAG_STRUC_wmi_cfr_capture_filter_cmd_fixed_param, + WMITLV_GET_STRUCT_TLVLEN + (wmi_cfr_capture_filter_cmd_fixed_param)); + cmd->pdev_id = ops->convert_pdev_id_host_to_target(wmi_handle, + rcc->pdev_id); + WMI_CFR_CAPTURE_INTERVAL_SET(cmd->capture_interval, + rcc->capture_interval); + WMI_CFR_CAPTURE_DURATION_SET(cmd->capture_duration, + rcc->capture_duration); + WMI_CFR_FILTER_GROUP_BITMAP_SET(cmd->filter_group_bitmap, + rcc->filter_group_bitmap); + WMI_CFR_UL_MU_USER_UPPER_SET(cmd->ul_mu_user_mask_upper, + rcc->ul_mu_user_mask_upper); + cmd->ul_mu_user_mask_lower = rcc->ul_mu_user_mask_lower; + WMI_CFR_FREEZE_DELAY_CNT_EN_SET(cmd->freeze_tlv_delay_cnt, + rcc->freeze_tlv_delay_cnt_en); + WMI_CFR_FREEZE_DELAY_CNT_THR_SET(cmd->freeze_tlv_delay_cnt, + rcc->freeze_tlv_delay_cnt_thr); + WMI_CFR_DIRECTED_FTM_ACK_EN_SET(cmd->filter_type, + rcc->m_directed_ftm); + WMI_CFR_ALL_FTM_ACK_EN_SET(cmd->filter_type, + rcc->m_all_ftm_ack); + WMI_CFR_NDPA_NDP_DIRECTED_EN_SET(cmd->filter_type, + rcc->m_ndpa_ndp_directed); + WMI_CFR_NDPA_NDP_ALL_EN_SET(cmd->filter_type, + rcc->m_ndpa_ndp_all); + WMI_CFR_TA_RA_TYPE_FILTER_EN_SET(cmd->filter_type, + rcc->m_ta_ra_filter); + WMI_CFR_ALL_PACKET_EN_SET(cmd->filter_type, + rcc->m_all_packet); + + /* TLV indicating array of structures to follow */ + buf_ptr += sizeof(wmi_cfr_capture_filter_cmd_fixed_param); + + WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, + rcc->num_grp_tlvs * sizeof(wmi_cfr_filter_group_config)); + + if (rcc->num_grp_tlvs) { + buf_ptr += WMI_TLV_HDR_SIZE; + param = (wmi_cfr_filter_group_config *)buf_ptr; + + for (grp_id = 0; grp_id < MAX_TA_RA_ENTRIES; grp_id++) { + if (qdf_test_bit(grp_id, + (unsigned long *) + &rcc->modified_in_curr_session)) { + populate_wmi_cfr_param(grp_id, rcc, param); + param++; + } + } + } + status = wmi_unified_cmd_send(wmi_handle, buf, len, + WMI_CFR_CAPTURE_FILTER_CMDID); + if (status) + wmi_buf_free(buf); + + return status; +} +#endif + +static QDF_STATUS send_peer_cfr_capture_cmd_tlv(wmi_unified_t wmi_handle, + struct peer_cfr_params *param) +{ + wmi_peer_cfr_capture_cmd_fixed_param *cmd; + wmi_buf_t buf; + int len = sizeof(*cmd); + int ret; + + buf = wmi_buf_alloc(wmi_handle, len); + if (!buf) { + qdf_print("%s:wmi_buf_alloc failed\n", __func__); + return QDF_STATUS_E_NOMEM; + } + + cmd = (wmi_peer_cfr_capture_cmd_fixed_param *)wmi_buf_data(buf); + WMITLV_SET_HDR(&cmd->tlv_header, + WMITLV_TAG_STRUC_wmi_peer_cfr_capture_cmd_fixed_param, + WMITLV_GET_STRUCT_TLVLEN + (wmi_peer_cfr_capture_cmd_fixed_param)); + + WMI_CHAR_ARRAY_TO_MAC_ADDR(param->macaddr, &cmd->mac_addr); + cmd->request = param->request; + cmd->vdev_id = param->vdev_id; + cmd->periodicity = param->periodicity; + cmd->bandwidth = param->bandwidth; + cmd->capture_method = param->capture_method; + + ret = wmi_unified_cmd_send(wmi_handle, buf, len, + WMI_PEER_CFR_CAPTURE_CMDID); + if (QDF_IS_STATUS_ERROR(ret)) { + WMI_LOGE("Failed to send WMI_PEER_CFR_CAPTURE_CMDID"); + wmi_buf_free(buf); + } + + return ret; +} + +#ifdef WLAN_ENH_CFR_ENABLE +static inline void wmi_enh_cfr_attach_tlv(wmi_unified_t wmi_handle) +{ + struct wmi_ops *ops = wmi_handle->ops; + + ops->send_cfr_rcc_cmd = send_cfr_rcc_cmd_tlv; +} +#else +static inline void wmi_enh_cfr_attach_tlv(wmi_unified_t wmi_handle) +{ +} +#endif + +void wmi_cfr_attach_tlv(wmi_unified_t wmi_handle) +{ + struct wmi_ops *ops = wmi_handle->ops; + + ops->send_peer_cfr_capture_cmd = send_peer_cfr_capture_cmd_tlv; + ops->extract_cfr_peer_tx_event_param = + extract_cfr_peer_tx_event_param_tlv; + wmi_enh_cfr_attach_tlv(wmi_handle); +} +#endif /* WLAN_CFR_ENABLE */ diff --git a/wmi/src/wmi_unified_tlv.c b/wmi/src/wmi_unified_tlv.c index d052e3f905..215da4c4f4 100644 --- a/wmi/src/wmi_unified_tlv.c +++ b/wmi/src/wmi_unified_tlv.c @@ -60,6 +60,11 @@ #ifdef WMI_AP_SUPPORT #include "wmi_unified_ap_api.h" #endif + +#ifdef WLAN_CFR_ENABLE +#include "wmi_unified_cfr_api.h" +#endif + #include #include @@ -12009,52 +12014,6 @@ static QDF_STATUS extract_single_phyerr_tlv(wmi_unified_t wmi_handle, return QDF_STATUS_SUCCESS; } -#ifdef WLAN_CFR_ENABLE -/** - * send_peer_cfr_capture_cmd_tlv() - configure cfr params in fw - * @wmi_handle: wmi handle - * @param: pointer to hold peer cfr config parameter - * - * Return: 0 for success or error code - */ -static QDF_STATUS send_peer_cfr_capture_cmd_tlv(wmi_unified_t wmi_handle, - struct peer_cfr_params *param) -{ - wmi_peer_cfr_capture_cmd_fixed_param *cmd; - wmi_buf_t buf; - int len = sizeof(*cmd); - int ret; - - buf = wmi_buf_alloc(wmi_handle, len); - if (!buf) { - qdf_print("%s:wmi_buf_alloc failed\n", __func__); - return QDF_STATUS_E_NOMEM; - } - - cmd = (wmi_peer_cfr_capture_cmd_fixed_param *)wmi_buf_data(buf); - WMITLV_SET_HDR(&cmd->tlv_header, - WMITLV_TAG_STRUC_wmi_peer_cfr_capture_cmd_fixed_param, - WMITLV_GET_STRUCT_TLVLEN - (wmi_peer_cfr_capture_cmd_fixed_param)); - - WMI_CHAR_ARRAY_TO_MAC_ADDR(param->macaddr, &cmd->mac_addr); - cmd->request = param->request; - cmd->vdev_id = param->vdev_id; - cmd->periodicity = param->periodicity; - cmd->bandwidth = param->bandwidth; - cmd->capture_method = param->capture_method; - - ret = wmi_unified_cmd_send(wmi_handle, buf, len, - WMI_PEER_CFR_CAPTURE_CMDID); - if (QDF_IS_STATUS_ERROR(ret)) { - WMI_LOGE("Failed to send WMI_PEER_CFR_CAPTURE_CMDID"); - wmi_buf_free(buf); - } - - return ret; -} -#endif /* WLAN_CFR_ENABLE */ - /** * extract_esp_estimation_ev_param_tlv() - extract air time from event * @wmi_handle: wmi handle @@ -12305,75 +12264,6 @@ send_vdev_fils_enable_cmd_send(struct wmi_unified *wmi_handle, } #endif -#ifdef WLAN_CFR_ENABLE -/** - * extract_cfr_peer_tx_event_param_tlv() - Extract peer cfr tx event params - * @wmi_handle: wmi handle - * @event_buf: pointer to event buffer - * @peer_tx_event: Pointer to hold peer cfr tx event params - * - * Return QDF_STATUS_SUCCESS on success or proper error code. - */ -static QDF_STATUS -extract_cfr_peer_tx_event_param_tlv(wmi_unified_t wmi_handle, void *evt_buf, - wmi_cfr_peer_tx_event_param *peer_tx_event) -{ - int idx; - WMI_PEER_CFR_CAPTURE_EVENTID_param_tlvs *param_buf; - wmi_peer_cfr_capture_event_fixed_param *peer_tx_event_ev; - wmi_peer_cfr_capture_event_phase_fixed_param *chain_phase_ev; - - param_buf = (WMI_PEER_CFR_CAPTURE_EVENTID_param_tlvs *)evt_buf; - if (!param_buf) { - WMI_LOGE("Invalid cfr capture buffer"); - return QDF_STATUS_E_INVAL; - } - - peer_tx_event_ev = param_buf->fixed_param; - if (!peer_tx_event_ev) { - qdf_err("peer cfr capture buffer is null"); - return QDF_STATUS_E_NULL_VALUE; - } - - peer_tx_event->capture_method = peer_tx_event_ev->capture_method; - peer_tx_event->vdev_id = peer_tx_event_ev->vdev_id; - WMI_MAC_ADDR_TO_CHAR_ARRAY(&peer_tx_event_ev->mac_addr, - &peer_tx_event->peer_mac_addr.bytes[0]); - peer_tx_event->primary_20mhz_chan = - peer_tx_event_ev->chan_mhz; - peer_tx_event->bandwidth = peer_tx_event_ev->bandwidth; - peer_tx_event->phy_mode = peer_tx_event_ev->phy_mode; - peer_tx_event->band_center_freq1 = peer_tx_event_ev->band_center_freq1; - peer_tx_event->band_center_freq2 = peer_tx_event_ev->band_center_freq2; - peer_tx_event->spatial_streams = peer_tx_event_ev->sts_count; - peer_tx_event->correlation_info_1 = - peer_tx_event_ev->correlation_info_1; - peer_tx_event->correlation_info_2 = - peer_tx_event_ev->correlation_info_2; - peer_tx_event->status = peer_tx_event_ev->status; - peer_tx_event->timestamp_us = peer_tx_event_ev->timestamp_us; - peer_tx_event->counter = peer_tx_event_ev->counter; - qdf_mem_copy(peer_tx_event->chain_rssi, peer_tx_event_ev->chain_rssi, - sizeof(peer_tx_event->chain_rssi)); - - chain_phase_ev = param_buf->phase_param; - if (chain_phase_ev) { - for (idx = 0; idx < WMI_HOST_MAX_CHAINS; idx++) { - /* Due to FW's alignment rules, phase information being - * passed is 32-bit, out of which only 16 bits is valid. - * Remaining bits are all zeroed. So direct mem copy - * will not work as it will copy extra zeroes into host - * structures. - */ - peer_tx_event->chain_phase[idx] = - (0xffff & chain_phase_ev->chain_phase[idx]); - } - } - - return QDF_STATUS_SUCCESS; -} -#endif /* WLAN_CFR_ENABLE */ - #ifdef WLAN_MWS_INFO_DEBUGFS /** * send_mws_coex_status_req_cmd_tlv() - send coex cmd to fw @@ -13161,11 +13051,6 @@ struct wmi_ops tlv_ops = { .extract_offload_bcn_tx_status_evt = extract_offload_bcn_tx_status_evt, .extract_ctl_failsafe_check_ev_param = extract_ctl_failsafe_check_ev_param_tlv, -#ifdef WLAN_CFR_ENABLE - .send_peer_cfr_capture_cmd = - send_peer_cfr_capture_cmd_tlv, - .extract_cfr_peer_tx_event_param = extract_cfr_peer_tx_event_param_tlv, -#endif /* WLAN_CFR_ENABLE */ #ifdef WIFI_POS_CONVERGED .extract_oem_response_param = extract_oem_response_param_tlv, #endif /* WIFI_POS_CONVERGED */ @@ -13868,6 +13753,7 @@ void wmi_tlv_attach(wmi_unified_t wmi_handle) wmi_11ax_bss_color_attach_tlv(wmi_handle); wmi_fwol_attach_tlv(wmi_handle); wmi_vdev_attach_tlv(wmi_handle); + wmi_cfr_attach_tlv(wmi_handle); } qdf_export_symbol(wmi_tlv_attach);