diff --git a/core/hdd/src/wlan_hdd_cfg80211.c b/core/hdd/src/wlan_hdd_cfg80211.c index 8d5e0d9fc0..38cb0d9770 100644 --- a/core/hdd/src/wlan_hdd_cfg80211.c +++ b/core/hdd/src/wlan_hdd_cfg80211.c @@ -21287,10 +21287,9 @@ static void hdd_update_chan_info(struct hdd_context *hdd_ctx, #undef CNT_DIFF #undef MAX_COUNT -#if defined(WLAN_FEATURE_FILS_SK) &&\ - defined(CFG80211_FILS_SK_OFFLOAD_SUPPORT) &&\ - (defined(CFG80211_UPDATE_CONNECT_PARAMS) ||\ - (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 10, 0))) +#ifndef UPDATE_ASSOC_IE +#define UPDATE_ASSOC_IE BIT(0) +#endif #ifndef UPDATE_FILS_ERP_INFO #define UPDATE_FILS_ERP_INFO BIT(1) @@ -21300,62 +21299,43 @@ static void hdd_update_chan_info(struct hdd_context *hdd_ctx, #define UPDATE_FILS_AUTH_TYPE BIT(2) #endif +#if defined(WLAN_FEATURE_FILS_SK) &&\ + defined(CFG80211_FILS_SK_OFFLOAD_SUPPORT) &&\ + (defined(CFG80211_UPDATE_CONNECT_PARAMS) ||\ + (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 10, 0))) + /** - * __wlan_hdd_cfg80211_update_connect_params - update connect params - * @wiphy: Handle to struct wiphy to get handle to module context. - * @dev: Pointer to network device + * hdd_update_connect_params_fils_info() - Update fils parameters based on + * the update_connect_params received from userspace + * @adapter: Pointer to hdd_adapter + * @hdd_ctx: Pointer to hdd_context * @req: Pointer to connect params - * @changed: Bitmap used to indicate the changed params + * @changed: bitmap indicating which parameters have changed * - * Update the connect parameters while connected to a BSS. The updated - * parameters can be used by driver/firmware for subsequent BSS selection - * (roaming) decisions and to form the Authentication/(Re)Association - * Request frames. This call does not request an immediate disassociation - * or reassociation with the current BSS, i.e., this impacts only - * subsequent (re)associations. The bits in changed are defined in enum - * cfg80211_connect_params_changed - * - * Return: zero for success, non-zero for failure + * Return 0 on SUCCESS or error code on FAILURE */ static int -__wlan_hdd_cfg80211_update_connect_params(struct wiphy *wiphy, - struct net_device *dev, - struct cfg80211_connect_params *req, - uint32_t changed) +hdd_update_connect_params_fils_info(struct hdd_adapter *adapter, + struct hdd_context *hdd_ctx, + struct cfg80211_connect_params *req, + uint32_t changed) { - struct csr_roam_profile *roam_profile; uint8_t *buf; - int ret; - enum eAniAuthType auth_type; - struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev); - struct hdd_context *hdd_ctx = wiphy_priv(wiphy); QDF_STATUS status; - struct cds_fils_connection_info *fils_info; mac_handle_t mac_handle; - - hdd_enter_dev(dev); - - if (wlan_hdd_validate_vdev_id(adapter->vdev_id)) - return -EINVAL; - - ret = wlan_hdd_validate_context(hdd_ctx); - if (ret) - return -EINVAL; + struct csr_roam_profile *roam_profile; + struct cds_fils_connection_info *fils_info; + enum eAniAuthType auth_type; roam_profile = hdd_roam_profile(adapter); fils_info = roam_profile->fils_con_info; - + mac_handle = hdd_ctx->mac_handle; if (!fils_info) { hdd_err("No valid FILS conn info"); return -EINVAL; } - if (req->ie_len) - wlan_hdd_cfg80211_set_ie(adapter, req->ie, req->ie_len); - - if (changed) - fils_info->is_fils_connection = true; - + fils_info->is_fils_connection = true; if (changed & UPDATE_FILS_ERP_INFO) { if (!wlan_hdd_fils_data_in_limits(req)) return -EINVAL; @@ -21405,18 +21385,113 @@ __wlan_hdd_cfg80211_update_connect_params(struct wiphy *wiphy, hdd_debug("fils conn update: changed %x is_fils %d keyname nai len %d", changed, roam_profile->fils_con_info->is_fils_connection, roam_profile->fils_con_info->key_nai_length); - - if (!hdd_ctx->is_fils_roaming_supported) { - hdd_debug("FILS roaming support %d", - hdd_ctx->is_fils_roaming_supported); - return 0; - } - - mac_handle = hdd_ctx->mac_handle; + /* + * Update the FILS config from adapter->roam_profile to + * csr_session + */ status = sme_update_fils_config(mac_handle, adapter->vdev_id, roam_profile); if (QDF_IS_STATUS_ERROR(status)) - hdd_err("Update FILS connect params to Fw failed %d", status); + hdd_err("Update FILS connect params to csr failed %d", status); + + return 0; +} +#else + +static int +hdd_update_connect_params_fils_info(struct hdd_adapter *adapter, + struct hdd_context *hdd_ctx, + struct cfg80211_connect_params *req, + uint32_t changed) +{ + return -EINVAL; +} + +#endif + +#if defined(CFG80211_UPDATE_CONNECT_PARAMS) ||\ + (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 10, 0)) + +/** + * __wlan_hdd_cfg80211_update_connect_params - update connect params + * @wiphy: Handle to struct wiphy to get handle to module context. + * @dev: Pointer to network device + * @req: Pointer to connect params + * @changed: Bitmap used to indicate the changed params + * + * Update the connect parameters while connected to a BSS. The updated + * parameters can be used by driver/firmware for subsequent BSS selection + * (roaming) decisions and to form the Authentication/(Re)Association + * Request frames. This call does not request an immediate disassociation + * or reassociation with the current BSS, i.e., this impacts only + * subsequent (re)associations. The bits in changed are defined in enum + * cfg80211_connect_params_changed + * + * Return: zero for success, non-zero for failure + */ +static int +__wlan_hdd_cfg80211_update_connect_params(struct wiphy *wiphy, + struct net_device *dev, + struct cfg80211_connect_params *req, + uint32_t changed) +{ + struct csr_roam_profile *roam_profile; + int ret; + struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev); + struct hdd_context *hdd_ctx = wiphy_priv(wiphy); + QDF_STATUS status; + mac_handle_t mac_handle; + + hdd_enter_dev(dev); + + if (wlan_hdd_validate_vdev_id(adapter->vdev_id)) + return -EINVAL; + + ret = wlan_hdd_validate_context(hdd_ctx); + if (ret) + return -EINVAL; + + mac_handle = hdd_ctx->mac_handle; + roam_profile = hdd_roam_profile(adapter); + + if (changed & UPDATE_ASSOC_IE) { + /* + * Validate the elements of the IE and copy it to + * roam_profile in adapter + */ + wlan_hdd_cfg80211_set_ie(adapter, req->ie, req->ie_len); + + /* + * Update this assoc IE received from user space to + * csr_session. RSO command will pick up the assoc + * IEs to be sent to firmware from the csr_session. + */ + sme_update_session_assoc_ie(mac_handle, adapter->vdev_id, + roam_profile); + } + + if ((changed & UPDATE_FILS_ERP_INFO) || + (changed & UPDATE_FILS_AUTH_TYPE)) { + ret = hdd_update_connect_params_fils_info(adapter, hdd_ctx, + req, changed); + if (ret) + return -EINVAL; + + if (!hdd_ctx->is_fils_roaming_supported) { + hdd_debug("FILS roaming support %d", + hdd_ctx->is_fils_roaming_supported); + return 0; + } + } + + if (changed) { + status = sme_send_rso_connect_params(mac_handle, + adapter->vdev_id, + roam_profile); + if (QDF_IS_STATUS_ERROR(status)) + hdd_err("Update connect params to fw failed %d", + status); + } return 0; } @@ -21888,10 +21963,8 @@ static struct cfg80211_ops wlan_hdd_cfg80211_ops = { defined(CFG80211_ABORT_SCAN) .abort_scan = wlan_hdd_cfg80211_abort_scan, #endif -#if defined(WLAN_FEATURE_FILS_SK) &&\ - defined(CFG80211_FILS_SK_OFFLOAD_SUPPORT) &&\ - (defined(CFG80211_UPDATE_CONNECT_PARAMS) ||\ - (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 10, 0))) +#if defined(CFG80211_UPDATE_CONNECT_PARAMS) || \ + (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 10, 0)) .update_connect_params = wlan_hdd_cfg80211_update_connect_params, #endif #if defined(WLAN_FEATURE_SAE) && \ diff --git a/core/sme/inc/sme_api.h b/core/sme/inc/sme_api.h index 142059ea12..7fdbc554f0 100644 --- a/core/sme/inc/sme_api.h +++ b/core/sme/inc/sme_api.h @@ -2304,31 +2304,61 @@ QDF_STATUS sme_set_del_pmkid_cache(mac_handle_t mac_handle, uint8_t session_id, /** * sme_send_hlp_ie_info() - API to send HLP IE info to fw * @mac_handle: Opaque handle to the global MAC context - * @session_id: Session id + * @vdev_id: vdev id * @profile: CSR Roam profile * @if_addr: IP address * * This API is used to send HLP IE info along with IP address * to fw if LFR3 is enabled. * - * Return: QDF_STATUS + * Return: None */ -void sme_send_hlp_ie_info(mac_handle_t mac_handle, uint8_t session_id, +void sme_send_hlp_ie_info(mac_handle_t mac_handle, uint8_t vdev_id, struct csr_roam_profile *profile, uint32_t if_addr); +/** + * sme_update_session_assoc_ie() - Updates the assoc IEs to csr_roam_session + * @mac_handle: Opaque handle to the global MAC context + * @vdev_id: vdev id + * @src_profile: Pointer to Roam profile in HDD + * + * This API is used to copy the assoc IE sent from user space to + * csr_roam_session + * + * Return: None + */ +void sme_update_session_assoc_ie(mac_handle_t mac_handle, + uint8_t vdev_id, + struct csr_roam_profile *src_profile); + +/** + * sme_send_rso_connect_params() - Updates the assoc IEs to csr_roam_session + * @mac_handle: Opaque handle to the global MAC context + * @vdev_id: vdev id + * @src_profile: CSR Roam profile + * + * When the user space updates the assoc IEs or FILS auth type or FILS ERP info, + * host driver needs to send these updated parameters to firmware via + * RSO update command. + * + * Return: None + */ +QDF_STATUS sme_send_rso_connect_params(mac_handle_t mac_handle, + uint8_t vdev_id, + struct csr_roam_profile *src_profile); + #if defined(WLAN_FEATURE_FILS_SK) /** * sme_update_fils_config - Update FILS config to CSR roam session * @mac_handle: Opaque handle to the global MAC context - * @session_id: session id - * @src_profile: Source profile having latest FILS config + * @vdev_id: vdev id + * @src_profile: Source roam profile having latest FILS config * - * API to update FILS config to roam csr session and update the same - * to fw if LFR3 is enabled. + * API to update FILS config to roam csr session. * * Return: QDF_STATUS */ -QDF_STATUS sme_update_fils_config(mac_handle_t mac_handle, uint8_t session_id, +QDF_STATUS sme_update_fils_config(mac_handle_t mac_handle, uint8_t vdev_id, struct csr_roam_profile *src_profile); /** @@ -2340,7 +2370,7 @@ QDF_STATUS sme_update_fils_config(mac_handle_t mac_handle, uint8_t session_id, void sme_free_join_rsp_fils_params(struct csr_roam_info *roam_info); #else static inline -QDF_STATUS sme_update_fils_config(mac_handle_t mac_handle, uint8_t session_id, +QDF_STATUS sme_update_fils_config(mac_handle_t mac_handle, uint8_t vdev_id, struct csr_roam_profile *src_profile) { return QDF_STATUS_SUCCESS; diff --git a/core/sme/src/common/sme_api.c b/core/sme/src/common/sme_api.c index ee63a47e99..8ec8cdfe2f 100644 --- a/core/sme/src/common/sme_api.c +++ b/core/sme/src/common/sme_api.c @@ -5985,17 +5985,47 @@ QDF_STATUS sme_update_roam_rssi_diff(mac_handle_t mac_handle, uint8_t sessionId, return status; } -#ifdef WLAN_FEATURE_FILS_SK -QDF_STATUS sme_update_fils_config(mac_handle_t mac_handle, uint8_t session_id, - struct csr_roam_profile *src_profile) +void sme_update_session_assoc_ie(mac_handle_t mac_handle, + uint8_t vdev_id, + struct csr_roam_profile *src_profile) +{ + struct mac_context *mac = MAC_CONTEXT(mac_handle); + struct csr_roam_session *session = CSR_GET_SESSION(mac, vdev_id); + + if (!session) { + sme_err("Session: %d not found", vdev_id); + return; + } + + qdf_mem_free(session->pAddIEAssoc); + session->pAddIEAssoc = NULL; + session->nAddIEAssocLength = 0; + + if (!src_profile->nAddIEAssocLength) { + sme_debug("Assoc IE len 0"); + return; + } + + session->pAddIEAssoc = qdf_mem_malloc(src_profile->nAddIEAssocLength); + if (!session->pAddIEAssoc) + return; + + session->nAddIEAssocLength = src_profile->nAddIEAssocLength; + qdf_mem_copy(session->pAddIEAssoc, src_profile->pAddIEAssoc, + src_profile->nAddIEAssocLength); +} + +QDF_STATUS sme_send_rso_connect_params(mac_handle_t mac_handle, + uint8_t vdev_id, + struct csr_roam_profile *src_profile) { struct mac_context *mac = MAC_CONTEXT(mac_handle); QDF_STATUS status = QDF_STATUS_SUCCESS; tpCsrNeighborRoamControlInfo neighbor_roam_info = - &mac->roam.neighborRoamInfo[session_id]; + &mac->roam.neighborRoamInfo[vdev_id]; - if (session_id >= WLAN_MAX_VDEVS) { - sme_err("Invalid sme session id: %d", session_id); + if (vdev_id >= WLAN_MAX_VDEVS) { + sme_err("Invalid sme vdev id: %d", vdev_id); return QDF_STATUS_E_INVAL; } @@ -6008,16 +6038,15 @@ QDF_STATUS sme_update_fils_config(mac_handle_t mac_handle, uint8_t session_id, (neighbor_roam_info->neighborRoamState != eCSR_NEIGHBOR_ROAM_STATE_CONNECTED)) { sme_info("Fast roam is disabled or not connected(%d)", - neighbor_roam_info->neighborRoamState); + neighbor_roam_info->neighborRoamState); return QDF_STATUS_E_PERM; } - csr_update_fils_config(mac, session_id, src_profile); if (csr_is_roam_offload_enabled(mac)) { status = sme_acquire_global_lock(&mac->sme); if (QDF_IS_STATUS_SUCCESS(status)) { sme_debug("Updating fils config to fw"); - csr_roam_offload_scan(mac, session_id, + csr_roam_offload_scan(mac, vdev_id, ROAM_SCAN_OFFLOAD_UPDATE_CFG, REASON_FILS_PARAMS_CHANGED); sme_release_global_lock(&mac->sme); @@ -6032,7 +6061,19 @@ QDF_STATUS sme_update_fils_config(mac_handle_t mac_handle, uint8_t session_id, return status; } -void sme_send_hlp_ie_info(mac_handle_t mac_handle, uint8_t session_id, +#ifdef WLAN_FEATURE_FILS_SK +QDF_STATUS sme_update_fils_config(mac_handle_t mac_handle, uint8_t vdev_id, + struct csr_roam_profile *src_profile) +{ + QDF_STATUS status = QDF_STATUS_SUCCESS; + struct mac_context *mac = MAC_CONTEXT(mac_handle); + + csr_update_fils_config(mac, vdev_id, src_profile); + + return status; +} + +void sme_send_hlp_ie_info(mac_handle_t mac_handle, uint8_t vdev_id, struct csr_roam_profile *profile, uint32_t if_addr) { int i; @@ -6040,9 +6081,9 @@ void sme_send_hlp_ie_info(mac_handle_t mac_handle, uint8_t session_id, QDF_STATUS status; struct hlp_params *params; struct mac_context *mac = MAC_CONTEXT(mac_handle); - struct csr_roam_session *session = CSR_GET_SESSION(mac, session_id); + struct csr_roam_session *session = CSR_GET_SESSION(mac, vdev_id); tpCsrNeighborRoamControlInfo neighbor_roam_info = - &mac->roam.neighborRoamInfo[session_id]; + &mac->roam.neighborRoamInfo[vdev_id]; if (!session) { sme_err("session NULL"); @@ -6069,7 +6110,7 @@ void sme_send_hlp_ie_info(mac_handle_t mac_handle, uint8_t session_id, return; } - params->vdev_id = session_id; + params->vdev_id = vdev_id; params->hlp_ie_len = profile->hlp_ie_len + SIR_IPV4_ADDR_LEN; for (i = 0; i < SIR_IPV4_ADDR_LEN; i++) @@ -6125,7 +6166,7 @@ void sme_free_join_rsp_fils_params(struct csr_roam_info *roam_info) } #else -inline void sme_send_hlp_ie_info(mac_handle_t mac_handle, uint8_t session_id, +inline void sme_send_hlp_ie_info(mac_handle_t mac_handle, uint8_t vdev_id, struct csr_roam_profile *profile, uint32_t if_addr) {} #endif