diff --git a/components/mlme/dispatcher/inc/wlan_mlme_public_struct.h b/components/mlme/dispatcher/inc/wlan_mlme_public_struct.h index c7ec17b323..cdb2acf75d 100644 --- a/components/mlme/dispatcher/inc/wlan_mlme_public_struct.h +++ b/components/mlme/dispatcher/inc/wlan_mlme_public_struct.h @@ -2487,6 +2487,7 @@ struct wlan_mlme_sae_single_pmk { * @data_11kv: Neighbor report/BTM parameters. * @btm_rsp: BTM response information * @roam_init_info: Roam initial info + * @roam_msg_info: roam related message information */ struct mlme_roam_debug_info { struct wmi_roam_trigger_info trigger; @@ -2495,6 +2496,7 @@ struct mlme_roam_debug_info { struct wmi_neighbor_report_data data_11kv; struct roam_btm_response_data btm_rsp; struct roam_initial_data roam_init_info; + struct roam_msg_info roam_msg_info; }; /** diff --git a/components/umac/mlme/connection_mgr/dispatcher/inc/wlan_cm_roam_api.h b/components/umac/mlme/connection_mgr/dispatcher/inc/wlan_cm_roam_api.h index 68ff1c276f..02c885048d 100644 --- a/components/umac/mlme/connection_mgr/dispatcher/inc/wlan_cm_roam_api.h +++ b/components/umac/mlme/connection_mgr/dispatcher/inc/wlan_cm_roam_api.h @@ -406,6 +406,19 @@ wlan_cm_roam_extract_roam_initial_info(wmi_unified_t wmi, void *evt_buf, struct roam_initial_data *dst, uint8_t idx); +/** + * wlan_cm_roam_extract_roam_msg_info() - Extract Roam msg stats + * @wmi: wmi handle + * @evt_buf: Pointer to the event buffer + * @dst: Pointer to destination structure to fill data + * @idx: TLV id + * + * Return: QDF_STATUS + */ +QDF_STATUS +wlan_cm_roam_extract_roam_msg_info(wmi_unified_t wmi, void *evt_buf, + struct roam_msg_info *dst, uint8_t idx); + /** * wlan_cm_roam_activate_pcl_per_vdev() - Set the PCL command to be sent per * vdev instead of pdev. @@ -559,7 +572,7 @@ wlan_cm_roam_extract_btm_response(wmi_unified_t wmi, void *evt_buf, struct roam_btm_response_data *dst, uint8_t idx) { - return true; + return QDF_STATUS_E_NOSUPPORT; } static inline QDF_STATUS @@ -567,7 +580,14 @@ wlan_cm_roam_extract_roam_initial_info(wmi_unified_t wmi, void *evt_buf, struct roam_initial_data *dst, uint8_t idx) { - return true; + return QDF_STATUS_E_NOSUPPORT; +} + +static inline QDF_STATUS +wlan_cm_roam_extract_roam_msg_info(wmi_unified_t wmi, void *evt_buf, + struct roam_msg_info *dst, uint8_t idx) +{ + return QDF_STATUS_E_NOSUPPORT; } static inline void diff --git a/components/umac/mlme/connection_mgr/dispatcher/inc/wlan_cm_roam_public_struct.h b/components/umac/mlme/connection_mgr/dispatcher/inc/wlan_cm_roam_public_struct.h index d539fb5e89..8651d85ad2 100644 --- a/components/umac/mlme/connection_mgr/dispatcher/inc/wlan_cm_roam_public_struct.h +++ b/components/umac/mlme/connection_mgr/dispatcher/inc/wlan_cm_roam_public_struct.h @@ -1218,6 +1218,25 @@ struct roam_initial_data { uint32_t fw_cancel_timer_bitmap; }; +/** + * struct roam_msg_info - Roam message related information + * @present: Flag to check if the roam msg info tlv is present + * @timestamp: Timestamp is the absolute time w.r.t host timer which is + * synchronized between the host and target + * @msg_id: Message ID from WMI_ROAM_MSG_ID + * @msg_param1: msg_param1, values is based on the host & FW + * understanding and depend on the msg ID + * @msg_param2: msg_param2 value is based on the host & FW understanding + * and depend on the msg ID + */ +struct roam_msg_info { + bool present; + uint32_t timestamp; + uint32_t msg_id; + uint32_t msg_param1; + uint32_t msg_param2; +}; + /** * enum wlan_cm_rso_control_requestor - Driver disabled roaming requestor that * will request the roam module to disable roaming based on the mlme operation diff --git a/components/umac/mlme/connection_mgr/dispatcher/src/wlan_cm_roam_api.c b/components/umac/mlme/connection_mgr/dispatcher/src/wlan_cm_roam_api.c index ec7b9bccf2..3abbbe7dd8 100644 --- a/components/umac/mlme/connection_mgr/dispatcher/src/wlan_cm_roam_api.c +++ b/components/umac/mlme/connection_mgr/dispatcher/src/wlan_cm_roam_api.c @@ -254,6 +254,16 @@ wlan_cm_roam_extract_roam_initial_info(wmi_unified_t wmi, void *evt_buf, return QDF_STATUS_E_FAILURE; } +QDF_STATUS +wlan_cm_roam_extract_roam_msg_info(wmi_unified_t wmi, void *evt_buf, + struct roam_msg_info *dst, uint8_t idx) +{ + if (wmi->ops->extract_roam_msg_info) + return wmi->ops->extract_roam_msg_info(wmi, evt_buf, dst, idx); + + return QDF_STATUS_E_FAILURE; +} + void wlan_cm_roam_activate_pcl_per_vdev(struct wlan_objmgr_psoc *psoc, uint8_t vdev_id, bool pcl_per_vdev) { diff --git a/components/wmi/src/wmi_unified_roam_tlv.c b/components/wmi/src/wmi_unified_roam_tlv.c index 103e8475b7..095d3ae19e 100644 --- a/components/wmi/src/wmi_unified_roam_tlv.c +++ b/components/wmi/src/wmi_unified_roam_tlv.c @@ -1452,6 +1452,41 @@ extract_roam_initial_info_tlv(wmi_unified_t wmi_handle, void *evt_buf, return QDF_STATUS_SUCCESS; } +/** + * extract_roam_msg_info_tlv() - Extract the roam message info + * from the WMI_ROAM_STATS_EVENTID + * @wmi_handle: wmi handle + * @evt_buf: Pointer to the event buffer + * @dst: Pointer to destination structure to fill data + * @idx: TLV id + */ +static QDF_STATUS +extract_roam_msg_info_tlv(wmi_unified_t wmi_handle, void *evt_buf, + struct roam_msg_info *dst, uint8_t idx) +{ + WMI_ROAM_STATS_EVENTID_param_tlvs *param_buf; + wmi_roam_msg_info *src_data = NULL; + + param_buf = (WMI_ROAM_STATS_EVENTID_param_tlvs *)evt_buf; + + if (!param_buf || !param_buf->roam_msg_info || + !param_buf->num_roam_msg_info || + idx >= param_buf->num_roam_msg_info) { + wmi_debug("Empty roam_msg_info param buf"); + return QDF_STATUS_SUCCESS; + } + + src_data = ¶m_buf->roam_msg_info[idx]; + + dst->present = true; + dst->timestamp = src_data->timestamp; + dst->msg_id = src_data->msg_id; + dst->msg_param1 = src_data->msg_param1; + dst->msg_param2 = src_data->msg_param2; + + return QDF_STATUS_SUCCESS; +} + void wmi_roam_offload_attach_tlv(wmi_unified_t wmi_handle) { struct wmi_ops *ops = wmi_handle->ops; @@ -1459,6 +1494,7 @@ void wmi_roam_offload_attach_tlv(wmi_unified_t wmi_handle) ops->extract_roam_btm_response_stats = extract_roam_btm_response_stats_tlv; ops->extract_roam_initial_info = extract_roam_initial_info_tlv; + ops->extract_roam_msg_info = extract_roam_msg_info_tlv; ops->send_set_ric_req_cmd = send_set_ric_req_cmd_tlv; ops->send_process_roam_synch_complete_cmd = @@ -1483,6 +1519,12 @@ extract_roam_initial_info_tlv(wmi_unified_t wmi_handle, void *evt_buf, return QDF_STATUS_E_NOSUPPORT; } +static inline QDF_STATUS +extract_roam_msg_info_tlv(wmi_unified_t wmi_handle, void *evt_buf, + struct roam_msg_info *dst, uint8_t idx) +{ + return QDF_STATUS_E_NOSUPPORT; +} #endif /* WLAN_FEATURE_ROAM_OFFLOAD */ #define ROAM_OFFLOAD_PMK_EXT_BYTES 16 diff --git a/core/wma/src/wma_scan_roam.c b/core/wma/src/wma_scan_roam.c index ceeb2ccd5f..19a6d0fa2a 100644 --- a/core/wma/src/wma_scan_roam.c +++ b/core/wma/src/wma_scan_roam.c @@ -1913,6 +1913,29 @@ wma_rso_print_roam_initial_info(struct roam_initial_data *data, data->cu_th, data->fw_cancel_timer_bitmap); } +/** + * wma_rso_print_roam_msg_info - Roaming related message details + * @data: Pointer to the btm rsp data + * @vdev_id: vdev id + * + * Prints the vdev, msg_id, msg_param1, msg_param2 and timer + * + * Return: None + */ +static void wma_rso_print_roam_msg_info(struct roam_msg_info *data, + uint8_t vdev_id) +{ + char time[TIME_STRING_LEN]; + static const char msg_id1_str[] = "Roam RSSI TH Reset"; + + if (data->msg_id == WMI_ROAM_MSG_RSSI_RECOVERED) { + mlme_get_converted_timestamp(data->timestamp, time); + wma_info("%s [ROAM MSG INFO]: VDEV[%d] %s, Current rssi: %d dbm, next_rssi_threshold: %d dbm", + time, vdev_id, msg_id1_str, data->msg_param1, + data->msg_param2); + } +} + /** * wma_log_roam_scan_candidates - Print roam scan candidate AP info * @ap: Pointer to the candidate AP list @@ -2122,7 +2145,7 @@ int wma_roam_stats_event_handler(WMA_HANDLE handle, uint8_t *event, wmi_roam_stats_event_fixed_param *fixed_param; struct mlme_roam_debug_info *roam_info = NULL; uint8_t vdev_id, i; - uint8_t num_tlv = 0, num_chan = 0, num_ap = 0, num_rpt = 0; + uint8_t num_tlv = 0, num_chan = 0, num_ap = 0, num_rpt = 0, rem_tlv = 0; uint32_t rem_len; QDF_STATUS status; @@ -2216,26 +2239,12 @@ int wma_roam_stats_event_handler(WMA_HANDLE handle, uint8_t *event, goto err; } - if (!num_tlv) { - roam_info = qdf_mem_malloc(sizeof(*roam_info)); - if (!roam_info) - return -ENOMEM; - - status = wmi_unified_extract_roam_11kv_stats( - wma->wmi_handle, event, - &roam_info->data_11kv, 0, 0); - if (QDF_IS_STATUS_ERROR(status)) { - wma_debug_rl("Roam 11kv stats extract failed vdev %d", - vdev_id); - qdf_mem_free(roam_info); - goto err; - } - - if (roam_info->data_11kv.present) - wma_rso_print_11kv_info(&roam_info->data_11kv, vdev_id); - - qdf_mem_free(roam_info); - return 0; + rem_len -= param_buf->num_roam_initial_info * + sizeof(wmi_roam_initial_info); + if (rem_len < param_buf->num_roam_msg_info * + sizeof(wmi_roam_msg_info)) { + wma_err_rl("Invalid roam msg info"); + goto err; } for (i = 0; i < num_tlv; i++) { @@ -2305,6 +2314,17 @@ int wma_roam_stats_event_handler(WMA_HANDLE handle, uint8_t *event, return -EINVAL; } + /* Roam message info */ + status = wlan_cm_roam_extract_roam_msg_info( + wma->wmi_handle, event, + &roam_info->roam_msg_info, i); + if (QDF_IS_STATUS_ERROR(status)) { + wma_err("roam msg stats extract fail vdev %d", + vdev_id); + qdf_mem_free(roam_info); + return -EINVAL; + } + /* BTM req/resp or Neighbor report/response info */ status = wmi_unified_extract_roam_11kv_stats( wma->wmi_handle, event, @@ -2341,9 +2361,60 @@ int wma_roam_stats_event_handler(WMA_HANDLE handle, uint8_t *event, wma_rso_print_roam_initial_info( &roam_info->roam_init_info, vdev_id); + if (roam_info->roam_msg_info.present) { + rem_tlv++; + wma_rso_print_roam_msg_info( + &roam_info->roam_msg_info, vdev_id); + } + qdf_mem_free(roam_info); } + if (!num_tlv) { + roam_info = qdf_mem_malloc(sizeof(*roam_info)); + if (!roam_info) + return -ENOMEM; + + status = wmi_unified_extract_roam_11kv_stats( + wma->wmi_handle, event, + &roam_info->data_11kv, 0, 0); + if (QDF_IS_STATUS_ERROR(status)) { + wma_err("Roam 11kv stats extract failed vdev %d", + vdev_id); + qdf_mem_free(roam_info); + return -EINVAL; + } + + if (roam_info->data_11kv.present) + wma_rso_print_11kv_info(&roam_info->data_11kv, vdev_id); + + qdf_mem_free(roam_info); + } + + if (param_buf->roam_msg_info && param_buf->num_roam_msg_info && + param_buf->num_roam_msg_info - rem_tlv) { + for (i = 0; i < (param_buf->num_roam_msg_info - rem_tlv); i++) { + roam_info = qdf_mem_malloc(sizeof(*roam_info)); + if (!roam_info) + return -ENOMEM; + status = wlan_cm_roam_extract_roam_msg_info( + wma->wmi_handle, event, + &roam_info->roam_msg_info, rem_tlv + i); + if (QDF_IS_STATUS_ERROR(status)) { + wma_err("roam msg stats extract fail vdev %d", + vdev_id); + qdf_mem_free(roam_info); + return -EINVAL; + } + + if (roam_info->roam_msg_info.present) + wma_rso_print_roam_msg_info( + &roam_info->roam_msg_info, + vdev_id); + qdf_mem_free(roam_info); + } + } + return 0; err: