From ac6e126adf4b44d202f344aeb4930b4f7d283dac Mon Sep 17 00:00:00 2001 From: Arun Kumar Khandavalli Date: Sun, 10 Mar 2019 16:32:21 +0530 Subject: [PATCH] qcacmn: Add support to improve coex logging Add support to get the various Coex data from the debugfs. This commit adds the support to get the various coex data: * COEX STATE * COEX DPWB STATE * COEX TDM STATE * COEX IDRX STATE * COEX ANTENNA SHARING STATE The specific state information can be read via the debugfs. Example to read the COEX STATE logging: sm6150:/ # echo "1" > /d/wlan/mws_coex_status_info sm6150:/ # cat /d/wlan/mws_coex_status_info Reading for command MWS_COEX_STATE. vdev_id = 0 coex_scheme_bitmap = 0 active_conflict_count = 0 potential_conflict_count = 0 chavd_group0_bitmap = 0 chavd_group1_bitmap = 0 chavd_group2_bitmap = 0 chavd_group3_bitmap = 0 Change-Id: I92272ad7edf44df22730ac0fa992d876840ba632 CRs-Fixed: 2413955 --- wmi/inc/wmi_unified_api.h | 13 ++++ wmi/inc/wmi_unified_param.h | 140 ++++++++++++++++++++++++++++++++++++ wmi/inc/wmi_unified_priv.h | 3 +- wmi/src/wmi_unified_api.c | 12 ++++ wmi/src/wmi_unified_tlv.c | 61 +++++++++++++++- 5 files changed, 227 insertions(+), 2 deletions(-) diff --git a/wmi/inc/wmi_unified_api.h b/wmi/inc/wmi_unified_api.h index 1400f53417..75125b6e47 100644 --- a/wmi/inc/wmi_unified_api.h +++ b/wmi/inc/wmi_unified_api.h @@ -1785,6 +1785,19 @@ enum cdp_sec_type wlan_crypto_cipher_to_cdp_sec_type( #endif +/** + * wmi_unified_send_mws_coex_req_cmd() - WMI function to send coex req cmd + * @wmi_hdl: wmi handle + * @vdev_id: Vdev Id + * @cmd_id: Coex cmd for which info is required + * + * Send wmi coex command to fw. + * + * Return: QDF_STATUS + */ +QDF_STATUS wmi_unified_send_mws_coex_req_cmd(struct wmi_unified *wmi_handle, + uint32_t vdev_id, uint32_t cmd_id); + #ifdef WLAN_CFR_ENABLE /** * wmi_unified_send_peer_cfr_capture_cmd() - WMI function to start CFR capture diff --git a/wmi/inc/wmi_unified_param.h b/wmi/inc/wmi_unified_param.h index 48d0a5c35b..48ddd1787c 100644 --- a/wmi/inc/wmi_unified_param.h +++ b/wmi/inc/wmi_unified_param.h @@ -4806,6 +4806,11 @@ typedef enum { wmi_wlm_stats_event_id, wmi_peer_cfr_capture_event_id, wmi_pdev_cold_boot_cal_event_id, + wmi_vdev_get_mws_coex_state_eventid, + wmi_vdev_get_mws_coex_dpwb_state_eventid, + wmi_vdev_get_mws_coex_tdm_state_eventid, + wmi_vdev_get_mws_coex_idrx_state_eventid, + wmi_vdev_get_mws_coex_antenna_sharing_state_eventid, wmi_events_max, } wmi_conv_event_id; @@ -7755,4 +7760,139 @@ typedef struct { uint32_t chain_rssi[WMI_HOST_MAX_CHAINS]; } wmi_cfr_peer_tx_event_param; +/** + * struct mws_coex_state - Modem Wireless Subsystem(MWS) coex info + * @vdev_id : vdev id + * @coex_scheme_bitmap: LTE-WLAN coexistence scheme bitmap + * Indicates the final schemes applied for the currrent Coex scenario. + * Bit 0 - TDM policy + * Bit 1 - Forced TDM policy + * Bit 2 - Dynamic Power Back-off policy + * Bit 3 - Channel Avoidance policy + * Bit 4 - Static Power Back-off policy. + * @active_conflict_count : active conflict count + * @potential_conflict_count: Potential conflict count + * @chavd_group0_bitmap : Indicates the WLAN channels to be avoided in + * b/w WLAN CH-1 and WLAN CH-14 + * @chavd_group1_bitmap : Indicates the WLAN channels to be avoided in + * WLAN CH-36 and WLAN CH-64 + * @chavd_group2_bitmap : Indicates the WLAN channels to be avoided in + * b/w WLAN CH-100 and WLAN CH-140 + * @chavd_group2_bitmap : Indicates the WLAN channels to be avoided in + * b/w WLAN CH-149 and WLAN CH-165 + */ +struct mws_coex_state { + uint32_t vdev_id; + uint32_t coex_scheme_bitmap; + uint32_t active_conflict_count; + uint32_t potential_conflict_count; + uint32_t chavd_group0_bitmap; + uint32_t chavd_group1_bitmap; + uint32_t chavd_group2_bitmap; + uint32_t chavd_group3_bitmap; +}; + +/** + * struct hdd_mws_coex_dpwb_state - Modem Wireless Subsystem(MWS) coex DPWB info + * @vdev_id : vdev id + * @current_dpwb_state: Current state of the Dynamic Power Back-off SM + * @pnp1_value: Tx power to be applied in next Dynamic Power Back-off cycle + * @lte_dutycycle: Indicates the duty cycle of current LTE frame + * @sinr_wlan_on: LTE SINR value in dB, when WLAN is ON + * @sinr_wlan_off: LTE SINR value in dB, when WLAN is OFF + * @bler_count: LTE blocks with error for the current block err report. + * @block_count: Number of LTE blocks considered for bler count report. + * @wlan_rssi_level: WLAN RSSI level + * @wlan_rssi: WLAN RSSI value in dBm considered in DP backoff algo + * @is_tdm_running: Indicates whether any TDM policy triggered + */ +struct mws_coex_dpwb_state { + uint32_t vdev_id; + int32_t current_dpwb_state; + int32_t pnp1_value; + uint32_t lte_dutycycle; + int32_t sinr_wlan_on; + int32_t sinr_wlan_off; + uint32_t bler_count; + uint32_t block_count; + uint32_t wlan_rssi_level; + int32_t wlan_rssi; + uint32_t is_tdm_running; +}; + +/** + * struct mws_coex_tdm_state - Modem Wireless Subsystem(MWS) coex TDM state info + * @vdev_id: vdev id + * @tdm_policy_bitmap: Time Division Multiplexing (TDM) LTE-Coex Policy type. + * @tdm_sf_bitmap: TDM LTE/WLAN sub-frame bitmap. + */ +struct mws_coex_tdm_state { + uint32_t vdev_id; + uint32_t tdm_policy_bitmap; + uint32_t tdm_sf_bitmap; +}; + +/** + * struct mws_coex_idrx_state - Modem Wireless Subsystem(MWS) coex IDRX state + * @vdev_id: vdev id + * @sub0_techid: SUB0 LTE-coex tech. + * @sub0_policy: SUB0 mitigation policy. + * @sub0_is_link_critical: Set if SUB0 is in link critical state. + * @sub0_static_power: LTE SUB0 imposed static power applied + * to WLAN due to LTE-WLAN coex. + * @sub0_rssi: LTE SUB0 RSSI value in dBm. + * @sub1_techid: SUB1 LTE-coex tech. + * @sub1_policy: SUB1 mitigation policy. + * @sub1_is_link_critical: Set if SUB1 is in link critical state. + * @sub1_static_power: LTE SUB1 imposed static power applied + * to WLAN due to LTE-WLAN coex. + * @sub1_rssi: LTE SUB1 RSSI value in dBm. + */ +struct mws_coex_idrx_state { + uint32_t vdev_id; + uint32_t sub0_techid; + uint32_t sub0_policy; + uint32_t sub0_is_link_critical; + int32_t sub0_static_power; + int32_t sub0_rssi; + uint32_t sub1_techid; + uint32_t sub1_policy; + uint32_t sub1_is_link_critical; + int32_t sub1_static_power; + int32_t sub1_rssi; +}; + +/** + * struct mws_antenna_sharing_info - MWS Antenna sharing Info + * @vdev_id: vdev id + * @coex_flags: BDF values of Coex flags + * @coex_config: BDF values of Coex Antenna sharing config + * @tx_chain_mask: Tx Chain mask value + * @rx_chain_mask: Rx Chain mask value + * @rx_nss: Currently active Rx Spatial streams + * @force_mrc: Forced MRC policy type + * @rssi_type: RSSI value considered for MRC + * @chain0_rssi: RSSI value measured at Chain-0 in dBm + * @chain1_rssi: RSSI value measured at Chain-1 in dBm + * @combined_rssi: RSSI value of two chains combined in dBm + * @imbalance: Absolute imbalance between two Rx chains in dB + * @mrc_threshold: RSSI threshold defined for the above imbalance value in dBm + * @grant_duration: Antenna grant duration to WLAN, in milliseconds + */ +struct mws_antenna_sharing_info { + uint32_t vdev_id; + uint32_t coex_flags; + uint32_t coex_config; + uint32_t tx_chain_mask; + uint32_t rx_chain_mask; + uint32_t rx_nss; + uint32_t force_mrc; + uint32_t rssi_type; + int32_t chain0_rssi; + int32_t chain1_rssi; + int32_t combined_rssi; + uint32_t imbalance; + int32_t mrc_threshold; + uint32_t grant_duration; +}; #endif /* _WMI_UNIFIED_PARAM_H_ */ diff --git a/wmi/inc/wmi_unified_priv.h b/wmi/inc/wmi_unified_priv.h index 4d673130e1..fac3760438 100644 --- a/wmi/inc/wmi_unified_priv.h +++ b/wmi/inc/wmi_unified_priv.h @@ -1925,10 +1925,11 @@ QDF_STATUS (*send_peer_cfr_capture_cmd)(wmi_unified_t wmi_handle, #ifdef WMI_AP_SUPPORT QDF_STATUS (*send_vdev_pcp_tid_map_cmd)(wmi_unified_t wmi_handle, struct vap_pcp_tid_map_params *param); - QDF_STATUS (*send_vdev_tidmap_prec_cmd)(wmi_unified_t wmi_handle, struct vap_tidmap_prec_params *param); #endif +QDF_STATUS (*send_mws_coex_status_req_cmd)(wmi_unified_t wmi_handle, + uint32_t vdev_id, uint32_t cmd_id); }; /* Forward declartion for psoc*/ diff --git a/wmi/src/wmi_unified_api.c b/wmi/src/wmi_unified_api.c index d0e338d403..70f8a6abd5 100644 --- a/wmi/src/wmi_unified_api.c +++ b/wmi/src/wmi_unified_api.c @@ -4671,3 +4671,15 @@ wmi_extract_cfr_peer_tx_event_param(void *wmi_hdl, void *evt_buf, 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) +{ + + if (wmi_handle->ops->send_mws_coex_status_req_cmd) + return wmi_handle->ops->send_mws_coex_status_req_cmd(wmi_handle, + vdev_id, cmd_id); + + return QDF_STATUS_E_FAILURE; +} diff --git a/wmi/src/wmi_unified_tlv.c b/wmi/src/wmi_unified_tlv.c index 703edee10e..57446807e0 100644 --- a/wmi/src/wmi_unified_tlv.c +++ b/wmi/src/wmi_unified_tlv.c @@ -11172,6 +11172,51 @@ extract_cfr_peer_tx_event_param_tlv(wmi_unified_t *wmi_handle, void *evt_buf, } #endif /* WLAN_CFR_ENABLE */ +#ifdef WLAN_MWS_INFO_DEBUGFS +/** + * send_mws_coex_status_req_cmd_tlv() - send coex cmd to fw + * + * @wmi_handle: wmi handle + * @vdev_id: vdev id + * @cmd_id: Coex command id + * + * Send WMI_VDEV_GET_MWS_COEX_INFO_CMDID to fw. + * + * Return: QDF_STATUS + */ +static QDF_STATUS send_mws_coex_status_req_cmd_tlv(wmi_unified_t wmi_handle, + uint32_t vdev_id, + uint32_t cmd_id) +{ + wmi_buf_t buf; + wmi_vdev_get_mws_coex_info_cmd_fixed_param *cmd; + uint16_t len = sizeof(*cmd); + int ret; + + buf = wmi_buf_alloc(wmi_handle, len); + if (!buf) { + WMI_LOGE("%s: Failed to allocate wmi buffer", __func__); + return QDF_STATUS_E_NOMEM; + } + + cmd = (wmi_vdev_get_mws_coex_info_cmd_fixed_param *)wmi_buf_data(buf); + WMITLV_SET_HDR(&cmd->tlv_header, + WMITLV_TAG_STRUC_wmi_vdev_get_mws_coex_info_cmd_fixed_param, + WMITLV_GET_STRUCT_TLVLEN + (wmi_vdev_get_mws_coex_info_cmd_fixed_param)); + cmd->vdev_id = vdev_id; + cmd->cmd_id = cmd_id; + wmi_mtrace(WMI_VDEV_GET_MWS_COEX_INFO_CMDID, vdev_id, 0); + ret = wmi_unified_cmd_send(wmi_handle, buf, len, + WMI_VDEV_GET_MWS_COEX_INFO_CMDID); + if (QDF_IS_STATUS_ERROR(ret)) { + WMI_LOGE("Failed to send set param command ret = %d", ret); + wmi_buf_free(buf); + } + return ret; +} +#endif + struct wmi_ops tlv_ops = { .send_vdev_create_cmd = send_vdev_create_cmd_tlv, .send_vdev_delete_cmd = send_vdev_delete_cmd_tlv, @@ -11435,7 +11480,9 @@ struct wmi_ops tlv_ops = { send_peer_cfr_capture_cmd_tlv, .extract_cfr_peer_tx_event_param = extract_cfr_peer_tx_event_param_tlv, #endif /* WLAN_CFR_ENABLE */ - +#ifdef WLAN_MWS_INFO_DEBUGFS + .send_mws_coex_status_req_cmd = send_mws_coex_status_req_cmd_tlv, +#endif }; /** @@ -11749,6 +11796,18 @@ static void populate_tlv_events_id(uint32_t *event_ids) event_ids[wmi_peer_cfr_capture_event_id] = WMI_PEER_CFR_CAPTURE_EVENTID; event_ids[wmi_pdev_cold_boot_cal_event_id] = WMI_PDEV_COLD_BOOT_CAL_DATA_EVENTID; +#ifdef WLAN_MWS_INFO_DEBUGFS + event_ids[wmi_vdev_get_mws_coex_state_eventid] = + WMI_VDEV_GET_MWS_COEX_STATE_EVENTID; + event_ids[wmi_vdev_get_mws_coex_dpwb_state_eventid] = + WMI_VDEV_GET_MWS_COEX_DPWB_STATE_EVENTID; + event_ids[wmi_vdev_get_mws_coex_tdm_state_eventid] = + WMI_VDEV_GET_MWS_COEX_TDM_STATE_EVENTID; + event_ids[wmi_vdev_get_mws_coex_idrx_state_eventid] = + WMI_VDEV_GET_MWS_COEX_IDRX_STATE_EVENTID; + event_ids[wmi_vdev_get_mws_coex_antenna_sharing_state_eventid] = + WMI_VDEV_GET_MWS_COEX_ANTENNA_SHARING_STATE_EVENTID; +#endif } /**