diff --git a/components/target_if/connection_mgr/inc/target_if_cm_roam_event.h b/components/target_if/connection_mgr/inc/target_if_cm_roam_event.h index 54aad13d6f..8fdcfc261a 100644 --- a/components/target_if/connection_mgr/inc/target_if_cm_roam_event.h +++ b/components/target_if/connection_mgr/inc/target_if_cm_roam_event.h @@ -77,6 +77,18 @@ int target_if_cm_roam_event(ol_scn_t scn, uint8_t *event, uint32_t len); int target_if_cm_roam_stats_event(ol_scn_t scn, uint8_t *event, uint32_t len); +/** + * target_if_cm_roam_auth_offload_event - auth roam offload event handler + * @scn: target handle + * @event: event buffer + * @len: event buffer length + * + * Return: int for success or error code + */ +int +target_if_cm_roam_auth_offload_event(ol_scn_t scn, uint8_t *event, + uint32_t len); + /** * target_if_roam_offload_register_events() - register roam events * @psoc: pointer to psoc object diff --git a/components/target_if/connection_mgr/src/target_if_cm_roam_event.c b/components/target_if/connection_mgr/src/target_if_cm_roam_event.c index a7adfd8bce..27db191fb8 100644 --- a/components/target_if/connection_mgr/src/target_if_cm_roam_event.c +++ b/components/target_if/connection_mgr/src/target_if_cm_roam_event.c @@ -61,6 +61,7 @@ target_if_cm_roam_register_rx_ops(struct wlan_cm_roam_rx_ops *rx_ops) rx_ops->vdev_disconnect_event = cm_vdev_disconnect_event_handler; rx_ops->roam_scan_chan_list_event = cm_roam_scan_ch_list_event_handler; rx_ops->roam_stats_event_rx = cm_roam_stats_event_handler; + rx_ops->roam_auth_offload_event = cm_roam_auth_offload_event_handler; #endif } @@ -396,6 +397,47 @@ err: return status; } +int +target_if_cm_roam_auth_offload_event(ol_scn_t scn, uint8_t *event, uint32_t len) +{ + QDF_STATUS qdf_status; + int status = 0; + struct wmi_unified *wmi_handle; + struct wlan_objmgr_psoc *psoc; + struct wlan_cm_roam_rx_ops *roam_rx_ops; + struct auth_offload_event auth_event = {0}; + + psoc = target_if_get_psoc_from_scn_hdl(scn); + if (!psoc) { + target_if_err("psoc is null"); + return -EINVAL; + } + + wmi_handle = get_wmi_unified_hdl_from_psoc(psoc); + if (!wmi_handle) { + target_if_err("wmi_handle is null"); + return -EINVAL; + } + + qdf_status = wmi_extract_auth_offload_event(wmi_handle, event, len, + &auth_event); + if (QDF_IS_STATUS_ERROR(qdf_status)) { + target_if_err("parsing of event failed, %d", qdf_status); + return -EINVAL; + } + + roam_rx_ops = target_if_cm_get_roam_rx_ops(psoc); + if (!roam_rx_ops || !roam_rx_ops->roam_auth_offload_event) { + target_if_err("No valid roam rx ops"); + return -EINVAL; + } + qdf_status = roam_rx_ops->roam_auth_offload_event(&auth_event); + if (QDF_IS_STATUS_ERROR(status)) + status = -EINVAL; + + return status; +} + QDF_STATUS target_if_roam_offload_register_events(struct wlan_objmgr_psoc *psoc) { @@ -473,6 +515,16 @@ target_if_roam_offload_register_events(struct wlan_objmgr_psoc *psoc) return QDF_STATUS_E_FAILURE; } + ret = wmi_unified_register_event_handler(handle, + wmi_roam_auth_offload_event_id, + target_if_cm_roam_auth_offload_event, + WMI_RX_SERIALIZER_CTX); + if (QDF_IS_STATUS_ERROR(ret)) { + target_if_err("wmi event(%u) registration failed, ret: %d", + wmi_roam_auth_offload_event_id, ret); + return QDF_STATUS_E_FAILURE; + } + return QDF_STATUS_SUCCESS; } 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 f92e100180..422c535150 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 @@ -1320,6 +1320,24 @@ QDF_STATUS cm_roam_stats_event_handler(struct wlan_objmgr_psoc *psoc, struct roam_stats_event *stats_info); +/** + * cm_handle_auth_offload() - auth offload evt wrapper for wma + * @auth_event: auth offload event data + * + * Return: QDF_STATUS + */ +QDF_STATUS +cm_handle_auth_offload(struct auth_offload_event *auth_event); + +/** + * cm_roam_auth_offload_event_handler() - Handler for auth offload event + * @auth_event: Authentication event + * + * Return: QDF_STATUS + */ +QDF_STATUS +cm_roam_auth_offload_event_handler(struct auth_offload_event *auth_event); + /** * cm_roam_update_vdev() - Update the STA and BSS * @sync_ind: Information needed for roam sync propagation 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 dea95f7d26..d3654100ac 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 @@ -1908,6 +1908,16 @@ struct roam_stats_event { struct roam_msg_info *roam_msg_info; }; +/* + * struct auth_offload_event - offload data carried by roam event + * @vdev_id: vdev id + * @ap_bssid: SAE authentication offload MAC Addess + */ +struct auth_offload_event { + uint8_t vdev_id; + struct qdf_mac_addr ap_bssid; +}; + /** * wlan_cm_roam_tx_ops - structure of tx function pointers for * roaming related commands @@ -2139,6 +2149,7 @@ struct roam_offload_synch_ind { * @vdev_disconnect_event: Rx ops function pointer for vdev disconnect event * @roam_scan_chan_list_event: Rx ops function pointer for roam scan ch event * @roam_stats_event_rx: Rx ops function pointer for roam stats event + * @roam_auth_offload_event: Rx ops function pointer for auth offload event */ struct wlan_cm_roam_rx_ops { QDF_STATUS (*roam_sync_event)(struct wlan_objmgr_psoc *psoc, @@ -2158,6 +2169,8 @@ struct wlan_cm_roam_rx_ops { QDF_STATUS (*roam_stats_event_rx)(struct wlan_objmgr_psoc *psoc, struct roam_stats_event *stats_info); + QDF_STATUS + (*roam_auth_offload_event)(struct auth_offload_event *auth_event); #endif }; #endif 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 dc6e49fcaa..d20c000020 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 @@ -2165,6 +2165,12 @@ cm_vdev_disconnect_event_handler(struct vdev_disconnect_event_data *data) { return cm_handle_disconnect_reason(data); } + +QDF_STATUS +cm_roam_auth_offload_event_handler(struct auth_offload_event *auth_event) +{ + return cm_handle_auth_offload(auth_event); +} #else static void cm_handle_roam_offload_events(struct roam_offload_roam_event roam_event) diff --git a/components/wmi/inc/wmi_unified_roam_api.h b/components/wmi/inc/wmi_unified_roam_api.h index 3b1ead4b5b..3dbafeb82d 100644 --- a/components/wmi/inc/wmi_unified_roam_api.h +++ b/components/wmi/inc/wmi_unified_roam_api.h @@ -381,6 +381,20 @@ QDF_STATUS wmi_extract_roam_stats_event(wmi_unified_t wmi_handle, uint8_t *event, uint32_t data_len, struct roam_stats_event **stats_info); + +/** + * wmi_extract_auth_offload_event - Extract auth offload event + * @wmi_handle: WMI handle + * @event: Event data received from firmware + * @data_len: Event data length received from firmware + * @roam_event: Extract the event and fill in auth_event + * + * Return: QDF_STATUS + */ +QDF_STATUS +wmi_extract_auth_offload_event(wmi_unified_t wmi_handle, + uint8_t *event, uint32_t data_len, + struct auth_offload_event *auth_event); #endif /* ROAM_TARGET_IF_CONVERGENCE */ #endif /* WLAN_FEATURE_ROAM_OFFLOAD */ diff --git a/components/wmi/src/wmi_unified_roam_api.c b/components/wmi/src/wmi_unified_roam_api.c index 257fb2418d..9f1d051ab5 100644 --- a/components/wmi/src/wmi_unified_roam_api.c +++ b/components/wmi/src/wmi_unified_roam_api.c @@ -461,5 +461,18 @@ wmi_extract_roam_stats_event(wmi_unified_t wmi_handle, return QDF_STATUS_E_FAILURE; } + +QDF_STATUS +wmi_extract_auth_offload_event(wmi_unified_t wmi_handle, + uint8_t *event, uint32_t data_len, + struct auth_offload_event *auth_event) +{ + if (wmi_handle->ops->extract_auth_offload_event) + return wmi_handle->ops->extract_auth_offload_event(wmi_handle, + event, + data_len, + auth_event); + return QDF_STATUS_E_FAILURE; +} #endif /* ROAM_TARGET_IF_CONVERGENCE */ #endif diff --git a/components/wmi/src/wmi_unified_roam_tlv.c b/components/wmi/src/wmi_unified_roam_tlv.c index 5802042881..4afe0523cf 100644 --- a/components/wmi/src/wmi_unified_roam_tlv.c +++ b/components/wmi/src/wmi_unified_roam_tlv.c @@ -2991,6 +2991,44 @@ err: } return status; } +static QDF_STATUS +extract_auth_offload_event_tlv(wmi_unified_t wmi_handle, + uint8_t *event, uint32_t len, + struct auth_offload_event *auth_event) +{ + wmi_roam_preauth_start_event_fixed_param *rso_auth_start_ev; + WMI_ROAM_PREAUTH_START_EVENTID_param_tlvs *param_buf; + + param_buf = (WMI_ROAM_PREAUTH_START_EVENTID_param_tlvs *) event; + + rso_auth_start_ev = param_buf->fixed_param; + if (!rso_auth_start_ev) { + wmi_debug("received null event data from target"); + return QDF_STATUS_E_INVAL; + } + + if (rso_auth_start_ev->vdev_id > WLAN_MAX_VDEVS) { + wmi_debug("received invalid vdev_id %d", + rso_auth_start_ev->vdev_id); + return QDF_STATUS_E_INVAL; + } + + auth_event->vdev_id = rso_auth_start_ev->vdev_id; + + WMI_MAC_ADDR_TO_CHAR_ARRAY(&rso_auth_start_ev->candidate_ap_bssid, + auth_event->ap_bssid.bytes); + if (qdf_is_macaddr_zero(&auth_event->ap_bssid) || + qdf_is_macaddr_broadcast(&auth_event->ap_bssid) || + qdf_is_macaddr_group(&auth_event->ap_bssid)) { + wmi_debug("Invalid bssid"); + return -EINVAL; + } + + wmi_debug("Received Roam auth offload event for bss:"QDF_MAC_ADDR_FMT" vdev_id:%d", + QDF_MAC_ADDR_REF(auth_event->ap_bssid.bytes), auth_event->vdev_id); + + return QDF_STATUS_SUCCESS; +} #endif void wmi_roam_offload_attach_tlv(wmi_unified_t wmi_handle) @@ -3009,6 +3047,7 @@ void wmi_roam_offload_attach_tlv(wmi_unified_t wmi_handle) ops->extract_vdev_disconnect_event = extract_vdev_disconnect_event_tlv; ops->extract_roam_scan_chan_list = extract_roam_scan_chan_list_tlv; ops->extract_roam_stats_event = extract_roam_stats_event_tlv; + ops->extract_auth_offload_event = extract_auth_offload_event_tlv; #endif /* ROAM_TARGET_IF_CONVERGENCE */ ops->send_set_ric_req_cmd = send_set_ric_req_cmd_tlv; ops->send_process_roam_synch_complete_cmd = diff --git a/core/wma/src/wma_main.c b/core/wma/src/wma_main.c index edb4158918..966630394d 100644 --- a/core/wma/src/wma_main.c +++ b/core/wma/src/wma_main.c @@ -3370,12 +3370,11 @@ QDF_STATUS wma_open(struct wlan_objmgr_psoc *psoc, wma_roam_stats_event_handler, WMA_RX_SERIALIZER_CTX); -#endif /* ROAM_TARGET_IF_CONVERGENCE */ wmi_unified_register_event_handler(wma_handle->wmi_handle, wmi_roam_auth_offload_event_id, wma_roam_auth_offload_event_handler, WMA_RX_SERIALIZER_CTX); - +#endif /* ROAM_TARGET_IF_CONVERGENCE */ wma_register_pmkid_req_event_handler(wma_handle); #endif /* WLAN_FEATURE_ROAM_OFFLOAD */ diff --git a/core/wma/src/wma_scan_roam.c b/core/wma/src/wma_scan_roam.c index 002833706e..707b4b3401 100644 --- a/core/wma/src/wma_scan_roam.c +++ b/core/wma/src/wma_scan_roam.c @@ -267,6 +267,37 @@ static void wma_handle_disconnect_reason(tp_wma_handle wma_handle, #ifdef WLAN_FEATURE_ROAM_OFFLOAD #ifdef ROAM_TARGET_IF_CONVERGENCE +QDF_STATUS +cm_handle_auth_offload(struct auth_offload_event *auth_event) +{ + QDF_STATUS status; + tp_wma_handle wma = cds_get_context(QDF_MODULE_ID_WMA); + struct mac_context *mac_ctx; + + mac_ctx = cds_get_context(QDF_MODULE_ID_PE); + if (!mac_ctx || !wma) { + QDF_ASSERT(0); + return QDF_STATUS_E_FAILURE; + } + + cds_host_diag_log_work(&wma->roam_preauth_wl, + WMA_ROAM_PREAUTH_WAKE_LOCK_DURATION, + WIFI_POWER_EVENT_WAKELOCK_WOW); + + qdf_wake_lock_timeout_acquire(&wma->roam_ho_wl, + WMA_ROAM_HO_WAKE_LOCK_DURATION); + + lim_sae_auth_cleanup_retry(mac_ctx, auth_event->vdev_id); + + status = wma->csr_roam_auth_event_handle_cb(mac_ctx, auth_event->vdev_id, + auth_event->ap_bssid); + if (QDF_IS_STATUS_ERROR(status)) { + wma_err_rl("Trigger pre-auth failed"); + return QDF_STATUS_E_FAILURE; + } + return QDF_STATUS_SUCCESS; +} + QDF_STATUS cm_handle_disconnect_reason(struct vdev_disconnect_event_data *data) {