diff --git a/os_if/linux/mlme/inc/osif_cm_req.h b/os_if/linux/mlme/inc/osif_cm_req.h deleted file mode 100644 index 0abdf04fb470..000000000000 --- a/os_if/linux/mlme/inc/osif_cm_req.h +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (c) 2012-2015, 2020 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. - */ - -/** - * DOC: osif_cm_req.h - * - * This header file maintains declarations of connect, disconnect, roam - * request apis. - */ - -#ifndef __OSIF_CM_REQ_H -#define __OSIF_CM_REQ_H - -#ifdef FEATURE_CM_ENABLE -#include "qdf_status.h" -#include "wlan_cm_public_struct.h" -#include -#include "wlan_objmgr_vdev_obj.h" - -/** - * osif_cm_connect() - Connect start request - * @dev: net dev - * @vdev: vdev pointer - * @req: connect req - * - * Return: int - */ -int osif_cm_connect(struct net_device *dev, - struct wlan_objmgr_vdev *vdev, - struct cfg80211_connect_params *req); - -/** - * osif_cm_disconnect() - Disconnect start request - * @dev: net dev - * @vdev: vdev pointer - * @reason: disconnect reason - * - * Return: int - */ -int osif_cm_disconnect(struct net_device *dev, - struct wlan_objmgr_vdev *vdev, - uint16_t reason); -#endif -#endif /* __OSIF_CM_REQ_H */ diff --git a/os_if/linux/mlme/inc/osif_cm_util.h b/os_if/linux/mlme/inc/osif_cm_util.h deleted file mode 100644 index eb7d8eb16848..000000000000 --- a/os_if/linux/mlme/inc/osif_cm_util.h +++ /dev/null @@ -1,107 +0,0 @@ -/* - * Copyright (c) 2012-2015, 2020 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. - */ - -/** - * DOC: osif_cm_util.h - * - * This header file maintains declarations of connect, disconnect, roam - * common apis. - */ - -#ifndef __OSIF_CM_UTIL_H -#define __OSIF_CM_UTIL_H - -#include -#include "wlan_cm_ucfg_api.h" - -/** - * osif_cm_qca_reason_to_str() - return string conversion of qca reason code - * @reason: enum qca_disconnect_reason_codes - * - * This utility function helps log string conversion of qca reason code. - * - * Return: string conversion of reason code, if match found; - * "Unknown" otherwise. - */ -const char * -osif_cm_qca_reason_to_str(enum qca_disconnect_reason_codes reason); - -/** - * osif_cm_mac_to_qca_reason() - Convert to qca internal disconnect reason - * @internal_reason: Mac reason code of type @wlan_reason_code - * - * Check if it is internal reason code and convert it to the - * enum qca_disconnect_reason_codes. - * - * Return: Reason code of type enum qca_disconnect_reason_codes - */ -enum qca_disconnect_reason_codes -osif_cm_mac_to_qca_reason(enum wlan_reason_code internal_reason); - -/** - * osif_cm_register_cb() - API to register connection manager - * callbacks. - * - * Return: QDF_STATUS - */ -QDF_STATUS osif_cm_register_cb(void); - -/** - * osif_cm_osif_priv_init() - API to init osif priv data for connection manager - * @vdev: vdev pointer - * - * Return: QDF_STATUS - */ -QDF_STATUS osif_cm_osif_priv_init(struct wlan_objmgr_vdev *vdev); - -/** - * osif_cm_osif_priv_deinit() - API to deinit osif priv data for connection - * manager - * @vdev: vdev pointer - * - * Return: QDF_STATUS - */ -QDF_STATUS osif_cm_osif_priv_deinit(struct wlan_objmgr_vdev *vdev); - -/** - * osif_cm_reset_id_and_src_no_lock() - Function to resets last - * connection manager command id and source in osif - * @osif_priv: Pointer to vdev osif priv - * - * This function resets the last connection manager command id - * and source. - * - * Context: Any context. This function should be called by holding - * cmd id spinlock - * Return: None - */ - -void osif_cm_reset_id_and_src_no_lock(struct vdev_osif_priv *osif_priv); - -/** - * osif_cm_reset_id_and_src() - Function to resets last - * connection manager command id and source in osif - * @vdev: vdev pointer - * - * This function resets the last connection manager command id - * and source. - * - * Context: Any context. Takes and release cmd id spinlock - * Return: None - */ -QDF_STATUS osif_cm_reset_id_and_src(struct wlan_objmgr_vdev *vdev); - -#endif /* __OSIF_CM_UTIL_H */ diff --git a/os_if/linux/mlme/src/osif_cm_connect_rsp.c b/os_if/linux/mlme/src/osif_cm_connect_rsp.c deleted file mode 100644 index 4bf4e4e18666..000000000000 --- a/os_if/linux/mlme/src/osif_cm_connect_rsp.c +++ /dev/null @@ -1,467 +0,0 @@ -/* - * Copyright (c) 2012-2015, 2020 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. - */ - -/** - * DOC: osif_cm_connect_rsp.c - * - * This file maintains definitaions of connect response apis. - */ - -#include -#include -#include -#include "wlan_osif_priv.h" -#include "osif_cm_rsp.h" -#include "osif_cm_util.h" -#include "wlan_cfg80211.h" -#include "wlan_cfg80211_scan.h" - -/** - * osif_validate_connect_and_reset_src_id() - Validate connect response and - * resets source and id - * @osif_priv: Pointer to vdev osif priv - * @cm_id: Command id received in the connect response - * - * This function validates connect response and if the connect - * response is valid, resets the source and id of the command - * - * Context: Any context. Takes and releases cmd id spinlock. - * Return: QDF_STATUS - */ -static QDF_STATUS -osif_validate_connect_and_reset_src_id(struct vdev_osif_priv *osif_priv, - wlan_cm_id cm_id) -{ - QDF_STATUS status = QDF_STATUS_SUCCESS; - /* - * Send to kernel only if last osif cmd type is connect and - * cookie match else drop. If cookie match reset the cookie - * and source. - */ - qdf_spinlock_acquire(&osif_priv->cm_info.cmd_id_lock); - if (cm_id != osif_priv->cm_info.last_id || - osif_priv->cm_info.last_source != CM_OSIF_CONNECT) { - osif_debug("Ignore as cm_id(%d)/src(%d) didn't match stored cm_id(%d)/src(%d)", - cm_id, CM_OSIF_CONNECT, - osif_priv->cm_info.last_id, - osif_priv->cm_info.last_source); - status = QDF_STATUS_E_INVAL; - goto rel_lock; - } - - osif_cm_reset_id_and_src_no_lock(osif_priv); -rel_lock: - qdf_spinlock_release(&osif_priv->cm_info.cmd_id_lock); - - return status; -} - -/** - * osif_convert_timeout_reason() - Convert to kernel specific enum - * @timeout_reason: reason for connect timeout - * - * This function is used to convert host timeout - * reason enum to kernel specific enum. - * - * Context: Any context. - * Return: nl timeout enum - */ - -static enum nl80211_timeout_reason -osif_convert_timeout_reason(enum wlan_cm_connect_fail_reason reason) -{ - switch (reason) { - case CM_JOIN_TIMEOUT: - return NL80211_TIMEOUT_SCAN; - case CM_AUTH_TIMEOUT: - return NL80211_TIMEOUT_AUTH; - case CM_ASSOC_TIMEOUT: - return NL80211_TIMEOUT_ASSOC; - default: - return NL80211_TIMEOUT_UNSPECIFIED; - } -} - -#if defined CFG80211_CONNECT_BSS || \ - (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 7, 0)) - -#if defined CFG80211_CONNECT_TIMEOUT_REASON_CODE || \ - (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0)) -/** - * osif_connect_timeout() - API to send connection timeout reason - * @dev: network device - * @bssid: bssid to which we want to associate - * @reason: reason for connect timeout - * - * This API is used to send connection timeout reason to supplicant - * - * Context: Any context. - * Return: Void - */ -static void -osif_connect_timeout(struct net_device *dev, const u8 *bssid, - enum wlan_cm_connect_fail_reason reason) -{ - enum nl80211_timeout_reason nl_timeout_reason; - - nl_timeout_reason = osif_convert_timeout_reason(reason); - - osif_debug("nl_timeout_reason %d", nl_timeout_reason); - - cfg80211_connect_timeout(dev, bssid, NULL, 0, GFP_KERNEL, - nl_timeout_reason); -} - -/** - * __osif_connect_bss() - API to send connection status to supplicant - * @dev: network device - * @bss: bss info - * @connect_rsp: Connection manager connect response - * - * Context: Any context. - * Return: void - */ -static void __osif_connect_bss(struct net_device *dev, - struct cfg80211_bss *bss, - struct wlan_cm_connect_rsp *rsp, - enum ieee80211_statuscode status) -{ - enum nl80211_timeout_reason nl_timeout_reason; - - nl_timeout_reason = osif_convert_timeout_reason(rsp->reason); - - osif_debug("nl_timeout_reason %d", nl_timeout_reason); - - cfg80211_connect_bss(dev, rsp->bssid.bytes, bss, - rsp->connect_ies.assoc_req.ptr, - rsp->connect_ies.assoc_req.len, - rsp->connect_ies.assoc_rsp.ptr, - rsp->connect_ies.assoc_rsp.len, - status, GFP_KERNEL, - nl_timeout_reason); -} -#else /* CFG80211_CONNECT_TIMEOUT_REASON_CODE */ - -#if defined CFG80211_CONNECT_TIMEOUT || \ - (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0)) -static void osif_connect_timeout( - struct net_device *dev, - const u8 *bssid, - enum wlan_cm_connect_fail_reason reason) -{ - cfg80211_connect_timeout(dev, bssid, NULL, 0, GFP_KERNEL); -} -#endif - -static void __osif_connect_bss(struct net_device *dev, - struct cfg80211_bss *bss, - struct wlan_cm_connect_rsp *rsp, - ieee80211_statuscode status) -{ - cfg80211_connect_bss(dev, rsp->bssid.bytes, bss, - rsp->connect_ies.assoc_req.ptr, - rsp->connect_ies.assoc_req.len, - rsp->connect_ies.assoc_rsp.ptr, - rsp->connect_ies.assoc_rsp.len, - status, GFP_KERNEL); -} -#endif /* CFG80211_CONNECT_TIMEOUT_REASON_CODE */ - -/** - * osif_connect_bss() - API to send connection status to supplicant - * @dev: network device - * @bss: bss info - * @connect_rsp: Connection manager connect response - * - * The API is a wrapper to send connection status to supplicant - * - * Context: Any context. - * Return: Void - */ -#if defined CFG80211_CONNECT_TIMEOUT || \ - (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0)) -static void osif_connect_bss(struct net_device *dev, struct cfg80211_bss *bss, - struct wlan_cm_connect_rsp *rsp) -{ - enum ieee80211_statuscode status = WLAN_STATUS_SUCCESS; - - osif_enter_dev(dev); - - if (rsp->reason == CM_JOIN_TIMEOUT || - rsp->reason == CM_AUTH_TIMEOUT || - rsp->reason == CM_ASSOC_TIMEOUT) { - osif_connect_timeout(dev, rsp->bssid.bytes, - rsp->reason); - } else { - if (QDF_IS_STATUS_ERROR(rsp->connect_status)) - status = WLAN_STATUS_UNSPECIFIED_FAILURE; - __osif_connect_bss(dev, bss, rsp, status); - } -} -#else /* CFG80211_CONNECT_TIMEOUT */ -static void osif_connect_bss(struct net_device *dev, struct cfg80211_bss *bss, - struct wlan_cm_connect_rsp *rsp) -{ - enum ieee80211_statuscode status = WLAN_STATUS_SUCCESS; - - osif_enter_dev(dev); - - if (QDF_IS_STATUS_ERROR(rsp->connect_status)) - status = WLAN_STATUS_UNSPECIFIED_FAILURE; - - __osif_connect_bss(dev, bss, rsp, status); -} -#endif /* CFG80211_CONNECT_TIMEOUT */ - -#if defined(WLAN_FEATURE_FILS_SK) - -#if (defined(CFG80211_CONNECT_DONE) || \ - (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0))) && \ - (LINUX_VERSION_CODE < KERNEL_VERSION(4, 19, 0)) - -#if defined(CFG80211_FILS_SK_OFFLOAD_SUPPORT) || \ - (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0)) -/** - * osif_populate_fils_params() - Populate FILS keys to connect response - * @conn_rsp_params: connect response to supplicant - * @fils_ie: Fils ie information from connection manager - * - * Context: Any context. - * Return: None - */ -static void -osif_populate_fils_params(struct cfg80211_connect_resp_params *rsp_params, - struct fils_connect_rsp_params *fils_ie) -{ - /* Increment seq number to be used for next FILS */ - rsp_params->fils_erp_next_seq_num = fils_ie->fils_seq_num + 1; - rsp_params->update_erp_next_seq_num = true; - rsp_params->fils_kek = fils_ie->kek; - rsp_params->fils_kek_len = fils_ie->kek_len; - rsp_params->pmk = fils_ie->fils_pmk; - rsp_params->pmk_len = fils_ie->fils_pmk_len; - rsp_params->pmkid = fils_ie->fils_pmkid; - osif_debug("erp_next_seq_num:%d", rsp_params->fils_erp_next_seq_num); -} -#else /* CFG80211_FILS_SK_OFFLOAD_SUPPORT */ -static inline void -osif_populate_fils_params(struct cfg80211_connect_resp_params *rsp_params, - struct fils_connect_rsp_params *fils_ie) - -{ } -#endif /* CFG80211_FILS_SK_OFFLOAD_SUPPORT */ - -#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 19, 0)) -/** - * osif_populate_fils_params() - Populate FILS keys to connect response - * @conn_rsp_params: connect response to supplicant - * @fils_ie: Fils ie information from connection manager - * - * Context: Any context. - * Return: None - */ -static void -osif_populate_fils_params(struct cfg80211_connect_resp_params *rsp_params, - struct fils_connect_rsp_params *fils_ie) - -{ - /* Increament seq number to be used for next FILS */ - rsp_params->fils.erp_next_seq_num = fils_ie->fils_seq_num + 1; - rsp_params->fils.update_erp_next_seq_num = true; - rsp_params->fils.kek = fils_ie->kek; - rsp_params->fils.kek_len = fils_ie->kek_len; - rsp_params->fils.pmk = fils_ie->fils_pmk; - rsp_params->fils.pmk_len = fils_ie->fils_pmk_len; - rsp_params->fils.pmkid = fils_ie->fils_pmkid; - osif_debug("erp_next_seq_num:%d", rsp_params->fils.erp_next_seq_num); -} -#endif /* CFG80211_CONNECT_DONE */ - -#if defined(CFG80211_CONNECT_DONE) || \ - (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0)) -/** - * osif_connect_done() - Wrapper API to call cfg80211_connect_done - * @dev: network device - * @bss: bss info - * @connect_rsp: Connection manager connect response - * - * This API is used as wrapper to send FILS key/sequence number - * params etc. to supplicant in case of FILS connection - * - * Context: Any context. - * Return: None - */ -static void osif_connect_done(struct net_device *dev, struct cfg80211_bss *bss, - struct wlan_cm_connect_rsp *rsp) -{ - struct cfg80211_connect_resp_params conn_rsp_params; - enum ieee80211_statuscode status = WLAN_STATUS_SUCCESS; - - osif_enter_dev(dev); - - if (QDF_IS_STATUS_ERROR(rsp->connect_status)) { - if (rsp->reason_code) - status = rsp->reason_code; - else - status = WLAN_STATUS_UNSPECIFIED_FAILURE; - } - qdf_mem_zero(&conn_rsp_params, sizeof(conn_rsp_params)); - - if (!rsp->connect_ies.fils_ie) { - conn_rsp_params.status = WLAN_STATUS_UNSPECIFIED_FAILURE; - } else { - conn_rsp_params.status = status; - conn_rsp_params.bssid = rsp->bssid.bytes; - conn_rsp_params.timeout_reason = - osif_convert_timeout_reason(rsp->reason); - conn_rsp_params.req_ie = rsp->connect_ies.assoc_req.ptr; - conn_rsp_params.req_ie_len = rsp->connect_ies.assoc_req.len; - conn_rsp_params.resp_ie = rsp->connect_ies.assoc_rsp.ptr; - conn_rsp_params.resp_ie_len = rsp->connect_ies.assoc_rsp.len; - conn_rsp_params.bss = bss; - osif_populate_fils_params(&conn_rsp_params, - rsp->connect_ies.fils_ie); - /* save GTK */ - } - - cfg80211_connect_done(dev, &conn_rsp_params, GFP_KERNEL); - /* hlp data for DHCP */ -} -#else /* CFG80211_CONNECT_DONE */ -static inline void -osif_connect_done(struct net_device *dev, struct cfg80211_bss *bss, - struct wlan_cm_connect_rsp *rsp) -{ } -#endif /* CFG80211_CONNECT_DONE */ -#endif /* WLAN_FEATURE_FILS_SK */ - -#if defined(WLAN_FEATURE_FILS_SK) && \ - (defined(CFG80211_CONNECT_DONE) || \ - (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 7, 0))) -/** - * osif_fils_update_connect_results() - API to send fils connection status to - * supplicant. - * @dev: network device - * @bss: bss info - * @connect_rsp: Connection manager connect response - * - * The API is a wrapper to send connection status to supplicant - * - * Context: Any context. - * Return: 0 if success else failure - */ -static int osif_update_connect_results(struct net_device *dev, - struct cfg80211_bss *bss, - struct wlan_cm_connect_rsp *rsp) -{ - if (!rsp->is_fils_connection) { - osif_debug("fils IE is NULL"); - return -EINVAL; - } - osif_connect_done(dev, bss, rsp); - - return 0; -} -#else /* WLAN_FEATURE_FILS_SK && CFG80211_CONNECT_DONE */ - -static inline int osif_update_connect_results(struct net_device *dev, - struct cfg80211_bss *bss, - struct wlan_cm_connect_rsp *rsp) -{ - return -EINVAL; -} -#endif /* WLAN_FEATURE_FILS_SK && CFG80211_CONNECT_DONE */ - -static void osif_indcate_connect_results(struct wlan_objmgr_vdev *vdev, - struct vdev_osif_priv *osif_priv, - struct wlan_cm_connect_rsp *rsp) -{ - struct cfg80211_bss *bss = NULL; - struct ieee80211_channel *chan; - - if (QDF_IS_STATUS_SUCCESS(rsp->connect_status)) { - chan = ieee80211_get_channel(osif_priv->wdev->wiphy, - rsp->freq); - bss = wlan_cfg80211_get_bss(osif_priv->wdev->wiphy, chan, - rsp->bssid.bytes, - rsp->ssid.ssid, - rsp->ssid.length); - } - - if (osif_update_connect_results(osif_priv->wdev->netdev, bss, rsp)) - osif_connect_bss(osif_priv->wdev->netdev, bss, rsp); -} -#else /* CFG80211_CONNECT_BSS */ -static void osif_indcate_connect_results(struct wlan_objmgr_vdev *vdev, - struct vdev_osif_priv *osif_priv, - struct wlan_cm_connect_rsp *rsp) -{ - enum ieee80211_statuscode status = WLAN_STATUS_SUCCESS; - - if (QDF_IS_STATUS_ERROR(rsp->connect_status)) { - if (rsp->reason_code) - status = rsp->reason_code; - else - status = WLAN_STATUS_UNSPECIFIED_FAILURE; - } - - cfg80211_connect_result(osif_priv->wdev->netdev, - rsp->bssid.bytes, - rsp->connect_ies.assoc_req.ptr, - rsp->connect_ies.assoc_req.len, - rsp->connect_ies.assoc_rsp.ptr, - rsp->connect_ies.assoc_rsp.len - status, GFP_KERNEL); -} -#endif /* CFG80211_CONNECT_BSS */ - -QDF_STATUS osif_connect_handler(struct wlan_objmgr_vdev *vdev, - struct wlan_cm_connect_rsp *rsp) -{ - struct vdev_osif_priv *osif_priv = wlan_vdev_get_ospriv(vdev); - QDF_STATUS status; - - osif_nofl_info("%s(vdevid-%d): " QDF_MAC_ADDR_FMT " Connect with " QDF_MAC_ADDR_FMT " SSID \"%.*s\" is %s cm_id %d cm_reason %d reason_code %d", - osif_priv->wdev->netdev->name, rsp->vdev_id, - QDF_MAC_ADDR_REF(wlan_vdev_mlme_get_macaddr(vdev)), - QDF_MAC_ADDR_REF(rsp->bssid.bytes), - rsp->ssid.length, rsp->ssid.ssid, - rsp->connect_status ? "FAILURE" : "SUCCESS", rsp->cm_id, - rsp->reason, rsp->reason_code); - - status = osif_validate_connect_and_reset_src_id(osif_priv, rsp->cm_id); - if (QDF_IS_STATUS_ERROR(status)) - return status; - - osif_indcate_connect_results(vdev, osif_priv, rsp); - - return QDF_STATUS_SUCCESS; -} - -QDF_STATUS osif_failed_candidate_handler(struct wlan_objmgr_vdev *vdev, - struct wlan_cm_connect_rsp *rsp) -{ - struct vdev_osif_priv *osif_priv = wlan_vdev_get_ospriv(vdev); - - osif_nofl_info("%s(vdevid-%d): " QDF_MAC_ADDR_FMT " Connect with " QDF_MAC_ADDR_FMT " SSID \"%.*s\" FAILED cm_id %d cm_reason %d reason_code %d", - osif_priv->wdev->netdev->name, rsp->vdev_id, - QDF_MAC_ADDR_REF(wlan_vdev_mlme_get_macaddr(vdev)), - QDF_MAC_ADDR_REF(rsp->bssid.bytes), - rsp->ssid.length, rsp->ssid.ssid, rsp->cm_id, - rsp->reason, rsp->reason_code); - - return QDF_STATUS_SUCCESS; -} diff --git a/os_if/linux/mlme/src/osif_cm_disconnect_rsp.c b/os_if/linux/mlme/src/osif_cm_disconnect_rsp.c deleted file mode 100644 index fd7f47f04af4..000000000000 --- a/os_if/linux/mlme/src/osif_cm_disconnect_rsp.c +++ /dev/null @@ -1,154 +0,0 @@ -/* - * Copyright (c) 2012-2015, 2020 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. - */ - -/** - * DOC: osif_cm_disconnect_rsp.c - * - * This file maintains definitaions of disconnect response - * fucntions. - */ - -#include -#include -#include "osif_cm_rsp.h" -#include "wlan_osif_priv.h" -#include "osif_cm_util.h" - -/** - * osif_validate_disconnect_and_reset_src_id() - Validate disconnection - * and resets source and id - * @osif_priv: Pointer to vdev osif priv - * @rsp: Disconnect response from connectin manager - * - * This function validates disconnect response and if the disconnect - * response is valid, resets the source and id of the command - * - * Context: Any context. Takes and releases cmd id spinlock. - * Return: QDF_STATUS - */ - -static QDF_STATUS -osif_validate_disconnect_and_reset_src_id(struct vdev_osif_priv *osif_priv, - struct wlan_cm_discon_rsp *rsp) -{ - QDF_STATUS status = QDF_STATUS_SUCCESS; - - /* Always drop internal disconnect */ - qdf_spinlock_acquire(&osif_priv->cm_info.cmd_id_lock); - if (rsp->req.req.source == CM_INTERNAL_DISCONNECT) { - osif_debug("ignore internal disconnect"); - status = QDF_STATUS_E_INVAL; - goto rel_lock; - } - - /* - * Send to kernel only if last osif cmd type is disconnect and - * cookie match else drop. If cookie match reset the cookie - * and source - */ - if (rsp->req.cm_id != osif_priv->cm_info.last_id || - rsp->req.req.source != osif_priv->cm_info.last_source) { - osif_debug("Ignore as cm_id(%d)/src(%d) didn't match stored cm_id(%d)/src(%d)", - rsp->req.cm_id, rsp->req.req.source, - osif_priv->cm_info.last_id, - osif_priv->cm_info.last_source); - status = QDF_STATUS_E_INVAL; - goto rel_lock; - } - - osif_cm_reset_id_and_src_no_lock(osif_priv); -rel_lock: - qdf_spinlock_release(&osif_priv->cm_info.cmd_id_lock); - - return status; -} - -#if defined(CFG80211_DISCONNECTED_V2) || \ -(LINUX_VERSION_CODE >= KERNEL_VERSION(4, 2, 0)) -static void -osif_cm_indicate_disconnect(struct net_device *dev, - enum ieee80211_reasoncode reason, - bool locally_generated, const u8 *ie, - size_t ie_len, gfp_t gfp) -{ - cfg80211_disconnected(dev, reason, ie, ie_len, locally_generated, gfp); -} -#else -static void -osif_cm_indicate_disconnect(struct net_device *dev, - enum ieee80211_reasoncode reason, - bool locally_generated, const u8 *ie, - size_t ie_len, gfp_t gfp) -{ - cfg80211_disconnected(dev, reason, ie, ie_len, gfp); -} -#endif - -static enum ieee80211_reasoncode -osif_cm_get_disconnect_reason(struct vdev_osif_priv *osif_priv, uint16_t reason) -{ - enum ieee80211_reasoncode ieee80211_reason = WLAN_REASON_UNSPECIFIED; - - osif_priv->cm_info.last_disconnect_reason = - osif_cm_mac_to_qca_reason(reason); - if (reason < REASON_PROP_START) - ieee80211_reason = reason; - /* - * Applications expect reason code as 0 for beacon miss failure - * due to backward compatibility. So send ieee80211_reason as 0. - */ - if (reason == REASON_BEACON_MISSED) - ieee80211_reason = 0; - - return ieee80211_reason; -} - -QDF_STATUS osif_disconnect_handler(struct wlan_objmgr_vdev *vdev, - struct wlan_cm_discon_rsp *rsp) -{ - enum ieee80211_reasoncode ieee80211_reason; - struct vdev_osif_priv *osif_priv = wlan_vdev_get_ospriv(vdev); - bool locally_generated = true; - QDF_STATUS status = QDF_STATUS_SUCCESS; - - ieee80211_reason = - osif_cm_get_disconnect_reason(osif_priv, - rsp->req.req.reason_code); - - osif_nofl_info("%s(vdevid-%d): " QDF_MAC_ADDR_FMT " %sdisconnect " QDF_MAC_ADDR_FMT " cm_id %d source %d reason:%u %s vendor:%u %s", - osif_priv->wdev->netdev->name, - rsp->req.req.vdev_id, - QDF_MAC_ADDR_REF(wlan_vdev_mlme_get_macaddr(vdev)), - locally_generated ? "locally-generated " : "", - QDF_MAC_ADDR_REF(rsp->req.req.bssid.bytes), - rsp->req.cm_id, rsp->req.req.source, ieee80211_reason, - ucfg_cm_reason_code_to_str(rsp->req.req.reason_code), - osif_priv->cm_info.last_disconnect_reason, - osif_cm_qca_reason_to_str(osif_priv->cm_info.last_disconnect_reason)); - - status = osif_validate_disconnect_and_reset_src_id(osif_priv, rsp); - if (QDF_IS_STATUS_ERROR(status)) - return status; - - if (rsp->req.req.source == CM_PEER_DISCONNECT) - locally_generated = false; - - osif_cm_indicate_disconnect(osif_priv->wdev->netdev, ieee80211_reason, - locally_generated, rsp->ap_discon_ie.ptr, - rsp->ap_discon_ie.len, GFP_KERNEL); - - return status; -} diff --git a/os_if/linux/mlme/src/osif_cm_req.c b/os_if/linux/mlme/src/osif_cm_req.c deleted file mode 100644 index 5f151e06b162..000000000000 --- a/os_if/linux/mlme/src/osif_cm_req.c +++ /dev/null @@ -1,428 +0,0 @@ -/* - * Copyright (c) 2012-2015, 2020 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. - */ - -/** - * DOC: osif_cm_req.c - * - * This file maintains definitaions of connect, disconnect, roam - * request apis. - */ - -#include "osif_cm_req.h" -#include "wlan_cm_ucfg_api.h" -#include "wlan_nl_to_crypto_params.h" -#include -#include "osif_cm_util.h" - -static void osif_cm_free_wep_key_params(struct wlan_cm_connect_req *connect_req) -{ - if (connect_req->crypto.wep_keys.key) { - qdf_mem_zero(connect_req->crypto.wep_keys.key, - connect_req->crypto.wep_keys.key_len); - qdf_mem_free(connect_req->crypto.wep_keys.key); - connect_req->crypto.wep_keys.key = NULL; - } - if (connect_req->crypto.wep_keys.seq) { - qdf_mem_zero(connect_req->crypto.wep_keys.seq, - connect_req->crypto.wep_keys.seq_len); - qdf_mem_free(connect_req->crypto.wep_keys.seq); - connect_req->crypto.wep_keys.seq = NULL; - } -} - -static QDF_STATUS osif_cm_set_wep_key_params( - struct wlan_cm_connect_req *connect_req, - struct cfg80211_connect_params *req) -{ - if (!req->key_len) - return QDF_STATUS_SUCCESS; - - connect_req->crypto.wep_keys.key_len = req->key_len; - connect_req->crypto.wep_keys.key_idx = req->key_idx; - - connect_req->crypto.wep_keys.key = - qdf_mem_malloc(connect_req->crypto.wep_keys.key_len); - if (!connect_req->crypto.wep_keys.key) - return QDF_STATUS_E_NOMEM; - - qdf_mem_copy(connect_req->crypto.wep_keys.key, req->key, - connect_req->crypto.wep_keys.key_len); - - if (req->crypto.wep_keys->seq_len) { - connect_req->crypto.wep_keys.seq_len = - req->crypto.wep_keys->seq_len; - connect_req->crypto.wep_keys.seq = - qdf_mem_malloc(connect_req->crypto.wep_keys.seq_len); - if (!connect_req->crypto.wep_keys.seq) { - osif_cm_free_wep_key_params(connect_req); - return QDF_STATUS_E_NOMEM; - } - qdf_mem_copy(connect_req->crypto.wep_keys.seq, - req->crypto.wep_keys->seq, - connect_req->crypto.wep_keys.seq_len); - } - - return QDF_STATUS_SUCCESS; -} - -static void osif_cm_set_auth_type(struct wlan_cm_connect_req *connect_req, - struct cfg80211_connect_params *req) -{ - wlan_crypto_auth_mode crypto_auth_type = - osif_nl_to_crypto_auth_type(req->auth_type); - - /* For auto check wpa version to decide WPA or RSNA */ - if (crypto_auth_type == WLAN_CRYPTO_AUTH_AUTO && - req->crypto.wpa_versions) { - if (req->crypto.wpa_versions & NL80211_WPA_VERSION_1) - crypto_auth_type = WLAN_CRYPTO_AUTH_WPA; - else - crypto_auth_type = WLAN_CRYPTO_AUTH_RSNA; - } else if (!req->crypto.wpa_versions) { - crypto_auth_type = WLAN_CRYPTO_AUTH_OPEN; - } - - QDF_SET_PARAM(connect_req->crypto.auth_type, crypto_auth_type); -} - -static -QDF_STATUS osif_cm_set_crypto_params(struct wlan_cm_connect_req *connect_req, - struct cfg80211_connect_params *req) -{ - uint32_t i = 0; - QDF_STATUS status; - wlan_crypto_cipher_type cipher = WLAN_CRYPTO_CIPHER_NONE; - wlan_crypto_key_mgmt akm; - - connect_req->crypto.wpa_versions = req->crypto.wpa_versions; - - osif_cm_set_auth_type(connect_req, req); - - if (req->crypto.cipher_group) - cipher = osif_nl_to_crypto_cipher_type(cipher); - - QDF_SET_PARAM(connect_req->crypto.group_cipher, cipher); - - /* Fill Pairwise ciphers */ - if (req->crypto.n_ciphers_pairwise) { - for (i = 0; i < req->crypto.n_ciphers_pairwise && - i < NL80211_MAX_NR_CIPHER_SUITES; i++) { - cipher = osif_nl_to_crypto_cipher_type( - req->crypto.ciphers_pairwise[i]); - QDF_SET_PARAM(connect_req->crypto.ciphers_pairwise, - cipher); - } - } else { - QDF_SET_PARAM(connect_req->crypto.ciphers_pairwise, - WLAN_CRYPTO_CIPHER_NONE); - } - - /* Fill AKM suites */ - if (req->crypto.n_akm_suites) { - for (i = 0; i < req->crypto.n_akm_suites && - i < NL80211_MAX_NR_AKM_SUITES; i++) { - akm = osif_nl_to_crypto_akm_type( - req->crypto.akm_suites[i]); - QDF_SET_PARAM(connect_req->crypto.akm_suites, akm); - } - } else { - QDF_SET_PARAM(connect_req->crypto.akm_suites, - WLAN_CRYPTO_KEY_MGMT_NONE); - } - - /* Fill WEP Key information */ - status = osif_cm_set_wep_key_params(connect_req, req); - if (QDF_IS_STATUS_ERROR(status)) - osif_err("set wep key params failed"); - - return status; -} - -#ifdef WLAN_FEATURE_FILS_SK -static bool osif_cm_is_fils_auth_type(enum nl80211_auth_type auth_type) -{ - switch (auth_type) { - case NL80211_AUTHTYPE_FILS_SK: - case NL80211_AUTHTYPE_FILS_SK_PFS: - case NL80211_AUTHTYPE_FILS_PK: - return true; - default: - return false; - } -} - -static bool osif_cm_is_akm_suite_fils(uint32_t key_mgmt) -{ - switch (key_mgmt) { - case WLAN_AKM_SUITE_FILS_SHA256: - case WLAN_AKM_SUITE_FILS_SHA384: - case WLAN_AKM_SUITE_FT_FILS_SHA256: - case WLAN_AKM_SUITE_FT_FILS_SHA384: - return true; - default: - return false; - } -} - -static bool osif_cm_is_conn_type_fils(struct cfg80211_connect_params *req) -{ - int num_akm_suites = req->crypto.n_akm_suites; - uint32_t key_mgmt = req->crypto.akm_suites[0]; - bool is_fils_auth_type = - osif_cm_is_fils_auth_type(req->auth_type); - - if (num_akm_suites <= 0) - return false; - - /* - * Auth type will be either be OPEN or FILS type for a FILS connection - */ - if (!is_fils_auth_type && - req->auth_type != NL80211_AUTHTYPE_OPEN_SYSTEM) - return false; - - if (!osif_cm_is_akm_suite_fils(key_mgmt)) - return false; - - osif_debug("Fils Auth %d AKM %d", req->auth_type, key_mgmt); - - return true; -} - -static QDF_STATUS osif_cm_set_fils_info(struct wlan_cm_connect_req *connect_req, - struct cfg80211_connect_params *req) -{ - connect_req->fils_info.is_fils_connection = - osif_cm_is_conn_type_fils(req); - connect_req->fils_info.username_len = req->fils_erp_username_len; - - if (connect_req->fils_info.username_len > - WLAN_CM_FILS_MAX_KEYNAME_NAI_LENGTH) { - osif_err("Invalid fils username len"); - return QDF_STATUS_E_INVAL; - } - qdf_mem_zero(connect_req->fils_info.username, - WLAN_CM_FILS_MAX_KEYNAME_NAI_LENGTH); - qdf_mem_copy(connect_req->fils_info.username, req->fils_erp_username, - connect_req->fils_info.username_len); - - connect_req->fils_info.realm_len = req->fils_erp_username_len; - - if (connect_req->fils_info.realm_len > WLAN_CM_FILS_MAX_REALM_LEN) { - osif_err("Invalid fils realm len"); - return QDF_STATUS_E_INVAL; - } - qdf_mem_zero(connect_req->fils_info.realm, WLAN_CM_FILS_MAX_REALM_LEN); - qdf_mem_copy(connect_req->fils_info.realm, req->fils_erp_realm, - connect_req->fils_info.realm_len); - - connect_req->fils_info.next_seq_num = req->fils_erp_next_seq_num; - - connect_req->fils_info.rrk_len = req->fils_erp_rrk_len; - - if (connect_req->fils_info.rrk_len > WLAN_CM_FILS_MAX_RRK_LENGTH) { - osif_err("Invalid fils rrk len"); - return QDF_STATUS_E_INVAL; - } - qdf_mem_zero(connect_req->fils_info.rrk, WLAN_CM_FILS_MAX_RRK_LENGTH); - qdf_mem_copy(connect_req->fils_info.rrk, req->fils_erp_rrk, - connect_req->fils_info.rrk_len); - - return QDF_STATUS_SUCCESS; -} -#else -static inline -QDF_STATUS osif_cm_set_fils_info(struct wlan_cm_connect_req *connect_req, - struct cfg80211_connect_params *req) -{ - return QDF_STATUS_SUCCESS; -} -#endif - -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 7, 0)) -static inline void -osif_cm_set_prev_bssid(struct wlan_cm_connect_req *connect_req, - struct cfg80211_connect_params *req) -{ - qdf_mem_copy(connect_req->prev_bssid.bytes, req->prev_bssid, - QDF_MAC_ADDR_SIZE); -} - -static inline void osif_cm_dump_prev_bssid(struct cfg80211_connect_params *req) -{ - if (req->prev_bssid) - osif_nofl_debug("prev BSSID "QDF_MAC_ADDR_FMT, - QDF_MAC_ADDR_REF(req->prev_bssid)); -} - -#else -static inline void -osif_cm_set_prev_bssid(struct wlan_cm_connect_req *connect_req, - struct cfg80211_connect_params *req); - -static inline void osif_cm_dump_prev_bssid(struct cfg80211_connect_params *req) -{ -} - -#endif - -static inline void osif_cm_dump_connect_req(struct net_device *dev, - uint8_t vdev_id, - struct cfg80211_connect_params *req) -{ - uint32_t i; - - osif_nofl_debug("connect req for %s(vdevid-%d) freq %d SSID %.*s auth type %d WPA ver %d n_akm %d n_cipher %d grp_cipher %x mfp %d freq hint %d", - dev->name, vdev_id, - req->channel ? req->channel->center_freq : 0, - (int)req->ssid_len, req->ssid, req->auth_type, - req->crypto.wpa_versions, - req->crypto.n_akm_suites, - req->crypto.n_ciphers_pairwise, - req->crypto.cipher_group, req->mfp, - req->channel_hint ? req->channel_hint->center_freq : 0); - if (req->bssid) - osif_nofl_debug("BSSID "QDF_MAC_ADDR_FMT, - QDF_MAC_ADDR_REF(req->bssid)); - if (req->bssid_hint) - osif_nofl_debug("BSSID hint "QDF_MAC_ADDR_FMT, - QDF_MAC_ADDR_REF(req->bssid_hint)); - osif_cm_dump_prev_bssid(req); - - for (i = 0; i < req->crypto.n_akm_suites; i++) - osif_nofl_debug("akm[%d] = %x", i, req->crypto.akm_suites[i]); - - for (i = 0; i < req->crypto.n_ciphers_pairwise; i++) - osif_nofl_debug("cipher_pairwise[%d] = %x", i, - req->crypto.ciphers_pairwise[i]); -} - -int osif_cm_connect(struct net_device *dev, struct wlan_objmgr_vdev *vdev, - struct cfg80211_connect_params *req) -{ - struct wlan_cm_connect_req *connect_req; - const u8 *bssid_hint = req->bssid_hint; - uint8_t vdev_id = vdev->vdev_objmgr.vdev_id; - QDF_STATUS status; - - osif_cm_dump_connect_req(dev, vdev_id, req); - - status = osif_cm_reset_id_and_src(vdev); - if (QDF_IS_STATUS_ERROR(status)) - return qdf_status_to_os_return(status); - - connect_req = qdf_mem_malloc(sizeof(*connect_req)); - if (!connect_req) - return -ENOMEM; - - connect_req->vdev_id = vdev_id; - connect_req->source = CM_OSIF_CONNECT; - if (req->bssid) - qdf_mem_copy(connect_req->bssid.bytes, req->bssid, - QDF_MAC_ADDR_SIZE); - else if (bssid_hint) - qdf_mem_copy(connect_req->bssid.bytes, req->bssid_hint, - QDF_MAC_ADDR_SIZE); - - osif_cm_set_prev_bssid(connect_req, req); - - connect_req->ssid.length = req->ssid_len; - if (connect_req->ssid.length > WLAN_SSID_MAX_LEN) { - osif_err("Invalid ssid len %zu", req->ssid_len); - return -EINVAL; - } - - qdf_mem_copy(connect_req->ssid.ssid, req->ssid, - connect_req->ssid.length); - - qdf_mem_copy(connect_req->bssid_hint.bytes, bssid_hint, - QDF_MAC_ADDR_SIZE); - - if (req->channel) - connect_req->chan_freq = req->channel->center_freq; - else - connect_req->chan_freq = 0; - - status = osif_cm_set_crypto_params(connect_req, req); - if (QDF_IS_STATUS_ERROR(status)) - goto connect_start_fail; - - connect_req->ht_caps = req->ht_capa.cap_info; - connect_req->ht_caps_mask = req->ht_capa_mask.cap_info; - connect_req->vht_caps = req->vht_capa.vht_cap_info; - connect_req->vht_caps_mask = req->vht_capa_mask.vht_cap_info; - - /* Copy complete ie */ - connect_req->assoc_ie.len = req->ie_len; - connect_req->assoc_ie.ptr = qdf_mem_malloc(req->ie_len); - if (!connect_req->assoc_ie.ptr) { - connect_req->assoc_ie.len = 0; - status = QDF_STATUS_E_NOMEM; - goto connect_start_fail; - } - qdf_mem_copy(connect_req->assoc_ie.ptr, req->ie, - connect_req->assoc_ie.len); - - status = osif_cm_set_fils_info(connect_req, req); - if (QDF_IS_STATUS_ERROR(status)) - goto connect_start_fail; - - status = ucfg_cm_start_connect(vdev, connect_req); - if (QDF_IS_STATUS_ERROR(status)) - osif_err("Connect failed with status %d", status); - -connect_start_fail: - if (connect_req->assoc_ie.ptr) { - qdf_mem_free(connect_req->assoc_ie.ptr); - connect_req->assoc_ie.ptr = NULL; - } - osif_cm_free_wep_key_params(connect_req); - qdf_mem_free(connect_req); - - return qdf_status_to_os_return(status); -} - -int osif_cm_disconnect(struct net_device *dev, struct wlan_objmgr_vdev *vdev, - uint16_t reason) -{ - struct wlan_cm_disconnect_req *req; - uint8_t vdev_id = vdev->vdev_objmgr.vdev_id; - QDF_STATUS status; - - osif_info("%s(vdevid-%d): Received Disconnect reason:%d %s", - dev->name, vdev_id, reason, - ucfg_cm_reason_code_to_str(reason)); - - status = osif_cm_reset_id_and_src(vdev); - if (QDF_IS_STATUS_ERROR(status)) - return qdf_status_to_os_return(status); - - req = qdf_mem_malloc(sizeof(*req)); - if (!req) - return -ENOMEM; - - req->vdev_id = vdev_id; - req->source = CM_OSIF_DISCONNECT; - req->reason_code = reason; - status = ucfg_cm_start_disconnect(vdev, req); - if (QDF_IS_STATUS_ERROR(status)) - osif_err("Disconnect failed with status %d", status); - - qdf_mem_free(req); - - return qdf_status_to_os_return(status); -} - diff --git a/os_if/linux/mlme/src/osif_cm_roam_rsp.c b/os_if/linux/mlme/src/osif_cm_roam_rsp.c deleted file mode 100644 index 8655eda5ec4a..000000000000 --- a/os_if/linux/mlme/src/osif_cm_roam_rsp.c +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Copyright (c) 2012-2015, 2020, 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. - */ - -/** - * DOC: osif_cm_roam_rsp.c - * - * This file maintains definitaions of roam response apis. - */ diff --git a/os_if/linux/mlme/src/osif_cm_rsp.h b/os_if/linux/mlme/src/osif_cm_rsp.h deleted file mode 100644 index bb6b3fc911e0..000000000000 --- a/os_if/linux/mlme/src/osif_cm_rsp.h +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright (c) 2012-2015, 2020 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. - */ - -/** - * DOC: osif_cm_rsp.h - * - * This header file maintains declarations of connect, disconnect, roam - * response apis. - */ - -#ifndef __OSIF_CM_RSP_H -#define __OSIF_CM_RSP_H - -#include "wlan_objmgr_vdev_obj.h" -#include "wlan_cm_public_struct.h" - -/** - * osif_disconnect_handler() - Indicate disconnnect to userspace - * @vdev: vdev pointer - * @rsp: Disconnect response from connection manager - * - * This function indicates disconnect to the kernel which thus indicates - * to the userspace. - * - * Context: Any context - * Return: QDF_STATUS_SUCCESS on successful indication to kernel, - * else QDF_STATUS with failure reason - */ -QDF_STATUS osif_disconnect_handler(struct wlan_objmgr_vdev *vdev, - struct wlan_cm_discon_rsp *rsp); - -/** - * osif_connect_handler() - API to send connect response to kernel - * @vdev: vdev pointer - * @rsp: Connection manager connect response - * - * The API is used to send connection response to kernel - * - * Context: Any context. - * Return: QDF_STATUS - */ -QDF_STATUS osif_connect_handler(struct wlan_objmgr_vdev *vdev, - struct wlan_cm_connect_rsp *rsp); - -/** - * osif_failed_candidate_handler() - API to indicate individual candidate - * connect failure resp - * @vdev: vdev pointer - * @rsp: Connection manager connect response for the candidate - * - * The API is is used indicate individual candidate connect failure resp for - * for tried all but last tried candidate. The last candidate will be sent in - * osif_connect_handler. - * - * Context: Any context. - * Return: QDF_STATUS - */ -QDF_STATUS osif_failed_candidate_handler(struct wlan_objmgr_vdev *vdev, - struct wlan_cm_connect_rsp *rsp); - -#endif /* __OSIF_CM_RSP_H */ diff --git a/os_if/linux/mlme/src/osif_cm_util.c b/os_if/linux/mlme/src/osif_cm_util.c deleted file mode 100644 index c6c440a643b7..000000000000 --- a/os_if/linux/mlme/src/osif_cm_util.c +++ /dev/null @@ -1,294 +0,0 @@ -/* - * Copyright (c) 2012-2015, 2020 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. - */ - -/** - * DOC: osif_cm_util.c - * - * This file maintains definitaions of connect, disconnect, roam - * common apis. - */ -#include -#include "osif_cm_util.h" -#include "wlan_osif_priv.h" -#include "wlan_cfg80211.h" -#include "osif_cm_rsp.h" - -const char * -osif_cm_qca_reason_to_str(enum qca_disconnect_reason_codes reason) -{ - switch (reason) { - CASE_RETURN_STRING(QCA_DISCONNECT_REASON_INTERNAL_ROAM_FAILURE); - CASE_RETURN_STRING(QCA_DISCONNECT_REASON_EXTERNAL_ROAM_FAILURE); - CASE_RETURN_STRING(QCA_DISCONNECT_REASON_GATEWAY_REACHABILITY_FAILURE); - CASE_RETURN_STRING(QCA_DISCONNECT_REASON_UNSUPPORTED_CHANNEL_CSA); - CASE_RETURN_STRING(QCA_DISCONNECT_REASON_OPER_CHANNEL_DISABLED_INDOOR); - CASE_RETURN_STRING(QCA_DISCONNECT_REASON_OPER_CHANNEL_USER_DISABLED); - CASE_RETURN_STRING(QCA_DISCONNECT_REASON_DEVICE_RECOVERY); - CASE_RETURN_STRING(QCA_DISCONNECT_REASON_KEY_TIMEOUT); - CASE_RETURN_STRING(QCA_DISCONNECT_REASON_OPER_CHANNEL_BAND_CHANGE); - CASE_RETURN_STRING(QCA_DISCONNECT_REASON_IFACE_DOWN); - CASE_RETURN_STRING(QCA_DISCONNECT_REASON_PEER_XRETRY_FAIL); - CASE_RETURN_STRING(QCA_DISCONNECT_REASON_PEER_INACTIVITY); - CASE_RETURN_STRING(QCA_DISCONNECT_REASON_SA_QUERY_TIMEOUT); - CASE_RETURN_STRING(QCA_DISCONNECT_REASON_BEACON_MISS_FAILURE); - CASE_RETURN_STRING(QCA_DISCONNECT_REASON_CHANNEL_SWITCH_FAILURE); - CASE_RETURN_STRING(QCA_DISCONNECT_REASON_USER_TRIGGERED); - case QCA_DISCONNECT_REASON_UNSPECIFIED: - return ""; - default: - return "Unknown"; - } -} - -enum qca_disconnect_reason_codes -osif_cm_mac_to_qca_reason(enum wlan_reason_code internal_reason) -{ - enum qca_disconnect_reason_codes reason = - QCA_DISCONNECT_REASON_UNSPECIFIED; - - if (internal_reason < REASON_PROP_START) - return reason; - - switch (internal_reason) { - case REASON_HOST_TRIGGERED_ROAM_FAILURE: - reason = QCA_DISCONNECT_REASON_INTERNAL_ROAM_FAILURE; - break; - case REASON_FW_TRIGGERED_ROAM_FAILURE: - reason = QCA_DISCONNECT_REASON_EXTERNAL_ROAM_FAILURE; - break; - case REASON_GATEWAY_REACHABILITY_FAILURE: - reason = - QCA_DISCONNECT_REASON_GATEWAY_REACHABILITY_FAILURE; - break; - case REASON_UNSUPPORTED_CHANNEL_CSA: - reason = QCA_DISCONNECT_REASON_UNSUPPORTED_CHANNEL_CSA; - break; - case REASON_OPER_CHANNEL_DISABLED_INDOOR: - reason = - QCA_DISCONNECT_REASON_OPER_CHANNEL_DISABLED_INDOOR; - break; - case REASON_OPER_CHANNEL_USER_DISABLED: - reason = - QCA_DISCONNECT_REASON_OPER_CHANNEL_USER_DISABLED; - break; - case REASON_DEVICE_RECOVERY: - reason = QCA_DISCONNECT_REASON_DEVICE_RECOVERY; - break; - case REASON_KEY_TIMEOUT: - reason = QCA_DISCONNECT_REASON_KEY_TIMEOUT; - break; - case REASON_OPER_CHANNEL_BAND_CHANGE: - reason = QCA_DISCONNECT_REASON_OPER_CHANNEL_BAND_CHANGE; - break; - case REASON_IFACE_DOWN: - reason = QCA_DISCONNECT_REASON_IFACE_DOWN; - break; - case REASON_PEER_XRETRY_FAIL: - reason = QCA_DISCONNECT_REASON_PEER_XRETRY_FAIL; - break; - case REASON_PEER_INACTIVITY: - reason = QCA_DISCONNECT_REASON_PEER_INACTIVITY; - break; - case REASON_SA_QUERY_TIMEOUT: - reason = QCA_DISCONNECT_REASON_SA_QUERY_TIMEOUT; - break; - case REASON_CHANNEL_SWITCH_FAILED: - reason = QCA_DISCONNECT_REASON_CHANNEL_SWITCH_FAILURE; - break; - case REASON_BEACON_MISSED: - reason = QCA_DISCONNECT_REASON_BEACON_MISS_FAILURE; - break; - case REASON_USER_TRIGGERED_ROAM_FAILURE: - reason = QCA_DISCONNECT_REASON_USER_TRIGGERED; - break; - default: - osif_debug("No QCA reason code for mac reason: %u", - internal_reason); - /* Unspecified reason by default */ - } - - return reason; -} - -void osif_cm_reset_id_and_src_no_lock(struct vdev_osif_priv *osif_priv) -{ - osif_priv->cm_info.last_id = CM_ID_INVALID; - osif_priv->cm_info.last_source = CM_SOURCE_INVALID; -} - -QDF_STATUS osif_cm_reset_id_and_src(struct wlan_objmgr_vdev *vdev) -{ - struct vdev_osif_priv *osif_priv = wlan_vdev_get_ospriv(vdev); - - if (!osif_priv) { - osif_err("Invalid vdev osif priv"); - return QDF_STATUS_E_INVAL; - } - qdf_spinlock_acquire(&osif_priv->cm_info.cmd_id_lock); - osif_cm_reset_id_and_src_no_lock(osif_priv); - qdf_spinlock_release(&osif_priv->cm_info.cmd_id_lock); - - return QDF_STATUS_SUCCESS; -} - -/** - * osif_cm_connect_complete_cb() - Connect complete callback - * @vdev: vdev pointer - * @rsp: connect response - * - * Return: QDF_STATUS - */ -static QDF_STATUS -osif_cm_connect_complete_cb(struct wlan_objmgr_vdev *vdev, - struct wlan_cm_connect_rsp *rsp) -{ - return osif_connect_handler(vdev, rsp); -} - -/** - * osif_cm_failed_candidate_cb() - Callback to indicate failed candidate - * @vdev: vdev pointer - * @rsp: connect response - * - * Return: QDF_STATUS - */ -static QDF_STATUS -osif_cm_failed_candidate_cb(struct wlan_objmgr_vdev *vdev, - struct wlan_cm_connect_rsp *rsp) -{ - return osif_failed_candidate_handler(vdev, rsp); -} - -/** - * osif_cm_update_id_and_src_cb() - Callback to update id and - * source of the connect/disconnect request - * @vdev: vdev pointer - * @Source: Source of the connect req - * @id: Connect/disconnect id - * - * Context: Any context. Takes and releases cmd id spinlock - * Return: QDF_STATUS - */ -static QDF_STATUS -osif_cm_update_id_and_src_cb(struct wlan_objmgr_vdev *vdev, - enum wlan_cm_source source, wlan_cm_id cm_id) -{ - struct vdev_osif_priv *osif_priv = wlan_vdev_get_ospriv(vdev); - - if (!osif_priv) { - osif_err("Invalid vdev osif priv"); - return QDF_STATUS_E_INVAL; - } - - qdf_spinlock_acquire(&osif_priv->cm_info.cmd_id_lock); - osif_priv->cm_info.last_id = cm_id; - osif_priv->cm_info.last_source = source; - qdf_spinlock_release(&osif_priv->cm_info.cmd_id_lock); - - return QDF_STATUS_SUCCESS; -} - -/** - * osif_cm_disconnect_complete_cb() - Disconnect done callback - * @vdev: vdev pointer - * @disconnect_rsp: Disconnect response - * - * Context: Any context - * Return: QDF_STATUS - */ - -static QDF_STATUS -osif_cm_disconnect_complete_cb(struct wlan_objmgr_vdev *vdev, - struct wlan_cm_discon_rsp *rsp) -{ - return osif_disconnect_handler(vdev, rsp); -} - -/** - * osif_cm_disconnect_start_cb() - Disconnect start callback - * @vdev: vdev pointer - * - * This callback indicates os_if that disconnection is started - * so that os_if can stop all the activity on this connection - * - * Return: QDF_STATUS - */ -static QDF_STATUS -osif_cm_disconnect_start_cb(struct wlan_objmgr_vdev *vdev) -{ - return QDF_STATUS_SUCCESS; -} - -static struct mlme_cm_ops cm_ops = { - .mlme_cm_connect_complete_cb = osif_cm_connect_complete_cb, - .mlme_cm_failed_candidate_cb = osif_cm_failed_candidate_cb, - .mlme_cm_update_id_and_src_cb = osif_cm_update_id_and_src_cb, - .mlme_cm_disconnect_complete_cb = osif_cm_disconnect_complete_cb, - .mlme_cm_disconnect_start_cb = osif_cm_disconnect_start_cb, -}; - -/** - * osif_cm_get_global_ops() - Get connection manager global ops - * - * Return: Connection manager global ops - */ -static struct mlme_cm_ops *osif_cm_get_global_ops(void) -{ - return &cm_ops; -} - -QDF_STATUS osif_cm_register_cb(void) -{ - mlme_set_osif_cm_cb(osif_cm_get_global_ops); - - return QDF_STATUS_SUCCESS; -} - -QDF_STATUS osif_cm_osif_priv_init(struct wlan_objmgr_vdev *vdev) -{ - struct vdev_osif_priv *osif_priv = wlan_vdev_get_ospriv(vdev); - enum QDF_OPMODE mode = wlan_vdev_mlme_get_opmode(vdev); - - if (mode != QDF_STA_MODE && mode != QDF_P2P_CLIENT_MODE) - return QDF_STATUS_SUCCESS; - - if (!osif_priv) { - osif_err("Invalid vdev osif priv"); - return QDF_STATUS_E_INVAL; - } - - qdf_spinlock_create(&osif_priv->cm_info.cmd_id_lock); - - return QDF_STATUS_SUCCESS; -} - -QDF_STATUS osif_cm_osif_priv_deinit(struct wlan_objmgr_vdev *vdev) -{ - struct vdev_osif_priv *osif_priv = wlan_vdev_get_ospriv(vdev); - enum QDF_OPMODE mode = wlan_vdev_mlme_get_opmode(vdev); - - if (mode != QDF_STA_MODE && mode != QDF_P2P_CLIENT_MODE) - return QDF_STATUS_SUCCESS; - - if (!osif_priv) { - osif_err("Invalid vdev osif priv"); - return QDF_STATUS_E_INVAL; - } - - qdf_spinlock_destroy(&osif_priv->cm_info.cmd_id_lock); - - return QDF_STATUS_SUCCESS; -} diff --git a/os_if/linux/wlan_osif_priv.h b/os_if/linux/wlan_osif_priv.h index ff4bd6c2b12f..6e43df5a0d83 100644 --- a/os_if/linux/wlan_osif_priv.h +++ b/os_if/linux/wlan_osif_priv.h @@ -21,7 +21,6 @@ #define _WLAN_OSIF_PRIV_H_ #include "qdf_net_if.h" -#include "wlan_cm_public_struct.h" #include struct osif_scan_pdev; @@ -41,39 +40,16 @@ struct pdev_osif_priv { struct qdf_net_if *nif; }; -#ifdef FEATURE_CM_ENABLE -/** - * struct osif_cm_info - osif connection manager info - * @last_source: Last command request source - * @last_id: Last command from connection manager - * @cmd_id_lock: lock to update and read last command source - * @last_disconnect_reason: last disconnect reason to be indicated in get - * station - * @ext_priv: legacy data pointer. - */ -struct osif_cm_info { - enum wlan_cm_source last_source; - wlan_cm_id last_id; - struct qdf_spinlock cmd_id_lock; - enum qca_disconnect_reason_codes last_disconnect_reason; - void *ext_priv; -}; -#endif - /** * struct vdev_osif_priv - OS private structure of vdev * @wdev: wireless device handle * @legacy_osif_priv: legacy osif private handle * @osif_tdls: osif tdls info - * @cm_info: osif connection manager info */ struct vdev_osif_priv { struct wireless_dev *wdev; void *legacy_osif_priv; struct osif_tdls_vdev *osif_tdls; -#ifdef FEATURE_CM_ENABLE - struct osif_cm_info cm_info; -#endif }; #endif diff --git a/umac/mlme/connection_mgr/core/src/wlan_cm_connect.c b/umac/mlme/connection_mgr/core/src/wlan_cm_connect.c deleted file mode 100644 index 71e9277762c2..000000000000 --- a/umac/mlme/connection_mgr/core/src/wlan_cm_connect.c +++ /dev/null @@ -1,1291 +0,0 @@ -/* - * Copyright (c) 2012-2015, 2020, 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. - */ - -/** - * DOC: Implements connect specific APIs of connection manager - */ - -#include "wlan_cm_main_api.h" -#include "wlan_cm_bss_score_param.h" -#include "wlan_scan_api.h" -#include "wlan_cm_sm.h" -#ifdef WLAN_POLICY_MGR_ENABLE -#include "wlan_policy_mgr_api.h" -#endif -#include -#include "wlan_crypto_global_api.h" -#ifdef CONN_MGR_ADV_FEATURE -#include "wlan_blm_api.h" -#endif - -static void -cm_fill_failure_resp_from_cm_id(struct cnx_mgr *cm_ctx, - struct wlan_cm_connect_rsp *resp, - wlan_cm_id cm_id, - enum wlan_cm_connect_fail_reason reason) -{ - resp->connect_status = QDF_STATUS_E_FAILURE; - resp->cm_id = cm_id; - resp->vdev_id = wlan_vdev_get_id(cm_ctx->vdev); - resp->reason = reason; - /* Get bssid and ssid and freq for the cm id from the req list */ - cm_fill_bss_info_in_connect_rsp_by_cm_id(cm_ctx, cm_id, resp); -} - -/** - * cm_connect_handle_event_post_fail() - initiate connect failure if msg posting - * to SM fails - * @cm_ctx: connection manager context - * @cm_id: cm_id for connect req for which post fails - * - * Context: Can be called from any context and to be used only after posting a - * msg to SM fails from external event e.g. peer create resp, - * HW mode change resp serialization cb. - * - * Return: QDF_STATUS - */ -static void -cm_connect_handle_event_post_fail(struct cnx_mgr *cm_ctx, wlan_cm_id cm_id) -{ - struct wlan_cm_connect_rsp *resp; - - resp = qdf_mem_malloc(sizeof(*resp)); - if (!resp) - return; - - cm_fill_failure_resp_from_cm_id(cm_ctx, resp, cm_id, - CM_ABORT_DUE_TO_NEW_REQ_RECVD); - cm_connect_complete(cm_ctx, resp); - qdf_mem_free(resp); -} - -static QDF_STATUS cm_connect_cmd_timeout(struct cnx_mgr *cm_ctx, - wlan_cm_id cm_id) -{ - struct wlan_cm_connect_rsp *resp; - QDF_STATUS status; - - resp = qdf_mem_malloc(sizeof(*resp)); - if (!resp) - return QDF_STATUS_E_NOMEM; - - cm_fill_failure_resp_from_cm_id(cm_ctx, resp, cm_id, CM_SER_TIMEOUT); - status = cm_sm_deliver_event(cm_ctx->vdev, - WLAN_CM_SM_EV_CONNECT_FAILURE, - sizeof(*resp), resp); - qdf_mem_free(resp); - - if (QDF_IS_STATUS_ERROR(status)) - cm_connect_handle_event_post_fail(cm_ctx, cm_id); - - return status; -} - -static QDF_STATUS -cm_ser_connect_cb(struct wlan_serialization_command *cmd, - enum wlan_serialization_cb_reason reason) -{ - QDF_STATUS status = QDF_STATUS_SUCCESS; - struct wlan_objmgr_vdev *vdev; - struct cnx_mgr *cm_ctx; - - if (!cmd) { - mlme_err("cmd is NULL, reason: %d", reason); - QDF_ASSERT(0); - return QDF_STATUS_E_NULL_VALUE; - } - - vdev = cmd->vdev; - - cm_ctx = cm_get_cm_ctx(vdev); - if (!cm_ctx) - return QDF_STATUS_E_NULL_VALUE; - - switch (reason) { - case WLAN_SER_CB_ACTIVATE_CMD: - /* - * For pending to active reason, use async api to take lock. - * For direct activation use sync api to avoid taking lock - * as lock is already acquired by the requester. - */ - if (cmd->activation_reason == SER_PENDING_TO_ACTIVE) - status = cm_sm_deliver_event(vdev, - WLAN_CM_SM_EV_CONNECT_ACTIVE, - sizeof(wlan_cm_id), - &cmd->cmd_id); - else - status = cm_sm_deliver_event_sync(cm_ctx, - WLAN_CM_SM_EV_CONNECT_ACTIVE, - sizeof(wlan_cm_id), - &cmd->cmd_id); - if (QDF_IS_STATUS_SUCCESS(status)) - break; - /* - * Handle failure if posting fails, i.e. the SM state has - * changed or head cm_id doesn't match the active cm_id. - * connect active should be handled only in JOIN_PENDING. If - * new command has been received connect activation should be - * aborted from here with connect req cleanup. - */ - cm_connect_handle_event_post_fail(cm_ctx, cmd->cmd_id); - break; - case WLAN_SER_CB_CANCEL_CMD: - /* command removed from pending list. */ - break; - case WLAN_SER_CB_ACTIVE_CMD_TIMEOUT: - mlme_err(CM_PREFIX_FMT "Active command timeout", - CM_PREFIX_REF(wlan_vdev_get_id(vdev), cmd->cmd_id)); - QDF_ASSERT(0); - - cm_connect_cmd_timeout(cm_ctx, cmd->cmd_id); - break; - case WLAN_SER_CB_RELEASE_MEM_CMD: - cm_reset_active_cm_id(vdev, cmd->cmd_id); - wlan_objmgr_vdev_release_ref(vdev, WLAN_MLME_CM_ID); - break; - default: - QDF_ASSERT(0); - status = QDF_STATUS_E_INVAL; - break; - } - - return status; -} - -#define CONNECT_TIMEOUT 30000 - -static QDF_STATUS cm_ser_connect_req(struct wlan_objmgr_pdev *pdev, - struct cnx_mgr *cm_ctx, - struct cm_connect_req *cm_req) -{ - struct wlan_serialization_command cmd = {0, }; - enum wlan_serialization_status ser_cmd_status; - QDF_STATUS status; - uint8_t vdev_id = wlan_vdev_get_id(cm_ctx->vdev); - - status = wlan_objmgr_vdev_try_get_ref(cm_ctx->vdev, WLAN_MLME_CM_ID); - if (QDF_IS_STATUS_ERROR(status)) { - mlme_err(CM_PREFIX_FMT "unable to get reference", - CM_PREFIX_REF(vdev_id, cm_req->cm_id)); - return status; - } - - cmd.cmd_type = WLAN_SER_CMD_VDEV_CONNECT; - cmd.cmd_id = cm_req->cm_id; - cmd.cmd_cb = cm_ser_connect_cb; - cmd.source = WLAN_UMAC_COMP_MLME; - cmd.is_high_priority = false; - cmd.cmd_timeout_duration = CONNECT_TIMEOUT; - cmd.vdev = cm_ctx->vdev; - cmd.is_blocking = cm_ser_get_blocking_cmd(); - - ser_cmd_status = wlan_serialization_request(&cmd); - switch (ser_cmd_status) { - case WLAN_SER_CMD_PENDING: - /* command moved to pending list.Do nothing */ - break; - case WLAN_SER_CMD_ACTIVE: - /* command moved to active list. Do nothing */ - break; - default: - mlme_err(CM_PREFIX_FMT "ser cmd status %d", - CM_PREFIX_REF(vdev_id, cm_req->cm_id), ser_cmd_status); - wlan_objmgr_vdev_release_ref(cm_ctx->vdev, WLAN_MLME_CM_ID); - - return QDF_STATUS_E_FAILURE; - } - - return QDF_STATUS_SUCCESS; -} - -/** - * cm_send_connect_start_fail() - initiate conenct failure - * @cm_ctx: connection manager context - * @req: connect req for which connect failed - * @reason: failure reason - * - * Context: Can be called from any context and to be used only after posting a - * msg to SM (ie holding the SM lock) to avoid use after free for req. - * - * Return: QDF_STATUS - */ -static QDF_STATUS -cm_send_connect_start_fail(struct cnx_mgr *cm_ctx, - struct cm_connect_req *req, - enum wlan_cm_connect_fail_reason reason) -{ - struct wlan_cm_connect_rsp *resp; - QDF_STATUS status; - - resp = qdf_mem_malloc(sizeof(*resp)); - if (!resp) - return QDF_STATUS_E_NOMEM; - - resp->connect_status = QDF_STATUS_E_FAILURE; - resp->cm_id = req->cm_id; - resp->vdev_id = wlan_vdev_get_id(cm_ctx->vdev); - resp->reason = reason; - resp->ssid.length = req->req.ssid.length; - qdf_mem_copy(resp->ssid.ssid, req->req.ssid.ssid, resp->ssid.length); - if (req->cur_candidate) { - qdf_copy_macaddr(&resp->bssid, - &req->cur_candidate->entry->bssid); - resp->freq = req->cur_candidate->entry->channel.chan_freq; - } - - status = cm_sm_deliver_event_sync(cm_ctx, WLAN_CM_SM_EV_CONNECT_FAILURE, - sizeof(*resp), resp); - qdf_mem_free(resp); - - return status; -} - -#ifdef WLAN_POLICY_MGR_ENABLE - -QDF_STATUS cm_handle_hw_mode_change(struct cnx_mgr *cm_ctx, wlan_cm_id *cm_id, - enum wlan_cm_sm_evt event) -{ - struct cm_req *cm_req; - enum wlan_cm_connect_fail_reason reason = CM_GENERIC_FAILURE; - struct wlan_objmgr_pdev *pdev; - QDF_STATUS status; - - if (!cm_id) - return QDF_STATUS_E_FAILURE; - - cm_req = cm_get_req_by_cm_id(cm_ctx, *cm_id); - if (!cm_req) - return QDF_STATUS_E_INVAL; - - pdev = wlan_vdev_get_pdev(cm_ctx->vdev); - if (!pdev) { - mlme_err(CM_PREFIX_FMT "Failed to find pdev", - CM_PREFIX_REF(wlan_vdev_get_id(cm_ctx->vdev), - cm_req->cm_id)); - goto send_failure; - } - - if (event == WLAN_CM_SM_EV_HW_MODE_SUCCESS) { - status = cm_ser_connect_req(pdev, cm_ctx, &cm_req->connect_req); - if (QDF_IS_STATUS_ERROR(status)) { - reason = CM_SER_FAILURE; - goto send_failure; - } - return status; - } - - /* Set reason HW mode fail for event WLAN_CM_SM_EV_HW_MODE_FAILURE */ - reason = CM_HW_MODE_FAILURE; - -send_failure: - return cm_send_connect_start_fail(cm_ctx, &cm_req->connect_req, reason); -} - -void cm_hw_mode_change_resp(struct wlan_objmgr_pdev *pdev, uint8_t vdev_id, - wlan_cm_id cm_id, QDF_STATUS status) -{ - struct wlan_objmgr_vdev *vdev; - QDF_STATUS qdf_status; - enum wlan_cm_sm_evt event = WLAN_CM_SM_EV_HW_MODE_SUCCESS; - struct cnx_mgr *cm_ctx; - - mlme_debug(CM_PREFIX_FMT "Continue connect after HW mode change, status %d", - CM_PREFIX_REF(vdev_id, cm_id), status); - - vdev = wlan_objmgr_get_vdev_by_id_from_pdev(pdev, vdev_id, - WLAN_MLME_CM_ID); - if (!vdev) - return; - - cm_ctx = cm_get_cm_ctx(vdev); - if (!cm_ctx) { - wlan_objmgr_vdev_release_ref(vdev, WLAN_MLME_CM_ID); - return; - } - - if (QDF_IS_STATUS_ERROR(status)) - event = WLAN_CM_SM_EV_HW_MODE_FAILURE; - qdf_status = cm_sm_deliver_event(vdev, event, sizeof(wlan_cm_id), - &cm_id); - - /* - * Handle failure if posting fails, i.e. the SM state has - * changed or head cm_id doesn't match the active cm_id. - * hw mode change resp should be handled only in JOIN_PENDING. If - * new command has been received connect should be - * aborted from here with connect req cleanup. - */ - if (QDF_IS_STATUS_ERROR(status)) - cm_connect_handle_event_post_fail(cm_ctx, cm_id); - wlan_objmgr_vdev_release_ref(vdev, WLAN_MLME_CM_ID); -} - -static QDF_STATUS cm_check_for_hw_mode_change(struct wlan_objmgr_psoc *psoc, - qdf_list_t *scan_list, - uint8_t vdev_id, - wlan_cm_id connect_id) -{ - return policy_mgr_change_hw_mode_sta_connect(psoc, scan_list, vdev_id, - connect_id); -} - -static void -cm_get_pcl_chan_weigtage_for_sta(struct wlan_objmgr_pdev *pdev, - struct pcl_freq_weight_list *pcl_lst) -{ - enum QDF_OPMODE opmode = QDF_STA_MODE; - enum policy_mgr_con_mode pm_mode; - uint32_t num_entries = 0; - QDF_STATUS status; - - if (!pcl_lst) - return; - - if (policy_mgr_map_concurrency_mode(&opmode, &pm_mode)) { - status = policy_mgr_get_pcl(wlan_pdev_get_psoc(pdev), pm_mode, - pcl_lst->pcl_freq_list, - &num_entries, - pcl_lst->pcl_weight_list, - NUM_CHANNELS); - if (QDF_IS_STATUS_ERROR(status)) - return; - pcl_lst->num_of_pcl_channels = num_entries; - } -} - -static void cm_calculate_scores(struct wlan_objmgr_pdev *pdev, - struct scan_filter *filter, qdf_list_t *list) -{ - struct pcl_freq_weight_list *pcl_lst = NULL; - - if (!filter->num_of_bssid) { - pcl_lst = qdf_mem_malloc(sizeof(*pcl_lst)); - cm_get_pcl_chan_weigtage_for_sta(pdev, pcl_lst); - if (pcl_lst && !pcl_lst->num_of_pcl_channels) { - qdf_mem_free(pcl_lst); - pcl_lst = NULL; - } - } - wlan_cm_calculate_bss_score(pdev, pcl_lst, list, &filter->bssid_hint); - if (pcl_lst) - qdf_mem_free(pcl_lst); -} -#else - -static QDF_STATUS cm_check_for_hw_mode_change(struct wlan_objmgr_psoc *psoc, - qdf_list_t *scan_list, - uint8_t vdev_id, - uint8_t connect_id) -{ - return QDF_STATUS_E_ALREADY; -} - -static inline -void cm_calculate_scores(struct wlan_objmgr_pdev *pdev, - struct scan_filter *filter, qdf_list_t *list) -{ - wlan_cm_calculate_bss_score(pdev, NULL, list, &filter->bssid_hint); -} -#endif - -static inline void -cm_set_pmf_caps(struct cm_connect_req *cm_req, struct scan_filter *filter) -{ - if (cm_req->req.crypto.rsn_caps & WLAN_CRYPTO_RSN_CAP_MFP_REQUIRED) - filter->pmf_cap = WLAN_PMF_REQUIRED; - else if (cm_req->req.crypto.rsn_caps & WLAN_CRYPTO_RSN_CAP_MFP_ENABLED) - filter->pmf_cap = WLAN_PMF_CAPABLE; - else - filter->pmf_cap = WLAN_PMF_DISABLED; -} - -static void cm_connect_prepare_scan_fliter(struct cnx_mgr *cm_ctx, - struct cm_connect_req *cm_req, - struct scan_filter *filter) -{ - if (!qdf_is_macaddr_zero(&cm_req->req.bssid)) { - filter->num_of_bssid = 1; - qdf_copy_macaddr(&filter->bssid_list[0], &cm_req->req.bssid); - } - - qdf_copy_macaddr(&filter->bssid_hint, &cm_req->req.bssid_hint); - filter->num_of_ssid = 1; - qdf_mem_copy(&filter->ssid_list[0], &cm_req->req.ssid, - sizeof(struct wlan_ssid)); - - if (cm_req->req.chan_freq) { - filter->num_of_channels = 1; - filter->chan_freq_list[0] = cm_req->req.chan_freq; - } - - /* Fill band (STA+STA) */ - /* RSN OVERRIDE */ - - filter->authmodeset = cm_req->req.crypto.auth_type; - filter->ucastcipherset = cm_req->req.crypto.ciphers_pairwise; - filter->key_mgmt = cm_req->req.crypto.akm_suites; - filter->mcastcipherset = cm_req->req.crypto.group_cipher; - filter->mgmtcipherset = cm_req->req.crypto.mgmt_ciphers; - - cm_set_pmf_caps(cm_req, filter); - - /* FOR WPS/OSEN set ignore auth */ - /* SET mobility domain */ - /* Fill fils info */ -} - -static QDF_STATUS cm_connect_get_candidates(struct wlan_objmgr_pdev *pdev, - struct cnx_mgr *cm_ctx, - struct cm_connect_req *cm_req) -{ - struct scan_filter *filter; - uint32_t num_bss = 0; - enum QDF_OPMODE op_mode; - qdf_list_t *candidate_list; - uint8_t vdev_id = wlan_vdev_get_id(cm_ctx->vdev); - - filter = qdf_mem_malloc(sizeof(*filter)); - if (!filter) - return QDF_STATUS_E_NOMEM; - - cm_connect_prepare_scan_fliter(cm_ctx, cm_req, filter); - - candidate_list = wlan_scan_get_result(pdev, filter); - if (candidate_list) { - num_bss = qdf_list_size(candidate_list); - mlme_debug(CM_PREFIX_FMT "num_entries found %d", - CM_PREFIX_REF(vdev_id, cm_req->cm_id), num_bss); - } - - op_mode = wlan_vdev_mlme_get_opmode(cm_ctx->vdev); - if (num_bss && op_mode == QDF_STA_MODE) - cm_calculate_scores(pdev, filter, candidate_list); - qdf_mem_free(filter); - - if (!candidate_list || !qdf_list_size(candidate_list)) { - if (candidate_list) - wlan_scan_purge_results(candidate_list); - mlme_info(CM_PREFIX_FMT "no valid candidate found, num_bss %d", - CM_PREFIX_REF(vdev_id, cm_req->cm_id), num_bss); - /* - * Do connect scan only of no candidates were found - * if candidates were found and were removed due to invalid - * return failure - */ - if (!num_bss) - return cm_sm_deliver_event_sync(cm_ctx, - WLAN_CM_SM_EV_SCAN, - sizeof(*cm_req), - cm_req); - - return QDF_STATUS_E_EMPTY; - } - cm_req->candidate_list = candidate_list; - - return QDF_STATUS_SUCCESS; -} - -#ifdef WLAN_FEATURE_INTERFACE_MGR -static QDF_STATUS cm_validate_candidate(struct cnx_mgr *cm_ctx, - struct scan_cache_entry *scan_entry) -{ - struct if_mgr_event_data event_data = {0}; - - event_data.validate_bss_info.chan_freq = scan_entry->channel.chan_freq; - qdf_copy_macaddr(&event_data.validate_bss_info.peer_addr, - &scan_entry->bssid); - - return if_mgr_deliver_event(cm_ctx->vdev, - WLAN_IF_MGR_EV_VALIDATE_CANDIDATE, - &event_data); -} - -static QDF_STATUS -cm_inform_if_mgr_connect_complete(struct wlan_objmgr_vdev *vdev, - QDF_STATUS connect_status) -{ - struct if_mgr_event_data *connect_complete; - - connect_complete = qdf_mem_malloc(sizeof(*connect_complete)); - if (!connect_complete) - return QDF_STATUS_E_NOMEM; - - connect_complete->status = connect_status; - if_mgr_deliver_event(vdev, WLAN_IF_MGR_EV_CONNECT_COMPLETE, - connect_complete); - qdf_mem_free(connect_complete); - - return QDF_STATUS_SUCCESS; -} - -static QDF_STATUS -cm_inform_if_mgr_connect_start(struct wlan_objmgr_vdev *vdev) -{ - return if_mgr_deliver_event(vdev, WLAN_IF_MGR_EV_CONNECT_START, NULL); -} - -#else -static inline -QDF_STATUS cm_validate_candidate(struct cnx_mgr *cm_ctx, - struct scan_cache_entry *scan_entry) -{ - return QDF_STATUS_SUCCESS; -} - -static inline QDF_STATUS -cm_inform_if_mgr_connect_complete(struct wlan_objmgr_vdev *vdev, - QDF_STATUS connect_status) -{ - return QDF_STATUS_SUCCESS; -} - -static QDF_STATUS -cm_inform_if_mgr_connect_start(struct wlan_objmgr_vdev *vdev) -{ - return QDF_STATUS_SUCCESS; -} - -#endif - -QDF_STATUS cm_connect_start(struct cnx_mgr *cm_ctx, - struct cm_connect_req *cm_req) -{ - struct wlan_objmgr_pdev *pdev; - struct wlan_objmgr_psoc *psoc; - enum wlan_cm_connect_fail_reason reason = CM_GENERIC_FAILURE; - QDF_STATUS status; - uint8_t vdev_id = wlan_vdev_get_id(cm_ctx->vdev); - - /* Interface event */ - pdev = wlan_vdev_get_pdev(cm_ctx->vdev); - if (!pdev) { - mlme_err(CM_PREFIX_FMT "Failed to find pdev", - CM_PREFIX_REF(vdev_id, cm_req->cm_id)); - goto connect_err; - } - - psoc = wlan_pdev_get_psoc(pdev); - if (!psoc) { - mlme_err(CM_PREFIX_FMT "Failed to find psoc", - CM_PREFIX_REF(vdev_id, cm_req->cm_id)); - goto connect_err; - } - - cm_inform_if_mgr_connect_start(cm_ctx->vdev); - mlme_cm_connect_start_ind(cm_ctx->vdev, &cm_req->req); - - status = cm_connect_get_candidates(pdev, cm_ctx, cm_req); - if (QDF_IS_STATUS_ERROR(status)) { - reason = CM_NO_CANDIDATE_FOUND; - goto connect_err; - } - - status = cm_check_for_hw_mode_change(psoc, cm_req->candidate_list, - vdev_id, cm_req->cm_id); - if (QDF_IS_STATUS_ERROR(status) && status != QDF_STATUS_E_ALREADY) { - reason = CM_HW_MODE_FAILURE; - mlme_err(CM_PREFIX_FMT "Failed to set HW mode change", - CM_PREFIX_REF(vdev_id, cm_req->cm_id)); - goto connect_err; - } else if (QDF_IS_STATUS_SUCCESS(status)) { - mlme_debug(CM_PREFIX_FMT "Connect will continue after HW mode change", - CM_PREFIX_REF(vdev_id, cm_req->cm_id)); - return QDF_STATUS_SUCCESS; - } - - status = cm_ser_connect_req(pdev, cm_ctx, cm_req); - if (QDF_IS_STATUS_ERROR(status)) { - reason = CM_SER_FAILURE; - goto connect_err; - } - - return QDF_STATUS_SUCCESS; - -connect_err: - return cm_send_connect_start_fail(cm_ctx, cm_req, reason); -} - -/** - * cm_get_valid_candidate() - This API will be called to get the next valid - * candidate - * @cm_ctx: connection manager context - * @cm_req: Connect request. - * - * This function return a valid candidate to try connection. It return failure - * if no valid candidate is present or all valid candidate are tried. - * - * Return: QDF status - */ -static QDF_STATUS cm_get_valid_candidate(struct cnx_mgr *cm_ctx, - struct cm_req *cm_req) -{ - struct scan_cache_node *scan_node = NULL; - qdf_list_node_t *cur_node = NULL, *next_node = NULL; - struct scan_cache_node *cur_candidate; - QDF_STATUS status = QDF_STATUS_SUCCESS; - uint8_t vdev_id = wlan_vdev_get_id(cm_ctx->vdev); - - if (cm_req->connect_req.connect_attempts >= - cm_ctx->max_connect_attempts) { - mlme_info(CM_PREFIX_FMT "%d attempts tried, max %d", - CM_PREFIX_REF(vdev_id, cm_req->cm_id), - cm_req->connect_req.connect_attempts, - cm_ctx->max_connect_attempts); - return QDF_STATUS_E_FAILURE; - } - - cur_candidate = cm_req->connect_req.cur_candidate; - /* - * Get next candidate if cur_candidate is not NULL, else get - * the first candidate - */ - if (cur_candidate) - qdf_list_peek_next(cm_req->connect_req.candidate_list, - &cur_candidate->node, &cur_node); - else - qdf_list_peek_front(cm_req->connect_req.candidate_list, - &cur_node); - - while (cur_node) { - qdf_list_peek_next(cm_req->connect_req.candidate_list, - cur_node, &next_node); - scan_node = qdf_container_of(cur_node, struct scan_cache_node, - node); - status = cm_validate_candidate(cm_ctx, scan_node->entry); - if (QDF_IS_STATUS_SUCCESS(status)) { - cur_candidate = scan_node; - break; - } - - cur_node = next_node; - next_node = NULL; - } - - /* - * If cur_node is NULL cur candidate was last to be tried so no more - * candidates left for connect now. - */ - if (!cur_node) { - mlme_debug(CM_PREFIX_FMT "No more candidates left", - CM_PREFIX_REF(vdev_id, cm_req->cm_id)); - cm_req->connect_req.cur_candidate = NULL; - return QDF_STATUS_E_FAILURE; - } - - cm_req->connect_req.connect_attempts++; - cm_req->connect_req.cur_candidate = cur_candidate; - - return QDF_STATUS_SUCCESS; -} - -static void cm_create_bss_peer(struct cnx_mgr *cm_ctx, - struct cm_connect_req *req) -{ - QDF_STATUS status; - struct qdf_mac_addr *bssid; - - bssid = &req->cur_candidate->entry->bssid; - status = mlme_cm_bss_peer_create_req(cm_ctx->vdev, bssid); - if (QDF_IS_STATUS_ERROR(status)) { - struct wlan_cm_connect_rsp *resp; - uint8_t vdev_id = wlan_vdev_get_id(cm_ctx->vdev); - - /* In case of failure try with next candidate */ - mlme_err(CM_PREFIX_FMT "peer create request failed %d", - CM_PREFIX_REF(vdev_id, req->cm_id), status); - - resp = qdf_mem_malloc(sizeof(*resp)); - if (!resp) - return; - - cm_fill_failure_resp_from_cm_id(cm_ctx, resp, req->cm_id, - CM_PEER_CREATE_FAILED); - cm_sm_deliver_event_sync(cm_ctx, - WLAN_CM_SM_EV_CONNECT_GET_NEXT_CANDIDATE, - sizeof(*resp), resp); - qdf_mem_free(resp); - } -} - -static QDF_STATUS -cm_send_bss_select_ind(struct cnx_mgr *cm_ctx, struct cm_connect_req *req) -{ - QDF_STATUS status; - struct wlan_cm_vdev_connect_req vdev_req; - struct wlan_cm_connect_rsp *resp; - - vdev_req.vdev_id = wlan_vdev_get_id(cm_ctx->vdev); - vdev_req.cm_id = req->cm_id; - vdev_req.bss = req->cur_candidate; - - status = mlme_cm_bss_select_ind(cm_ctx->vdev, &vdev_req); - if (QDF_IS_STATUS_SUCCESS(status) || - status == QDF_STATUS_E_NOSUPPORT) - return status; - - /* In supported and failure try with next candidate */ - mlme_err(CM_PREFIX_FMT "mlme candidate select indication failed %d", - CM_PREFIX_REF(vdev_req.vdev_id, req->cm_id), status); - resp = qdf_mem_malloc(sizeof(*resp)); - if (!resp) - return QDF_STATUS_E_FAILURE; - - cm_fill_failure_resp_from_cm_id(cm_ctx, resp, req->cm_id, - CM_BSS_SELECT_IND_FAILED); - cm_sm_deliver_event_sync(cm_ctx, - WLAN_CM_SM_EV_CONNECT_GET_NEXT_CANDIDATE, - sizeof(*resp), resp); - qdf_mem_free(resp); - - return QDF_STATUS_SUCCESS; -} - -QDF_STATUS cm_try_next_candidate(struct cnx_mgr *cm_ctx, - struct wlan_cm_connect_rsp *resp) -{ - QDF_STATUS status; - struct cm_req *cm_req; - - cm_req = cm_get_req_by_cm_id(cm_ctx, resp->cm_id); - if (!cm_req) - return QDF_STATUS_E_FAILURE; - - status = cm_get_valid_candidate(cm_ctx, cm_req); - if (QDF_IS_STATUS_ERROR(status)) - goto connect_err; - - mlme_cm_osif_failed_candidate_ind(cm_ctx->vdev, resp); - - status = cm_send_bss_select_ind(cm_ctx, &cm_req->connect_req); - /* - * If candidate select indication is not supported continue with bss - * peer create, else peer will be created after resp. - */ - if (status == QDF_STATUS_E_NOSUPPORT) - cm_create_bss_peer(cm_ctx, &cm_req->connect_req); - else if (QDF_IS_STATUS_ERROR(status)) - goto connect_err; - - return QDF_STATUS_SUCCESS; - -connect_err: - return cm_sm_deliver_event_sync(cm_ctx, WLAN_CM_SM_EV_CONNECT_FAILURE, - sizeof(*resp), resp); - -} - -bool cm_connect_resp_cmid_match_list_head(struct cnx_mgr *cm_ctx, - struct wlan_cm_connect_rsp *resp) -{ - return cm_check_cmid_match_list_head(cm_ctx, &resp->cm_id); -} - -QDF_STATUS cm_connect_active(struct cnx_mgr *cm_ctx, wlan_cm_id *cm_id) -{ - struct cm_req *cm_req; - QDF_STATUS status; - struct wlan_cm_connect_req *req; - - cm_req = cm_get_req_by_cm_id(cm_ctx, *cm_id); - if (!cm_req) - return QDF_STATUS_E_INVAL; - - cm_ctx->active_cm_id = *cm_id; - req = &cm_req->connect_req.req; - wlan_vdev_mlme_set_ssid(cm_ctx->vdev, req->ssid.ssid, req->ssid.length); - - status = cm_get_valid_candidate(cm_ctx, cm_req); - if (QDF_IS_STATUS_ERROR(status)) - goto connect_err; - - status = cm_send_bss_select_ind(cm_ctx, &cm_req->connect_req); - /* - * If candidate select indication is not supported continue with bss - * peer create, else peer will be created after resp. - */ - if (status == QDF_STATUS_E_NOSUPPORT) - cm_create_bss_peer(cm_ctx, &cm_req->connect_req); - else if (QDF_IS_STATUS_ERROR(status)) - goto connect_err; - - return QDF_STATUS_SUCCESS; - -connect_err: - return cm_send_connect_start_fail(cm_ctx, - &cm_req->connect_req, CM_JOIN_FAILED); -} - -QDF_STATUS -cm_peer_create_on_bss_select_ind_resp(struct cnx_mgr *cm_ctx, wlan_cm_id *cm_id) -{ - struct cm_req *cm_req; - - cm_req = cm_get_req_by_cm_id(cm_ctx, *cm_id); - if (!cm_req) - return QDF_STATUS_E_FAILURE; - - cm_create_bss_peer(cm_ctx, &cm_req->connect_req); - - return QDF_STATUS_SUCCESS; -} - -QDF_STATUS -cm_resume_connect_after_peer_create(struct cnx_mgr *cm_ctx, wlan_cm_id *cm_id) -{ - struct wlan_cm_vdev_connect_req req; - struct cm_req *cm_req; - QDF_STATUS status; - - cm_req = cm_get_req_by_cm_id(cm_ctx, *cm_id); - if (!cm_req) - return QDF_STATUS_E_FAILURE; - /* - * fill vdev crypto for the peer. - */ - - req.vdev_id = wlan_vdev_get_id(cm_ctx->vdev); - req.cm_id = *cm_id; - req.bss = cm_req->connect_req.cur_candidate; - - status = mlme_cm_connect_req(cm_ctx->vdev, &req); - if (QDF_IS_STATUS_ERROR(status)) { - mlme_err(CM_PREFIX_FMT "connect request failed", - CM_PREFIX_REF(req.vdev_id, req.cm_id)); - status = cm_send_connect_start_fail(cm_ctx, - &cm_req->connect_req, - CM_JOIN_FAILED); - } - - return status; -} - -#ifdef CONN_MGR_ADV_FEATURE -static QDF_STATUS -cm_inform_blm_connect_complete(struct wlan_objmgr_vdev *vdev, - struct wlan_cm_connect_rsp *resp) -{ - struct wlan_objmgr_pdev *pdev; - - pdev = wlan_vdev_get_pdev(vdev); - if (!pdev) { - mlme_err(CM_PREFIX_FMT "Failed to find pdev", - CM_PREFIX_REF(wlan_vdev_get_id(vdev), resp->cm_id)); - return QDF_STATUS_E_FAILURE; - } - - if (QDF_IS_STATUS_SUCCESS(resp->connect_status)) - wlan_blm_update_bssid_connect_params(pdev, resp->bssid, - BLM_AP_CONNECTED); - - return QDF_STATUS_SUCCESS; -} -#else -static QDF_STATUS -cm_inform_blm_connect_complete(struct wlan_objmgr_vdev *vdev, - struct wlan_cm_connect_rsp *resp) -{ - return QDF_STATUS_SUCCESS; -} -#endif - -QDF_STATUS cm_connect_complete(struct cnx_mgr *cm_ctx, - struct wlan_cm_connect_rsp *resp) -{ - enum wlan_cm_sm_state sm_state; - struct bss_info bss_info; - struct mlme_info mlme_info; - - /* - * If the entry is not present in the list, it must have been cleared - * already. - */ - if (!cm_get_req_by_cm_id(cm_ctx, resp->cm_id)) - return QDF_STATUS_SUCCESS; - - sm_state = cm_get_state(cm_ctx); - mlme_cm_connect_complete_ind(cm_ctx->vdev, resp); - mlme_cm_osif_connect_complete(cm_ctx->vdev, resp); - cm_inform_if_mgr_connect_complete(cm_ctx->vdev, resp->connect_status); - cm_inform_blm_connect_complete(cm_ctx->vdev, resp); - - /* Update scan entry in case connect is success or fails with bssid */ - if (!qdf_is_macaddr_zero(&resp->bssid)) { - if (QDF_IS_STATUS_SUCCESS(resp->connect_status)) - mlme_info.assoc_state = SCAN_ENTRY_CON_STATE_ASSOC; - else - mlme_info.assoc_state = SCAN_ENTRY_CON_STATE_NONE; - qdf_copy_macaddr(&bss_info.bssid, &resp->bssid); - bss_info.freq = resp->freq; - bss_info.ssid.length = resp->ssid.length; - qdf_mem_copy(&bss_info.ssid.ssid, resp->ssid.ssid, - bss_info.ssid.length); - wlan_scan_update_mlme_by_bssinfo( - wlan_vdev_get_pdev(cm_ctx->vdev), - &bss_info, &mlme_info); - } - - /* - * update fils/wep key and inform legacy, update bcn filter, - * start OBSS scan for open mode. - */ - - cm_remove_cmd(cm_ctx, resp->cm_id); - - return QDF_STATUS_SUCCESS; -} - -QDF_STATUS cm_add_connect_req_to_list(struct cnx_mgr *cm_ctx, - struct cm_connect_req *req) -{ - QDF_STATUS status; - struct cm_req *cm_req; - - cm_req = qdf_container_of(req, struct cm_req, connect_req); - req->cm_id = cm_get_cm_id(cm_ctx, req->req.source); - cm_req->cm_id = req->cm_id; - status = cm_add_req_to_list_and_indicate_osif(cm_ctx, cm_req, - req->req.source); - - return status; -} - -QDF_STATUS cm_connect_rsp(struct wlan_objmgr_vdev *vdev, - struct wlan_cm_connect_rsp *resp) -{ - struct cnx_mgr *cm_ctx; - QDF_STATUS qdf_status; - wlan_cm_id cm_id; - uint32_t prefix; - - cm_ctx = cm_get_cm_ctx(vdev); - if (!cm_ctx) - return QDF_STATUS_E_INVAL; - - cm_id = cm_ctx->active_cm_id; - prefix = CM_ID_GET_PREFIX(cm_id); - - if (prefix != CONNECT_REQ_PREFIX || cm_id != resp->cm_id) { - mlme_err(CM_PREFIX_FMT " Active cm_id 0x%x is different", - CM_PREFIX_REF(wlan_vdev_get_id(vdev), resp->cm_id), - cm_id); - qdf_status = QDF_STATUS_E_FAILURE; - goto post_err; - } - - if (QDF_IS_STATUS_SUCCESS(resp->connect_status)) { - qdf_status = - cm_sm_deliver_event(vdev, - WLAN_CM_SM_EV_CONNECT_SUCCESS, - sizeof(*resp), resp); - if (QDF_IS_STATUS_SUCCESS(qdf_status)) - return qdf_status; - /* - * failure mean that the new connect/disconnect is received so - * cleanup. - */ - goto post_err; - } - - /* In case of failure try with next candidate */ - qdf_status = - cm_sm_deliver_event(vdev, - WLAN_CM_SM_EV_CONNECT_GET_NEXT_CANDIDATE, - sizeof(*resp), resp); - - if (QDF_IS_STATUS_SUCCESS(qdf_status)) - return qdf_status; - -post_err: - /* - * If there is a event posting error it means the SM state is not in - * JOIN ACTIVE (some new cmd has changed the state of SM), so just - * complete the connect command. - */ - cm_connect_complete(cm_ctx, resp); - - return qdf_status; -} - -QDF_STATUS cm_bss_select_ind_rsp(struct wlan_objmgr_vdev *vdev, - QDF_STATUS status) -{ - struct cnx_mgr *cm_ctx; - QDF_STATUS qdf_status; - wlan_cm_id cm_id; - uint32_t prefix; - struct wlan_cm_connect_rsp *resp; - - cm_ctx = cm_get_cm_ctx(vdev); - if (!cm_ctx) - return QDF_STATUS_E_INVAL; - - cm_id = cm_ctx->active_cm_id; - prefix = CM_ID_GET_PREFIX(cm_id); - - if (prefix != CONNECT_REQ_PREFIX) { - mlme_err(CM_PREFIX_FMT "active req is not connect req", - CM_PREFIX_REF(wlan_vdev_get_id(cm_ctx->vdev), cm_id)); - return QDF_STATUS_E_INVAL; - } - - if (QDF_IS_STATUS_SUCCESS(status)) { - qdf_status = - cm_sm_deliver_event(vdev, - WLAN_CM_SM_EV_BSS_SELECT_IND_SUCCESS, - sizeof(wlan_cm_id), &cm_id); - if (QDF_IS_STATUS_SUCCESS(qdf_status)) - return qdf_status; - - goto post_err; - } - - /* In case of failure try with next candidate */ - resp = qdf_mem_malloc(sizeof(*resp)); - if (!resp) { - qdf_status = QDF_STATUS_E_NOMEM; - goto post_err; - } - - cm_fill_failure_resp_from_cm_id(cm_ctx, resp, cm_id, - CM_BSS_SELECT_IND_FAILED); - qdf_status = - cm_sm_deliver_event(vdev, - WLAN_CM_SM_EV_CONNECT_GET_NEXT_CANDIDATE, - sizeof(*resp), resp); - qdf_mem_free(resp); - if (QDF_IS_STATUS_SUCCESS(qdf_status)) - return qdf_status; - -post_err: - /* - * If there is a event posting error it means the SM state is not in - * JOIN ACTIVE (some new cmd has changed the state of SM), so just - * complete the connect command. - */ - cm_connect_handle_event_post_fail(cm_ctx, cm_id); - return qdf_status; -} - -QDF_STATUS cm_bss_peer_create_rsp(struct wlan_objmgr_vdev *vdev, - QDF_STATUS status, - struct qdf_mac_addr *peer_mac) -{ - struct cnx_mgr *cm_ctx; - QDF_STATUS qdf_status; - wlan_cm_id cm_id; - uint32_t prefix; - struct wlan_cm_connect_rsp *resp; - - cm_ctx = cm_get_cm_ctx(vdev); - if (!cm_ctx) - return QDF_STATUS_E_INVAL; - - cm_id = cm_ctx->active_cm_id; - prefix = CM_ID_GET_PREFIX(cm_id); - - if (prefix != CONNECT_REQ_PREFIX) { - mlme_err(CM_PREFIX_FMT "active req is not connect req", - CM_PREFIX_REF(wlan_vdev_get_id(cm_ctx->vdev), cm_id)); - mlme_cm_bss_peer_delete_req(vdev); - return QDF_STATUS_E_INVAL; - } - - if (QDF_IS_STATUS_SUCCESS(status)) { - qdf_status = - cm_sm_deliver_event(vdev, - WLAN_CM_SM_EV_BSS_CREATE_PEER_SUCCESS, - sizeof(wlan_cm_id), &cm_id); - if (QDF_IS_STATUS_SUCCESS(qdf_status)) - return qdf_status; - - mlme_cm_bss_peer_delete_req(vdev); - goto post_err; - } - - /* In case of failure try with next candidate */ - resp = qdf_mem_malloc(sizeof(*resp)); - if (!resp) { - qdf_status = QDF_STATUS_E_NOMEM; - goto post_err; - } - - cm_fill_failure_resp_from_cm_id(cm_ctx, resp, cm_id, - CM_PEER_CREATE_FAILED); - qdf_status = - cm_sm_deliver_event(vdev, - WLAN_CM_SM_EV_CONNECT_GET_NEXT_CANDIDATE, - sizeof(*resp), resp); - qdf_mem_free(resp); - if (QDF_IS_STATUS_SUCCESS(qdf_status)) - return qdf_status; - -post_err: - /* - * If there is a event posting error it means the SM state is not in - * JOIN ACTIVE (some new cmd has changed the state of SM), so just - * complete the connect command. - */ - cm_connect_handle_event_post_fail(cm_ctx, cm_id); - return qdf_status; -} - -static void -cm_copy_crypto_prarams(struct wlan_cm_connect_crypto_info *dst_params, - struct wlan_crypto_params *src_params) -{ - dst_params->akm_suites = src_params->key_mgmt; - dst_params->auth_type = src_params->authmodeset; - dst_params->ciphers_pairwise = src_params->ucastcipherset; - dst_params->group_cipher = src_params->mcastcipherset; - dst_params->mgmt_ciphers = src_params->mgmtcipherset; - dst_params->rsn_caps = src_params->rsn_caps; -} - -static void -cm_set_crypto_params_from_ie(struct wlan_cm_connect_req *req) -{ - struct wlan_crypto_params crypto_params; - QDF_STATUS status; - - if (!req->assoc_ie.ptr) - return; - - status = wlan_get_crypto_params_from_rsn_ie(&crypto_params, - req->assoc_ie.ptr, - req->assoc_ie.len); - if (QDF_IS_STATUS_SUCCESS(status)) { - cm_copy_crypto_prarams(&req->crypto, &crypto_params); - return; - } - - status = wlan_get_crypto_params_from_wpa_ie(&crypto_params, - req->assoc_ie.ptr, - req->assoc_ie.len); - if (QDF_IS_STATUS_SUCCESS(status)) { - cm_copy_crypto_prarams(&req->crypto, &crypto_params); - return; - } - - status = wlan_get_crypto_params_from_wapi_ie(&crypto_params, - req->assoc_ie.ptr, - req->assoc_ie.len); - if (QDF_IS_STATUS_SUCCESS(status)) - cm_copy_crypto_prarams(&req->crypto, &crypto_params); -} - -static QDF_STATUS -cm_allocate_and_copy_assoc_wep_ie(struct wlan_cm_connect_req *target, - struct wlan_cm_connect_req *source) -{ - if (source->assoc_ie.ptr) { - target->assoc_ie.ptr = qdf_mem_malloc(source->assoc_ie.len); - if (!target->assoc_ie.ptr) - return QDF_STATUS_E_NOMEM; - - target->assoc_ie.len = source->assoc_ie.len; - qdf_mem_copy(target->assoc_ie.ptr, source->assoc_ie.ptr, - source->assoc_ie.len); - } - - if (source->crypto.wep_keys.key) { - target->crypto.wep_keys.key = - qdf_mem_malloc(source->crypto.wep_keys.key_len); - if (!target->crypto.wep_keys.key) - goto wep_key_alloc_fail; - - target->crypto.wep_keys.key_len = - source->crypto.wep_keys.key_len; - qdf_mem_copy(target->crypto.wep_keys.key, - source->crypto.wep_keys.key, - source->crypto.wep_keys.key_len); - } - - if (source->crypto.wep_keys.seq) { - target->crypto.wep_keys.seq = - qdf_mem_malloc(source->crypto.wep_keys.seq_len); - if (!target->crypto.wep_keys.seq) - goto wep_seq_alloc_fail; - - target->crypto.wep_keys.seq_len = - source->crypto.wep_keys.seq_len; - qdf_mem_copy(target->crypto.wep_keys.seq, - source->crypto.wep_keys.seq, - source->crypto.wep_keys.seq_len); - } - - return QDF_STATUS_SUCCESS; - -wep_seq_alloc_fail: - if (target->crypto.wep_keys.key) { - qdf_mem_zero(target->crypto.wep_keys.key, - target->crypto.wep_keys.key_len); - qdf_mem_free(target->crypto.wep_keys.key); - target->crypto.wep_keys.key = NULL; - } - -wep_key_alloc_fail: - if (target->assoc_ie.ptr) { - qdf_mem_zero(target->assoc_ie.ptr, target->assoc_ie.len); - qdf_mem_free(target->assoc_ie.ptr); - target->assoc_ie.ptr = NULL; - } - - return QDF_STATUS_E_NOMEM; -} - -QDF_STATUS cm_connect_start_req(struct wlan_objmgr_vdev *vdev, - struct wlan_cm_connect_req *req) -{ - struct cnx_mgr *cm_ctx; - struct cm_req *cm_req; - struct cm_connect_req *connect_req; - QDF_STATUS status; - - cm_ctx = cm_get_cm_ctx(vdev); - if (!cm_ctx) - return QDF_STATUS_E_INVAL; - - cm_vdev_scan_cancel(wlan_vdev_get_pdev(cm_ctx->vdev), cm_ctx->vdev); - - /* - * This would be freed as part of removal from cm req list if adding - * to list is success after posting WLAN_CM_SM_EV_CONNECT_REQ. - */ - cm_req = qdf_mem_malloc(sizeof(*cm_req)); - if (!cm_req) - return QDF_STATUS_E_NOMEM; - - connect_req = &cm_req->connect_req; - connect_req->req = *req; - - status = cm_allocate_and_copy_assoc_wep_ie(&connect_req->req, req); - if (QDF_IS_STATUS_ERROR(status)) { - qdf_mem_free(cm_req); - return status; - } - cm_set_crypto_params_from_ie(&connect_req->req); - - status = cm_sm_deliver_event(vdev, WLAN_CM_SM_EV_CONNECT_REQ, - sizeof(*connect_req), connect_req); - - /* free the req if connect is not handled */ - if (QDF_IS_STATUS_ERROR(status)) { - cm_free_connect_req_mem(connect_req); - qdf_mem_free(cm_req); - } - - return status; -} diff --git a/umac/mlme/connection_mgr/core/src/wlan_cm_connect_scan.c b/umac/mlme/connection_mgr/core/src/wlan_cm_connect_scan.c deleted file mode 100644 index 1904b62f4d99..000000000000 --- a/umac/mlme/connection_mgr/core/src/wlan_cm_connect_scan.c +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (c) 2012-2015, 2020, 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. - */ - -/** - * DOC: Implements connect scan (scan for ssid) specific apis of - * connection manager - */ - -#include "wlan_cm_main_api.h" - -QDF_STATUS cm_connect_scan_start(struct cnx_mgr *cm_ctx, - struct cm_connect_req *req) -{ - /* - * initiate connect scan and scan timer. - * post WLAN_CM_SM_EV_CONNECT_SCAN_FAILURE on scan req failure. - */ - return QDF_STATUS_SUCCESS; -} - -QDF_STATUS cm_connect_scan_resp(struct cnx_mgr *cm_ctx, wlan_scan_id *scan_id, - QDF_STATUS status) -{ - /* - * get connect req from head and check if scan_id match - * if not drop else proceed with success or failure handling - * (post WLAN_CM_SM_EV_CONNECT_FAILURE in case of status failure or if - * no candidate found again after scan) - */ - return QDF_STATUS_SUCCESS; -} diff --git a/umac/mlme/connection_mgr/core/src/wlan_cm_disconnect.c b/umac/mlme/connection_mgr/core/src/wlan_cm_disconnect.c deleted file mode 100644 index 459a1f0fe870..000000000000 --- a/umac/mlme/connection_mgr/core/src/wlan_cm_disconnect.c +++ /dev/null @@ -1,474 +0,0 @@ -/* - * Copyright (c) 2012-2015, 2020, 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. - */ - -/** - * DOC: Implements disconnect specific apis of connection manager - */ -#include "wlan_cm_main_api.h" -#include "wlan_cm_sm.h" -#include -#include "wlan_mlme_vdev_mgr_interface.h" -#include "wlan_scan_api.h" -#ifdef CONN_MGR_ADV_FEATURE -#include "wlan_blm_api.h" -#endif - -static void -cm_send_disconnect_resp(struct cnx_mgr *cm_ctx, wlan_cm_id cm_id) -{ - struct wlan_cm_discon_rsp resp; - QDF_STATUS status; - - status = cm_fill_disconnect_resp_from_cm_id(cm_ctx, cm_id, &resp); - if (QDF_IS_STATUS_SUCCESS(status)) - cm_disconnect_complete(cm_ctx, &resp); -} - -static QDF_STATUS -cm_sm_deliver_disconnect_event(struct cnx_mgr *cm_ctx, - struct wlan_serialization_command *cmd) -{ - /* - * For pending to active, use async cmnd to take lock. - * Use sync command for direct activation as lock is already - * acquired. - */ - if (cmd->activation_reason == SER_PENDING_TO_ACTIVE) - return cm_sm_deliver_event( - cm_ctx->vdev, - WLAN_CM_SM_EV_DISCONNECT_ACTIVE, - sizeof(wlan_cm_id), - &cmd->cmd_id); - else - return cm_sm_deliver_event_sync( - cm_ctx, - WLAN_CM_SM_EV_DISCONNECT_ACTIVE, - sizeof(wlan_cm_id), - &cmd->cmd_id); -} - -static QDF_STATUS -cm_ser_disconnect_cb(struct wlan_serialization_command *cmd, - enum wlan_serialization_cb_reason reason) -{ - QDF_STATUS status = QDF_STATUS_SUCCESS; - struct wlan_objmgr_vdev *vdev; - struct cnx_mgr *cm_ctx; - - if (!cmd) { - mlme_err("cmd is NULL, reason: %d", reason); - QDF_ASSERT(0); - return QDF_STATUS_E_NULL_VALUE; - } - - vdev = cmd->vdev; - - cm_ctx = cm_get_cm_ctx(vdev); - if (!cm_ctx) - return QDF_STATUS_E_NULL_VALUE; - - switch (reason) { - case WLAN_SER_CB_ACTIVATE_CMD: - status = cm_sm_deliver_disconnect_event(cm_ctx, cmd); - if (QDF_IS_STATUS_SUCCESS(status)) - break; - /* - * Handle failure if posting fails, i.e. the SM state has - * changes. Disconnect should be handled in JOIN_PENDING, - * JOIN-SCAN state as well apart from DISCONNECTING. - * Also no need to check for head list as diconnect needs to be - * completed always once active. - */ - - cm_send_disconnect_resp(cm_ctx, cmd->cmd_id); - break; - case WLAN_SER_CB_CANCEL_CMD: - /* command removed from pending list. */ - break; - case WLAN_SER_CB_ACTIVE_CMD_TIMEOUT: - mlme_err(CM_PREFIX_FMT "Active command timeout", - CM_PREFIX_REF(wlan_vdev_get_id(vdev), cmd->cmd_id)); - QDF_ASSERT(0); - cm_send_disconnect_resp(cm_ctx, cmd->cmd_id); - break; - case WLAN_SER_CB_RELEASE_MEM_CMD: - cm_reset_active_cm_id(vdev, cmd->cmd_id); - wlan_objmgr_vdev_release_ref(vdev, WLAN_MLME_CM_ID); - break; - default: - QDF_ASSERT(0); - status = QDF_STATUS_E_INVAL; - break; - } - - return status; -} - -#define DISCONNECT_TIMEOUT STOP_RESPONSE_TIMER + DELETE_RESPONSE_TIMER + 1000 - -static QDF_STATUS cm_ser_disconnect_req(struct wlan_objmgr_pdev *pdev, - struct cnx_mgr *cm_ctx, - struct cm_disconnect_req *req) -{ - struct wlan_serialization_command cmd = {0, }; - enum wlan_serialization_status ser_cmd_status; - QDF_STATUS status; - uint8_t vdev_id = wlan_vdev_get_id(cm_ctx->vdev); - - status = wlan_objmgr_vdev_try_get_ref(cm_ctx->vdev, WLAN_MLME_CM_ID); - if (QDF_IS_STATUS_ERROR(status)) { - mlme_err(CM_PREFIX_FMT "unable to get reference", - CM_PREFIX_REF(vdev_id, req->cm_id)); - return status; - } - - cmd.cmd_type = WLAN_SER_CMD_VDEV_CONNECT; - cmd.cmd_id = req->cm_id; - cmd.cmd_cb = cm_ser_disconnect_cb; - cmd.source = WLAN_UMAC_COMP_MLME; - cmd.is_high_priority = false; - cmd.cmd_timeout_duration = DISCONNECT_TIMEOUT; - cmd.vdev = cm_ctx->vdev; - cmd.is_blocking = cm_ser_get_blocking_cmd(); - - ser_cmd_status = wlan_serialization_request(&cmd); - switch (ser_cmd_status) { - case WLAN_SER_CMD_PENDING: - /* command moved to pending list.Do nothing */ - break; - case WLAN_SER_CMD_ACTIVE: - /* command moved to active list. Do nothing */ - break; - default: - mlme_err(CM_PREFIX_FMT "ser cmd status %d", - CM_PREFIX_REF(vdev_id, req->cm_id), ser_cmd_status); - wlan_objmgr_vdev_release_ref(cm_ctx->vdev, WLAN_MLME_CM_ID); - - return QDF_STATUS_E_FAILURE; - } - - return QDF_STATUS_SUCCESS; -} - -#ifdef WLAN_FEATURE_INTERFACE_MGR -static void -cm_inform_if_mgr_disconnect_complete(struct wlan_objmgr_vdev *vdev) -{ - struct if_mgr_event_data *disconnect_complete; - - disconnect_complete = qdf_mem_malloc(sizeof(*disconnect_complete)); - if (!disconnect_complete) - return; - - disconnect_complete->status = QDF_STATUS_SUCCESS; - - if_mgr_deliver_event(vdev, WLAN_IF_MGR_EV_DISCONNECT_COMPLETE, - disconnect_complete); - qdf_mem_free(disconnect_complete); -} - -static void -cm_inform_if_mgr_disconnect_start(struct wlan_objmgr_vdev *vdev) -{ - struct if_mgr_event_data *disconnect_start; - - disconnect_start = qdf_mem_malloc(sizeof(*disconnect_start)); - if (!disconnect_start) - return; - - disconnect_start->status = QDF_STATUS_SUCCESS; - - if_mgr_deliver_event(vdev, WLAN_IF_MGR_EV_DISCONNECT_START, - disconnect_start); - qdf_mem_free(disconnect_start); -} - -#else -static inline void -cm_inform_if_mgr_disconnect_complete(struct wlan_objmgr_vdev *vdev) -{ -} - -static inline void -cm_inform_if_mgr_disconnect_start(struct wlan_objmgr_vdev *vdev) -{ -} -#endif - -QDF_STATUS cm_disconnect_start(struct cnx_mgr *cm_ctx, - struct cm_disconnect_req *req) -{ - struct wlan_objmgr_pdev *pdev; - QDF_STATUS status; - - pdev = wlan_vdev_get_pdev(cm_ctx->vdev); - if (!pdev) - return QDF_STATUS_E_INVAL; - - /* disconnect TDLS, P2P roc cleanup */ - - cm_inform_if_mgr_disconnect_start(cm_ctx->vdev); - cm_vdev_scan_cancel(wlan_vdev_get_pdev(cm_ctx->vdev), cm_ctx->vdev); - mlme_cm_osif_disconnect_start_ind(cm_ctx->vdev); - - /* Serialize disconnect req, Handle failure status */ - status = cm_ser_disconnect_req(pdev, cm_ctx, req); - - if (QDF_IS_STATUS_ERROR(status)) - cm_send_disconnect_resp(cm_ctx, req->cm_id); - - return QDF_STATUS_SUCCESS; -} - -static void -cm_update_scan_mlme_on_disconnect(struct wlan_objmgr_vdev *vdev, - struct cm_disconnect_req *req) -{ - struct wlan_objmgr_pdev *pdev; - struct bss_info bss_info; - struct mlme_info mlme; - struct wlan_channel *chan; - QDF_STATUS status; - - pdev = wlan_vdev_get_pdev(vdev); - if (!pdev) { - mlme_err(CM_PREFIX_FMT "failed to find pdev", - CM_PREFIX_REF(req->req.vdev_id, req->cm_id)); - return; - } - - chan = wlan_vdev_get_active_channel(vdev); - if (!chan) { - mlme_err(CM_PREFIX_FMT "failed to get active channel", - CM_PREFIX_REF(req->req.vdev_id, req->cm_id)); - return; - } - - status = wlan_vdev_mlme_get_ssid(vdev, bss_info.ssid.ssid, - &bss_info.ssid.length); - - if (QDF_IS_STATUS_ERROR(status)) { - mlme_err(CM_PREFIX_FMT "failed to get ssid", - CM_PREFIX_REF(req->req.vdev_id, req->cm_id)); - return; - } - - mlme.assoc_state = SCAN_ENTRY_CON_STATE_NONE; - qdf_copy_macaddr(&bss_info.bssid, &req->req.bssid); - - bss_info.freq = chan->ch_freq; - - wlan_scan_update_mlme_by_bssinfo(pdev, &bss_info, &mlme); -} - -QDF_STATUS cm_disconnect_active(struct cnx_mgr *cm_ctx, wlan_cm_id *cm_id) -{ - struct wlan_cm_vdev_discon_req *req; - struct cm_req *cm_req; - struct qdf_mac_addr bssid; - QDF_STATUS status; - - cm_req = cm_get_req_by_cm_id(cm_ctx, *cm_id); - if (!cm_req) - return QDF_STATUS_E_INVAL; - - req = qdf_mem_malloc(sizeof(*req)); - if (!req) - return QDF_STATUS_E_NOMEM; - - cm_ctx->active_cm_id = *cm_id; - - wlan_vdev_get_bss_peer_mac(cm_ctx->vdev, &bssid); - qdf_copy_macaddr(&req->req.bssid, &bssid); - - req->cm_id = *cm_id; - req->req.vdev_id = wlan_vdev_get_id(cm_ctx->vdev); - req->req.source = cm_req->discon_req.req.source; - req->req.reason_code = cm_req->discon_req.req.reason_code; - - cm_update_scan_mlme_on_disconnect(cm_ctx->vdev, - &cm_req->discon_req); - - mlme_debug(CM_PREFIX_FMT "disconnect " QDF_MAC_ADDR_FMT " source %d reason %d", - CM_PREFIX_REF(req->req.vdev_id, req->cm_id), - QDF_MAC_ADDR_REF(req->req.bssid.bytes), - req->req.source, req->req.reason_code); - status = mlme_cm_disconnect_req(cm_ctx->vdev, req); - if (QDF_IS_STATUS_ERROR(status)) { - mlme_err(CM_PREFIX_FMT "disconnect req fail", - CM_PREFIX_REF(req->req.vdev_id, req->cm_id)); - cm_send_disconnect_resp(cm_ctx, req->cm_id); - } - qdf_mem_free(req); - - return status; -} - -#ifdef CONN_MGR_ADV_FEATURE -static void -cm_inform_blm_disconnect_complete(struct wlan_objmgr_vdev *vdev, - struct wlan_cm_discon_rsp *resp) -{ - struct wlan_objmgr_pdev *pdev; - - pdev = wlan_vdev_get_pdev(vdev); - if (!pdev) { - mlme_err(CM_PREFIX_FMT "failed to find pdev", - CM_PREFIX_REF(wlan_vdev_get_id(vdev), - resp->req.cm_id)); - return; - } - - wlan_blm_update_bssid_connect_params(pdev, resp->req.req.bssid, - BLM_AP_DISCONNECTED); -} -#else -static void -cm_inform_blm_disconnect_complete(struct wlan_objmgr_vdev *vdev, - struct wlan_cm_discon_rsp *resp) -{ - return QDF_STATUS_SUCCESS; -} -#endif - -QDF_STATUS cm_disconnect_complete(struct cnx_mgr *cm_ctx, - struct wlan_cm_discon_rsp *resp) -{ - /* update fils/wep key and inform legacy, update bcn filter */ - - /* - * If the entry is not present in the list, it must have been cleared - * already. - */ - if (!cm_get_req_by_cm_id(cm_ctx, resp->req.cm_id)) - return QDF_STATUS_SUCCESS; - - mlme_cm_disconnect_complete_ind(cm_ctx->vdev, resp); - mlme_cm_osif_disconnect_complete(cm_ctx->vdev, resp); - - cm_inform_if_mgr_disconnect_complete(cm_ctx->vdev); - - cm_inform_blm_disconnect_complete(cm_ctx->vdev, resp); - - cm_remove_cmd(cm_ctx, resp->req.cm_id); - - return QDF_STATUS_SUCCESS; -} - -QDF_STATUS cm_add_disconnect_req_to_list(struct cnx_mgr *cm_ctx, - struct cm_disconnect_req *req) -{ - QDF_STATUS status; - struct cm_req *cm_req; - - cm_req = qdf_container_of(req, struct cm_req, discon_req); - req->cm_id = cm_get_cm_id(cm_ctx, req->req.source); - cm_req->cm_id = req->cm_id; - status = cm_add_req_to_list_and_indicate_osif(cm_ctx, cm_req, - req->req.source); - - return status; -} - -QDF_STATUS cm_disconnect_start_req(struct wlan_objmgr_vdev *vdev, - struct wlan_cm_disconnect_req *req) -{ - struct cnx_mgr *cm_ctx; - struct cm_req *cm_req; - struct cm_disconnect_req *disconnect_req; - QDF_STATUS status; - - cm_ctx = cm_get_cm_ctx(vdev); - if (!cm_ctx) - return QDF_STATUS_E_INVAL; - - /* - * This would be freed as part of removal from cm req list if adding - * to list is success after posting WLAN_CM_SM_EV_DISCONNECT_REQ. - */ - cm_req = qdf_mem_malloc(sizeof(*cm_req)); - - if (!cm_req) - return QDF_STATUS_E_NOMEM; - - disconnect_req = &cm_req->discon_req; - disconnect_req->req = *req; - - status = cm_sm_deliver_event(vdev, WLAN_CM_SM_EV_DISCONNECT_REQ, - sizeof(*disconnect_req), disconnect_req); - /* free the req if connect is not handled */ - if (QDF_IS_STATUS_ERROR(status)) - qdf_mem_free(cm_req); - - return status; -} - -QDF_STATUS cm_disconnect_rsp(struct wlan_objmgr_vdev *vdev, - struct wlan_cm_discon_rsp *resp) -{ - struct cnx_mgr *cm_ctx; - QDF_STATUS qdf_status; - wlan_cm_id cm_id; - uint32_t prefix; - - cm_ctx = cm_get_cm_ctx(vdev); - if (!cm_ctx) - return QDF_STATUS_E_INVAL; - - cm_id = cm_ctx->active_cm_id; - prefix = CM_ID_GET_PREFIX(cm_id); - - if (prefix != DISCONNECT_REQ_PREFIX || cm_id != resp->req.cm_id) { - mlme_err(CM_PREFIX_FMT "Active cm_id 0x%x is different", - CM_PREFIX_REF(wlan_vdev_get_id(vdev), resp->req.cm_id), - cm_id); - qdf_status = QDF_STATUS_E_FAILURE; - goto disconnect_complete; - } - qdf_status = - cm_sm_deliver_event(vdev, - WLAN_CM_SM_EV_DISCONNECT_DONE, - sizeof(*resp), resp); - if (QDF_IS_STATUS_ERROR(qdf_status)) - goto disconnect_complete; - - return qdf_status; - -disconnect_complete: - /* - * If there is a event posting error it means the SM state is not in - * DISCONNECTING (some new cmd has changed the state of SM), so just - * complete the disconnect command. - */ - return cm_disconnect_complete(cm_ctx, resp); -} - -QDF_STATUS cm_bss_peer_delete_req(struct wlan_objmgr_vdev *vdev, - struct qdf_mac_addr *peer_mac) -{ - mlme_debug("vdev-id %d, delete peer" QDF_MAC_ADDR_FMT, - wlan_vdev_get_id(vdev), QDF_MAC_ADDR_REF(peer_mac->bytes)); - - return mlme_cm_bss_peer_delete_req(vdev); -} - -QDF_STATUS cm_vdev_down_req(struct wlan_objmgr_vdev *vdev, uint32_t status) -{ - mlme_debug("vdev id %d down req status %d", - wlan_vdev_get_id(vdev), status); - - return mlme_cm_vdev_down_req(vdev); -} diff --git a/umac/mlme/connection_mgr/core/src/wlan_cm_main.c b/umac/mlme/connection_mgr/core/src/wlan_cm_main.c deleted file mode 100644 index 1356e43e896b..000000000000 --- a/umac/mlme/connection_mgr/core/src/wlan_cm_main.c +++ /dev/null @@ -1,109 +0,0 @@ -/* - * Copyright (c) 2012-2015, 2020, 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. - */ - -/** - * DOC: Implements init/deinit specific apis of connection manager - */ - -#include "wlan_cm_main.h" -#include "wlan_cm_sm.h" - -#ifdef WLAN_CM_USE_SPINLOCK -/** - * cm_req_lock_create - Create CM req SM mutex/spinlock - * @cm_ctx: connection manager ctx - * - * Creates CM SM mutex/spinlock - * - * Return: void - */ -static inline void -cm_req_lock_create(struct cnx_mgr *cm_ctx) -{ - qdf_spinlock_create(&cm_ctx->cm_req_lock); -} - -/** - * cm_req_lock_destroy - Destroy CM SM mutex/spinlock - * @cm_ctx: connection manager ctx - * - * Destroy CM SM mutex/spinlock - * - * Return: void - */ -static inline void -cm_req_lock_destroy(struct cnx_mgr *cm_ctx) -{ - qdf_spinlock_destroy(&cm_ctx->cm_req_lock); -} -#else -static inline void -cm_req_lock_create(struct cnx_mgr *cm_ctx) -{ - qdf_mutex_create(&cm_ctx->cm_req_lock); -} - -static inline void -cm_req_lock_destroy(struct cnx_mgr *cm_ctx) -{ - qdf_mutex_destroy(&cm_ctx->cm_req_lock); -} -#endif /* WLAN_CM_USE_SPINLOCK */ - -QDF_STATUS wlan_cm_init(struct vdev_mlme_obj *vdev_mlme) -{ - struct wlan_objmgr_vdev *vdev = vdev_mlme->vdev; - enum QDF_OPMODE op_mode = wlan_vdev_mlme_get_opmode(vdev); - QDF_STATUS status; - - if (op_mode != QDF_STA_MODE && op_mode != QDF_P2P_CLIENT_MODE) - return QDF_STATUS_SUCCESS; - - vdev_mlme->cnx_mgr_ctx = qdf_mem_malloc(sizeof(struct cnx_mgr)); - if (!vdev_mlme->cnx_mgr_ctx) - return QDF_STATUS_E_NOMEM; - - vdev_mlme->cnx_mgr_ctx->vdev = vdev_mlme->vdev; - status = cm_sm_create(vdev_mlme->cnx_mgr_ctx); - if (QDF_IS_STATUS_ERROR(status)) { - qdf_mem_free(vdev_mlme->cnx_mgr_ctx); - vdev_mlme->cnx_mgr_ctx = NULL; - return QDF_STATUS_E_NOMEM; - } - vdev_mlme->cnx_mgr_ctx->max_connect_attempts = - CM_MAX_CONNECT_ATTEMPTS; - qdf_list_create(&vdev_mlme->cnx_mgr_ctx->req_list, CM_MAX_REQ); - cm_req_lock_create(vdev_mlme->cnx_mgr_ctx); - - return QDF_STATUS_SUCCESS; -} - -QDF_STATUS wlan_cm_deinit(struct vdev_mlme_obj *vdev_mlme) -{ - struct wlan_objmgr_vdev *vdev = vdev_mlme->vdev; - enum QDF_OPMODE op_mode = wlan_vdev_mlme_get_opmode(vdev); - - if (op_mode != QDF_STA_MODE && op_mode != QDF_P2P_CLIENT_MODE) - return QDF_STATUS_SUCCESS; - - cm_req_lock_destroy(vdev_mlme->cnx_mgr_ctx); - qdf_list_destroy(&vdev_mlme->cnx_mgr_ctx->req_list); - cm_sm_destroy(vdev_mlme->cnx_mgr_ctx); - qdf_mem_free(vdev_mlme->cnx_mgr_ctx); - vdev_mlme->cnx_mgr_ctx = NULL; - - return QDF_STATUS_SUCCESS; -} diff --git a/umac/mlme/connection_mgr/core/src/wlan_cm_main.h b/umac/mlme/connection_mgr/core/src/wlan_cm_main.h deleted file mode 100644 index 9a34423e2082..000000000000 --- a/umac/mlme/connection_mgr/core/src/wlan_cm_main.h +++ /dev/null @@ -1,227 +0,0 @@ -/* - * Copyright (c) 2012-2015, 2020, 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. - */ - -/** - * DOC: wlan_cm_main.h - * - * This header file maintain structures required for connection mgr core - */ - -#ifndef __WLAN_CM_MAIN_H__ -#define __WLAN_CM_MAIN_H__ - -#include "include/wlan_vdev_mlme.h" - -#ifdef FEATURE_CM_ENABLE -#include - -/* Max candidate/attempts to be tried to connect */ -#define CM_MAX_CONNECT_ATTEMPTS 5 -/* Max time to wait for scan for SSID */ -#define CM_SCAN_MAX_TIME 5000 -/* Max connect/disconnect/roam req that can be queued at a time */ -#define CM_MAX_REQ 5 - -/** - * enum wlan_cm_sm_state - Connection manager states - * @WLAN_CM_S_INIT: Default state, IDLE state - * @WLAN_CM_S_CONNECTING: State when connect request comes - * @WLAN_CM_S_CONNECTED: State when connect is complete - * @WLAN_CM_S_DISCONNECTING: State when disconnect request comes - * @WLAN_CM_S_ROAMING: State when roaming is in progress - * @WLAN_CM_S_MAX: Max State - * @WLAN_CM_SS_IDLE: Idle state (no substate) - * @WLAN_CM_SS_JOIN_PENDING: Connect request not serialized - * @WLAN_CM_SS_SCAN: Scan for SSID state - * @WLAN_CM_SS_JOIN_ACTIVE: Conenct request activated - * @WLAN_CM_SS_PREAUTH: Roam substate of preauth stage - * @WLAN_CM_SS_REASSOC: Roam substate for reassoc state - * @WLAN_CM_SS_ROAM_STARTED: Roaming in progress (LFR 3.0) - * @WLAN_CM_SS_ROAM_SYNC: Roam sync indication from FW - * @WLAN_CM_SS_MAX: Max Substate - */ -enum wlan_cm_sm_state { - WLAN_CM_S_INIT = 0, - WLAN_CM_S_CONNECTING = 1, - WLAN_CM_S_CONNECTED = 2, - WLAN_CM_S_DISCONNECTING = 3, - WLAN_CM_S_ROAMING = 4, - WLAN_CM_S_MAX = 5, - WLAN_CM_SS_IDLE = 6, - WLAN_CM_SS_JOIN_PENDING = 7, - WLAN_CM_SS_SCAN = 8, - WLAN_CM_SS_JOIN_ACTIVE = 9, - WLAN_CM_SS_PREAUTH = 10, - WLAN_CM_SS_REASSOC = 11, - WLAN_CM_SS_ROAM_STARTED = 12, - WLAN_CM_SS_ROAM_SYNC = 13, - WLAN_CM_SS_MAX = 14, -}; - -/** - * struct cm_state_sm - connection manager sm - * @cm_sm_lock: sm lock - * @sm_hdl: sm handlers - * @cm_state: current state - * @cm_substate: current substate - */ -struct cm_state_sm { -#ifdef WLAN_CM_USE_SPINLOCK - qdf_spinlock_t cm_sm_lock; -#else - qdf_mutex_t cm_sm_lock; -#endif - struct wlan_sm *sm_hdl; - enum wlan_cm_sm_state cm_state; - enum wlan_cm_sm_state cm_substate; -}; - -/** - * struct cm_connect_req - connect req stored in connect manager - * @cm_id: Connect manager id - * @scan_id: scan id for scan for ssid - * @scan_timer: timer for scan for ssid to get completed - * @hw_mode_timer: timer for hw mode chane to get completed - * @req: connect req from osif - * @rsn_ie: rsn_ie in connect req - * @candidate_list: candidate list - * @cur_candidate: current candidate - * @connect_attempts: number of connect attempts tried - */ -struct cm_connect_req { - wlan_cm_id cm_id; - wlan_scan_id scan_id; - qdf_timer_t scan_timer; - qdf_timer_t hw_mode_timer; - struct wlan_cm_connect_req req; - struct element_info rsn_ie; - qdf_list_t *candidate_list; - struct scan_cache_node *cur_candidate; - uint8_t connect_attempts; -}; - -/** - * struct cm_disconnect_req - disconnect req - * @cm_id: Connect manager id - * @req: disconnect connect req from osif - */ -struct cm_disconnect_req { - wlan_cm_id cm_id; - struct wlan_cm_disconnect_req req; -}; - -/** - * struct cm_req - connect manager req - * @node: connection manager req node - * @cm_id: cm id - * @connect_req: connect req - * @disconnect_req: disconnect req - */ -struct cm_req { - qdf_list_node_t node; - wlan_cm_id cm_id; - union { - struct cm_connect_req connect_req; - struct cm_disconnect_req discon_req; - }; -}; - -/** - * struct connect_ies - connect related ies stored in vdev, set by osif/user - * @auth_ft_ies: auth ft ies received during preauth phase - * @reassoc_ft_ies: reassoc ft ies received during reassoc phase - * @cck_ie: cck ie for cck connection - * @discon_ie: disconnect ie to be sent in disassoc/deauth req - */ -struct connect_ies { - struct element_info auth_ft_ies; - struct element_info reassoc_ft_ies; -#ifdef FEATURE_WLAN_ESE - struct element_info cck_ie; -#endif - struct element_info discon_ie; -}; - -/** - * struct cnx_mgr - connect manager req - * @vdev: vdev back pointer - * @sm: state machine - * @active_cm_id: cm_id of the active command, if any active command present - * @req_list: connect/disconnect req list - * @cm_req_lock: lock to manupulate/read the cm req list - * @disconnect_count: disconnect count - * @connect_count: connect count - * @force_rsne_override: if QCA_WLAN_VENDOR_ATTR_CONFIG_RSN_IE is set by - * framework - * @req_ie: request ies for connect/disconnect set by osif/user separately from - * connect req - * @global_cmd_id: global cmd id for getting cm id for connect/disconnect req - * @max_connect_attempts: Max attempts to be tried for a connect req - */ -struct cnx_mgr { - struct wlan_objmgr_vdev *vdev; - struct cm_state_sm sm; - wlan_cm_id active_cm_id; - qdf_list_t req_list; -#ifdef WLAN_CM_USE_SPINLOCK - qdf_spinlock_t cm_req_lock; -#else - qdf_mutex_t cm_req_lock; -#endif - uint8_t disconnect_count; - uint8_t connect_count; - bool force_rsne_override; - struct connect_ies req_ie; - qdf_atomic_t global_cmd_id; - uint8_t max_connect_attempts; -}; - -/** - * wlan_cm_init() - Invoke connection manager init - * @vdev_mlme_obj: VDEV MLME comp object - * - * API allocates CM and init - * - * Return: SUCCESS on successful allocation - * FAILURE, if registration fails - */ -QDF_STATUS wlan_cm_init(struct vdev_mlme_obj *vdev_mlme); - -/** - * wlan_cm_deinit() - Invoke connection manager deinit - * @vdev_mlme_obj: VDEV MLME comp object - * - * API destroys CM - * - * Return: SUCCESS on successful deletion - * FAILURE, if deletion fails - */ -QDF_STATUS wlan_cm_deinit(struct vdev_mlme_obj *vdev_mlme); -#else - -static inline QDF_STATUS wlan_cm_init(struct vdev_mlme_obj *vdev_mlme) -{ - return QDF_STATUS_SUCCESS; -} - -static inline QDF_STATUS wlan_cm_deinit(struct vdev_mlme_obj *vdev_mlme) -{ - return QDF_STATUS_SUCCESS; -} - -#endif /* FEATURE_CM_ENABLE */ - -#endif /* __WLAN_CM_MAIN_H__ */ diff --git a/umac/mlme/connection_mgr/core/src/wlan_cm_main_api.h b/umac/mlme/connection_mgr/core/src/wlan_cm_main_api.h deleted file mode 100644 index da515103d46b..000000000000 --- a/umac/mlme/connection_mgr/core/src/wlan_cm_main_api.h +++ /dev/null @@ -1,567 +0,0 @@ -/* - * Copyright (c) 2012-2015, 2020, 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. - */ - -/** - * DOC: wlan_cm_main_api.h - * - * This header file maintain connect, disconnect APIs of connection manager - */ - -#ifndef __WLAN_CM_MAIN_API_H__ -#define __WLAN_CM_MAIN_API_H__ - -#include "wlan_cm_main.h" -#include "wlan_cm_sm.h" -#include -#ifdef WLAN_FEATURE_INTERFACE_MGR -#include -#endif - -#define CONNECT_REQ_PREFIX 0x00C00000 -#define DISCONNECT_REQ_PREFIX 0x00D00000 -#define CM_ID_MASK 0x0000FFFF - -#define CM_ID_GET_PREFIX(cm_id) cm_id & 0xFFFF0000 - -#define CM_PREFIX_FMT "vdev %d cm_id 0x%x: " -#define CM_PREFIX_REF(vdev_id, cm_id) (vdev_id), (cm_id) - -/*************** CONNECT APIs ****************/ - -/** - * cm_connect_start() - This API will be called to initiate the connect - * process - * @cm_ctx: connection manager context - * @req: Connect request. - * - * Return: QDF status - */ -QDF_STATUS cm_connect_start(struct cnx_mgr *cm_ctx, struct cm_connect_req *req); - -/** - * cm_connect_scan_start() - This API will be called to initiate the connect - * scan if no candidate are found in scan db. - * @cm_ctx: connection manager context - * @req: Connect request. - * - * Return: QDF status - */ -QDF_STATUS cm_connect_scan_start(struct cnx_mgr *cm_ctx, - struct cm_connect_req *req); - -/** - * cm_connect_scan_resp() - Handle the connect scan resp and next action - * scan if no candidate are found in scan db. - * @scan_id: scan id of the req - * @status: Connect scan status - * - * Return: QDF status - */ -QDF_STATUS cm_connect_scan_resp(struct cnx_mgr *cm_ctx, wlan_scan_id *scan_id, - QDF_STATUS status); - -/** - * cm_connect_resp_cmid_match_list_head() - Check if resp cmid is same as list - * head - * @cm_ctx: connection manager context - * @resp: connect resp - * - * Return: bool - */ -bool cm_connect_resp_cmid_match_list_head(struct cnx_mgr *cm_ctx, - struct wlan_cm_connect_rsp *resp); - -/** - * cm_connect_active() - This API would be called after the connect - * request gets activated in serialization. - * @cm_ctx: connection manager context - * @cm_id: Connection mgr ID assigned to this connect request. - * - * Return: QDF status - */ -QDF_STATUS cm_connect_active(struct cnx_mgr *cm_ctx, wlan_cm_id *cm_id); - -/** - * cm_try_next_candidate() - This API would try to connect to next valid - * candidate and fail if no candidate left - * request gets activated in serialization. - * @cm_ctx: connection manager context - * @connect_resp: connect resp. - * - * Return: QDF status - */ -QDF_STATUS cm_try_next_candidate(struct cnx_mgr *cm_ctx, - struct wlan_cm_connect_rsp *connect_resp); - -/** - * cm_peer_create_on_bss_select_ind_resp() - Called to create peer - * if bss select inidication's resp was success - * @cm_ctx: connection manager context - * @cm_id: Connection mgr ID assigned to this connect request. - * - * Return: QDF status - */ -QDF_STATUS -cm_peer_create_on_bss_select_ind_resp(struct cnx_mgr *cm_ctx, - wlan_cm_id *cm_id); - -/** - * cm_resume_connect_after_peer_create() - Called after bss create rsp - * @cm_ctx: connection manager context - * @cm_id: Connection mgr ID assigned to this connect request. - * - * Return: QDF status - */ -QDF_STATUS -cm_resume_connect_after_peer_create(struct cnx_mgr *cm_ctx, wlan_cm_id *cm_id); - -/** - * cm_bss_select_ind_rsp() - Connection manager resp for bss - * select indication - * @vdev: vdev pointer - * @status: Status - * - * Return: QDF_STATUS - */ -QDF_STATUS cm_bss_select_ind_rsp(struct wlan_objmgr_vdev *vdev, - QDF_STATUS status); - -/** - * cm_bss_peer_create_rsp() - handle bss peer create response - * @vdev: vdev - * @status: bss peer create status - * @peer_mac: peer mac - * - * Return: QDF status - */ -QDF_STATUS cm_bss_peer_create_rsp(struct wlan_objmgr_vdev *vdev, - QDF_STATUS status, - struct qdf_mac_addr *peer_mac); - -/** - * cm_connect_rsp() - Connection manager connect response - * @vdev: vdev pointer - * @resp: Connect response - * - * Return: QDF_STATUS - */ -QDF_STATUS cm_connect_rsp(struct wlan_objmgr_vdev *vdev, - struct wlan_cm_connect_rsp *resp); - -/** - * cm_connect_complete() - This API would be called after connect complete - * request from the serialization. - * @cm_ctx: connection manager context - * @resp: Connection complete resp. - * - * This API would be called after connection completion resp from VDEV mgr - * - * Return: QDF status - */ -QDF_STATUS cm_connect_complete(struct cnx_mgr *cm_ctx, - struct wlan_cm_connect_rsp *resp); - -/** - * cm_add_connect_req_to_list() - add connect req to the connection manager - * req list - * @vdev: vdev on which connect is received - * @req: Connection req provided - * - * Return: QDF status - */ -QDF_STATUS cm_add_connect_req_to_list(struct cnx_mgr *cm_ctx, - struct cm_connect_req *req); - -/** - * cm_connect_start_req() - Connect start req from the requester - * @vdev: vdev on which connect is received - * @req: Connection req provided - * - * Return: QDF status - */ -QDF_STATUS cm_connect_start_req(struct wlan_objmgr_vdev *vdev, - struct wlan_cm_connect_req *req); - -#ifdef WLAN_POLICY_MGR_ENABLE -/** - * cm_hw_mode_change_resp() - HW mode change response - * @pdev: pdev pointer - * @vdev_id: vdev id - * @cm_id: connection ID which gave the hw mode change request - * @status: status of the HW mode change. - * - * Return: void - */ -void cm_hw_mode_change_resp(struct wlan_objmgr_pdev *pdev, uint8_t vdev_id, - wlan_cm_id cm_id, QDF_STATUS status); - -/** - * cm_handle_hw_mode_change() - SM handling of hw mode change resp - * @cm_ctx: connection manager context - * @cm_id: Connection mgr ID assigned to this connect request. - * @event: HW mode success or failure event - * - * Return: QDF_STATUS - */ -QDF_STATUS cm_handle_hw_mode_change(struct cnx_mgr *cm_ctx, wlan_cm_id *cm_id, - enum wlan_cm_sm_evt event); -#else -QDF_STATUS cm_handle_hw_mode_change(struct cnx_mgr *cm_ctx, wlan_cm_id *cm_id, - enum wlan_cm_sm_evt event) -{ - return QDF_STATUS_SUCCESS; -} -#endif - -/*************** DISCONNECT APIs ****************/ - -/** - * cm_disconnect_start() - Initiate the disconnect process - * @cm_ctx: connection manager context - * @req: Disconnect request. - * - * Return: QDF status - */ -QDF_STATUS cm_disconnect_start(struct cnx_mgr *cm_ctx, - struct cm_disconnect_req *req); - -/** - * cm_disconnect_active() - This API would be called after the disconnect - * request gets activated in serialization. - * @cm_ctx: connection manager context - * @cm_id: Connection mgr ID assigned to this connect request. - * - * Return: QDF status - */ -QDF_STATUS cm_disconnect_active(struct cnx_mgr *cm_ctx, wlan_cm_id *cm_id); - -/** - * cm_disconnect_complete() - This API would be called after disconnect complete - * request from the serialization. - * @cm_ctx: connection manager context - * @resp: disconnection complete resp. - * - * This API would be called after connection completion resp from VDEV mgr - * - * Return: QDF status - */ -QDF_STATUS cm_disconnect_complete(struct cnx_mgr *cm_ctx, - struct wlan_cm_discon_rsp *resp); - -/** - * cm_add_disconnect_req_to_list() - add disconnect req to the connection - * manager req list - * @vdev: vdev on which connect is received - * @req: Disconnection req provided - * - * Return: QDF status - */ -QDF_STATUS cm_add_disconnect_req_to_list(struct cnx_mgr *cm_ctx, - struct cm_disconnect_req *req); - -/** - * cm_disconnect_start_req() - Disconnect start req from the requester - * @vdev: vdev on which connect is received - * @req: disconnection req provided - * - * Return: QDF status - */ -QDF_STATUS cm_disconnect_start_req(struct wlan_objmgr_vdev *vdev, - struct wlan_cm_disconnect_req *req); - -/** - * cm_bss_peer_delete_req() - Connection manager bss peer delete - * request - * @vdev: VDEV object - * @peer_mac: Peer mac address - * - * This function is called on peer delete indication and sends peer delete - * request to mlme. - * - * Context: Any context. - * - * Return: QDF_STATUS - */ -QDF_STATUS cm_bss_peer_delete_req(struct wlan_objmgr_vdev *vdev, - struct qdf_mac_addr *peer_mac); - -/** - * cm_vdev_down_req() - Connection manager req to send vdev down to FW - * @vdev: VDEV object - * @status: status - * - * This function is called when peer delete response is received, to send - * vdev down request to mlme - * - * Context: Any context. - * - * Return: QDF_STATUS - */ -QDF_STATUS cm_vdev_down_req(struct wlan_objmgr_vdev *vdev, uint32_t status); - -/** - * cm_disconnect_rsp() - Connection manager api to post connect event - * @vdev: VDEV object - * @cm_discon_rsp: Disconnect response - * - * This function is called when disconnecte response is received, to deliver - * disconnect event to SM - * - * Context: Any context. - * - * Return: QDF_STATUS - */ -QDF_STATUS cm_disconnect_rsp(struct wlan_objmgr_vdev *vdev, - struct wlan_cm_discon_rsp *resp); - -/*************** UTIL APIs ****************/ - -/** - * cm_ser_get_blocking_cmd() - check if serialization command needs to be - * blocking - * - * Return: bool - */ -#ifdef CONN_MGR_ADV_FEATURE -static inline bool cm_ser_get_blocking_cmd(void) -{ - return true; -} -#else -static inline bool cm_ser_get_blocking_cmd(void) -{ - return false; -} -#endif - -/** - * cm_get_cm_id() - Get unique cm id for connect/disconnect request - * @cm_ctx: connection manager context - * @source: source of the request (can be connect or disconnect request) - * - * Return: cm id - */ -wlan_cm_id cm_get_cm_id(struct cnx_mgr *cm_ctx, enum wlan_cm_source source); - -struct cnx_mgr *cm_get_cm_ctx_fl(struct wlan_objmgr_vdev *vdev, - const char *func, uint32_t line); - -/** - * cm_get_cm_ctx() - Get connection manager context from vdev - * @vdev: vdev object pointer - * - * Return: pointer to connection manager context - */ -#define cm_get_cm_ctx(vdev) \ - cm_get_cm_ctx_fl(vdev, __func__, __LINE__) - -/** - * cm_reset_active_cm_id() - Reset active cm_id from cm context, if its same as - * passed cm_id - * @vdev: vdev object pointer - * @cm_id: cmid to match - * - * Return: void - */ -void cm_reset_active_cm_id(struct wlan_objmgr_vdev *vdev, wlan_cm_id cm_id); - -/** - * cm_check_cmid_match_list_head() - check if list head command matches the - * given cm_id - * @cm_ctx: connection manager context - * @cm_id: cm id of connect/disconnect req - * - * Check if front req command matches the given - * cm_id, this can be used to check if the latest (head) is same we are - * trying to processing - * - * Return: true if match else false - */ -bool cm_check_cmid_match_list_head(struct cnx_mgr *cm_ctx, wlan_cm_id *cm_id); - -/** - * cm_check_scanid_match_list_head() - check if list head command matches the - * given scan_id - * @cm_ctx: connection manager context - * @scan_id: scan_id of connect req - * - * Check if front req command is connect command and matches the given - * scan_id, this can be used to check if the latest (head) is same we are - * trying to processing - * - * Return: true if match else false - */ -bool cm_check_scanid_match_list_head(struct cnx_mgr *cm_ctx, - wlan_scan_id *scan_id); - -/** - * cm_free_connect_req_mem() - free connect req internal memory, to be called - * before cm_req is freed - * @connect_req: connect req - * - * Return: void - */ -void cm_free_connect_req_mem(struct cm_connect_req *connect_req); - -/** - * cm_delete_req_from_list() - Delete the request matching cm id - * @cm_ctx: connection manager context - * @cm_id: cm id of connect/disconnect req - * - * Context: Can be called from any context. - * - * Return: QDF_STATUS - */ -QDF_STATUS cm_delete_req_from_list(struct cnx_mgr *cm_ctx, wlan_cm_id cm_id); - -/** - * cm_fill_bss_info_in_connect_rsp_by_cm_id() - fill bss info for the cm id - * @cm_ctx: connection manager context - * @cm_id: cm id of connect/disconnect req - * @resp: resp to copy bss info like ssid/bssid and freq - * - * Fill the SSID form the connect req. - * Fill freq and bssid from current candidate if available (i.e the connection - * has tried to connect to a candidate), else get the bssid from req bssid or - * bssid hint which ever is present. - * - * Return: Success if entry was found else failure - */ -QDF_STATUS -cm_fill_bss_info_in_connect_rsp_by_cm_id(struct cnx_mgr *cm_ctx, - wlan_cm_id cm_id, - struct wlan_cm_connect_rsp *resp); - -/** - * cm_remove_cmd() - Remove cmd from req list and serialization - * @cm_ctx: connection manager context - * @cm_id: cm id of connect/disconnect req - * - * Return: void - */ -void cm_remove_cmd(struct cnx_mgr *cm_ctx, wlan_cm_id cm_id); - -/** - * cm_add_req_to_list_and_indicate_osif() - Add the request to request list in - * cm ctx and indicate same to osif - * @cm_ctx: connection manager context - * @cm_req: cm request - * @source: source of request - * - * Context: Can be called from any context. - * - * Return: QDF_STATUS - */ -QDF_STATUS cm_add_req_to_list_and_indicate_osif(struct cnx_mgr *cm_ctx, - struct cm_req *cm_req, - enum wlan_cm_source source); - -struct cm_req *cm_get_req_by_cm_id_fl(struct cnx_mgr *cm_ctx, wlan_cm_id cm_id, - const char *func, uint32_t line); - -/** - * cm_get_req_by_cm_id() - Get cm req matching the cm id - * @cm_ctx: connection manager context - * @cm_id: cm id of connect/disconnect req - * - * Context: Can be called from any context and to be used only after posting a - * msg to SM (ie holding the SM lock) to avoid use after free. also returned req - * should only be used till SM lock is hold. - * - * Return: cm req from the req list whose cm id matches the argument - */ -#define cm_get_req_by_cm_id(cm_ctx, cm_id) \ - cm_get_req_by_cm_id_fl(cm_ctx, cm_id, __func__, __LINE__) - -/** - * cm_vdev_scan_cancel() - cancel all scans for vdev - * @pdev: pdev pointer - * @vdev: vdev for which scan to be canceled - * - * Return: void - */ -void cm_vdev_scan_cancel(struct wlan_objmgr_pdev *pdev, - struct wlan_objmgr_vdev *vdev); - -/** - * cm_fill_disconnect_resp_from_cm_id() - Fill disconnect response - * @cm_ctx: connection manager context - * @cm_id: cm id of connect/disconnect req - * @resp: Disconnect response which needs to filled - * - * This function is called to fill disconnect response from cm id - * - * Context: Any Context. - * - * Return: Success if disconnect - */ -QDF_STATUS -cm_fill_disconnect_resp_from_cm_id(struct cnx_mgr *cm_ctx, wlan_cm_id cm_id, - struct wlan_cm_discon_rsp *resp); - -/** - * cm_set_max_connect_attempts() - Set max connect attempts - * @vdev: vdev pointer - * @max_connect_attempts: max connect attempts to be set. - * - * Set max connect attempts. Max value is limited to CM_MAX_CONNECT_ATTEMPTS. - * - * Return: void - */ -void cm_set_max_connect_attempts(struct wlan_objmgr_vdev *vdev, - uint8_t max_connect_attempts); - -/** - * cm_is_vdev_connecting() - check if vdev is in conneting state - * @vdev: vdev pointer - * - * Return: bool - */ -bool cm_is_vdev_connecting(struct wlan_objmgr_vdev *vdev); - -/** - * cm_is_vdev_connected() - check if vdev is in conneted state - * @vdev: vdev pointer - * - * Return: bool - */ -bool cm_is_vdev_connected(struct wlan_objmgr_vdev *vdev); - -/** - * cm_is_vdev_disconnecting() - check if vdev is in disconneting state - * @vdev: vdev pointer - * - * Return: bool - */ -bool cm_is_vdev_disconnecting(struct wlan_objmgr_vdev *vdev); - -/** - * cm_is_vdev_disconnected() - check if vdev is disconnected/init state - * @vdev: vdev pointer - * - * Return: bool - */ -bool cm_is_vdev_disconnected(struct wlan_objmgr_vdev *vdev); - -/** - * cm_is_vdev_roaming() - check if vdev is in roaming state - * @vdev: vdev pointer - * - * Return: bool - */ -bool cm_is_vdev_roaming(struct wlan_objmgr_vdev *vdev); - -#endif /* __WLAN_CM_MAIN_API_H__ */ diff --git a/umac/mlme/connection_mgr/core/src/wlan_cm_roam_sm.c b/umac/mlme/connection_mgr/core/src/wlan_cm_roam_sm.c deleted file mode 100644 index f45e1b990bb9..000000000000 --- a/umac/mlme/connection_mgr/core/src/wlan_cm_roam_sm.c +++ /dev/null @@ -1,173 +0,0 @@ -/* - * Copyright (c) 2012-2015, 2020, 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. - */ - -/** - * DOC: Implements general SM framework for connection manager roaming sm - */ - -#include "wlan_cm_main.h" -#include "wlan_cm_roam_sm.h" -#include "wlan_cm_sm.h" - -void cm_state_roaming_entry(void *ctx) -{ - struct cnx_mgr *cm_ctx = ctx; - - cm_sm_state_update(cm_ctx, WLAN_CM_S_ROAMING, WLAN_CM_SS_IDLE); -} - -void cm_state_roaming_exit(void *ctx) -{ -} - -bool cm_state_roaming_event(void *ctx, uint16_t event, uint16_t data_len, - void *data) -{ -// struct cnx_mgr *cm_ctx = ctx; - bool status; - - switch (event) { - default: - status = false; - break; - } - - return status; -} - -#ifdef WLAN_FEATURE_HOST_ROAM -#ifdef WLAN_FEATURE_PREAUTH_ENABLE -void cm_subst_preauth_entry(void *ctx) -{ - struct cnx_mgr *cm_ctx = ctx; - - if (cm_get_state(cm_ctx) != WLAN_CM_S_ROAMING) - QDF_BUG(0); - - cm_set_substate(cm_ctx, WLAN_CM_SS_PREAUTH); -} - -void cm_subst_preauth_exit(void *ctx) -{ -} - -bool cm_subst_preauth_event(void *ctx, uint16_t event, uint16_t data_len, - void *data) -{ -// struct cnx_mgr *cm_ctx = ctx; - bool status; - - switch (event) { - default: - status = false; - break; - } - - return status; -} - -#endif /* WLAN_FEATURE_PREAUTH_ENABLE */ - -void cm_subst_reassoc_entry(void *ctx) -{ - struct cnx_mgr *cm_ctx = ctx; - - if (cm_get_state(cm_ctx) != WLAN_CM_S_ROAMING) - QDF_BUG(0); - - cm_set_substate(cm_ctx, WLAN_CM_SS_REASSOC); -} - -void cm_subst_reassoc_exit(void *ctx) -{ -} - -bool cm_subst_reassoc_event(void *ctx, uint16_t event, uint16_t data_len, - void *data) -{ -// struct cnx_mgr *cm_ctx = ctx; - bool status; - - switch (event) { - default: - status = false; - break; - } - - return status; -} - -#endif /* WLAN_FEATURE_HOST_ROAM */ - -#ifdef WLAN_FEATURE_ROAM_OFFLOAD -void cm_subst_roam_start_entry(void *ctx) -{ - struct cnx_mgr *cm_ctx = ctx; - - if (cm_get_state(cm_ctx) != WLAN_CM_S_ROAMING) - QDF_BUG(0); - - cm_set_substate(cm_ctx, WLAN_CM_SS_ROAM_STARTED); -} - -void cm_subst_roam_start_exit(void *ctx) -{ -} - -bool cm_subst_roam_start_event(void *ctx, uint16_t event, uint16_t data_len, - void *data) -{ -// struct cnx_mgr *cm_ctx = ctx; - bool status; - - switch (event) { - default: - status = false; - break; - } - - return status; -} - -void cm_subst_roam_sync_entry(void *ctx) -{ - struct cnx_mgr *cm_ctx = ctx; - - if (cm_get_state(cm_ctx) != WLAN_CM_S_ROAMING) - QDF_BUG(0); - - cm_set_substate(cm_ctx, WLAN_CM_SS_ROAM_SYNC); -} - -void cm_subst_roam_sync_exit(void *ctx) -{ -} - -bool cm_subst_roam_sync_event(void *ctx, uint16_t event, uint16_t data_len, - void *data) -{ -// struct cnx_mgr *cm_ctx = ctx; - bool status; - - switch (event) { - default: - status = false; - break; - } - - return status; -} -#endif /* WLAN_FEATURE_ROAM_OFFLOAD */ diff --git a/umac/mlme/connection_mgr/core/src/wlan_cm_roam_sm.h b/umac/mlme/connection_mgr/core/src/wlan_cm_roam_sm.h deleted file mode 100644 index 2754d4932c9c..000000000000 --- a/umac/mlme/connection_mgr/core/src/wlan_cm_roam_sm.h +++ /dev/null @@ -1,263 +0,0 @@ -/* - * Copyright (c) 2012-2015, 2020, 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. - */ - -/** - * DOC: wlan_cm_roam_sm.h - * - * This header file maintain structures required for connection mgr roam sm - */ - -#ifndef __WLAN_CM_ROAM_SM_H__ -#define __WLAN_CM_ROAM_SM_H__ - -/** - * cm_state_roaming_entry() - Entry API for roaming state for - * connection mgr - * @ctx: connection manager ctx - * - * API to perform operations on moving to roaming state - * - * Return: void - */ -void cm_state_roaming_entry(void *ctx); - -/** - * cm_state_roaming_exit() - Exit API for roaming state for connection mgr - * @ctx: connection manager ctx - * - * API to perform operations on exiting from roaming state - * - * Return: void - */ -void cm_state_roaming_exit(void *ctx); - -/** - * cm_state_roaming_event() - Roaming State event handler for - * connection mgr - * @ctx: connection manager ctx - * @event: event to handle - * @data_len: event data len - * @data:event data - * - * API to handle events in roaming state - * - * Return: bool - */ -bool cm_state_roaming_event(void *ctx, uint16_t event, uint16_t data_len, - void *data); - -#if defined(WLAN_FEATURE_HOST_ROAM) && defined(WLAN_FEATURE_PREAUTH_ENABLE) -/** - * cm_subst_preauth_entry() - Entry API for preauth sub-state for - * connection mgr - * @ctx: connection manager ctx - * - * API to perform operations on moving to preauth sub-state - * - * Return: void - */ -void cm_subst_preauth_entry(void *ctx); - -/** - * cm_subst_preauth_exit() - Exit API for preauth sub-state for - * connection mgr - * @ctx: connection manager ctx - * - * API to perform operations on exiting from preauth sub-state - * - * Return: void - */ -void cm_subst_preauth_exit(void *ctx); - -/** - * cm_subst_preauth_event() - Preauth sub-state event handler for - * connection mgr - * @ctx: connection manager ctx - * @event: event to handle - * @data_len: event data len - * @data:event data - * - * API to handle events in preauth sub-state - * - * Return: bool - */ -bool cm_subst_preauth_event(void *ctx, uint16_t event, - uint16_t data_len, void *data); -#else - -static inline void cm_subst_preauth_entry(void *ctx) {} - -static inline void cm_subst_preauth_exit(void *ctx) {} - -static inline bool cm_subst_preauth_event(void *ctx, uint16_t event, - uint16_t data_len, void *data) -{ - return true; -} -#endif /* WLAN_FEATURE_HOST_ROAM && WLAN_FEATURE_PREAUTH_ENABLE */ - -#ifdef WLAN_FEATURE_HOST_ROAM -/** - * cm_subst_reassoc_entry() - Entry API for reassoc sub-state for - * connection mgr - * @ctx: connection manager ctx - * - * API to perform operations on moving to reassoc sub-state - * - * Return: void - */ -void cm_subst_reassoc_entry(void *ctx); - -/** - * cm_subst_reassoc_exit() - Exit API for reassoc sub-state for - * connection mgr - * @ctx: connection manager ctx - * - * API to perform operations on exiting from reassoc sub-state - * - * Return: void - */ -void cm_subst_reassoc_exit(void *ctx); - -/** - * cm_subst_reassoc_event() - Reassoc sub-state event handler for - * connection mgr - * @ctx: connection manager ctx - * @event: event to handle - * @data_len: event data len - * @data:event data - * - * API to handle events in preauth sub-state - * - * Return: bool - */ -bool cm_subst_reassoc_event(void *ctx, uint16_t event, uint16_t data_len, - void *data); -#else - -static inline void cm_subst_reassoc_entry(void *ctx) {} -static inline void cm_subst_reassoc_exit(void *ctx) {} -static inline -bool cm_subst_reassoc_event(void *ctx, uint16_t event, uint16_t data_len, - void *data) -{ - return true; -} - -#endif /* WLAN_FEATURE_HOST_ROAM */ - -#ifdef WLAN_FEATURE_ROAM_OFFLOAD - -/** - * cm_subst_roam_start_entry() - Entry API for roam start sub-state for - * connection mgr - * @ctx: connection manager ctx - * - * API to perform operations on moving to roam start sub-state - * - * Return: void - */ -void cm_subst_roam_start_entry(void *ctx); - -/** - * cm_subst_roam_start_exit() - Exit API for roam start sub-state for - * connection mgr - * @ctx: connection manager ctx - * - * API to perform operations on exiting from roam start sub-state - * - * Return: void - */ -void cm_subst_roam_start_exit(void *ctx); - -/** - * cm_subst_roam_start_event() - Roam start sub-state event handler for - * connection mgr - * @ctx: connection manager ctx - * @event: event to handle - * @data_len: event data len - * @data:event data - * - * API to handle events in roam start sub-state - * - * Return: bool - */ -bool cm_subst_roam_start_event(void *ctx, uint16_t event, uint16_t data_len, - void *data); - -/** - * cm_subst_roam_sync_entry() - Entry API for roam sync sub-state for - * connection mgr - * @ctx: connection manager ctx - * - * API to perform operations on moving to roam sync sub-state - * - * Return: void - */ -void cm_subst_roam_sync_entry(void *ctx); - -/** - * cm_subst_roam_sync_exit() - Exit API for roam sync sub-state for - * connection mgr - * @ctx: connection manager ctx - * - * API to perform operations on exiting from roam sync sub-state - * - * Return: void - */ -void cm_subst_roam_sync_exit(void *ctx); - -/** - * cm_subst_roam_sync_event() - Roam sync sub-state event handler for - * connection mgr - * @ctx: connection manager ctx - * @event: event to handle - * @data_len: event data len - * @data:event data - * - * API to handle events in roam sync sub-state - * - * Return: bool - */ -bool cm_subst_roam_sync_event(void *ctx, uint16_t event, uint16_t data_len, - void *data); -#else - -static inline void cm_subst_roam_start_entry(void *ctx) {} - -static inline void cm_subst_roam_start_exit(void *ctx) {} - -static inline -bool cm_subst_roam_start_event(void *ctx, uint16_t event, uint16_t data_len, - void *data) -{ - return true; -} - -static inline void cm_subst_roam_sync_entry(void *ctx) {} - -static inline void cm_subst_roam_sync_exit(void *ctx) {} - -static inline -bool cm_subst_roam_sync_event(void *ctx, uint16_t event, uint16_t data_len, - void *data) -{ - return true; -} - -#endif /* WLAN_FEATURE_ROAM_OFFLOAD */ - -#endif /* __WLAN_CM_ROAM_SM_H__ */ diff --git a/umac/mlme/connection_mgr/core/src/wlan_cm_sm.c b/umac/mlme/connection_mgr/core/src/wlan_cm_sm.c deleted file mode 100644 index 3efda7527a22..000000000000 --- a/umac/mlme/connection_mgr/core/src/wlan_cm_sm.c +++ /dev/null @@ -1,921 +0,0 @@ -/* - * Copyright (c) 2012-2015, 2020, 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. - */ - -/** - * DOC: Implements general SM framework for connection manager - */ - -#include "wlan_cm_main_api.h" -#include "wlan_cm_sm.h" -#include "wlan_cm_roam_sm.h" - -void cm_set_state(struct cnx_mgr *cm_ctx, enum wlan_cm_sm_state state) -{ - if (state < WLAN_CM_S_MAX) - cm_ctx->sm.cm_state = state; - else - mlme_err("vdev %d mlme state (%d) is invalid", - wlan_vdev_get_id(cm_ctx->vdev), state); -} - -void cm_set_substate(struct cnx_mgr *cm_ctx, enum wlan_cm_sm_state substate) -{ - if ((substate > WLAN_CM_S_MAX) && (substate < WLAN_CM_SS_MAX)) - cm_ctx->sm.cm_substate = substate; - else - mlme_err("vdev %d mlme sub state (%d) is invalid", - wlan_vdev_get_id(cm_ctx->vdev), substate); -} - -void cm_sm_state_update(struct cnx_mgr *cm_ctx, - enum wlan_cm_sm_state state, - enum wlan_cm_sm_state substate) -{ - if (!cm_ctx) { - mlme_err("vdev %d cm_ctx is NULL", - wlan_vdev_get_id(cm_ctx->vdev)); - return; - } - - cm_set_state(cm_ctx, state); - cm_set_substate(cm_ctx, substate); -} - -/** - * cm_state_init_entry() - Entry API for init state for connection mgr - * @ctx: connection manager ctx - * - * API to perform operations on moving to init state - * - * Return: void - */ -static void cm_state_init_entry(void *ctx) -{ - struct cnx_mgr *cm_ctx = ctx; - - cm_sm_state_update(cm_ctx, WLAN_CM_S_INIT, WLAN_CM_SS_IDLE); -} - -/** - * cm_state_init_exit() - Exit API for init state for connection mgr - * @ctx: connection manager ctx - * - * API to perform operations on exiting from init state - * - * Return: void - */ -static void cm_state_init_exit(void *ctx) -{ -} - -/** - * cm_state_init_event() - Init State event handler for connection mgr - * @ctx: connection manager ctx - * - * API to handle events in INIT state - * - * Return: bool - */ -static bool cm_state_init_event(void *ctx, uint16_t event, - uint16_t data_len, void *data) -{ - struct cnx_mgr *cm_ctx = ctx; - bool status; - QDF_STATUS qdf_status; - - switch (event) { - case WLAN_CM_SM_EV_CONNECT_REQ: - qdf_status = cm_add_connect_req_to_list(cm_ctx, data); - if (QDF_IS_STATUS_ERROR(qdf_status)) { - /* if fail to add req return failure */ - status = false; - break; - } - cm_sm_transition_to(cm_ctx, WLAN_CM_S_CONNECTING); - cm_sm_deliver_event_sync(cm_ctx, WLAN_CM_SM_EV_CONNECT_START, - data_len, data); - status = true; - break; - case WLAN_CM_SM_EV_CONNECT_FAILURE: - cm_connect_complete(cm_ctx, data); - status = true; - break; - case WLAN_CM_SM_EV_DISCONNECT_DONE: - cm_disconnect_complete(cm_ctx, data); - status = true; - break; - default: - status = false; - break; - } - - return status; -} - -/** - * cm_state_connecting_entry() - Entry API for connecting state for - * connection mgr - * @ctx: connection manager ctx - * - * API to perform operations on moving to connecting state - * - * Return: void - */ -static void cm_state_connecting_entry(void *ctx) -{ - struct cnx_mgr *cm_ctx = ctx; - - cm_sm_state_update(cm_ctx, WLAN_CM_S_CONNECTING, WLAN_CM_SS_IDLE); -} - -/** - * cm_state_connecting_exit() - Exit API for connecting state for - * connection mgr - * @ctx: connection manager ctx - * - * API to perform operations on exiting from connecting state - * - * Return: void - */ -static void cm_state_connecting_exit(void *ctx) -{ -} - -/** - * cm_state_connecting_event() - Connecting State event handler for - * connection mgr - * @ctx: connection manager ctx - * - * API to handle events in CONNECTING state - * - * Return: bool - */ -static bool cm_state_connecting_event(void *ctx, uint16_t event, - uint16_t data_len, void *data) -{ - struct cnx_mgr *cm_ctx = ctx; - bool status; - - switch (event) { - case WLAN_CM_SM_EV_CONNECT_START: - cm_sm_transition_to(cm_ctx, WLAN_CM_SS_JOIN_PENDING); - cm_sm_deliver_event_sync(cm_ctx, event, data_len, data); - status = true; - break; - default: - status = false; - break; - } - - return status; -} - -/** - * cm_state_connected_entry() - Entry API for connected state for - * connection mgr - * @ctx: connection manager ctx - * - * API to perform operations on moving to connected state - * - * Return: void - */ -static void cm_state_connected_entry(void *ctx) -{ - struct cnx_mgr *cm_ctx = ctx; - - cm_sm_state_update(cm_ctx, WLAN_CM_S_CONNECTED, WLAN_CM_SS_IDLE); -} - -/** - * cm_state_connected_exit() - Exit API for connected state for - * connection mgr - * @ctx: connection manager ctx - * - * API to perform operations on exiting from connected state - * - * Return: void - */ -static void cm_state_connected_exit(void *ctx) -{ -} - -/** - * cm_state_connected_event() - Connected State event handler for - * connection mgr - * @ctx: connection manager ctx - * - * API to handle events in CONNECTED state - * - * Return: bool - */ -static bool cm_state_connected_event(void *ctx, uint16_t event, - uint16_t data_len, void *data) -{ - struct cnx_mgr *cm_ctx = ctx; - bool status; - QDF_STATUS qdf_status; - - switch (event) { - case WLAN_CM_SM_EV_CONNECT_SUCCESS: - cm_connect_complete(cm_ctx, data); - status = true; - break; - case WLAN_CM_SM_EV_DISCONNECT_REQ: - qdf_status = cm_add_disconnect_req_to_list(cm_ctx, data); - if (QDF_IS_STATUS_ERROR(qdf_status)) { - /* if fail to add req return failure */ - status = false; - break; - } - cm_sm_transition_to(cm_ctx, WLAN_CM_S_DISCONNECTING); - cm_sm_deliver_event_sync(cm_ctx, WLAN_CM_SM_EV_DISCONNECT_START, - data_len, data); - status = true; - break; - default: - status = false; - break; - } - - return status; -} - -/** - * cm_state_disconnecting_entry() - Entry API for disconnecting state for - * connection mgr - * @ctx: connection manager ctx - * - * API to perform operations on moving to disconnecting state - * - * Return: void - */ -static void cm_state_disconnecting_entry(void *ctx) -{ - struct cnx_mgr *cm_ctx = ctx; - - cm_sm_state_update(cm_ctx, WLAN_CM_S_DISCONNECTING, WLAN_CM_SS_IDLE); -} - -/** - * cm_state_disconnecting_exit() - Exit API for disconnecting state for - * connection mgr - * @ctx: connection manager ctx - * - * API to perform operations on exiting from disconnecting state - * - * Return: void - */ -static void cm_state_disconnecting_exit(void *ctx) -{ -} - -/** - * cm_state_connected_event() - Disconnecting State event handler for - * connection mgr - * @ctx: connection manager ctx - * - * API to handle events in Disconnecting state - * - * Return: bool - */ -static bool cm_state_disconnecting_event(void *ctx, uint16_t event, - uint16_t data_len, void *data) -{ - struct cnx_mgr *cm_ctx = ctx; - bool status; - - switch (event) { - case WLAN_CM_SM_EV_DISCONNECT_START: - cm_disconnect_start(cm_ctx, data); - status = true; - break; - case WLAN_CM_SM_EV_DISCONNECT_ACTIVE: - cm_disconnect_active(cm_ctx, data); - status = true; - break; - case WLAN_CM_SM_EV_DISCONNECT_DONE: - cm_sm_transition_to(cm_ctx, WLAN_CM_S_INIT); - cm_sm_deliver_event_sync(cm_ctx, event, data_len, data); - status = true; - break; - default: - status = false; - break; - } - - return status; -} - -/** - * cm_subst_join_pending_entry() - Entry API for join pending sub-state for - * connection mgr - * @ctx: connection manager ctx - * - * API to perform operations on moving to join pending sub-state - * - * Return: void - */ -static void cm_subst_join_pending_entry(void *ctx) -{ - struct cnx_mgr *cm_ctx = ctx; - - if (cm_get_state(cm_ctx) != WLAN_CM_S_CONNECTING) - QDF_BUG(0); - - cm_set_substate(cm_ctx, WLAN_CM_SS_JOIN_PENDING); -} - -/** - * cm_subst_join_pending_exit() - Exit API for join pending sub-state for - * connection mgr - * @ctx: connection manager ctx - * - * API to perform operations on exiting from join pending sub-state - * - * Return: void - */ -static void cm_subst_join_pending_exit(void *ctx) -{ -} - -/** - * cm_subst_join_pending_event() - Join pending sub-state event handler for - * connection mgr - * @ctx: connection manager ctx - * - * API to handle events in Join pending sub-state - * - * Return: bool - */ -static bool cm_subst_join_pending_event(void *ctx, uint16_t event, - uint16_t data_len, void *data) -{ - struct cnx_mgr *cm_ctx = ctx; - bool status; - QDF_STATUS qdf_status = QDF_STATUS_SUCCESS; - - switch (event) { - case WLAN_CM_SM_EV_CONNECT_START: - cm_connect_start(cm_ctx, data); - status = true; - break; - case WLAN_CM_SM_EV_CONNECT_ACTIVE: - /* check if cm id is valid for the current req */ - if (!cm_check_cmid_match_list_head(cm_ctx, data)) { - status = false; - break; - } - cm_sm_transition_to(cm_ctx, WLAN_CM_SS_JOIN_ACTIVE); - cm_sm_deliver_event_sync(cm_ctx, event, data_len, data); - status = true; - break; - case WLAN_CM_SM_EV_HW_MODE_SUCCESS: - case WLAN_CM_SM_EV_HW_MODE_FAILURE: - /* check if cm id is valid for the current req */ - if (!cm_check_cmid_match_list_head(cm_ctx, data)) { - status = false; - break; - } - cm_handle_hw_mode_change(cm_ctx, data, event); - status = true; - break; - case WLAN_CM_SM_EV_SCAN: - cm_sm_transition_to(cm_ctx, WLAN_CM_SS_SCAN); - cm_sm_deliver_event_sync(cm_ctx, event, data_len, data); - status = true; - break; - case WLAN_CM_SM_EV_SCAN_FAILURE: - qdf_status = QDF_STATUS_E_FAILURE; - /* Fall through after setting status failure */ - case WLAN_CM_SM_EV_SCAN_SUCCESS: - cm_connect_scan_resp(cm_ctx, data, qdf_status); - status = true; - break; - case WLAN_CM_SM_EV_CONNECT_FAILURE: - /* check if connect resp cm id is valid for the current req */ - if (!cm_connect_resp_cmid_match_list_head(cm_ctx, data)) { - status = false; - break; - } - cm_sm_transition_to(cm_ctx, WLAN_CM_S_INIT); - cm_sm_deliver_event_sync(cm_ctx, event, data_len, data); - status = true; - break; - case WLAN_CM_SM_EV_DISCONNECT_ACTIVE: - cm_disconnect_active(cm_ctx, data); - status = true; - break; - default: - status = false; - break; - } - - return status; -} - -/** - * cm_subst_scan_entry() - Entry API for scan sub-state for - * connection mgr - * @ctx: connection manager ctx - * - * API to perform operations on moving to scan sub-state - * - * Return: void - */ -static void cm_subst_scan_entry(void *ctx) -{ - struct cnx_mgr *cm_ctx = ctx; - - if (cm_get_state(cm_ctx) != WLAN_CM_S_CONNECTING) - QDF_BUG(0); - - cm_set_substate(cm_ctx, WLAN_CM_SS_SCAN); -} - -/** - * cm_subst_scan_exit() - Exit API for scan sub-state for - * connection mgr - * @ctx: connection manager ctx - * - * API to perform operations on exiting from scan sub-state - * - * Return: void - */ -static void cm_subst_scan_exit(void *ctx) -{ -} - -/** - * cm_subst_scan_event() - Scan sub-state event handler for - * connection mgr - * @ctx: connection manager ctx - * - * API to handle events in scan sub-state - * - * Return: bool - */ -static bool cm_subst_scan_event(void *ctx, uint16_t event, - uint16_t data_len, void *data) -{ - struct cnx_mgr *cm_ctx = ctx; - bool status; - - switch (event) { - case WLAN_CM_SM_EV_SCAN: - cm_connect_scan_start(cm_ctx, data); - status = true; - break; - case WLAN_CM_SM_EV_SCAN_SUCCESS: - case WLAN_CM_SM_EV_SCAN_FAILURE: - /* check if scan id is valid for the current req */ - if (!cm_check_scanid_match_list_head(cm_ctx, data)) { - status = false; - break; - } - cm_sm_transition_to(cm_ctx, WLAN_CM_SS_JOIN_PENDING); - cm_sm_deliver_event_sync(cm_ctx, event, data_len, data); - status = true; - break; - case WLAN_CM_SM_EV_DISCONNECT_ACTIVE: - cm_disconnect_active(cm_ctx, data); - status = true; - break; - default: - status = false; - break; - } - - return status; -} - -/** - * cm_subst_join_active_entry() - Entry API for join active sub-state for - * connection mgr - * @ctx: connection manager ctx - * - * API to perform operations on moving to join active sub-state - * - * Return: void - */ -static void cm_subst_join_active_entry(void *ctx) -{ - struct cnx_mgr *cm_ctx = ctx; - - if (cm_get_state(cm_ctx) != WLAN_CM_S_CONNECTING) - QDF_BUG(0); - - cm_set_substate(cm_ctx, WLAN_CM_SS_JOIN_ACTIVE); -} - -/** - * cm_subst_join_active_exit() - Exit API for join active sub-state for - * connection mgr - * @ctx: connection manager ctx - * - * API to perform operations on exiting from join active sub-state - * - * Return: void - */ -static void cm_subst_join_active_exit(void *ctx) -{ -} - -/** - * cm_subst_join_active_event() - Join active sub-state event handler for - * connection mgr - * @ctx: connection manager ctx - * - * API to handle events in join active sub-state - * - * Return: bool - */ -static bool cm_subst_join_active_event(void *ctx, uint16_t event, - uint16_t data_len, void *data) -{ - struct cnx_mgr *cm_ctx = ctx; - bool status; - - switch (event) { - case WLAN_CM_SM_EV_CONNECT_ACTIVE: - cm_connect_active(cm_ctx, data); - status = true; - break; - case WLAN_CM_SM_EV_CONNECT_SUCCESS: - /* check if connect resp cm id is valid for the current req */ - if (!cm_connect_resp_cmid_match_list_head(cm_ctx, data)) { - status = false; - break; - } - cm_sm_transition_to(cm_ctx, WLAN_CM_S_CONNECTED); - cm_sm_deliver_event_sync(cm_ctx, event, data_len, data); - status = true; - break; - case WLAN_CM_SM_EV_CONNECT_GET_NEXT_CANDIDATE: - /* check if connect resp cm id is valid for the current req */ - if (!cm_connect_resp_cmid_match_list_head(cm_ctx, data)) { - status = false; - break; - } - cm_try_next_candidate(cm_ctx, data); - status = true; - break; - case WLAN_CM_SM_EV_CONNECT_FAILURE: - /* check if connect resp cm id is valid for the current req */ - if (!cm_connect_resp_cmid_match_list_head(cm_ctx, data)) { - status = false; - break; - } - cm_sm_transition_to(cm_ctx, WLAN_CM_S_INIT); - cm_sm_deliver_event_sync(cm_ctx, event, data_len, data); - status = true; - break; - case WLAN_CM_SM_EV_BSS_SELECT_IND_SUCCESS: - /* check if cm id is valid for the current req */ - if (!cm_check_cmid_match_list_head(cm_ctx, data)) { - status = false; - break; - } - cm_peer_create_on_bss_select_ind_resp(cm_ctx, data); - status = true; - break; - case WLAN_CM_SM_EV_BSS_CREATE_PEER_SUCCESS: - /* check if cm id is valid for the current req */ - if (!cm_check_cmid_match_list_head(cm_ctx, data)) { - status = false; - break; - } - cm_resume_connect_after_peer_create(cm_ctx, data); - status = true; - break; - default: - status = false; - break; - } - - return status; -} - -struct wlan_sm_state_info cm_sm_info[] = { - { - (uint8_t)WLAN_CM_S_INIT, - (uint8_t)WLAN_SM_ENGINE_STATE_NONE, - (uint8_t)WLAN_SM_ENGINE_STATE_NONE, - true, - "INIT", - cm_state_init_entry, - cm_state_init_exit, - cm_state_init_event - }, - { - (uint8_t)WLAN_CM_S_CONNECTING, - (uint8_t)WLAN_SM_ENGINE_STATE_NONE, - (uint8_t)WLAN_SM_ENGINE_STATE_NONE, - true, - "CONNECTING", - cm_state_connecting_entry, - cm_state_connecting_exit, - cm_state_connecting_event - }, - { - (uint8_t)WLAN_CM_S_CONNECTED, - (uint8_t)WLAN_SM_ENGINE_STATE_NONE, - (uint8_t)WLAN_SM_ENGINE_STATE_NONE, - true, - "CONNECTED", - cm_state_connected_entry, - cm_state_connected_exit, - cm_state_connected_event - }, - { - (uint8_t)WLAN_CM_S_DISCONNECTING, - (uint8_t)WLAN_SM_ENGINE_STATE_NONE, - (uint8_t)WLAN_SM_ENGINE_STATE_NONE, - true, - "DISCONNECTING", - cm_state_disconnecting_entry, - cm_state_disconnecting_exit, - cm_state_disconnecting_event - }, - { - (uint8_t)WLAN_CM_S_ROAMING, - (uint8_t)WLAN_SM_ENGINE_STATE_NONE, - (uint8_t)WLAN_SM_ENGINE_STATE_NONE, - true, - "ROAMING", - cm_state_roaming_entry, - cm_state_roaming_exit, - cm_state_roaming_event - }, - { - (uint8_t)WLAN_CM_S_MAX, - (uint8_t)WLAN_SM_ENGINE_STATE_NONE, - (uint8_t)WLAN_SM_ENGINE_STATE_NONE, - false, - "INVALID", - NULL, - NULL, - NULL - }, - { - (uint8_t)WLAN_CM_SS_IDLE, - (uint8_t)WLAN_SM_ENGINE_STATE_NONE, - (uint8_t)WLAN_SM_ENGINE_STATE_NONE, - false, - "IDLE", - NULL, - NULL, - NULL - }, - { - (uint8_t)WLAN_CM_SS_JOIN_PENDING, - (uint8_t)WLAN_CM_S_CONNECTING, - (uint8_t)WLAN_SM_ENGINE_STATE_NONE, - false, - "JOIN_PENDING", - cm_subst_join_pending_entry, - cm_subst_join_pending_exit, - cm_subst_join_pending_event - }, - { - (uint8_t)WLAN_CM_SS_SCAN, - (uint8_t)WLAN_CM_S_CONNECTING, - (uint8_t)WLAN_SM_ENGINE_STATE_NONE, - false, - "SCAN", - cm_subst_scan_entry, - cm_subst_scan_exit, - cm_subst_scan_event - }, - { - (uint8_t)WLAN_CM_SS_JOIN_ACTIVE, - (uint8_t)WLAN_CM_S_CONNECTING, - (uint8_t)WLAN_SM_ENGINE_STATE_NONE, - false, - "JOIN_ACTIVE", - cm_subst_join_active_entry, - cm_subst_join_active_exit, - cm_subst_join_active_event - }, - { - (uint8_t)WLAN_CM_SS_PREAUTH, - (uint8_t)WLAN_CM_S_ROAMING, - (uint8_t)WLAN_SM_ENGINE_STATE_NONE, - false, - "PREAUTH", - cm_subst_preauth_entry, - cm_subst_preauth_exit, - cm_subst_preauth_event - }, - { - (uint8_t)WLAN_CM_SS_REASSOC, - (uint8_t)WLAN_CM_S_ROAMING, - (uint8_t)WLAN_SM_ENGINE_STATE_NONE, - false, - "REASSOC", - cm_subst_reassoc_entry, - cm_subst_reassoc_exit, - cm_subst_reassoc_event - }, - { - (uint8_t)WLAN_CM_SS_ROAM_STARTED, - (uint8_t)WLAN_CM_S_ROAMING, - (uint8_t)WLAN_SM_ENGINE_STATE_NONE, - false, - "ROAM_START", - cm_subst_roam_start_entry, - cm_subst_roam_start_exit, - cm_subst_roam_start_event - }, - { - (uint8_t)WLAN_CM_SS_ROAM_SYNC, - (uint8_t)WLAN_CM_S_ROAMING, - (uint8_t)WLAN_SM_ENGINE_STATE_NONE, - false, - "ROAM_SYNC", - cm_subst_roam_sync_entry, - cm_subst_roam_sync_exit, - cm_subst_roam_sync_event - }, - { - (uint8_t)WLAN_CM_SS_MAX, - (uint8_t)WLAN_SM_ENGINE_STATE_NONE, - (uint8_t)WLAN_SM_ENGINE_STATE_NONE, - false, - "INVALID", - NULL, - NULL, - NULL - }, -}; - -static const char *cm_sm_event_names[] = { - "EV_CONNECT_REQ", - "EV_SCAN", - "EV_SCAN_SUCCESS", - "EV_SCAN_FAILURE", - "EV_HW_MODE_SUCCESS", - "EV_HW_MODE_FAILURE", - "EV_CONNECT_START", - "EV_CONNECT_ACTIVE", - "EV_CONNECT_SUCCESS", - "EV_BSS_SELECT_IND_SUCCESS", - "EV_BSS_CREATE_PEER_SUCCESS" - "EV_CONNECT_GET_NXT_CANDIDATE", - "EV_CONNECT_FAILURE", - "EV_DISCONNECT_REQ", - "EV_DISCONNECT_START", - "EV_DISCONNECT_ACTIVE", - "EV_DISCONNECT_DONE", - "EV_ROAM_START", - "EV_ROAM_SYNC", - "EV_ROAM_INVOKE_FAIL", - "EV_ROAM_HO_FAIL", - "EV_PREAUTH_DONE", - "EV_GET_NEXT_PREAUTH_AP", - "EV_PREAUTH_FAIL", - "EV_START_REASSOC", - "EV_REASSOC_DONE", - "EV_REASSOC_FAILURE", - "EV_ROAM_COMPLETE", -}; - -enum wlan_cm_sm_state cm_get_state(struct cnx_mgr *cm_ctx) -{ - enum QDF_OPMODE op_mode; - - if (!cm_ctx || !cm_ctx->vdev) - return WLAN_CM_S_MAX; - - op_mode = wlan_vdev_mlme_get_opmode(cm_ctx->vdev); - - if (op_mode != QDF_STA_MODE && op_mode != QDF_P2P_CLIENT_MODE) - return WLAN_CM_S_MAX; - - return cm_ctx->sm.cm_state; -} - -enum wlan_cm_sm_state cm_get_sub_state(struct cnx_mgr *cm_ctx) -{ - enum QDF_OPMODE op_mode; - - if (!cm_ctx || !cm_ctx->vdev) - return WLAN_CM_SS_MAX; - - op_mode = wlan_vdev_mlme_get_opmode(cm_ctx->vdev); - - if (op_mode != QDF_STA_MODE && op_mode != QDF_P2P_CLIENT_MODE) - return WLAN_CM_SS_MAX; - - return cm_ctx->sm.cm_substate; -} - -static void cm_sm_print_state_event(struct cnx_mgr *cm_ctx, - enum wlan_cm_sm_evt event) -{ - enum wlan_cm_sm_state state; - enum wlan_cm_sm_state substate; - - state = cm_get_state(cm_ctx); - substate = cm_get_sub_state(cm_ctx); - - mlme_nofl_debug("[%s]%s - %s, %s", cm_ctx->sm.sm_hdl->name, - cm_sm_info[state].name, cm_sm_info[substate].name, - cm_sm_event_names[event]); -} - -static void cm_sm_print_state(struct cnx_mgr *cm_ctx) -{ - enum wlan_cm_sm_state state; - enum wlan_cm_sm_state substate; - - state = cm_get_state(cm_ctx); - substate = cm_get_sub_state(cm_ctx); - - mlme_nofl_debug("[%s]%s - %s", cm_ctx->sm.sm_hdl->name, - cm_sm_info[state].name, cm_sm_info[substate].name); -} - -QDF_STATUS cm_sm_deliver_event(struct wlan_objmgr_vdev *vdev, - enum wlan_cm_sm_evt event, - uint16_t data_len, void *data) -{ - QDF_STATUS status; - enum wlan_cm_sm_state state_entry, state_exit; - enum wlan_cm_sm_state substate_entry, substate_exit; - enum QDF_OPMODE op_mode = wlan_vdev_mlme_get_opmode(vdev); - struct cnx_mgr *cm_ctx; - - if (op_mode != QDF_STA_MODE && op_mode != QDF_P2P_CLIENT_MODE) { - mlme_err("vdev %d Invalid mode %d", - wlan_vdev_get_id(vdev), op_mode); - return QDF_STATUS_E_NOSUPPORT; - } - - cm_ctx = cm_get_cm_ctx(vdev); - if (!cm_ctx) - return QDF_STATUS_E_FAILURE; - - cm_lock_acquire(cm_ctx); - - /* store entry state and sub state for prints */ - state_entry = cm_get_state(cm_ctx); - substate_entry = cm_get_sub_state(cm_ctx); - cm_sm_print_state_event(cm_ctx, event); - - status = cm_sm_deliver_event_sync(cm_ctx, event, data_len, data); - /* Take exit state, exit substate for prints */ - state_exit = cm_get_state(cm_ctx); - substate_exit = cm_get_sub_state(cm_ctx); - /* If no state and substate change, don't print */ - if (!((state_entry == state_exit) && (substate_entry == substate_exit))) - cm_sm_print_state(cm_ctx); - cm_lock_release(cm_ctx); - - return status; -} - -QDF_STATUS cm_sm_create(struct cnx_mgr *cm_ctx) -{ - struct wlan_sm *sm; - uint8_t name[WLAN_SM_ENGINE_MAX_NAME]; - - qdf_scnprintf(name, sizeof(name), "CM-VDEV-%d", - wlan_vdev_get_id(cm_ctx->vdev)); - sm = wlan_sm_create(name, cm_ctx, - WLAN_CM_S_INIT, - cm_sm_info, - QDF_ARRAY_SIZE(cm_sm_info), - cm_sm_event_names, - QDF_ARRAY_SIZE(cm_sm_event_names)); - if (!sm) { - mlme_err("vdev %d CM State Machine allocation failed", - wlan_vdev_get_id(cm_ctx->vdev)); - return QDF_STATUS_E_NOMEM; - } - cm_ctx->sm.sm_hdl = sm; - - cm_lock_create(cm_ctx); - - return QDF_STATUS_SUCCESS; -} - -QDF_STATUS cm_sm_destroy(struct cnx_mgr *cm_ctx) -{ - cm_lock_destroy(cm_ctx); - wlan_sm_delete(cm_ctx->sm.sm_hdl); - - return QDF_STATUS_SUCCESS; -} diff --git a/umac/mlme/connection_mgr/core/src/wlan_cm_sm.h b/umac/mlme/connection_mgr/core/src/wlan_cm_sm.h deleted file mode 100644 index 55f3b9afae2b..000000000000 --- a/umac/mlme/connection_mgr/core/src/wlan_cm_sm.h +++ /dev/null @@ -1,333 +0,0 @@ -/* - * Copyright (c) 2012-2015, 2020, 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. - */ - -/** - * DOC: wlan_cm_sm.h - * - * This header file maintain structures required for connection mgr sm infra - */ - -#ifndef __WLAN_CM_SM_H__ -#define __WLAN_CM_SM_H__ - -#ifdef FEATURE_CM_ENABLE -#include - -/** - * enum wlan_cm_sm_evt - connection manager related events - * @WLAN_CM_SM_EV_CONNECT_REQ: Connect request event from requester - * @WLAN_CM_SM_EV_SCAN: Event to start connect scan - * @WLAN_CM_SM_EV_SCAN_SUCCESS: Connect scan success event - * @WLAN_CM_SM_EV_SCAN_FAILURE: Connect scan fail event - * @WLAN_CM_SM_EV_HW_MODE_SUCCESS: Hw mode change is success - * @WLAN_CM_SM_EV_HW_MODE_FAILURE: Hw mode change is failure - * @WLAN_CM_SM_EV_CONNECT_START: Connect start process initiate - * @WLAN_CM_SM_EV_CONNECT_ACTIVE: Connect request is activated - * @WLAN_CM_SM_EV_CONNECT_SUCCESS: Connect success - * @WLAN_CM_SM_EV_BSS_SELECT_IND_SUCCESS: Mlme resp for BSS select indication - * @WLAN_CM_SM_EV_BSS_CREATE_PEER_SUCCESS: BSS peer create success - * @WLAN_CM_SM_EV_CONNECT_GET_NEXT_CANDIDATE: Get next candidate for connection - * @WLAN_CM_SM_EV_CONNECT_FAILURE: Connect failed for all candidate - * @WLAN_CM_SM_EV_DISCONNECT_REQ: Disconnect request event from - * requester - * @WLAN_CM_SM_EV_DISCONNECT_START: Start disconnect sequence - * @WLAN_CM_SM_EV_DISCONNECT_ACTIVE: Process disconnect after in active cmd - * @WLAN_CM_SM_EV_DISCONNECT_DONE: Disconnect done event - * @WLAN_CM_SM_EV_ROAM_START: Roam start event - * @WLAN_CM_SM_EV_ROAM_SYNC: Roam sync event - * @WLAN_CM_SM_EV_ROAM_INVOKE_FAIL: Roam invoke fail event - * @WLAN_CM_SM_EV_ROAM_HO_FAIL: Hand off failed event - * @WLAN_CM_SM_EV_PREAUTH_DONE: Preauth is completed - * @WLAN_CM_SM_EV_GET_NEXT_PREAUTH_AP: Get next candidate as preauth failed - * @WLAN_CM_SM_EV_PREAUTH_FAIL: Preauth failed for all candidate - * @WLAN_CM_SM_EV_START_REASSOC: Start reassoc after preauth done - * @WLAN_CM_SM_EV_REASSOC_DONE: Reassoc completed - * @WLAN_CM_SM_EV_REASSOC_FAILURE: Reassoc failed - * @WLAN_CM_SM_EV_ROAM_COMPLETE: Roaming completed - * @WLAN_CM_SM_EV_MAX: Max event - */ -enum wlan_cm_sm_evt { - WLAN_CM_SM_EV_CONNECT_REQ = 0, - WLAN_CM_SM_EV_SCAN = 1, - WLAN_CM_SM_EV_SCAN_SUCCESS = 2, - WLAN_CM_SM_EV_SCAN_FAILURE = 3, - WLAN_CM_SM_EV_HW_MODE_SUCCESS = 4, - WLAN_CM_SM_EV_HW_MODE_FAILURE = 5, - WLAN_CM_SM_EV_CONNECT_START = 6, - WLAN_CM_SM_EV_CONNECT_ACTIVE = 7, - WLAN_CM_SM_EV_CONNECT_SUCCESS = 8, - WLAN_CM_SM_EV_BSS_SELECT_IND_SUCCESS = 9, - WLAN_CM_SM_EV_BSS_CREATE_PEER_SUCCESS = 10, - WLAN_CM_SM_EV_CONNECT_GET_NEXT_CANDIDATE = 11, - WLAN_CM_SM_EV_CONNECT_FAILURE = 12, - WLAN_CM_SM_EV_DISCONNECT_REQ = 13, - WLAN_CM_SM_EV_DISCONNECT_START = 14, - WLAN_CM_SM_EV_DISCONNECT_ACTIVE = 15, - WLAN_CM_SM_EV_DISCONNECT_DONE = 16, - WLAN_CM_SM_EV_ROAM_START = 17, - WLAN_CM_SM_EV_ROAM_SYNC = 18, - WLAN_CM_SM_EV_ROAM_INVOKE_FAIL = 19, - WLAN_CM_SM_EV_ROAM_HO_FAIL = 20, - WLAN_CM_SM_EV_PREAUTH_DONE = 21, - WLAN_CM_SM_EV_GET_NEXT_PREAUTH_AP = 22, - WLAN_CM_SM_EV_PREAUTH_FAIL = 23, - WLAN_CM_SM_EV_START_REASSOC = 24, - WLAN_CM_SM_EV_REASSOC_DONE = 25, - WLAN_CM_SM_EV_REASSOC_FAILURE = 26, - WLAN_CM_SM_EV_ROAM_COMPLETE = 27, - WLAN_CM_SM_EV_MAX, -}; - -/** - * cm_sm_create() - Invoke SM creation for connection manager - * @cm_ctx: connection manager ctx - * - * API allocates CM MLME SM and initializes SM lock - * - * Return: SUCCESS on successful allocation - * FAILURE, if registration fails - */ -QDF_STATUS cm_sm_create(struct cnx_mgr *cm_ctx); - -/** - * cm_sm_destroy() - Invoke SM deletion for connection manager - * @cm_ctx: connection manager ctx - * - * API destroys CM MLME SM and SM lock - * - * Return: SUCCESS on successful deletion - * FAILURE, if deletion fails - */ -QDF_STATUS cm_sm_destroy(struct cnx_mgr *cm_ctx); - -/** - * cm_sm_history_print() - Prints SM history - * @cm_ctx: connection manager ctx - * - * API to print CM SM history - * - * Return: void - */ -#ifdef SM_ENG_HIST_ENABLE -static inline void cm_sm_history_print(struct cnx_mgr *cm_ctx) -{ - return wlan_sm_print_history(cm_ctx->sm.sm_hdl); -} -#else -static inline void cm_sm_history_print(struct cnx_mgr *cm_ctx) -{ -} -#endif - -#ifdef WLAN_CM_USE_SPINLOCK -/** - * cm_lock_create - Create CM SM mutex/spinlock - * @cm_ctx: connection manager ctx - * - * Creates CM SM mutex/spinlock - * - * Return: void - */ -static inline void -cm_lock_create(struct cnx_mgr *cm_ctx) -{ - qdf_spinlock_create(&cm_ctx->sm.cm_sm_lock); -} - -/** - * cm_lock_destroy - Destroy CM SM mutex/spinlock - * @cm_ctx: connection manager ctx - * - * Destroy CM SM mutex/spinlock - * - * Return: void - */ -static inline void -cm_lock_destroy(struct cnx_mgr *cm_ctx) -{ - qdf_spinlock_destroy(&cm_ctx->sm.cm_sm_lock); -} - -/** - * cm_lock_acquire - acquire CM SM mutex/spinlock - * @cm_ctx: connection manager ctx - * - * acquire CM SM mutex/spinlock - * - * return: void - */ -static inline void cm_lock_acquire(struct cnx_mgr *cm_ctx) -{ - qdf_spinlock_acquire(&cm_ctx->sm.cm_sm_lock); -} - -/** - * cm_lock_release - release CM SM mutex/spinlock - * @cm_ctx: connection manager ctx - * - * release CM SM mutex/spinlock - * - * return: void - */ -static inline void cm_lock_release(struct cnx_mgr *cm_ctx) -{ - qdf_spinlock_release(&cm_ctx->sm.cm_sm_lock); -} -#else -static inline void -cm_lock_create(struct cnx_mgr *cm_ctx) -{ - qdf_mutex_create(&cm_ctx->sm.cm_sm_lock); -} - -static inline void -cm_lock_destroy(struct cnx_mgr *cm_ctx) -{ - qdf_mutex_destroy(&cm_ctx->sm.cm_sm_lock); -} - -static inline void cm_lock_acquire(struct cnx_mgr *cm_ctx) -{ - qdf_mutex_acquire(&cm_ctx->sm.cm_sm_lock); -} - -static inline void cm_lock_release(struct cnx_mgr *cm_ctx) -{ - qdf_mutex_release(&cm_ctx->sm.cm_sm_lock); -} -#endif /* WLAN_CM_USE_SPINLOCK */ - -/** - * cm_sm_transition_to() - invokes state transition - * @cm_ctx: connection manager ctx - * @state: new cm state - * - * API to invoke SM API to move to new state - * - * Return: void - */ -static inline void cm_sm_transition_to(struct cnx_mgr *cm_ctx, - enum wlan_cm_sm_state state) -{ - wlan_sm_transition_to(cm_ctx->sm.sm_hdl, state); -} - -/** - * cm_get_state() - get mlme state - * @cm_ctx: connection manager SM ctx - * - * API to get cm state - * - * Return: state of cm - */ -enum wlan_cm_sm_state cm_get_state(struct cnx_mgr *cm_ctx); - -/** - * cm_get_sub_state() - get mlme substate - * @cm_ctx: connection manager SM ctx - * - * API to get cm substate - * - * Return: substate of cm - */ -enum wlan_cm_sm_state cm_get_sub_state(struct cnx_mgr *cm_ctx); - -/** - * cm_set_state() - set cm mlme state - * @cm_ctx: connection manager SM ctx - * @state: cm state - * - * API to set cm state - * - * Return: void - */ -void cm_set_state(struct cnx_mgr *cm_ctx, enum wlan_cm_sm_state state); -/** - * cm_set_substate() - set cm mlme sub state - * @cm_ctx: connection manager SM ctx - * @substate: cm sub state - * - * API to set cm sub state - * - * Return: void - */ -void cm_set_substate(struct cnx_mgr *cm_ctx, - enum wlan_cm_sm_state substate); - -/** - * cm_sm_state_update() - set cm mlme state and sub state - * @cm_ctx: connection manager SM ctx - * @state: cm state - * @substate: cm sub state - * - * API to invoke util APIs to set state and MLME sub state - * - * Return: void - */ -void cm_sm_state_update(struct cnx_mgr *cm_ctx, - enum wlan_cm_sm_state state, - enum wlan_cm_sm_state substate); - -/** - * cm_sm_deliver_event_sync() - Delivers event to connection manager SM while - * holding lock - * @cm_ctx: cm ctx - * @event: CM event - * @data_len: data size - * @data: event data - * - * API to dispatch event to VDEV MLME SM without lock, in case lock is already - * held. - * - * Context: Can be called from any context, This should be called in case - * SM lock is already taken. If lock is not taken use cm_sm_deliver_event API - * instead. - * - * Return: SUCCESS: on handling event - * FAILURE: If event not handled - */ -static inline -QDF_STATUS cm_sm_deliver_event_sync(struct cnx_mgr *cm_ctx, - enum wlan_cm_sm_evt event, - uint16_t data_len, void *data) -{ - return wlan_sm_dispatch(cm_ctx->sm.sm_hdl, event, data_len, data); -} - -/** - * cm_sm_deliver_event() - Delivers event to connection manager SM - * @vdev: Object manager VDEV object - * @event: CM event - * @data_len: data size - * @data: event data - * - * API to dispatch event to VDEV MLME SM with lock. To be used while paosting - * events from API called from publick API. i.e. indication/response/request - * from any other moudle or NB/SB. - * - * Context: Can be called from any context, This should be called in case - * SM lock is not taken, the API will take the lock before posting to SM. - * If lock is already taken use cm_sm_deliver_event_sync API instead. - * - * Return: SUCCESS: on handling event - * FAILURE: If event not handled - */ -QDF_STATUS cm_sm_deliver_event(struct wlan_objmgr_vdev *vdev, - enum wlan_cm_sm_evt event, - uint16_t data_len, void *data); - -#endif /* FEATURE_CM_ENABLE */ -#endif /* __WLAN_CM_SM_H__ */ diff --git a/umac/mlme/connection_mgr/core/src/wlan_cm_util.c b/umac/mlme/connection_mgr/core/src/wlan_cm_util.c deleted file mode 100644 index f955a02f3eba..000000000000 --- a/umac/mlme/connection_mgr/core/src/wlan_cm_util.c +++ /dev/null @@ -1,551 +0,0 @@ -/* - * Copyright (c) 2012-2015, 2020, 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. - */ - -/** - * DOC: Implements general util apis of connection manager - */ - -#include "wlan_cm_main_api.h" -#include "wlan_scan_api.h" -#include "wlan_cm_public_struct.h" -#include "wlan_serialization_api.h" - -static uint32_t cm_get_prefix_for_cm_id(enum wlan_cm_source source) { - switch (source) { - case CM_OSIF_CONNECT: - case CM_ROAMING: - return CONNECT_REQ_PREFIX; - default: - return DISCONNECT_REQ_PREFIX; - } -} - -wlan_cm_id cm_get_cm_id(struct cnx_mgr *cm_ctx, enum wlan_cm_source source) -{ - wlan_cm_id cmd_id; - uint32_t prefix; - - prefix = cm_get_prefix_for_cm_id(source); - - cmd_id = qdf_atomic_inc_return(&cm_ctx->global_cmd_id); - cmd_id = (cmd_id & CM_ID_MASK); - cmd_id = (cmd_id | prefix); - - return cmd_id; -} - -struct cnx_mgr *cm_get_cm_ctx_fl(struct wlan_objmgr_vdev *vdev, - const char *func, uint32_t line) -{ - struct vdev_mlme_obj *vdev_mlme; - struct cnx_mgr *cm_ctx = NULL; - - vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev); - if (vdev_mlme) - cm_ctx = vdev_mlme->cnx_mgr_ctx; - - if (!cm_ctx) - mlme_nofl_err("%s:%u: vdev %d cm_ctx is NULL", func, line, - wlan_vdev_get_id(vdev)); - - return cm_ctx; -} - -void cm_reset_active_cm_id(struct wlan_objmgr_vdev *vdev, wlan_cm_id cm_id) -{ - struct cnx_mgr *cm_ctx; - - cm_ctx = cm_get_cm_ctx(vdev); - if (!cm_ctx) - return; - - /* Reset active cm id if cm id match */ - if (cm_ctx->active_cm_id == cm_id) - cm_ctx->active_cm_id = CM_ID_INVALID; -} - - -#ifdef WLAN_CM_USE_SPINLOCK -/** - * cm_req_lock_acquire - acquire CM SM mutex/spinlock - * @cm_ctx: connection manager ctx - * - * acquire CM SM mutex/spinlock - * - * return: void - */ -static inline void cm_req_lock_acquire(struct cnx_mgr *cm_ctx) -{ - qdf_spinlock_acquire(&cm_ctx->cm_req_lock); -} - -/** - * cm_req_lock_release - release CM SM mutex/spinlock - * @cm_ctx: connection manager ctx - * - * release CM SM mutex/spinlock - * - * return: void - */ -static inline void cm_req_lock_release(struct cnx_mgr *cm_ctx) -{ - qdf_spinlock_release(&cm_ctx->cm_req_lock); -} -#else -static inline void cm_req_lock_acquire(struct cnx_mgr *cm_ctx) -{ - qdf_mutex_acquire(&cm_ctx->cm_req_lock); -} - -static inline void cm_req_lock_release(struct cnx_mgr *cm_ctx) -{ - qdf_mutex_release(&cm_ctx->cm_req_lock); -} -#endif /* WLAN_CM_USE_SPINLOCK */ - -bool cm_check_cmid_match_list_head(struct cnx_mgr *cm_ctx, wlan_cm_id *cm_id) -{ - qdf_list_node_t *cur_node = NULL; - struct cm_req *cm_req; - bool match = false; - wlan_cm_id head_cm_id = 0; - - if (!cm_id) - return false; - - cm_req_lock_acquire(cm_ctx); - qdf_list_peek_front(&cm_ctx->req_list, &cur_node); - if (!cur_node) - goto exit; - - cm_req = qdf_container_of(cur_node, struct cm_req, node); - head_cm_id = cm_req->cm_id; - if (head_cm_id == *cm_id) - match = true; - -exit: - cm_req_lock_release(cm_ctx); - if (!match) - mlme_info("head_cm_id 0x%x didn't match the given cm_id 0x%x", - head_cm_id, *cm_id); - - return match; -} - -bool cm_check_scanid_match_list_head(struct cnx_mgr *cm_ctx, - wlan_scan_id *scan_id) -{ - qdf_list_node_t *cur_node = NULL; - struct cm_req *cm_req; - bool match = false; - wlan_cm_id head_scan_id = 0; - uint32_t prefix = 0; - - if (!scan_id) - return false; - - cm_req_lock_acquire(cm_ctx); - qdf_list_peek_front(&cm_ctx->req_list, &cur_node); - if (!cur_node) - goto exit; - - cm_req = qdf_container_of(cur_node, struct cm_req, node); - prefix = CM_ID_GET_PREFIX(cm_req->cm_id); - /* Check only if head is connect req */ - if (prefix != CONNECT_REQ_PREFIX) - goto exit; - head_scan_id = cm_req->connect_req.scan_id; - if (head_scan_id == *scan_id) - match = true; - -exit: - cm_req_lock_release(cm_ctx); - if (!match) - mlme_info("head_scan_id 0x%x didn't match the given scan_id 0x%x prefix 0x%x", - head_scan_id, *scan_id, prefix); - - return match; -} - -struct cm_req *cm_get_req_by_cm_id_fl(struct cnx_mgr *cm_ctx, wlan_cm_id cm_id, - const char *func, uint32_t line) -{ - qdf_list_node_t *cur_node = NULL, *next_node = NULL; - struct cm_req * cm_req; - - cm_req_lock_acquire(cm_ctx); - qdf_list_peek_front(&cm_ctx->req_list, &cur_node); - while (cur_node) { - qdf_list_peek_next(&cm_ctx->req_list, cur_node, &next_node); - cm_req = qdf_container_of(cur_node, struct cm_req, node); - - if (cm_req->cm_id == cm_id) { - cm_req_lock_release(cm_ctx); - return cm_req; - } - - cur_node = next_node; - next_node = NULL; - } - cm_req_lock_release(cm_ctx); - - mlme_nofl_info("%s:%u: cm req not found for cm id 0x%x", func, - line, cm_id); - - return NULL; -} - -QDF_STATUS -cm_fill_bss_info_in_connect_rsp_by_cm_id(struct cnx_mgr *cm_ctx, - wlan_cm_id cm_id, - struct wlan_cm_connect_rsp *resp) -{ - qdf_list_node_t *cur_node = NULL, *next_node = NULL; - struct cm_req *cm_req; - uint32_t prefix = CM_ID_GET_PREFIX(cm_id); - struct scan_cache_node *candidate; - struct wlan_cm_connect_req *req; - - if (prefix != CONNECT_REQ_PREFIX) - return QDF_STATUS_E_INVAL; - - cm_req_lock_acquire(cm_ctx); - qdf_list_peek_front(&cm_ctx->req_list, &cur_node); - while (cur_node) { - qdf_list_peek_next(&cm_ctx->req_list, cur_node, &next_node); - cm_req = qdf_container_of(cur_node, struct cm_req, node); - - if (cm_req->cm_id == cm_id) { - req = &cm_req->connect_req.req; - candidate = cm_req->connect_req.cur_candidate; - if (candidate) - qdf_copy_macaddr(&resp->bssid, - &candidate->entry->bssid); - else if (!qdf_is_macaddr_zero(&req->bssid)) - qdf_copy_macaddr(&resp->bssid, - &req->bssid); - else - qdf_copy_macaddr(&resp->bssid, - &req->bssid_hint); - if (candidate) - resp->freq = - candidate->entry->channel.chan_freq; - else - resp->freq = req->chan_freq; - qdf_mem_copy(&resp->ssid, &req->ssid, - sizeof(resp->bssid)); - cm_req_lock_release(cm_ctx); - return QDF_STATUS_SUCCESS; - } - - cur_node = next_node; - next_node = NULL; - } - cm_req_lock_release(cm_ctx); - - return QDF_STATUS_E_FAILURE; -} - -QDF_STATUS cm_add_req_to_list_and_indicate_osif(struct cnx_mgr *cm_ctx, - struct cm_req *cm_req, - enum wlan_cm_source source) -{ - uint32_t prefix = CM_ID_GET_PREFIX(cm_req->cm_id); - - cm_req_lock_acquire(cm_ctx); - if (qdf_list_size(&cm_ctx->req_list) >= CM_MAX_REQ) { - cm_req_lock_release(cm_ctx); - mlme_err(CM_PREFIX_FMT "List full size %d", - CM_PREFIX_REF(wlan_vdev_get_id(cm_ctx->vdev), - cm_req->cm_id), - qdf_list_size(&cm_ctx->req_list)); - return QDF_STATUS_E_FAILURE; - } - - qdf_list_insert_front(&cm_ctx->req_list, &cm_req->node); - if (prefix == CONNECT_REQ_PREFIX) - cm_ctx->connect_count++; - else - cm_ctx->disconnect_count++; - cm_req_lock_release(cm_ctx); - - mlme_cm_osif_update_id_and_src(cm_ctx->vdev, source, cm_req->cm_id); - - return QDF_STATUS_SUCCESS; -} - -void cm_free_connect_req_mem(struct cm_connect_req *connect_req) -{ - if (connect_req->candidate_list) - wlan_scan_purge_results(connect_req->candidate_list); - - if (connect_req->req.assoc_ie.ptr) { - qdf_mem_zero(connect_req->req.assoc_ie.ptr, - connect_req->req.assoc_ie.len); - qdf_mem_free(connect_req->req.assoc_ie.ptr); - connect_req->req.assoc_ie.ptr = NULL; - } - - if (connect_req->req.crypto.wep_keys.key) { - qdf_mem_zero(connect_req->req.crypto.wep_keys.key, - connect_req->req.crypto.wep_keys.key_len); - qdf_mem_free(connect_req->req.crypto.wep_keys.key); - connect_req->req.crypto.wep_keys.key = NULL; - } - - if (connect_req->req.crypto.wep_keys.seq) { - qdf_mem_zero(connect_req->req.crypto.wep_keys.seq, - connect_req->req.crypto.wep_keys.seq_len); - qdf_mem_free(connect_req->req.crypto.wep_keys.seq); - connect_req->req.crypto.wep_keys.seq = NULL; - } -} - -QDF_STATUS -cm_delete_req_from_list(struct cnx_mgr *cm_ctx, wlan_cm_id cm_id) -{ - uint32_t prefix = CM_ID_GET_PREFIX(cm_id); - qdf_list_node_t *cur_node = NULL, *next_node = NULL; - struct cm_req *cm_req = NULL; - - cm_req_lock_acquire(cm_ctx); - qdf_list_peek_front(&cm_ctx->req_list, &cur_node); - while (cur_node) { - qdf_list_peek_next(&cm_ctx->req_list, cur_node, &next_node); - - cm_req = qdf_container_of(cur_node, struct cm_req, node); - if (cm_req->cm_id == cm_id) - break; - - cur_node = next_node; - next_node = NULL; - cm_req = NULL; - } - - if (!cm_req) { - cm_req_lock_release(cm_ctx); - mlme_err(CM_PREFIX_FMT " req not found", - CM_PREFIX_REF(wlan_vdev_get_id(cm_ctx->vdev), cm_id)); - return QDF_STATUS_E_FAILURE; - } - - qdf_list_remove_node(&cm_ctx->req_list, &cm_req->node); - if (prefix == CONNECT_REQ_PREFIX) { - cm_ctx->connect_count--; - cm_free_connect_req_mem(&cm_req->connect_req); - } else { - cm_ctx->disconnect_count--; - } - - qdf_mem_free(cm_req); - cm_req_lock_release(cm_ctx); - - return QDF_STATUS_SUCCESS; -} - -void cm_remove_cmd(struct cnx_mgr *cm_ctx, wlan_cm_id cm_id) -{ - struct wlan_objmgr_psoc *psoc; - struct wlan_serialization_queued_cmd_info cmd_info; - uint32_t prefix = CM_ID_GET_PREFIX(cm_id); - QDF_STATUS status; - - psoc = wlan_vdev_get_psoc(cm_ctx->vdev); - if (!psoc) { - mlme_err(CM_PREFIX_FMT "Failed to find psoc", - CM_PREFIX_REF(wlan_vdev_get_id(cm_ctx->vdev), cm_id)); - return; - } - - status = cm_delete_req_from_list(cm_ctx, cm_id); - if (QDF_IS_STATUS_ERROR(status)) - return; - - qdf_mem_zero(&cmd_info, sizeof(cmd_info)); - cmd_info.cmd_id = cm_id; - cmd_info.req_type = WLAN_SER_CANCEL_NON_SCAN_CMD; - - if (prefix == CONNECT_REQ_PREFIX) - cmd_info.cmd_type = WLAN_SER_CMD_VDEV_CONNECT; - else - cmd_info.cmd_type = WLAN_SER_CMD_VDEV_DISCONNECT; - - cmd_info.vdev = cm_ctx->vdev; - - if (cm_id == cm_ctx->active_cm_id) { - cmd_info.queue_type = WLAN_SERIALIZATION_ACTIVE_QUEUE; - wlan_serialization_remove_cmd(&cmd_info); - } else { - cmd_info.queue_type = WLAN_SERIALIZATION_PENDING_QUEUE; - wlan_serialization_cancel_request(&cmd_info); - } -} - -void cm_vdev_scan_cancel(struct wlan_objmgr_pdev *pdev, - struct wlan_objmgr_vdev *vdev) -{ - struct scan_cancel_request *req; - QDF_STATUS status; - - req = qdf_mem_malloc(sizeof(*req)); - if (!req) - return; - - req->vdev = vdev; - req->cancel_req.scan_id = INVAL_SCAN_ID; - req->cancel_req.vdev_id = wlan_vdev_get_id(vdev); - req->cancel_req.pdev_id = wlan_objmgr_pdev_get_pdev_id(pdev); - req->cancel_req.req_type = WLAN_SCAN_CANCEL_VDEV_ALL; - - status = wlan_scan_cancel(req); - /* In success/failure case wlan_scan_cancel free the req memory */ - if (QDF_IS_STATUS_ERROR(status)) - mlme_err("vdev %d cancel scan request failed", - wlan_vdev_get_id(vdev)); -} - -void cm_set_max_connect_attempts(struct wlan_objmgr_vdev *vdev, - uint8_t max_connect_attempts) -{ - struct cnx_mgr *cm_ctx; - - cm_ctx = cm_get_cm_ctx(vdev); - if (!cm_ctx) - return; - - cm_ctx->max_connect_attempts = - QDF_MIN(max_connect_attempts, CM_MAX_CONNECT_ATTEMPTS); - mlme_debug("vdev %d max connect attempts set to %d, requested %d", - wlan_vdev_get_id(vdev), - cm_ctx->max_connect_attempts, max_connect_attempts); -} - -QDF_STATUS -cm_fill_disconnect_resp_from_cm_id(struct cnx_mgr *cm_ctx, wlan_cm_id cm_id, - struct wlan_cm_discon_rsp *resp) -{ - qdf_list_node_t *cur_node = NULL, *next_node = NULL; - struct cm_req *cm_req; - uint32_t prefix = CM_ID_GET_PREFIX(cm_id); - - if (prefix != DISCONNECT_REQ_PREFIX) - return QDF_STATUS_E_INVAL; - - cm_req_lock_acquire(cm_ctx); - qdf_list_peek_front(&cm_ctx->req_list, &cur_node); - while (cur_node) { - qdf_list_peek_next(&cm_ctx->req_list, cur_node, &next_node); - cm_req = qdf_container_of(cur_node, struct cm_req, node); - - if (cm_req->cm_id == cm_id) { - resp->req.cm_id = cm_id; - resp->req.req = cm_req->discon_req.req; - cm_req_lock_release(cm_ctx); - return QDF_STATUS_SUCCESS; - } - - cur_node = next_node; - next_node = NULL; - } - cm_req_lock_release(cm_ctx); - - return QDF_STATUS_E_FAILURE; -} - -bool cm_is_vdev_connecting(struct wlan_objmgr_vdev *vdev) -{ - struct cnx_mgr *cm_ctx; - enum wlan_cm_sm_state state; - - cm_ctx = cm_get_cm_ctx(vdev); - if (!cm_ctx) - return false; - - state = cm_get_state(cm_ctx); - - if (state == WLAN_CM_S_CONNECTING) - return true; - - return false; -} - -bool cm_is_vdev_connected(struct wlan_objmgr_vdev *vdev) -{ - struct cnx_mgr *cm_ctx; - enum wlan_cm_sm_state state; - - cm_ctx = cm_get_cm_ctx(vdev); - if (!cm_ctx) - return false; - - state = cm_get_state(cm_ctx); - - if (state == WLAN_CM_S_CONNECTED) - return true; - - return false; -} - -bool cm_is_vdev_disconnecting(struct wlan_objmgr_vdev *vdev) -{ - struct cnx_mgr *cm_ctx; - enum wlan_cm_sm_state state; - - cm_ctx = cm_get_cm_ctx(vdev); - if (!cm_ctx) - return false; - - state = cm_get_state(cm_ctx); - - if (state == WLAN_CM_S_DISCONNECTING) - return true; - - return false; -} - -bool cm_is_vdev_disconnected(struct wlan_objmgr_vdev *vdev) -{ - struct cnx_mgr *cm_ctx; - enum wlan_cm_sm_state state; - - cm_ctx = cm_get_cm_ctx(vdev); - if (!cm_ctx) - return false; - - state = cm_get_state(cm_ctx); - - if (state == WLAN_CM_S_INIT) - return true; - - return false; -} - -bool cm_is_vdev_roaming(struct wlan_objmgr_vdev *vdev) -{ - struct cnx_mgr *cm_ctx; - enum wlan_cm_sm_state state; - - cm_ctx = cm_get_cm_ctx(vdev); - if (!cm_ctx) - return false; - - state = cm_get_state(cm_ctx); - - if (state == WLAN_CM_S_ROAMING) - return true; - - return false; -} diff --git a/umac/mlme/connection_mgr/dispatcher/inc/cfg_mlme_cm.h b/umac/mlme/connection_mgr/dispatcher/inc/cfg_mlme_cm.h deleted file mode 100644 index b3ec9064b423..000000000000 --- a/umac/mlme/connection_mgr/dispatcher/inc/cfg_mlme_cm.h +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Copyright (c) 2012-2015, 2020, 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. - */ - -/** - * DOC: This file contains connection manager related CFG/INI Items. - */ - -#ifndef __CFG_MLME_CM_H -#define __CFG_MLME_CM_H - -#endif /* __CFG_MLME_CM_H */ diff --git a/umac/mlme/connection_mgr/dispatcher/inc/wlan_cm_api.h b/umac/mlme/connection_mgr/dispatcher/inc/wlan_cm_api.h deleted file mode 100644 index 8e16dc500568..000000000000 --- a/umac/mlme/connection_mgr/dispatcher/inc/wlan_cm_api.h +++ /dev/null @@ -1,200 +0,0 @@ -/* - * Copyright (c) 2020 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. - */ - -/** - * DOC: wlan_cm_api.h - * - * This file maintains declarations of public apis - */ - -#ifndef __WLAN_CM_API_H -#define __WLAN_CM_API_H - -#ifdef FEATURE_CM_ENABLE -#include "wlan_cm_public_struct.h" - -/** - * wlan_cm_start_connect() - connect start request - * @vdev: vdev pointer - * @req: connect req - * - * Return: QDF_STATUS - */ -QDF_STATUS wlan_cm_start_connect(struct wlan_objmgr_vdev *vdev, - struct wlan_cm_connect_req *req); - -/** - * wlan_cm_start_disconnect() - disconnect start request - * @vdev: vdev pointer - * @req: disconnect req - * - * Return: QDF_STATUS - */ -QDF_STATUS wlan_cm_start_disconnect(struct wlan_objmgr_vdev *vdev, - struct wlan_cm_disconnect_req *req); - -/** - * wlan_cm_bss_select_ind_rsp() - Connection manager resp for bss - * select indication - * @vdev: vdev pointer - * @status: Status - * - * Return: QDF_STATUS - */ -QDF_STATUS wlan_cm_bss_select_ind_rsp(struct wlan_objmgr_vdev *vdev, - QDF_STATUS status); - -/** - * wlan_cm_bss_peer_create_rsp() - Connection manager bss peer create response - * @vdev: vdev pointer - * @status: Status - * @peer_mac: Peer mac address - * - * Return: QDF_STATUS - */ -QDF_STATUS wlan_cm_bss_peer_create_rsp(struct wlan_objmgr_vdev *vdev, - QDF_STATUS status, - struct qdf_mac_addr *peer_mac); - -/** - * wlan_cm_connect_rsp() - Connection manager connect response - * @vdev: vdev pointer - * @resp: Connect response - * - * Return: QDF_STATUS - */ -QDF_STATUS wlan_cm_connect_rsp(struct wlan_objmgr_vdev *vdev, - struct wlan_cm_connect_rsp *resp); - -/** - * wlan_cm_bss_peer_delete_ind() - Connection manager peer delete indication - * @vdev: vdev pointer - * @peer_mac: Peer mac address - * - * Return: QDF_STATUS - */ -QDF_STATUS wlan_cm_bss_peer_delete_ind(struct wlan_objmgr_vdev *vdev, - struct qdf_mac_addr *peer_mac); - -/** - * wlan_cm_bss_peer_delete_rsp() - Connection manager peer delete response - * @vdev: vdev pointer - * @status: status - * - * Return: QDF_STATUS - */ -QDF_STATUS wlan_cm_bss_peer_delete_rsp(struct wlan_objmgr_vdev *vdev, - uint32_t status); - -/** - * wlan_cm_disconnect_rsp() - Connection manager disconnect response - * @vdev: vdev pointer - * @resp: disconnect response - * - * Return: QDF_STATUS - */ -QDF_STATUS wlan_cm_disconnect_rsp(struct wlan_objmgr_vdev *vdev, - struct wlan_cm_discon_rsp *resp); - -/** - * wlan_cm_set_max_connect_attempts() - Set max connect attempts - * @vdev: vdev pointer - * @max_connect_attempts: max connect attempts to be set. - * - * Set max connect attempts. Max value is limited to CM_MAX_CONNECT_ATTEMPTS. - * - * Return: void - */ -void wlan_cm_set_max_connect_attempts(struct wlan_objmgr_vdev *vdev, - uint8_t max_connect_attempts); - -/** - * wlan_cm_is_vdev_connecting() - check if vdev is in conneting state - * @vdev: vdev pointer - * - * Return: bool - */ -bool wlan_cm_is_vdev_connecting(struct wlan_objmgr_vdev *vdev); - -/** - * wlan_cm_is_vdev_connected() - check if vdev is in conneted state - * @vdev: vdev pointer - * - * Return: bool - */ -bool wlan_cm_is_vdev_connected(struct wlan_objmgr_vdev *vdev); - -/** - * wlan_cm_is_vdev_disconnecting() - check if vdev is in disconneting state - * @vdev: vdev pointer - * - * Return: bool - */ -bool wlan_cm_is_vdev_disconnecting(struct wlan_objmgr_vdev *vdev); - -/** - * wlan_cm_is_vdev_disconnected() - check if vdev is disconnected/init state - * @vdev: vdev pointer - * - * Return: bool - */ -bool wlan_cm_is_vdev_disconnected(struct wlan_objmgr_vdev *vdev); - -/** - * wlan_cm_is_vdev_roaming() - check if vdev is in roaming state - * @vdev: vdev pointer - * - * Return: bool - */ -bool wlan_cm_is_vdev_roaming(struct wlan_objmgr_vdev *vdev); - -/** - * wlan_cm_reason_code_to_str() - return string conversion of reason code - * @reason: reason code. - * - * This utility function helps log string conversion of reason code. - * - * Return: string conversion of reason code, if match found; - * "Unknown" otherwise. - */ -const char *wlan_cm_reason_code_to_str(enum wlan_reason_code reason); - -/** - * wlan_cm_hw_mode_change_resp() - HW mode change response - * @pdev: pdev pointer - * @vdev_id: vdev id - * @cm_id: connection ID which gave the hw mode change request - * @status: status of the HW mode change. - * - * Return: void - */ -#ifdef WLAN_POLICY_MGR_ENABLE -void wlan_cm_hw_mode_change_resp(struct wlan_objmgr_pdev *pdev, uint8_t vdev_id, - wlan_cm_id cm_id, QDF_STATUS status); -#endif /* ifdef POLICY_MGR_ENABLE */ - -#else - -#ifdef WLAN_POLICY_MGR_ENABLE -static inline void -wlan_cm_hw_mode_change_resp(struct wlan_objmgr_pdev *pdev, uint8_t vdev_id, - uint32_t cm_id, QDF_STATUS status) -{ -} -#endif /* ifdef POLICY_MGR_ENABLE */ - -#endif -#endif /* __WLAN_CM_UCFG_API_H */ diff --git a/umac/mlme/connection_mgr/dispatcher/inc/wlan_cm_public_struct.h b/umac/mlme/connection_mgr/dispatcher/inc/wlan_cm_public_struct.h deleted file mode 100644 index 27e109440a58..000000000000 --- a/umac/mlme/connection_mgr/dispatcher/inc/wlan_cm_public_struct.h +++ /dev/null @@ -1,347 +0,0 @@ -/* - * Copyright (c) 2012-2015, 2020, 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. - */ - -/** - * DOC: wlan_cm_public_struct.h - * - * This header file maintain public structures required for connection mgr - */ - -#ifndef __WLAN_CM_PUBLIC_STRUCT_H__ -#define __WLAN_CM_PUBLIC_STRUCT_H__ - -#ifdef FEATURE_CM_ENABLE -#include -#include "wlan_crypto_global_def.h" -#include "qdf_status.h" - -#define CM_ID_INVALID 0xFFFFFFFF -typedef uint32_t wlan_cm_id; - -/** - * struct wlan_cm_wep_key_params - store wep key info - * @key: key info - * @seq: seq info - * @key_len: key length - * @seq_len: seq len - * @key_idx: key index - */ -struct wlan_cm_wep_key_params { - uint8_t *key; - uint8_t *seq; - uint8_t key_len; - uint8_t seq_len; - uint8_t key_idx; -}; - -/** - * struct wlan_cm_connect_crypto_info - Crypto settings - * @wpa_versions: indicates which, if any, WPA versions are enabled - * (from enum nl80211_wpa_versions) - * @auth_type: Auth mode type bitmask - * @group_cipher: group key cipher suite bitmask - * @ciphers_pairwise: unicast key cipher suites bitmask - * @akm_suites: AKM suites bitmask - * @wep_keys: static WEP keys, if not NULL points to an array of - * MAX_WEP_KEYS WEP keys - * @rsn_caps: rsn caps - * @mgmt_ciphers: mgmt cipher bitmask - */ -struct wlan_cm_connect_crypto_info { - uint32_t wpa_versions; - uint32_t auth_type; - uint32_t group_cipher; - uint32_t ciphers_pairwise; - uint32_t akm_suites; - struct wlan_cm_wep_key_params wep_keys; - uint16_t rsn_caps; - uint32_t mgmt_ciphers; -}; - -#ifdef WLAN_FEATURE_FILS_SK -#define WLAN_CM_FILS_MAX_KEYNAME_NAI_LENGTH 253 -#define WLAN_CM_FILS_MAX_REALM_LEN 255 -#define WLAN_CM_FILS_MAX_RRK_LENGTH 64 -#define WLAN_CM_FILS_MAX_RIK_LENGTH CM_FILS_MAX_RRK_LENGTH - -/** - * struct wlan_fils_con_info - fils connect req info - * @is_fils_connection: is fils connection - * @username_len: username length - * @username: username - * @realm_len: realm length - * @realm: realm - * @next_seq_num: next seq number - * @rrk_len: rrk length - * @rrk: rrk - */ -struct wlan_fils_con_info { - bool is_fils_connection; - uint32_t username_len; - uint8_t username[WLAN_CM_FILS_MAX_KEYNAME_NAI_LENGTH]; - uint32_t realm_len; - uint8_t realm[WLAN_CM_FILS_MAX_REALM_LEN]; - uint16_t next_seq_num; - uint32_t rrk_len; - uint8_t rrk[WLAN_CM_FILS_MAX_RRK_LENGTH]; -}; -#endif - -/** - * enum wlan_cm_source - connection manager req source - * @CM_OSIF_CONNECT: Connect req initiated by OSIF or north bound - * @CM_ROAMING: Roaming request - * @CM_OSIF_DISCONNECT: Disconnect req initiated by OSIF or north bound - * @CM_PEER_DISCONNECT: Disconnect req initiated by peer sending deauth/disassoc - * only for this localy generated will be false while indicating to kernel - * @CM_SB_DISCONNECT: Disconnect req initiated by South bound/VDEV mgr/Peer mgr - * @CM_INTERNAL_DISCONNECT: Internal disconnect initiated by Connection manager - * on receiving the back to back commands - * @CM_ROAM_DISCONNECT: Disconnect req due to HO failure - * @CM_SOURCE_MAX: max value of connection manager source - * @CM_SOURCE_INVALID: Invalid connection manager req source - */ -enum wlan_cm_source { - CM_OSIF_CONNECT, - CM_ROAMING, - CM_OSIF_DISCONNECT, - CM_PEER_DISCONNECT, - CM_SB_DISCONNECT, - CM_INTERNAL_DISCONNECT, - CM_ROAM_DISCONNECT, - CM_SOURCE_MAX, - CM_SOURCE_INVALID = CM_SOURCE_MAX, -}; - -/** - * struct wlan_cm_connect_req - connect req from requester - * @vdev_id: vdev id - * @source: source of the req - * @bssid: bssid given - * @prev_bssid: prev AP bssid, given in case supplican want to roam to new BSSID - * @ssid: profile SSID - * @bssid_hint: bssid hint to connect - * @chan_freq: channel of the AP - * @crypto: crypto related info - * @assoc_ie:Additional assoc IE to be appended in assoc req - * (Include RSN/WPA/WAPI/WPS ies) - * @ht_caps: ht capability - * @ht_caps_mask: mask of valid ht caps - * @vht_caps: vht capability - * @vht_caps_mask: mask of valid vht caps - * @fils_info: Fills related connect info - */ -struct wlan_cm_connect_req { - uint8_t vdev_id; - enum wlan_cm_source source; - struct qdf_mac_addr bssid; - struct qdf_mac_addr prev_bssid; - struct wlan_ssid ssid; - struct qdf_mac_addr bssid_hint; - uint32_t chan_freq; - struct wlan_cm_connect_crypto_info crypto; - struct element_info assoc_ie; - uint16_t ht_caps; - uint16_t ht_caps_mask; - uint32_t vht_caps; - uint32_t vht_caps_mask; -#ifdef WLAN_FEATURE_FILS_SK - struct wlan_fils_con_info fils_info; -#endif -}; - -/** - * struct wlan_cm_vdev_connect_req - connect req from connection manager to - * vdev mgr - * @vdev_id: vdev id - * @cm_id: Connect manager id - * @bss: scan entry for the candidate - */ -struct wlan_cm_vdev_connect_req { - uint8_t vdev_id; - wlan_cm_id cm_id; - struct scan_cache_node *bss; -}; - -/** - * struct wlan_cm_disconnect_req - disconnect req from requester - * @vdev_id: vdev id - * @source: source of disconnect - * @reason_code: protocol/propitiatory reason code of the disconnect. - * propitiatory will be used to send in - * QCA_WLAN_VENDOR_ATTR_GET_STATION_INFO_DRIVER_DISCONNECT_REASON - * @bssid: bssid of AP - */ -struct wlan_cm_disconnect_req { - uint8_t vdev_id; - enum wlan_cm_source source; - enum wlan_reason_code reason_code; - struct qdf_mac_addr bssid; -}; - -/** - * struct wlan_cm_vdev_discon_req - disconnect req from connection manager to - * vdev mgr - * @cm_id: connection manager ID - * @req: disconnect req - */ -struct wlan_cm_vdev_discon_req { - wlan_cm_id cm_id; - struct wlan_cm_disconnect_req req; -}; - -/* - * enum wlan_cm_connect_fail_reason: connection manager connect fail reason - * @CM_NO_CANDIDATE_FOUND: No candidate found - * @CM_ABORT_DUE_TO_NEW_REQ_RECVD: Aborted as new command is received and - * @CM_BSS_SELECT_IND_FAILED: Failed BSS select indication - * State machine is not able to handle as state has changed due to new command. - * @CM_PEER_CREATE_FAILED: peer create failed - * @CM_JOIN_FAILED: Failed in joining state - * (BSS peer creation or other handling) - * @CM_JOIN_TIMEOUT: Did not receive beacon or probe response after unicast - * probe request - * @CM_AUTH_FAILED: Auth rejected by AP - * @CM_AUTH_TIMEOUT: No Auth resp from AP - * @CM_ASSOC_FAILED: Assoc rejected by AP - * @CM_ASSOC_TIMEOUT: No Assoc resp from AP - * @CM_HW_MODE_FAILURE: failed to change HW mode - * @CM_SER_FAILURE: Failed to serialize command - * @CM_SER_TIMEOUT: Serialization cmd timeout - * @CM_GENERIC_FAILURE: Generic failure apart from above - */ -enum wlan_cm_connect_fail_reason { - CM_NO_CANDIDATE_FOUND, - CM_ABORT_DUE_TO_NEW_REQ_RECVD, - CM_BSS_SELECT_IND_FAILED, - CM_PEER_CREATE_FAILED, - CM_JOIN_FAILED, - CM_JOIN_TIMEOUT, - CM_AUTH_FAILED, - CM_AUTH_TIMEOUT, - CM_ASSOC_FAILED, - CM_ASSOC_TIMEOUT, - CM_HW_MODE_FAILURE, - CM_SER_FAILURE, - CM_SER_TIMEOUT, - CM_GENERIC_FAILURE, -}; - -#ifdef WLAN_FEATURE_FILS_SK -#define CM_FILS_MAX_HLP_DATA_LEN 2048 -#define MAX_KEK_LENGTH 64 -#define MAX_TK_LENGTH 32 -#define MAX_GTK_LENGTH 255 - -/** - * struct fils_connect_rsp_params - fils related connect rsp params - * @fils_pmk: fils pmk - * @fils_pmk_len: fils pmk length - * @fils_pmkid: fils pmkid - * @kek: kek - * @kek_len: kek length - * @tk: tk - * @tk_len: tk length - * @gtk: gtk - * @gtk_len: gtk length - * @dst_mac: dst mac - * @src_mac: src mac - * @hlp_data: hlp data - * @hlp_data_len: hlp data length - * @fils_seq_num: FILS sequence number - */ -struct fils_connect_rsp_params { - uint8_t *fils_pmk; - uint8_t fils_pmk_len; - uint8_t fils_pmkid[PMKID_LEN]; - uint8_t kek[MAX_KEK_LENGTH]; - uint8_t kek_len; - uint8_t tk[MAX_TK_LENGTH]; - uint8_t tk_len; - uint8_t gtk[MAX_GTK_LENGTH]; - uint8_t gtk_len; - struct qdf_mac_addr dst_mac; - struct qdf_mac_addr src_mac; - uint8_t hlp_data[CM_FILS_MAX_HLP_DATA_LEN]; - uint16_t hlp_data_len; - uint16_t fils_seq_num; -}; -#endif - -/** - * struct connect_rsp_ies - connect rsp ies stored in vdev filled during connect - * @bcn_probe_rsp: beacon or probe rsp of connected AP - * @assoc_req: assoc req send during conenct - * @assoc_rsq: assoc rsp received during connection - * @ric_resp_ie: ric ie from assoc resp received during connection - * @fills_ie: fills connection ie received during connection - */ -struct wlan_connect_rsp_ies { - struct element_info bcn_probe_rsp; - struct element_info assoc_req; - struct element_info assoc_rsp; - struct element_info ric_resp_ie; -#ifdef WLAN_FEATURE_FILS_SK - struct fils_connect_rsp_params *fils_ie; -#endif -}; - -/** - * struct wlan_cm_connect_rsp - connect resp from VDEV mgr and will be sent to - * OSIF - * @vdev_id: vdev id - * @cm_id: Connect manager id - * @bssid: BSSID of the ap - * @ssid: SSID of the connection - * @freq: Channel frequency - * @connect_status: connect status success or failure - * @reason: connect fail reason, valid only in case of failure - * @reason_code: protocol reason code of the connect failure - * @aid: aid - * @connect_ies: connect related IE required by osif to send to kernel - * @is_fils_connection: is fils connection - */ -struct wlan_cm_connect_rsp { - uint8_t vdev_id; - wlan_cm_id cm_id; - struct qdf_mac_addr bssid; - struct wlan_ssid ssid; - qdf_freq_t freq; - QDF_STATUS connect_status; - enum wlan_cm_connect_fail_reason reason; - uint8_t reason_code; - uint8_t aid; - struct wlan_connect_rsp_ies connect_ies; -#ifdef WLAN_FEATURE_FILS_SK - bool is_fils_connection; -#endif -}; - - -/** - * struct wlan_cm_discon_rsp - disconnect resp from VDEV mgr and will be sent to - * OSIF - * @req: disconnect req sent to vdev mgr - * @ap_discon_ie: disconnect IE sent by AP - */ -struct wlan_cm_discon_rsp { - struct wlan_cm_vdev_discon_req req; - struct element_info ap_discon_ie; -}; - -#endif /* FEATURE_CM_ENABLE */ - -#endif /* __WLAN_CM_PUBLIC_STRUCT_H__ */ diff --git a/umac/mlme/connection_mgr/dispatcher/inc/wlan_cm_ucfg_api.h b/umac/mlme/connection_mgr/dispatcher/inc/wlan_cm_ucfg_api.h deleted file mode 100644 index 066f902d3df4..000000000000 --- a/umac/mlme/connection_mgr/dispatcher/inc/wlan_cm_ucfg_api.h +++ /dev/null @@ -1,107 +0,0 @@ -/* - * Copyright (c) 2020 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. - */ - -/** - * DOC: wlan_cm_ucfg_api.h - * - * This file maintains declarations of public ucfg apis - */ - -#ifndef __WLAN_CM_UCFG_API_H -#define __WLAN_CM_UCFG_API_H - -#ifdef FEATURE_CM_ENABLE - -#include - -/** - * ucfg_cm_start_connect() - connect start request - * @vdev: vdev pointer - * @req: connect req - * - * Return: QDF_STATUS - */ -QDF_STATUS ucfg_cm_start_connect(struct wlan_objmgr_vdev *vdev, - struct wlan_cm_connect_req *req); - -/** - * ucfg_cm_start_disconnect() - disconnect start request - * @vdev: vdev pointer - * @req: disconnect req - * - * Return: QDF_STATUS - */ -QDF_STATUS ucfg_cm_start_disconnect(struct wlan_objmgr_vdev *vdev, - struct wlan_cm_disconnect_req *req); - -/** - * ucfg_cm_is_vdev_connecting() - check if vdev is in conneting state - * @vdev: vdev pointer - * - * Return: bool - */ -bool ucfg_cm_is_vdev_connecting(struct wlan_objmgr_vdev *vdev); - -/** - * ucfg_cm_is_vdev_connected() - check if vdev is in conneted state - * @vdev: vdev pointer - * - * Return: bool - */ -bool ucfg_cm_is_vdev_connected(struct wlan_objmgr_vdev *vdev); - -/** - * ucfg_cm_is_vdev_disconnecting() - check if vdev is in disconneting state - * @vdev: vdev pointer - * - * Return: bool - */ -bool ucfg_cm_is_vdev_disconnecting(struct wlan_objmgr_vdev *vdev); - -/** - * ucfg_cm_is_vdev_disconnected() - check if vdev is disconnected/init state - * @vdev: vdev pointer - * - * Return: bool - */ -bool ucfg_cm_is_vdev_disconnected(struct wlan_objmgr_vdev *vdev); - -/** - * ucfg_cm_is_vdev_roaming() - check if vdev is in roaming state - * @vdev: vdev pointer - * - * Return: bool - */ -bool ucfg_cm_is_vdev_roaming(struct wlan_objmgr_vdev *vdev); - -/** - * ucfg_cm_reason_code_to_str() - return string conversion of reason code - * @reason: reason code. - * - * This utility function helps log string conversion of reason code. - * - * Return: string conversion of reason code, if match found; - * "Unknown" otherwise. - */ -static inline -const char *ucfg_cm_reason_code_to_str(enum wlan_reason_code reason) -{ - return wlan_cm_reason_code_to_str(reason); -} - -#endif -#endif /* __WLAN_CM_UCFG_API_H */ - diff --git a/umac/mlme/connection_mgr/dispatcher/src/wlan_cm_api.c b/umac/mlme/connection_mgr/dispatcher/src/wlan_cm_api.c deleted file mode 100644 index 0f490c73c46b..000000000000 --- a/umac/mlme/connection_mgr/dispatcher/src/wlan_cm_api.c +++ /dev/null @@ -1,185 +0,0 @@ -/* - * Copyright (c) 2012-2015, 2020, 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. - */ - -/** - * DOC: wlan_cm_api.c - * - * This file maintains definitaions public apis. - */ - -#include -#include "connection_mgr/core/src/wlan_cm_main_api.h" - -QDF_STATUS wlan_cm_start_connect(struct wlan_objmgr_vdev *vdev, - struct wlan_cm_connect_req *req) -{ - return cm_connect_start_req(vdev, req); -} - -QDF_STATUS wlan_cm_start_disconnect(struct wlan_objmgr_vdev *vdev, - struct wlan_cm_disconnect_req *req) -{ - return cm_disconnect_start_req(vdev, req); -} - -QDF_STATUS wlan_cm_bss_select_ind_rsp(struct wlan_objmgr_vdev *vdev, - QDF_STATUS status) -{ - return cm_bss_select_ind_rsp(vdev, status); -} - -QDF_STATUS wlan_cm_bss_peer_create_rsp(struct wlan_objmgr_vdev *vdev, - QDF_STATUS status, - struct qdf_mac_addr *peer_mac) -{ - return cm_bss_peer_create_rsp(vdev, status, peer_mac); -} - -QDF_STATUS wlan_cm_connect_rsp(struct wlan_objmgr_vdev *vdev, - struct wlan_cm_connect_rsp *resp) -{ - return cm_connect_rsp(vdev, resp); -} - -QDF_STATUS wlan_cm_bss_peer_delete_ind(struct wlan_objmgr_vdev *vdev, - struct qdf_mac_addr *peer_mac) -{ - return cm_bss_peer_delete_req(vdev, peer_mac); -} - -QDF_STATUS wlan_cm_bss_peer_delete_rsp(struct wlan_objmgr_vdev *vdev, - uint32_t status) -{ - return cm_vdev_down_req(vdev, status); -} - -QDF_STATUS wlan_cm_disconnect_rsp(struct wlan_objmgr_vdev *vdev, - struct wlan_cm_discon_rsp *resp) -{ - return cm_disconnect_rsp(vdev, resp); -} - -void wlan_cm_set_max_connect_attempts(struct wlan_objmgr_vdev *vdev, - uint8_t max_connect_attempts) -{ - cm_set_max_connect_attempts(vdev, max_connect_attempts); -} - -bool wlan_cm_is_vdev_connecting(struct wlan_objmgr_vdev *vdev) -{ - return cm_is_vdev_connecting(vdev); -} - -bool wlan_cm_is_vdev_connected(struct wlan_objmgr_vdev *vdev) -{ - return cm_is_vdev_connected(vdev); -} - -bool wlan_cm_is_vdev_disconnecting(struct wlan_objmgr_vdev *vdev) -{ - return cm_is_vdev_disconnecting(vdev); -} - -bool wlan_cm_is_vdev_disconnected(struct wlan_objmgr_vdev *vdev) -{ - return cm_is_vdev_disconnected(vdev); -} - -bool wlan_cm_is_vdev_roaming(struct wlan_objmgr_vdev *vdev) -{ - return cm_is_vdev_roaming(vdev); -} - -const char *wlan_cm_reason_code_to_str(enum wlan_reason_code reason) -{ - if (reason > REASON_PROP_START) - return ""; - - switch (reason) { - CASE_RETURN_STRING(REASON_UNSPEC_FAILURE); - CASE_RETURN_STRING(REASON_PREV_AUTH_NOT_VALID); - CASE_RETURN_STRING(REASON_DEAUTH_NETWORK_LEAVING); - CASE_RETURN_STRING(REASON_DISASSOC_DUE_TO_INACTIVITY); - CASE_RETURN_STRING(REASON_DISASSOC_AP_BUSY); - CASE_RETURN_STRING(REASON_CLASS2_FRAME_FROM_NON_AUTH_STA); - CASE_RETURN_STRING(REASON_CLASS3_FRAME_FROM_NON_ASSOC_STA); - CASE_RETURN_STRING(REASON_DISASSOC_NETWORK_LEAVING); - CASE_RETURN_STRING(REASON_STA_NOT_AUTHENTICATED); - CASE_RETURN_STRING(REASON_BAD_PWR_CAPABILITY); - CASE_RETURN_STRING(REASON_BAD_SUPPORTED_CHANNELS); - CASE_RETURN_STRING(REASON_DISASSOC_BSS_TRANSITION); - CASE_RETURN_STRING(REASON_INVALID_IE); - CASE_RETURN_STRING(REASON_MIC_FAILURE); - CASE_RETURN_STRING(REASON_4WAY_HANDSHAKE_TIMEOUT); - CASE_RETURN_STRING(REASON_GROUP_KEY_UPDATE_TIMEOUT); - CASE_RETURN_STRING(REASON_IN_4WAY_DIFFERS); - CASE_RETURN_STRING(REASON_INVALID_GROUP_CIPHER); - CASE_RETURN_STRING(REASON_INVALID_PAIRWISE_CIPHER); - CASE_RETURN_STRING(REASON_INVALID_AKMP); - CASE_RETURN_STRING(REASON_UNSUPPORTED_RSNE_VER); - CASE_RETURN_STRING(REASON_INVALID_RSNE_CAPABILITIES); - CASE_RETURN_STRING(REASON_1X_AUTH_FAILURE); - CASE_RETURN_STRING(REASON_CIPHER_SUITE_REJECTED); - CASE_RETURN_STRING(REASON_TDLS_PEER_UNREACHABLE); - CASE_RETURN_STRING(REASON_TDLS_UNSPEC); - CASE_RETURN_STRING(REASON_DISASSOC_SSP_REQUESTED); - CASE_RETURN_STRING(REASON_NO_SSP_ROAMING_AGREEMENT); - CASE_RETURN_STRING(REASON_BAD_CIPHER_OR_AKM); - CASE_RETURN_STRING(REASON_LOCATION_NOT_AUTHORIZED); - CASE_RETURN_STRING(REASON_SERVICE_CHANGE_PRECLUDES_TS); - CASE_RETURN_STRING(REASON_QOS_UNSPECIFIED); - CASE_RETURN_STRING(REASON_NO_BANDWIDTH); - CASE_RETURN_STRING(REASON_XS_UNACKED_FRAMES); - CASE_RETURN_STRING(REASON_EXCEEDED_TXOP); - CASE_RETURN_STRING(REASON_STA_LEAVING); - CASE_RETURN_STRING(REASON_END_TS_BA_DLS); - CASE_RETURN_STRING(REASON_UNKNOWN_TS_BA); - CASE_RETURN_STRING(REASON_TIMEDOUT); - CASE_RETURN_STRING(REASON_PEERKEY_MISMATCH); - CASE_RETURN_STRING(REASON_AUTHORIZED_ACCESS_LIMIT_REACHED); - CASE_RETURN_STRING(REASON_EXTERNAL_SERVICE_REQUIREMENTS); - CASE_RETURN_STRING(REASON_INVALID_FT_ACTION_FRAME_COUNT); - CASE_RETURN_STRING(REASON_INVALID_PMKID); - CASE_RETURN_STRING(REASON_INVALID_MDE); - CASE_RETURN_STRING(REASON_INVALID_FTE); - CASE_RETURN_STRING(REASON_MESH_PEERING_CANCELLED); - CASE_RETURN_STRING(REASON_MESH_MAX_PEERS); - CASE_RETURN_STRING(REASON_MESH_CONFIG_POLICY_VIOLATION); - CASE_RETURN_STRING(REASON_MESH_CLOSE_RCVD); - CASE_RETURN_STRING(REASON_MESH_MAX_RETRIES); - CASE_RETURN_STRING(REASON_MESH_CONFIRM_TIMEOUT); - CASE_RETURN_STRING(REASON_MESH_INVALID_GTK); - CASE_RETURN_STRING(REASON_MESH_INCONSISTENT_PARAMS); - CASE_RETURN_STRING(REASON_MESH_INVALID_SECURITY_CAP); - CASE_RETURN_STRING(REASON_MESH_PATH_ERROR_NO_PROXY_INFO); - CASE_RETURN_STRING(REASON_MESH_PATH_ERROR_NO_FORWARDING_INFO); - CASE_RETURN_STRING(REASON_MESH_PATH_ERROR_DEST_UNREACHABLE); - CASE_RETURN_STRING(REASON_MAC_ADDRESS_ALREADY_EXISTS_IN_MBSS); - CASE_RETURN_STRING(REASON_MESH_CHANNEL_SWITCH_REGULATORY_REQ); - CASE_RETURN_STRING(REASON_MESH_CHANNEL_SWITCH_UNSPECIFIED); - CASE_RETURN_STRING(REASON_POOR_RSSI_CONDITIONS); - default: - return "Unknown"; - } -} - -#ifdef WLAN_POLICY_MGR_ENABLE -void wlan_cm_hw_mode_change_resp(struct wlan_objmgr_pdev *pdev, uint8_t vdev_id, - wlan_cm_id cm_id, QDF_STATUS status) -{ - cm_hw_mode_change_resp(pdev, vdev_id, cm_id, status); -} -#endif /* ifdef POLICY_MGR_ENABLE */ diff --git a/umac/mlme/connection_mgr/dispatcher/src/wlan_cm_ucfg_api.c b/umac/mlme/connection_mgr/dispatcher/src/wlan_cm_ucfg_api.c deleted file mode 100644 index dcf6a7daa799..000000000000 --- a/umac/mlme/connection_mgr/dispatcher/src/wlan_cm_ucfg_api.c +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright (c) 2012-2015, 2020, 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. - */ - -/** - * DOC: wlan_cm_ucfg_api.c - * - * This file maintains definitaions public ucfg apis. - */ - -#include -#include "connection_mgr/core/src/wlan_cm_main_api.h" - -QDF_STATUS ucfg_cm_start_connect(struct wlan_objmgr_vdev *vdev, - struct wlan_cm_connect_req *req) -{ - return cm_connect_start_req(vdev, req); -} - -QDF_STATUS ucfg_cm_start_disconnect(struct wlan_objmgr_vdev *vdev, - struct wlan_cm_disconnect_req *req) -{ - return cm_disconnect_start_req(vdev, req); -} - -bool ucfg_cm_is_vdev_connecting(struct wlan_objmgr_vdev *vdev) -{ - return cm_is_vdev_connecting(vdev); -} - -bool ucfg_cm_is_vdev_connected(struct wlan_objmgr_vdev *vdev) -{ - return cm_is_vdev_connected(vdev); -} - -bool ucfg_cm_is_vdev_disconnecting(struct wlan_objmgr_vdev *vdev) -{ - return cm_is_vdev_disconnecting(vdev); -} - -bool ucfg_cm_is_vdev_disconnected(struct wlan_objmgr_vdev *vdev) -{ - return cm_is_vdev_disconnected(vdev); -} - -bool ucfg_cm_is_vdev_roaming(struct wlan_objmgr_vdev *vdev) -{ - return cm_is_vdev_roaming(vdev); -} diff --git a/umac/mlme/include/wlan_mlme_cmn.h b/umac/mlme/include/wlan_mlme_cmn.h index 9abf0681235b..fa953b984aaa 100644 --- a/umac/mlme/include/wlan_mlme_cmn.h +++ b/umac/mlme/include/wlan_mlme_cmn.h @@ -23,53 +23,6 @@ #include #include #include -#ifdef FEATURE_CM_ENABLE -#include "wlan_cm_public_struct.h" -#endif - -#ifdef FEATURE_CM_ENABLE - -/** - * mlme_cm_ops: connection manager osif callbacks - * @mlme_cm_connect_complete_cb: Connect done callback - * @vdev: vdev pointer - * @rsp: connect response - * - * @mlme_cm_failed_candidate_cb: Callback to indicate failed candidate - * @vdev: vdev pointer - * @rsp: connect response - * - * @mlme_cm_update_id_and_src_cb: Callback to update connect id and - * source of the connect request - * @vdev: vdev pointer - * @Source: Source of the connect req - * @cm_id: connection manager id - * - * @mlme_cm_disconnect_complete_cb: Disconnect done callback - * @vdev: vdev pointer - * @rsp: Disconnect response - * - * @mlme_cm_disconnect_start_cb: Disconnect start callback - * @vdev: vdev pointer - */ -struct mlme_cm_ops { - QDF_STATUS (*mlme_cm_connect_complete_cb)( - struct wlan_objmgr_vdev *vdev, - struct wlan_cm_connect_rsp *rsp); - QDF_STATUS (*mlme_cm_failed_candidate_cb)( - struct wlan_objmgr_vdev *vdev, - struct wlan_cm_connect_rsp *rsp); - QDF_STATUS (*mlme_cm_update_id_and_src_cb)( - struct wlan_objmgr_vdev *vdev, - enum wlan_cm_source source, - wlan_cm_id cm_id); - QDF_STATUS (*mlme_cm_disconnect_complete_cb)( - struct wlan_objmgr_vdev *vdev, - struct wlan_cm_discon_rsp *rsp); - QDF_STATUS (*mlme_cm_disconnect_start_cb)( - struct wlan_objmgr_vdev *vdev); -}; -#endif /** * struct vdev_mlme_ext_ops - VDEV MLME legacy callbacks structure @@ -98,22 +51,6 @@ struct mlme_cm_ops { * required by serialization * @mlme_multi_vdev_restart_resp: callback to process multivdev * restart response - * @mlme_cm_ext_connect_start_ind_cb: callback to indicate connect start - * @mlme_cm_ext_bss_select_ind_cb: callback to indicate candidate - * select for connect - * @mlme_cm_ext_bss_peer_create_req_cb: callback to bss peer create request - * @mlme_cm_ext_connect_req_cb: callback for connect request to - * VDEV/PEER SM - * @mlme_cm_ext_connect_complete_ind_cb: callback to indicate connect - * complete - * @mlme_cm_ext_disconnect_start_ind_cb : callback to indicate disconnect - * start - * @mlme_cm_ext_disconnect_req_cb: callback to disconnect req to - * VDEV/PEER SM - * @mlme_cm_ext_bss_peer_delete_req_cb: callback to bss peer delete request - * @mlme_cm_ext_disconnect_complete_ind_cb: callback to indicate disconnect - * complete - * @mlme_cm_ext_vdev_down_req_cb: callback to send vdev down to FW */ struct mlme_ext_ops { QDF_STATUS (*mlme_psoc_ext_hdl_create)( @@ -145,35 +82,6 @@ struct mlme_ext_ops { QDF_STATUS (*mlme_multi_vdev_restart_resp)( struct wlan_objmgr_psoc *psoc, struct multi_vdev_restart_resp *resp); -#ifdef FEATURE_CM_ENABLE - QDF_STATUS (*mlme_cm_ext_connect_start_ind_cb)( - struct wlan_objmgr_vdev *vdev, - struct wlan_cm_connect_req *req); - QDF_STATUS (*mlme_cm_ext_bss_select_ind_cb)( - struct wlan_objmgr_vdev *vdev, - struct wlan_cm_vdev_connect_req *req); - QDF_STATUS (*mlme_cm_ext_bss_peer_create_req_cb)( - struct wlan_objmgr_vdev *vdev, - struct qdf_mac_addr *peer_mac); - QDF_STATUS (*mlme_cm_ext_connect_req_cb)(struct wlan_objmgr_vdev *vdev, - struct wlan_cm_vdev_connect_req *req); - QDF_STATUS (*mlme_cm_ext_connect_complete_ind_cb)( - struct wlan_objmgr_vdev *vdev, - struct wlan_cm_connect_rsp *rsp); - QDF_STATUS (*mlme_cm_ext_disconnect_start_ind_cb)( - struct wlan_objmgr_vdev *vdev, - struct wlan_cm_disconnect_req *req); - QDF_STATUS (*mlme_cm_ext_disconnect_req_cb) - (struct wlan_objmgr_vdev *vdev, - struct wlan_cm_vdev_discon_req *req); - QDF_STATUS (*mlme_cm_ext_bss_peer_delete_req_cb)( - struct wlan_objmgr_vdev *vdev); - QDF_STATUS (*mlme_cm_ext_disconnect_complete_ind_cb)( - struct wlan_objmgr_vdev *vdev, - struct wlan_cm_discon_rsp *rsp); - QDF_STATUS (*mlme_cm_ext_vdev_down_req_cb)( - struct wlan_objmgr_vdev *vdev); -#endif }; /** @@ -371,182 +279,4 @@ QDF_STATUS wlan_cmn_mlme_deinit(void); */ QDF_STATUS mlme_vdev_ops_ext_hdl_delete_rsp(struct wlan_objmgr_psoc *psoc, struct vdev_delete_response *rsp); - -#ifdef FEATURE_CM_ENABLE -/** - * mlme_cm_connect_start_ind() - Connection manager ext Connect start indication - * @vdev: VDEV object - * @req: Connection manager connect request - * - * Return: QDF_STATUS - */ -QDF_STATUS mlme_cm_connect_start_ind(struct wlan_objmgr_vdev *vdev, - struct wlan_cm_connect_req *req); - -/** - * mlme_cm_bss_select_ind() - Connection manager ext Connect candidate - * select indication, to do operations for the candidate - * @vdev: VDEV object - * @req: Vdev connect request - * - * Return: QDF_STATUS - */ -QDF_STATUS mlme_cm_bss_select_ind(struct wlan_objmgr_vdev *vdev, - struct wlan_cm_vdev_connect_req *req); - -/** - * mlme_cm_bss_peer_create_req() - Connection manager ext bss peer create - * request - * @vdev: VDEV object - * @peer_mac: Peer mac address - * - * Return: QDF_STATUS - */ -QDF_STATUS mlme_cm_bss_peer_create_req(struct wlan_objmgr_vdev *vdev, - struct qdf_mac_addr *peer_mac); - -/** - * mlme_cm_connect_req() - Connection manager ext connect request to start vdev - * and peer assoc state machine - * @vdev: VDEV object - * @req: Vdev connect request - * - * Return: QDF_STATUS - */ -QDF_STATUS mlme_cm_connect_req(struct wlan_objmgr_vdev *vdev, - struct wlan_cm_vdev_connect_req *req); - -/** - * mlme_cm_connect_complete_ind() - Connection manager ext connect complete - * indication - * @vdev: VDEV object - * @rsp: Connection manager connect response - * - * Return: QDF_STATUS - */ -QDF_STATUS mlme_cm_connect_complete_ind(struct wlan_objmgr_vdev *vdev, - struct wlan_cm_connect_rsp *rsp); - -/** - * mlme_cm_disconnect_start_ind() - Connection manager ext disconnect start - * indication - * @vdev: VDEV object - * @req: Connection manager disconnect request - * - * Return: QDF_STATUS - */ -QDF_STATUS mlme_cm_disconnect_start_ind(struct wlan_objmgr_vdev *vdev, - struct wlan_cm_disconnect_req *req); - -/** - * mlme_cm_disconnect_req() - Connection manager ext disconnect - * req to vdev and peer sm - * @vdev: VDEV object - * @req: vdev disconnect request - * - * Return: QDF_STATUS - */ -QDF_STATUS mlme_cm_disconnect_req(struct wlan_objmgr_vdev *vdev, - struct wlan_cm_vdev_discon_req *req); - -/** - * mlme_cm_bss_peer_delete_req() - Connection manager ext bss peer delete - * request - * @vdev: VDEV object - * - * Return: QDF_STATUS - */ -QDF_STATUS -mlme_cm_bss_peer_delete_req(struct wlan_objmgr_vdev *vdev); - -/** - * mlme_cm_disconnect_complete_ind() - Connection manager ext disconnect - * complete indication - * @vdev: VDEV object - * @rsp: Connection manager disconnect response - * - * Return: QDF_STATUS - */ -QDF_STATUS mlme_cm_disconnect_complete_ind(struct wlan_objmgr_vdev *vdev, - struct wlan_cm_discon_rsp *rsp); - -/** - * mlme_cm_vdev_down() - Connection manager ext req to send vdev down to FW - * @vdev: VDEV object - * - * Return: QDF_STATUS - */ -QDF_STATUS mlme_cm_vdev_down_req(struct wlan_objmgr_vdev *vdev); - -/** - * mlme_cm_osif_connect_complete() - Connect complete resp to osif - * @vdev: vdev pointer - * @rsp: Connect response - * - * Return: QDF_STATUS - */ -QDF_STATUS mlme_cm_osif_connect_complete(struct wlan_objmgr_vdev *vdev, - struct wlan_cm_connect_rsp *rsp); - -/** - * mlme_cm_osif_failed_candidate_ind() - Failed Candidate indication to osif - * @vdev: vdev pointer - * @rsp: Connect response - * - * Return: QDF_STATUS - */ -QDF_STATUS -mlme_cm_osif_failed_candidate_ind(struct wlan_objmgr_vdev *vdev, - struct wlan_cm_connect_rsp *rsp); - -/** - * mlme_cm_osif_update_id_and_src() - Update connection id and source to osif - * @vdev: vdev pointer - * @source: source of request - * @cm_id: connection manager id - * - * Return: QDF_STATUS - */ -QDF_STATUS mlme_cm_osif_update_id_and_src(struct wlan_objmgr_vdev *vdev, - enum wlan_cm_source source, - wlan_cm_id cm_id); - -/** - * mlme_cm_osif_disconnect_complete() - Disconnect complete osif response - * @vdev: vdev pointer - * @cm_conn_rsp: Connect response - * - * Return: QDF_STATUS - */ -QDF_STATUS -mlme_cm_osif_disconnect_complete(struct wlan_objmgr_vdev *vdev, - struct wlan_cm_discon_rsp *rsp); - -/** - * mlme_cm_osif_disconnect_start_ind() - osif Disconnect start indication - * @vdev: vdev pointer - * @cm_conn_rsp: Connect response - * - * Return: QDF_STATUS - */ -QDF_STATUS mlme_cm_osif_disconnect_start_ind(struct wlan_objmgr_vdev *vdev); - -/** - * typedef osif_cm_get_global_ops_cb() - Callback to get connection manager - * global ops - */ -typedef struct mlme_cm_ops *(*osif_cm_get_global_ops_cb)(void); - -/** - * mlme_set_osif_cm_cb() - Sets ops registration callback - * @cm_osif_ops: Function pointer - * - * API to set ops registration call back - * - * Return: void - */ -void mlme_set_osif_cm_cb(osif_cm_get_global_ops_cb cm_osif_ops); - -#endif - #endif diff --git a/umac/mlme/mlme_objmgr/dispatcher/src/wlan_cmn_mlme_main.c b/umac/mlme/mlme_objmgr/dispatcher/src/wlan_cmn_mlme_main.c index 05879b9c9949..8098c90cc1a2 100644 --- a/umac/mlme/mlme_objmgr/dispatcher/src/wlan_cmn_mlme_main.c +++ b/umac/mlme/mlme_objmgr/dispatcher/src/wlan_cmn_mlme_main.c @@ -30,31 +30,6 @@ struct mlme_ext_ops *glbl_ops; mlme_get_global_ops_cb glbl_ops_cb; -#ifdef FEATURE_CM_ENABLE -struct mlme_cm_ops *glbl_cm_ops; -osif_cm_get_global_ops_cb glbl_cm_ops_cb; - -static void mlme_cm_ops_init(void) -{ - if (glbl_cm_ops_cb) - glbl_cm_ops = glbl_cm_ops_cb(); -} - -static void mlme_cm_ops_deinit(void) -{ - if (glbl_cm_ops_cb) - glbl_cm_ops = NULL; -} -#else -static inline void mlme_cm_ops_init(void) -{ -} - -static inline void mlme_cm_ops_deinit(void) -{ -} -#endif - QDF_STATUS wlan_cmn_mlme_init(void) { QDF_STATUS status; @@ -74,8 +49,6 @@ QDF_STATUS wlan_cmn_mlme_init(void) if (glbl_ops_cb) glbl_ops = glbl_ops_cb(); - mlme_cm_ops_init(); - return QDF_STATUS_SUCCESS; } @@ -95,8 +68,6 @@ QDF_STATUS wlan_cmn_mlme_deinit(void) if (status != QDF_STATUS_SUCCESS) return status; - mlme_cm_ops_deinit(); - return QDF_STATUS_SUCCESS; } @@ -246,183 +217,6 @@ QDF_STATUS mlme_vdev_ops_ext_hdl_multivdev_restart_resp( return ret; } -#ifdef FEATURE_CM_ENABLE -QDF_STATUS mlme_cm_connect_start_ind(struct wlan_objmgr_vdev *vdev, - struct wlan_cm_connect_req *req) -{ - QDF_STATUS ret = QDF_STATUS_SUCCESS; - - if ((glbl_ops) && glbl_ops->mlme_cm_ext_connect_start_ind_cb) - ret = glbl_ops->mlme_cm_ext_connect_start_ind_cb(vdev, req); - - return ret; -} - -QDF_STATUS mlme_cm_bss_select_ind(struct wlan_objmgr_vdev *vdev, - struct wlan_cm_vdev_connect_req *req) -{ - QDF_STATUS ret = QDF_STATUS_E_NOSUPPORT; - - if ((glbl_ops) && glbl_ops->mlme_cm_ext_bss_select_ind_cb) - ret = glbl_ops->mlme_cm_ext_bss_select_ind_cb(vdev, req); - - return ret; -} - -QDF_STATUS mlme_cm_bss_peer_create_req(struct wlan_objmgr_vdev *vdev, - struct qdf_mac_addr *peer_mac) -{ - QDF_STATUS ret = QDF_STATUS_SUCCESS; - - if ((glbl_ops) && glbl_ops->mlme_cm_ext_bss_peer_create_req_cb) - ret = glbl_ops->mlme_cm_ext_bss_peer_create_req_cb(vdev, - peer_mac); - - return ret; -} - -QDF_STATUS mlme_cm_connect_req(struct wlan_objmgr_vdev *vdev, - struct wlan_cm_vdev_connect_req *req) -{ - QDF_STATUS ret = QDF_STATUS_SUCCESS; - - if ((glbl_ops) && glbl_ops->mlme_cm_ext_connect_req_cb) - ret = glbl_ops->mlme_cm_ext_connect_req_cb(vdev, req); - - return ret; -} - -QDF_STATUS mlme_cm_connect_complete_ind(struct wlan_objmgr_vdev *vdev, - struct wlan_cm_connect_rsp *rsp) -{ - QDF_STATUS ret = QDF_STATUS_SUCCESS; - - if ((glbl_ops) && glbl_ops->mlme_cm_ext_connect_complete_ind_cb) - ret = glbl_ops->mlme_cm_ext_connect_complete_ind_cb(vdev, rsp); - - return ret; -} - -QDF_STATUS mlme_cm_disconnect_start_ind(struct wlan_objmgr_vdev *vdev, - struct wlan_cm_disconnect_req *req) -{ - QDF_STATUS ret = QDF_STATUS_SUCCESS; - - if ((glbl_ops) && glbl_ops->mlme_cm_ext_disconnect_start_ind_cb) - ret = glbl_ops->mlme_cm_ext_disconnect_start_ind_cb(vdev, req); - - return ret; -} - -QDF_STATUS mlme_cm_disconnect_req(struct wlan_objmgr_vdev *vdev, - struct wlan_cm_vdev_discon_req *req) -{ - QDF_STATUS ret = QDF_STATUS_SUCCESS; - - if ((glbl_ops) && glbl_ops->mlme_cm_ext_disconnect_req_cb) - ret = glbl_ops->mlme_cm_ext_disconnect_req_cb(vdev, req); - - return ret; -} - -QDF_STATUS mlme_cm_bss_peer_delete_req(struct wlan_objmgr_vdev *vdev) -{ - QDF_STATUS ret = QDF_STATUS_SUCCESS; - - if ((glbl_ops) && glbl_ops->mlme_cm_ext_bss_peer_delete_req_cb) - ret = glbl_ops->mlme_cm_ext_bss_peer_delete_req_cb(vdev); - - return ret; -} - -QDF_STATUS mlme_cm_disconnect_complete_ind(struct wlan_objmgr_vdev *vdev, - struct wlan_cm_discon_rsp *rsp) -{ - QDF_STATUS ret = QDF_STATUS_SUCCESS; - - if ((glbl_ops) && glbl_ops->mlme_cm_ext_disconnect_complete_ind_cb) - ret = glbl_ops->mlme_cm_ext_disconnect_complete_ind_cb(vdev, - rsp); - - return ret; -} - -QDF_STATUS mlme_cm_vdev_down_req(struct wlan_objmgr_vdev *vdev) -{ - QDF_STATUS ret = QDF_STATUS_SUCCESS; - - if ((glbl_ops) && glbl_ops->mlme_cm_ext_vdev_down_req_cb) - ret = glbl_ops->mlme_cm_ext_vdev_down_req_cb(vdev); - return ret; -} - -QDF_STATUS mlme_cm_osif_connect_complete(struct wlan_objmgr_vdev *vdev, - struct wlan_cm_connect_rsp *rsp) -{ - QDF_STATUS ret = QDF_STATUS_SUCCESS; - - if (glbl_cm_ops && glbl_cm_ops->mlme_cm_connect_complete_cb) - ret = glbl_cm_ops->mlme_cm_connect_complete_cb(vdev, rsp); - - return ret; -} - -QDF_STATUS -mlme_cm_osif_failed_candidate_ind(struct wlan_objmgr_vdev *vdev, - struct wlan_cm_connect_rsp *rsp) -{ - QDF_STATUS ret = QDF_STATUS_SUCCESS; - - if (glbl_cm_ops && - glbl_cm_ops->mlme_cm_failed_candidate_cb) - ret = glbl_cm_ops->mlme_cm_failed_candidate_cb(vdev, rsp); - - return ret; -} - -QDF_STATUS mlme_cm_osif_update_id_and_src(struct wlan_objmgr_vdev *vdev, - enum wlan_cm_source source, - wlan_cm_id cm_id) -{ - QDF_STATUS ret = QDF_STATUS_SUCCESS; - - if (glbl_cm_ops && - glbl_cm_ops->mlme_cm_update_id_and_src_cb) - ret = glbl_cm_ops->mlme_cm_update_id_and_src_cb(vdev, source, - cm_id); - - return ret; -} - -QDF_STATUS mlme_cm_osif_disconnect_complete(struct wlan_objmgr_vdev *vdev, - struct wlan_cm_discon_rsp *rsp) -{ - QDF_STATUS ret = QDF_STATUS_SUCCESS; - - if (glbl_cm_ops && - glbl_cm_ops->mlme_cm_disconnect_complete_cb) - ret = glbl_cm_ops->mlme_cm_disconnect_complete_cb(vdev, rsp); - - return ret; -} - -QDF_STATUS mlme_cm_osif_disconnect_start_ind(struct wlan_objmgr_vdev *vdev) -{ - QDF_STATUS ret = QDF_STATUS_SUCCESS; - - if (glbl_cm_ops && - glbl_cm_ops->mlme_cm_disconnect_start_cb) - ret = glbl_cm_ops->mlme_cm_disconnect_start_cb(vdev); - - return ret; -} - -void mlme_set_osif_cm_cb(osif_cm_get_global_ops_cb osif_cm_ops) -{ - glbl_cm_ops_cb = osif_cm_ops; -} -#endif - void mlme_set_ops_register_cb(mlme_get_global_ops_cb ops_cb) { glbl_ops_cb = ops_cb; diff --git a/umac/mlme/mlme_objmgr/dispatcher/src/wlan_vdev_mlme_main.c b/umac/mlme/mlme_objmgr/dispatcher/src/wlan_vdev_mlme_main.c index 82f639e1f396..0703ce0a4936 100644 --- a/umac/mlme/mlme_objmgr/dispatcher/src/wlan_vdev_mlme_main.c +++ b/umac/mlme/mlme_objmgr/dispatcher/src/wlan_vdev_mlme_main.c @@ -33,7 +33,6 @@ #include #include #include -#include "connection_mgr/core/src/wlan_cm_main.h" static QDF_STATUS mlme_vdev_obj_create_handler(struct wlan_objmgr_vdev *vdev, void *arg) @@ -104,11 +103,6 @@ static QDF_STATUS mlme_vdev_obj_create_handler(struct wlan_objmgr_vdev *vdev, goto init_failed; } - if (QDF_IS_STATUS_ERROR(wlan_cm_init(vdev_mlme))) { - mlme_err("CM SM create failed"); - goto cm_sm_create_failed; - } - if (mlme_vdev_ops_ext_hdl_create(vdev_mlme) != QDF_STATUS_SUCCESS) { mlme_err("Legacy vdev object creation failed"); @@ -133,8 +127,6 @@ ext_hdl_post_create_failed: wlan_objmgr_vdev_component_obj_detach(vdev, WLAN_UMAC_COMP_MLME, vdev_mlme); ext_hdl_create_failed: - wlan_cm_deinit(vdev_mlme); -cm_sm_create_failed: mlme_vdev_sm_destroy(vdev_mlme); init_failed: wlan_minidump_remove(vdev_mlme); @@ -158,7 +150,6 @@ static QDF_STATUS mlme_vdev_obj_destroy_handler(struct wlan_objmgr_vdev *vdev, return QDF_STATUS_SUCCESS; } - wlan_cm_deinit(vdev_mlme); mlme_vdev_sm_destroy(vdev_mlme); mlme_vdev_ops_ext_hdl_destroy(vdev_mlme);