소스 검색

qcacmn: VDEV MLME SM changes

1) Fixes to enable VDEV MLME SM with legacy code
2) Define/Enable PDEV MLME component object.

Change-Id: Ieb87e5b7b70d6bb593ba0950297894a81c6a4feb
CRs-Fixed: 2384173
Srinivas Pitla 6 년 전
부모
커밋
39a9222d27

+ 16 - 18
init_deinit/dispatcher/src/dispatcher_init_deinit.c

@@ -1,19 +1,17 @@
 /*
  * Copyright (c) 2016-2019 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.
+ * 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.
+ * 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.
  */
 
 #include "cfg_dispatcher.h"
@@ -27,7 +25,7 @@
 #include <wlan_ftm_init_deinit_api.h>
 #include <wlan_mgmt_txrx_utils_api.h>
 #include <wlan_serialization_api.h>
-#include <wlan_vdev_mlme_main.h>
+#include <include/wlan_mlme_cmn.h>
 #ifdef WLAN_ATF_ENABLE
 #include <wlan_atf_utils_api.h>
 #endif
@@ -721,8 +719,8 @@ QDF_STATUS dispatcher_init(void)
 	if (QDF_STATUS_SUCCESS != dispatcher_spectral_init())
 		goto spectral_init_fail;
 
-	if (QDF_STATUS_SUCCESS != wlan_vdev_mlme_init())
-		goto vdev_mlme_init_fail;
+	if (QDF_STATUS_SUCCESS != wlan_cmn_mlme_init())
+		goto cmn_mlme_init_fail;
 
 	/*
 	 * scheduler INIT has to be the last as each component's
@@ -735,8 +733,8 @@ QDF_STATUS dispatcher_init(void)
 	return QDF_STATUS_SUCCESS;
 
 scheduler_init_fail:
-	wlan_vdev_mlme_deinit();
-vdev_mlme_init_fail:
+	wlan_cmn_mlme_deinit();
+cmn_mlme_init_fail:
 	dispatcher_spectral_deinit();
 spectral_init_fail:
 	cfg_dispatcher_deinit();
@@ -786,7 +784,7 @@ QDF_STATUS dispatcher_deinit(void)
 
 	QDF_BUG(QDF_STATUS_SUCCESS == scheduler_deinit());
 
-	QDF_BUG(QDF_STATUS_SUCCESS == wlan_vdev_mlme_deinit());
+	QDF_BUG(QDF_STATUS_SUCCESS == wlan_cmn_mlme_deinit());
 
 	status = cfg_dispatcher_deinit();
 	QDF_BUG(QDF_IS_STATUS_SUCCESS(status));

+ 1 - 0
spectral/Kbuild

@@ -113,6 +113,7 @@ INCS += -I$(obj)/$(DEPTH)/include -I$(obj)/$(DEPTH)/umac/include \
         -I$(obj)/$(DEPTH)/cmn_dev/target_if/regulatory/inc \
         -I$(obj)/$(DEPTH)/cmn_dev/umac/mlme/mlme_objmgr/dispatcher/inc/ \
         -I$(obj)/$(DEPTH)/cmn_dev/umac/mlme/vdev_mgr/dispatcher/inc \
+        -I$(obj)/$(DEPTH)/cmn_dev/umac/mlme/pdev_mgr/dispatcher/inc \
 
 PERF_PWR_OFFLOAD_INC += -I$(PERF_PWR_OFFLOAD_DIR_PATH)/wlan/include \
  -I$(PERF_PWR_OFFLOAD_DIR_PATH)/wlan/ath_pktlog/include \

+ 62 - 15
umac/cmn_services/obj_mgr/inc/wlan_objmgr_pdev_obj.h

@@ -1,19 +1,17 @@
 /*
- * Copyright (c) 2016-2018 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2016-2019 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.
+ * 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.
+ * 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.
  */
 
 /**
@@ -82,6 +80,10 @@
 /*#define WLAN_PDEV_F_DUPIE                 0x00200000*/
  /* QWRAP enable flag */
 #define WLAN_PDEV_F_WRAP_EN                 0x04000000
+/* Chan concurrency enabled */
+#define WLAN_PDEV_F_CHAN_CONCURRENCY        0x08000000
+/* Multivdev restart enabled */
+#define WLAN_PDEV_F_MULTIVDEV_RESTART       0x10000000
 
 /* PDEV op flags */
    /* Enable htrate for wep and tkip */
@@ -113,6 +115,8 @@
 #define WLAN_PDEV_OP_OBSS_LONGSLOT      0x00008000
    /* enable/disable min rssi cli block */
 #define WLAN_PDEV_OP_MIN_RSSI_ENABLE    0x00010000
+   /* PDEV VDEV restart is in progress */
+#define WLAN_PDEV_OP_RESTART_INPROGRESS 0x00020000
 
 
 struct osif_pdev_priv;
@@ -137,11 +141,9 @@ struct wlan_objmgr_pdev_nif {
  * struct wlan_objmgr_pdev_mlme - pdev object mlme structure
  * @pdev_op_flags:    PDEV operation flags, can be used to know the
  *                    operation status (deletion progress, etc)
- * @mlme_register_ops: Call back to register MLME legacy APIs
  */
 struct wlan_objmgr_pdev_mlme {
 	uint32_t pdev_op_flags;
-	QDF_STATUS (*mlme_register_ops)(void *vdev_mlme);
 };
 
 /**
@@ -569,6 +571,51 @@ static inline uint8_t wlan_pdev_nif_feat_cap_get(struct wlan_objmgr_pdev *pdev,
 	return (pdev->pdev_nif.pdev_feature_caps & cap) ? 1 : 0;
 }
 
+/**
+ * wlan_pdev_mlme_op_set() - set operation flags
+ * @pdev: PDEV object
+ * @op: Operation flag to be set
+ *
+ * API to set operation flag in pdev
+ *
+ * Return: void
+ */
+static inline void wlan_pdev_mlme_op_set(struct wlan_objmgr_pdev *pdev,
+					 uint32_t op)
+{
+	pdev->pdev_mlme.pdev_op_flags |= op;
+}
+
+/**
+ * wlan_pdev_mlme_op_clear() - clear op flags
+ * @pdev: PDEV object
+ * @op: Operation flag to be cleared
+ *
+ * API to clear op flag in pdev
+ *
+ * Return: void
+ */
+static inline void wlan_pdev_mlme_op_clear(struct wlan_objmgr_pdev *pdev,
+					   uint32_t op)
+{
+	pdev->pdev_mlme.pdev_op_flags &= ~op;
+}
+
+/**
+ * wlan_pdev_mlme_op_get() - get op flag
+ * @pdev: PDEV object
+ * @op: Operation flag to be checked
+ *
+ * API to know, whether particular operation flag is set in pdev
+ *
+ * Return: 1 (for set) or 0 (for not set)
+ */
+static inline uint8_t wlan_pdev_mlme_op_get(struct wlan_objmgr_pdev *pdev,
+					    uint32_t op)
+{
+	return (pdev->pdev_mlme.pdev_op_flags & op) ? 1 : 0;
+}
+
 /**
  * wlan_pdev_get_hw_macaddr() - get hw macaddr
  * @pdev: PDEV object

+ 16 - 23
umac/cmn_services/obj_mgr/src/wlan_objmgr_vdev_obj.c

@@ -1,19 +1,18 @@
 /*
- * Copyright (c) 2016-2018 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2016-2019 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.
+ * 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.
+ * 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: Public APIs to perform operations on Global objects
@@ -145,20 +144,14 @@ struct wlan_objmgr_vdev *wlan_objmgr_vdev_obj_create(
 	}
 	vdev->obj_state = WLAN_OBJ_STATE_ALLOCATED;
 
-	vdev->vdev_mlme.bss_chan = (struct wlan_channel *)qdf_mem_malloc(
-			sizeof(struct wlan_channel));
-	if (vdev->vdev_mlme.bss_chan == NULL) {
-		QDF_TRACE(QDF_MODULE_ID_MLME, QDF_TRACE_LEVEL_ERROR,
-				"%s:bss_chan is NULL", __func__);
+	vdev->vdev_mlme.bss_chan = qdf_mem_malloc(sizeof(struct wlan_channel));
+	if (!vdev->vdev_mlme.bss_chan) {
 		qdf_mem_free(vdev);
 		return NULL;
 	}
 
-	vdev->vdev_mlme.des_chan = (struct wlan_channel *)qdf_mem_malloc(
-			sizeof(struct wlan_channel));
-	if (vdev->vdev_mlme.des_chan == NULL) {
-		QDF_TRACE(QDF_MODULE_ID_MLME, QDF_TRACE_LEVEL_ERROR,
-				"%s:des_chan is NULL", __func__);
+	vdev->vdev_mlme.des_chan = qdf_mem_malloc(sizeof(struct wlan_channel));
+	if (!vdev->vdev_mlme.des_chan) {
 		qdf_mem_free(vdev->vdev_mlme.bss_chan);
 		qdf_mem_free(vdev);
 		return NULL;

+ 63 - 27
umac/cmn_services/utils/inc/wlan_utility.h

@@ -1,19 +1,17 @@
 /*
  * Copyright (c) 2017-2019 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.
+ * 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.
  */
 
 /**
@@ -184,23 +182,24 @@ struct wlan_objmgr_vdev *wlan_util_get_vdev_by_ifname(
  */
 uint8_t *wlan_util_vdev_get_if_name(struct wlan_objmgr_vdev *vdev);
 
-/*
+/**
  * wlan_util_is_vdev_active() - Check for vdev active
  * @pdev: pdev pointer
  * @dbg_id: debug id for ref counting
  *
- * @Return: QDF_STATUS_SUCCESS in case of vdev active
+ * Return: QDF_STATUS_SUCCESS in case of vdev active
+ *          QDF_STATUS_E_INVAL, if dev is not active
  */
 QDF_STATUS wlan_util_is_vdev_active(struct wlan_objmgr_pdev *pdev,
 				    wlan_objmgr_ref_dbgid dbg_id);
 
-/*
+/**
  * wlan_vdev_is_up() - Check for vdev is in UP state
  * @vdev: vdev pointer
  *
- * @Return: true in case of vdev is in UP state
+ * Return: QDF_STATUS_SUCCESS, if vdev is in up, otherwise QDF_STATUS_E_FAILURE
  */
-bool wlan_vdev_is_up(struct wlan_objmgr_vdev *vdev);
+QDF_STATUS wlan_vdev_is_up(struct wlan_objmgr_vdev *vdev);
 
 /**
  * wlan_util_pdev_vdevs_deschan_match() - function to check des channel matches
@@ -211,7 +210,7 @@ bool wlan_vdev_is_up(struct wlan_objmgr_vdev *vdev);
  *
  * This function checks the vdev desired channel with other vdev channels
  *
- * Return : SUCCESS, if it matches, otherwise FAILURE
+ * Return: QDF_STATUS_SUCCESS, if it matches, otherwise QDF_STATUS_E_FAILURE
  */
 QDF_STATUS wlan_util_pdev_vdevs_deschan_match(struct wlan_objmgr_pdev *pdev,
 					      struct wlan_objmgr_vdev *vdev,
@@ -225,9 +224,9 @@ QDF_STATUS wlan_util_pdev_vdevs_deschan_match(struct wlan_objmgr_pdev *pdev,
  *
  * This function set/reset given index bit
  *
- * Return : void
+ * Return: void
  */
-void wlan_util_change_map_index(uint32_t *map, uint8_t id, uint8_t set);
+void wlan_util_change_map_index(unsigned long *map, uint8_t id, uint8_t set);
 
 /**
  * wlan_util_map_index_is_set() - function to check whether given index bit is
@@ -237,9 +236,9 @@ void wlan_util_change_map_index(uint32_t *map, uint8_t id, uint8_t set);
  *
  * This function checks the given index bit is set
  *
- * Return : true, if bit is set, otherwise false
+ * Return: true, if bit is set, otherwise false
  */
-bool wlan_util_map_index_is_set(uint32_t *map, uint8_t id);
+bool wlan_util_map_index_is_set(unsigned long *map, uint8_t id);
 
 /**
  * wlan_pdev_chan_change_pending_vdevs() - function to test/set channel change
@@ -250,10 +249,11 @@ bool wlan_util_map_index_is_set(uint32_t *map, uint8_t id);
  *
  * This function test/set channel change pending flag
  *
- * Return : SUCCESS, if it iterates through all vdevs, otherwise FAILURE
+ * Return: QDF_STATUS_SUCCESS, if it iterates through all vdevs,
+ *         otherwise QDF_STATUS_E_FAILURE
  */
 QDF_STATUS wlan_pdev_chan_change_pending_vdevs(struct wlan_objmgr_pdev *pdev,
-					       uint32_t *vdev_id_map,
+					       unsigned long *vdev_id_map,
 					       wlan_objmgr_ref_dbgid dbg_id);
 
 /**
@@ -263,10 +263,33 @@ QDF_STATUS wlan_pdev_chan_change_pending_vdevs(struct wlan_objmgr_pdev *pdev,
  *
  * This function checks the chan1 and chan2 are same
  *
- * Return : SUCCESS, if it matches, otherwise FAILURE
+ * Return: QDF_STATUS_SUCCESS, if it matches, otherwise QDF_STATUS_E_FAILURE
  */
 QDF_STATUS wlan_chan_eq(struct wlan_channel *chan1, struct wlan_channel *chan2);
 
+/**
+ * wlan_chan_copy() - function to copy channel
+ * @tgt:  target channel object
+ * @src:  src achannel object
+ *
+ * This function copies channel data from src to tgt
+ *
+ * Return: void
+ */
+void wlan_chan_copy(struct wlan_channel *tgt, struct wlan_channel *src);
+
+/**
+ * wlan_vdev_get_active_channel() - derives the vdev operating channel
+ * @vdev:  VDEV object
+ *
+ * This function checks vdev state and return the channel pointer accordingly
+ *
+ * Return: active channel, if vdev chan config is valid
+ *         NULL, if VDEV is in INIT or STOP state
+ */
+struct wlan_channel *wlan_vdev_get_active_channel
+				(struct wlan_objmgr_vdev *vdev);
+
 /**
  * wlan_util_stats_get_rssi() - API to get rssi in dbm
  * @db2dbm_enabled: If db2dbm capability is enabled
@@ -285,6 +308,20 @@ void
 wlan_util_stats_get_rssi(bool db2dbm_enabled, int32_t bcn_snr, int32_t dat_snr,
 			 int8_t *rssi);
 
+/**
+ * wlan_util_is_pdev_restart_progress() - Check if any vdev is in restart state
+ * @pdev: pdev pointer
+ * @dbg_id: module id
+ *
+ * Iterates through all vdevs, checks if any VDEV is in RESTART_PROGRESS
+ * substate
+ *
+ * Return: QDF_STATUS_SUCCESS,if any vdev is in RESTART_PROGRESS substate
+ *         otherwise QDF_STATUS_E_FAILURE
+ */
+QDF_STATUS wlan_util_is_pdev_restart_progress(struct wlan_objmgr_pdev *pdev,
+					      wlan_objmgr_ref_dbgid dbg_id);
+
 /**
  * wlan_util_is_pdev_scan_allowed() - Check for vdev is allowed to scan
  * @pdev: pdev pointer
@@ -297,5 +334,4 @@ wlan_util_stats_get_rssi(bool db2dbm_enabled, int32_t bcn_snr, int32_t dat_snr,
  */
 QDF_STATUS wlan_util_is_pdev_scan_allowed(struct wlan_objmgr_pdev *pdev,
 					  wlan_objmgr_ref_dbgid dbg_id);
-
 #endif /* _WLAN_UTILITY_H_ */

+ 139 - 71
umac/cmn_services/utils/src/wlan_utility.c

@@ -1,19 +1,17 @@
 /*
  * Copyright (c) 2017-2019 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.
+ * 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.
+ * 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.
  */
 
 /**
@@ -272,14 +270,9 @@ static void wlan_vdev_active(struct wlan_objmgr_pdev *pdev, void *object,
 	wlan_vdev_obj_unlock(vdev);
 }
 
-bool wlan_vdev_is_up(struct wlan_objmgr_vdev *vdev)
+QDF_STATUS wlan_vdev_is_up(struct wlan_objmgr_vdev *vdev)
 {
-	bool ret_val = false;
-
-	if (wlan_vdev_allow_connect_n_tx(vdev) == QDF_STATUS_SUCCESS)
-		ret_val = true;
-
-	return ret_val;
+	return wlan_vdev_allow_connect_n_tx(vdev);
 }
 
 qdf_export_symbol(wlan_vdev_is_up);
@@ -298,17 +291,17 @@ static void wlan_vdev_active(struct wlan_objmgr_pdev *pdev, void *object,
 	wlan_vdev_obj_unlock(vdev);
 }
 
-bool wlan_vdev_is_up(struct wlan_objmgr_vdev *vdev)
+QDF_STATUS wlan_vdev_is_up(struct wlan_objmgr_vdev *vdev)
 {
-	bool ret_val = false;
+	QDF_STATUS is_up = QDF_STATUS_E_FAILURE;
 
 	wlan_vdev_obj_lock(vdev);
 	if (wlan_vdev_mlme_get_state(vdev) == WLAN_VDEV_S_RUN)
-		ret_val = true;
+		is_up = QDF_STATUS_SUCCESS;
 
 	wlan_vdev_obj_unlock(vdev);
 
-	return ret_val;
+	return is_up;
 }
 
 qdf_export_symbol(wlan_vdev_is_up);
@@ -332,51 +325,24 @@ QDF_STATUS wlan_util_is_vdev_active(struct wlan_objmgr_pdev *pdev,
 }
 
 #ifdef CMN_VDEV_MLME_SM_ENABLE
-void wlan_util_change_map_index(uint32_t *map, uint8_t id, uint8_t set)
-{
-	uint8_t map_index = 0;
-	uint8_t map_entry_size = 32;
-	uint8_t adjust_index = 0;
-
-	/*
-	 * Derive map_index and adjust_index to find actual DWORD
-	 * the id map is present
-	 */
-	while ((id - adjust_index) >= map_entry_size) {
-		map_index++;
-		adjust_index = map_index * map_entry_size;
-	}
+void wlan_util_change_map_index(unsigned long *map, uint8_t id, uint8_t set)
+{
 	if (set)
-		map[map_index] |= (1 << (id - adjust_index));
+		qdf_set_bit(id, map);
 	else
-		map[map_index] &= ~(1 << (id - adjust_index));
+		qdf_clear_bit(id, map);
 }
 
-bool wlan_util_map_index_is_set(uint32_t *map, uint8_t id)
+bool wlan_util_map_index_is_set(unsigned long *map, uint8_t id)
 {
-	uint8_t map_index = 0;
-	uint8_t map_entry_size = 32;
-	uint8_t adjust_index = 0;
-
-	/*
-	 * Derive map_index and adjust_index to find actual DWORD
-	 * the id map is present
-	 */
-	while ((id - adjust_index) >= map_entry_size) {
-		map_index++;
-		adjust_index = map_index * map_entry_size;
-	}
-	if (map[map_index] & (1 << (id - adjust_index)))
-		return true;
-
-	return false;
+	return qdf_test_bit(id, map);
 }
 
 static void wlan_vdev_chan_change_pending(struct wlan_objmgr_pdev *pdev,
 					  void *object, void *arg)
 {
 	struct wlan_objmgr_vdev *vdev = (struct wlan_objmgr_vdev *)object;
-	uint32_t *vdev_id_map = (uint32_t *)arg;
+	unsigned long *vdev_id_map = (unsigned long *)arg;
 	uint8_t id = 0;
 	struct wlan_objmgr_psoc *psoc;
 
@@ -388,8 +354,10 @@ static void wlan_vdev_chan_change_pending(struct wlan_objmgr_pdev *pdev,
 	if (wlan_vdev_chan_config_valid(vdev) == QDF_STATUS_SUCCESS) {
 		id = wlan_vdev_get_id(vdev);
 		/* Invalid vdev id */
-		if (id >= wlan_psoc_get_max_vdev_count(psoc))
+		if (id >= wlan_psoc_get_max_vdev_count(psoc)) {
+			wlan_vdev_obj_unlock(vdev);
 			return;
+		}
 
 		wlan_util_change_map_index(vdev_id_map, id, 1);
 	}
@@ -398,7 +366,7 @@ static void wlan_vdev_chan_change_pending(struct wlan_objmgr_pdev *pdev,
 }
 
 QDF_STATUS wlan_pdev_chan_change_pending_vdevs(struct wlan_objmgr_pdev *pdev,
-					       uint32_t *vdev_id_map,
+					       unsigned long *vdev_id_map,
 					       wlan_objmgr_ref_dbgid dbg_id)
 {
 	if (!pdev)
@@ -419,23 +387,85 @@ QDF_STATUS wlan_chan_eq(struct wlan_channel *chan1, struct wlan_channel *chan2)
 	return QDF_STATUS_E_FAILURE;
 }
 
-static void wlan_pdev_chan_match(struct wlan_objmgr_pdev *pdev,	void *object,
+void wlan_chan_copy(struct wlan_channel *tgt, struct wlan_channel *src)
+{
+	qdf_mem_copy(tgt, src, sizeof(struct wlan_channel));
+}
+
+struct wlan_channel *wlan_vdev_get_active_channel(struct wlan_objmgr_vdev *vdev)
+{
+	struct wlan_channel *comp_vdev_chan = NULL;
+
+	if (wlan_vdev_chan_config_valid(vdev) == QDF_STATUS_SUCCESS) {
+		/* compare with BSS channel, when vdev is active, since desired
+		 * channel gets update, if channel is triggered in another path
+		 */
+		if (wlan_vdev_mlme_is_active(vdev) == QDF_STATUS_SUCCESS)
+			comp_vdev_chan = wlan_vdev_mlme_get_bss_chan(vdev);
+		else
+			comp_vdev_chan = wlan_vdev_mlme_get_des_chan(vdev);
+	}
+
+	return comp_vdev_chan;
+}
+
+static void wlan_pdev_chan_match(struct wlan_objmgr_pdev *pdev, void *object,
 				 void *arg)
 {
 	struct wlan_objmgr_vdev *comp_vdev = (struct wlan_objmgr_vdev *)object;
 	struct wlan_vdev_ch_check_filter *ch_filter = arg;
+	struct wlan_channel *vdev_chan;
+	struct wlan_channel *iter_vdev_chan;
 
 	if (ch_filter->flag)
 		return;
 
+	if (comp_vdev == ch_filter->vdev)
+		return;
+
 	wlan_vdev_obj_lock(comp_vdev);
 	wlan_vdev_obj_lock(ch_filter->vdev);
 
-	if (wlan_vdev_chan_config_valid(ch_filter->vdev) == QDF_STATUS_SUCCESS)
-		if (wlan_chan_eq(wlan_vdev_mlme_get_des_chan(comp_vdev),
-				 wlan_vdev_mlme_get_des_chan(ch_filter->vdev))
-				 != QDF_STATUS_SUCCESS)
-			ch_filter->flag = 1;
+	vdev_chan = wlan_vdev_get_active_channel(comp_vdev);
+	if (vdev_chan) {
+		iter_vdev_chan = wlan_vdev_mlme_get_des_chan(
+							ch_filter->vdev);
+		if (wlan_chan_eq(vdev_chan, iter_vdev_chan)
+						!= QDF_STATUS_SUCCESS) {
+			if (!((vdev_chan->ch_ieee == iter_vdev_chan->ch_ieee) &&
+			      (vdev_chan->ch_freq_seg2 ==
+						iter_vdev_chan->ch_freq_seg2) &&
+			      (vdev_chan->ch_phymode ==
+						iter_vdev_chan->ch_phymode)))
+				ch_filter->flag = 1;
+
+			qdf_err("Chan match failed");
+			qdf_err("==> iter vdev id: %d: ieee %d, freq %d",
+				wlan_vdev_get_id(comp_vdev), vdev_chan->ch_ieee,
+				vdev_chan->ch_freq);
+			qdf_err("flags %016llx, flags ext: %08x, max pwr %d",
+				vdev_chan->ch_flags, vdev_chan->ch_flagext,
+				vdev_chan->ch_maxpower);
+			qdf_err(" seg1 %d seg2 %d chwidth %d, ch_phymode %d",
+				vdev_chan->ch_freq_seg1,
+				vdev_chan->ch_freq_seg2,
+				vdev_chan->ch_width, vdev_chan->ch_phymode);
+
+			qdf_err("==> base vdev id: %d: ieee %d, freq %d",
+				wlan_vdev_get_id(ch_filter->vdev),
+				iter_vdev_chan->ch_ieee,
+				iter_vdev_chan->ch_freq);
+			qdf_err("flags %016llx, flags ext: %08x, max pwr %d",
+				iter_vdev_chan->ch_flags,
+				iter_vdev_chan->ch_flagext,
+				iter_vdev_chan->ch_maxpower);
+			qdf_err(" seg1 %d seg2 %d chwidth %d, ch_phymode %d",
+				iter_vdev_chan->ch_freq_seg1,
+				iter_vdev_chan->ch_freq_seg2,
+				iter_vdev_chan->ch_width,
+				iter_vdev_chan->ch_phymode);
+		}
+	}
 
 	wlan_vdev_obj_unlock(ch_filter->vdev);
 	wlan_vdev_obj_unlock(comp_vdev);
@@ -450,17 +480,55 @@ QDF_STATUS wlan_util_pdev_vdevs_deschan_match(struct wlan_objmgr_pdev *pdev,
 	if (!pdev)
 		return QDF_STATUS_E_INVAL;
 
-	ch_filter.flag = 0;
-	ch_filter.vdev = vdev;
+	if (wlan_pdev_nif_feat_cap_get(pdev, WLAN_PDEV_F_CHAN_CONCURRENCY))
+		return QDF_STATUS_SUCCESS;
+
+	if (wlan_objmgr_vdev_try_get_ref(vdev, dbg_id) == QDF_STATUS_SUCCESS) {
+		ch_filter.flag = 0;
+		ch_filter.vdev = vdev;
+
+		wlan_objmgr_pdev_iterate_obj_list(pdev, WLAN_VDEV_OP,
+						  wlan_pdev_chan_match,
+						  &ch_filter, 0, dbg_id);
+
+		wlan_objmgr_vdev_release_ref(vdev, dbg_id);
+
+		if (ch_filter.flag == 0)
+			return QDF_STATUS_SUCCESS;
+	}
+
+	return QDF_STATUS_E_FAILURE;
+}
+
+static void wlan_vdev_restart_progress(struct wlan_objmgr_pdev *pdev,
+				       void *object, void *arg)
+{
+	struct wlan_objmgr_vdev *vdev = (struct wlan_objmgr_vdev *)object;
+	uint8_t *flag = (uint8_t *)arg;
+
+	wlan_vdev_obj_lock(vdev);
+	if (wlan_vdev_is_restart_progress(vdev) == QDF_STATUS_SUCCESS)
+		*flag = 1;
+
+	wlan_vdev_obj_unlock(vdev);
+}
+
+QDF_STATUS wlan_util_is_pdev_restart_progress(struct wlan_objmgr_pdev *pdev,
+					      wlan_objmgr_ref_dbgid dbg_id)
+{
+	uint8_t flag = 0;
+
+	if (!pdev)
+		return QDF_STATUS_E_INVAL;
 
 	wlan_objmgr_pdev_iterate_obj_list(pdev, WLAN_VDEV_OP,
-					  wlan_pdev_chan_match, &ch_filter, 0,
-					  dbg_id);
+					  wlan_vdev_restart_progress,
+					  &flag, 0, dbg_id);
 
-	if (ch_filter.flag == 0)
+	if (flag == 1)
 		return QDF_STATUS_SUCCESS;
 
-	return QDF_STATUS_E_FAILURE;
+	return QDF_STATUS_E_INVAL;
 }
 
 static void wlan_vdev_scan_allowed(struct wlan_objmgr_pdev *pdev, void *object,

+ 228 - 0
umac/mlme/include/wlan_mlme_cmn.h

@@ -0,0 +1,228 @@
+/*
+ * Copyright (c) 2019 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: Define Common MLME structure and APIs
+ */
+#ifndef _WLAN_MLME_CMN_H_
+#define _WLAN_MLME_CMN_H_
+
+#ifdef CMN_VDEV_MLME_CMPT_ENABLE
+#include <include/wlan_pdev_mlme.h>
+#include <include/wlan_vdev_mlme.h>
+
+/**
+ * struct vdev_mlme_ext_ops - VDEV MLME legacy callbacks structure
+ * @mlme_pdev_ext_hdl_create:        callback to invoke creation of legacy
+ *                                   pdev object
+ * @mlme_pdev_ext_hdl_destroy:       callback to invoke destroy of legacy
+ *                                   pdev object
+ * @mlme_vdev_ext_hdl_create:        callback to invoke creation of legacy
+ *                                   vdev object
+ * @mlme_vdev_ext_hdl_post_create:   callback to invoke post creation actions
+ *                                   of legacy vdev object
+ * @mlme_vdev_ext_hdl_destroy:       callback to invoke destroy of legacy
+ *                                   vdev object
+ * @mlme_vdev_start_fw_send:         callback to invoke vdev start command
+ * @mlme_vdev_stop_fw_send:          callback to invoke vdev stop command
+ * @mlme_vdev_down_fw_send:          callback to invoke vdev down command
+ * @mlme_multivdev_restart_fw_send:  callback to invoke multivdev restart
+ *                                   command
+ * @mlme_vdev_enqueue_exp_cmd:       callback to enqueue exception command
+ *                                   required by serialization
+ */
+struct mlme_ext_ops {
+	QDF_STATUS (*mlme_pdev_ext_hdl_create)(
+				struct pdev_mlme_obj *pdev_mlme);
+	QDF_STATUS (*mlme_pdev_ext_hdl_destroy)(
+				struct pdev_mlme_obj *pdev_mlme);
+	QDF_STATUS (*mlme_vdev_ext_hdl_create)(
+				struct vdev_mlme_obj *vdev_mlme);
+	QDF_STATUS (*mlme_vdev_ext_hdl_post_create)(
+				struct vdev_mlme_obj *vdev_mlme);
+	QDF_STATUS (*mlme_vdev_ext_hdl_destroy)(
+				struct vdev_mlme_obj *vdev_mlme);
+	QDF_STATUS (*mlme_vdev_start_fw_send)(
+				struct wlan_objmgr_vdev *vdev, uint8_t restart);
+	QDF_STATUS (*mlme_vdev_stop_fw_send)(struct wlan_objmgr_vdev *vdev);
+	QDF_STATUS (*mlme_vdev_down_fw_send)(struct wlan_objmgr_vdev *vdev);
+	QDF_STATUS (*mlme_multivdev_restart_fw_send)(
+				struct wlan_objmgr_pdev *pdev);
+	QDF_STATUS (*mlme_vdev_enqueue_exp_cmd)(
+				struct vdev_mlme_obj *vdev_mlme,
+				uint8_t cmd_type);
+};
+
+/**
+ * mlme_pdev_ops_ext_hdl_create - Alloc PDEV mlme ext handle
+ * @pdev_mlme_obj:  PDEV MLME comp object
+ *
+ * API to allocate PDEV MLME ext handle
+ *
+ * Return: SUCCESS on successful allocation
+ *         Else FAILURE
+ */
+QDF_STATUS mlme_pdev_ops_ext_hdl_create(struct pdev_mlme_obj *pdev_mlme);
+
+/**
+ * mlme_pdev_ops_ext_hdl_destroy - Destroy PDEV mlme ext handle
+ * @pdev_mlme_obj:  PDEV MLME comp object
+ *
+ * API to free pdev MLME ext handle
+ *
+ * Return: SUCCESS on successful free
+ *         Else FAILURE
+ */
+QDF_STATUS mlme_pdev_ops_ext_hdl_destroy(struct pdev_mlme_obj *pdev_mlme);
+
+/**
+ * mlme_vdev_ops_ext_hdl_create - Alloc VDEV mlme ext handle
+ * @vdev_mlme_obj:  VDEV MLME comp object
+ *
+ * API to allocate VDEV MLME ext handle
+ *
+ * Return: SUCCESS on successful allocation
+ *         Else FAILURE
+ */
+QDF_STATUS mlme_vdev_ops_ext_hdl_create(struct vdev_mlme_obj *vdev_mlme);
+
+/**
+ * mlme_vdev_ops_ext_hdl_post_create - Perform post VDEV mlme ext handle alloc
+ *                                     operations
+ * @vdev_mlme_obj:  VDEV MLME comp object
+ *
+ * API to perform post vdev MLME ext handle allocation operations
+ *
+ * Return: SUCCESS on initialization successful
+ *         Else FAILURE
+ */
+QDF_STATUS mlme_vdev_ops_ext_hdl_post_create(struct vdev_mlme_obj *vdev_mlme);
+
+/**
+ * mlme_vdev_ops_ext_hdl_destroy - Destroy VDEV mlme ext handle
+ * @vdev_mlme_obj:  VDEV MLME comp object
+ *
+ * API to free vdev MLME ext handle
+ *
+ * Return: SUCCESS on successful free
+ *         Else FAILURE
+ */
+QDF_STATUS mlme_vdev_ops_ext_hdl_destroy(struct vdev_mlme_obj *vdev_mlme);
+
+/**
+ * mlme_vdev_enqueue_exp_ser_cmd - Enqueue exception serialization cmd
+ * @vdev_mlme_obj:  VDEV MLME comp object
+ * @cmd_type: Serialization command type
+ *
+ * API to enqueue the exception serialization command, used by
+ * mlme-serialization wrapper layer
+ *
+ * Return: SUCCESS on successful enqueuing the command
+ *         Else FAILURE
+ */
+QDF_STATUS mlme_vdev_enqueue_exp_ser_cmd(struct vdev_mlme_obj *vdev_mlme,
+					 uint8_t cmd_type);
+
+/**
+ * mlme_vdev_ops_start_fw_send - Send WMI START/RESTART commmand to FW
+ * @vdev:  VDEV object
+ *
+ * API to send WMI start/restart command to FW
+ *
+ * Return: SUCCESS on successful sending the command
+ *         Else FAILURE
+ */
+QDF_STATUS mlme_vdev_ops_start_fw_send(struct wlan_objmgr_vdev *vdev,
+				       uint8_t restart);
+
+/**
+ * mlme_vdev_ops_multivdev_restart_fw_cmd_send - Send WMI Multivdev restart
+ *                                              commmand to FW
+ * @pdev:  PDEV object
+ *
+ * API to send WMI multivdev restart command to FW
+ *
+ * Return: SUCCESS on successful sending the command
+ *         Else FAILURE
+ */
+QDF_STATUS mlme_vdev_ops_multivdev_restart_fw_cmd_send(
+						struct wlan_objmgr_pdev *pdev);
+
+/**
+ * mlme_vdev_ops_stop_fw_send - Send WMI STOP commmand to FW
+ * @vdev:  VDEV object
+ *
+ * API to send WMI stop command to FW
+ *
+ * Return: SUCCESS on successful sending the command
+ *         Else FAILURE
+ */
+QDF_STATUS mlme_vdev_ops_stop_fw_send(struct wlan_objmgr_vdev *vdev);
+
+/**
+ * mlme_vdev_ops_down_fw_send - Send WMI Down commmand to FW
+ * @vdev:  VDEV object
+ *
+ * API to send WMI down command to FW
+ *
+ * Return: SUCCESS on successful sending the command
+ *         Else FAILURE
+ */
+QDF_STATUS mlme_vdev_ops_down_fw_send(struct wlan_objmgr_vdev *vdev);
+
+/**
+ * mlme_set_ops_register_cb - Sets ops registration callback
+ * @ops_cb:  Function pointer
+ *
+ * API to set ops registration call back
+ *
+ * Return: void
+ */
+typedef struct mlme_ext_ops *(*mlme_get_global_ops_cb)(void);
+void mlme_set_ops_register_cb(mlme_get_global_ops_cb ops_cb);
+
+/**
+ * wlan_cmn_mlme_init - Initializes MLME component
+ *
+ * Registers callbacks with object manager for create/destroy
+ *
+ * Return: SUCCESS on successful registration
+ *         FAILURE, if registration fails
+ */
+QDF_STATUS wlan_cmn_mlme_init(void);
+
+/**
+ * wlan_cmn_mlme_deinit - Uninitializes MLME component
+ *
+ * Unregisters callbacks with object manager for create/destroy
+ *
+ * Return: SUCCESS on successful registration
+ *         FAILURE, if registration fails
+ */
+QDF_STATUS wlan_cmn_mlme_deinit(void);
+#else
+static inline QDF_STATUS wlan_cmn_mlme_init(void)
+{
+	return QDF_STATUS_SUCCESS;
+}
+
+static inline QDF_STATUS wlan_cmn_mlme_deinit(void)
+{
+	return QDF_STATUS_SUCCESS;
+}
+#endif
+
+#endif

+ 47 - 0
umac/mlme/include/wlan_pdev_mlme.h

@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2019 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: Define PDEV MLME structure and APIs
+ */
+#ifndef _WLAN_PDEV_MLME_H_
+#define _WLAN_PDEV_MLME_H_
+
+#include <qdf_timer.h>
+#include <include/wlan_vdev_mlme.h>
+/**
+ * struct pdev_mlme_obj -  PDEV MLME component object
+ * @pdev:                  PDEV object
+ * @ext_pdev_ptr:          PDEV MLME legacy pointer
+ * @mlme_register_ops:     Call back to register MLME legacy APIs
+ * @vdev_restart_lock:     Lock for VDEVs restart
+ * @restart_req_timer:     Timer handle for VDEVs restart
+ * @restart_pend_vdev_bmap: Bitmap for VDEV RESTART command pending
+ * @restart_send_vdev_bmap: Bitmap for VDEV RESTART command sending
+ * @start_send_vdev_arr:   Bitmap for VDEV START command sending
+ */
+struct pdev_mlme_obj {
+	struct wlan_objmgr_pdev *pdev;
+	void *ext_pdev_ptr;
+	QDF_STATUS (*mlme_register_ops)(struct vdev_mlme_obj *vdev_mlme);
+	qdf_spinlock_t vdev_restart_lock;
+	qdf_timer_t restart_req_timer;
+	unsigned long restart_pend_vdev_bmap[2];
+	unsigned long restart_send_vdev_bmap[2];
+	unsigned long start_send_vdev_arr[2];
+};
+
+#endif

+ 14 - 118
umac/mlme/include/wlan_vdev_mlme.h

@@ -1,19 +1,17 @@
 /*
  * Copyright (c) 2018-2019 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.
+ * 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.
  */
 
 /**
@@ -57,7 +55,7 @@ enum vdev_cmd_type {
 };
 
 /**
- * struct vdev_mlme_ops - VDEV MLME operation callbacks strucutre
+ * struct vdev_mlme_ops - VDEV MLME operation callbacks structure
  * @mlme_vdev_validate_basic_params:    callback to validate VDEV basic params
  * @mlme_vdev_reset_proto_params:       callback to Reset protocol params
  * @mlme_vdev_start_send:               callback to initiate actions of VDEV
@@ -85,14 +83,6 @@ enum vdev_cmd_type {
  *                                      peer delete completion
  * @mlme_vdev_down_send:                callback to initiate actions of VDEV
  *                                      MLME down operation
- * @mlme_vdev_ext_hdl_create:           callback to invoke creation of legacy
- *                                      vdev object
- * @mlme_vdev_ext_hdl_post_create:      callback to invoke post creation actions
- *                                      of legacy vdev object
- * @mlme_vdev_ext_hdl_destroy:          callback to invoke destroy of legacy
- *                                      vdev object
- * @mlme_vdev_enqueue_exp_cmd:          callback to enqueue exception command
- *                                      required by serialization
  */
 struct vdev_mlme_ops {
 	QDF_STATUS (*mlme_vdev_validate_basic_params)(
@@ -151,16 +141,6 @@ struct vdev_mlme_ops {
 	QDF_STATUS (*mlme_vdev_notify_down_complete)(
 				struct vdev_mlme_obj *vdev_mlme,
 				uint16_t event_data_len, void *event_data);
-	QDF_STATUS (*mlme_vdev_ext_hdl_create)(
-				struct vdev_mlme_obj *vdev_mlme);
-	QDF_STATUS (*mlme_vdev_ext_hdl_post_create)(
-				struct vdev_mlme_obj *vdev_mlme);
-	QDF_STATUS (*mlme_vdev_ext_hdl_destroy)(
-				struct vdev_mlme_obj *vdev_mlme);
-	QDF_STATUS (*mlme_vdev_enqueue_exp_cmd)(
-				struct vdev_mlme_obj *vdev_mlme,
-				uint8_t cmd_type);
-
 };
 
 /**
@@ -414,7 +394,8 @@ static inline QDF_STATUS mlme_vdev_up_send(
  */
 static inline
 QDF_STATUS mlme_vdev_notify_up_complete(struct vdev_mlme_obj *vdev_mlme,
-				uint16_t event_data_len, void *event_data)
+					uint16_t event_data_len,
+					void *event_data)
 {
 	QDF_STATUS ret = QDF_STATUS_SUCCESS;
 
@@ -622,89 +603,4 @@ static inline QDF_STATUS mlme_vdev_notify_down_complete(
 	return ret;
 }
 
-/**
- * mlme_vdev_ext_hdl_create - VDEV legacy pointer allocation
- * @vdev_mlme_obj:  VDEV MLME comp object
- *
- * API invokes legacy pointer allocation and initialization
- *
- * Return: SUCCESS on successful creation of legacy handle
- *         FAILURE, if it fails due to any
- */
-static inline QDF_STATUS mlme_vdev_ext_hdl_create(
-			      struct vdev_mlme_obj *vdev_mlme)
-{
-	QDF_STATUS ret = QDF_STATUS_SUCCESS;
-
-	if ((vdev_mlme->ops) && vdev_mlme->ops->mlme_vdev_ext_hdl_create)
-		ret = vdev_mlme->ops->mlme_vdev_ext_hdl_create(vdev_mlme);
-
-	return ret;
-}
-
-/**
- * mlme_vdev_ext_hdl_post_create - VDEV post legacy pointer allocation
- * @vdev_mlme_obj:  VDEV MLME comp object
- *
- * API invokes post legacy pointer allocation operation
- *
- * Return: SUCCESS on successful creation of legacy handle
- *         FAILURE, if it fails due to any
- */
-static inline QDF_STATUS mlme_vdev_ext_hdl_post_create(
-				struct vdev_mlme_obj *vdev_mlme)
-{
-	QDF_STATUS ret = QDF_STATUS_SUCCESS;
-
-	if ((vdev_mlme->ops) &&
-	    vdev_mlme->ops->mlme_vdev_ext_hdl_post_create)
-		ret = vdev_mlme->ops->mlme_vdev_ext_hdl_post_create(
-								vdev_mlme);
-
-	return ret;
-}
-
-/**
- * mlme_vdev_ext_hdl_destroy - VDEV legacy pointer free
- * @vdev_mlme_obj:  VDEV MLME comp object
- *
- * API invokes legacy pointer free
- *
- * Return: SUCCESS on successful free of legacy handle
- *         FAILURE, if it fails due to any
- */
-static inline QDF_STATUS mlme_vdev_ext_hdl_destroy(
-			      struct vdev_mlme_obj *vdev_mlme)
-{
-	QDF_STATUS ret = QDF_STATUS_SUCCESS;
-
-	if ((vdev_mlme->ops) && vdev_mlme->ops->mlme_vdev_ext_hdl_destroy)
-		ret = vdev_mlme->ops->mlme_vdev_ext_hdl_destroy(vdev_mlme);
-
-	return ret;
-}
-
-/**
- * mlme_vdev_enqueue_exp_ser_cmd - Enqueue exception serialization cmd
- * @vdev_mlme_obj:  VDEV MLME comp object
- * @cmd_type: Serialization command type
- *
- * API to enqueue the exception serialization command, used by
- * mlme-serialization wrapper layer
- *
- * Return: SUCCESS on successful enqueuing the command
- *         Else FAILURE
- */
-static inline QDF_STATUS
-mlme_vdev_enqueue_exp_ser_cmd(struct vdev_mlme_obj *vdev_mlme,
-			      uint8_t cmd_type)
-{
-	QDF_STATUS ret = QDF_STATUS_SUCCESS;
-
-	if (vdev_mlme->ops && vdev_mlme->ops->mlme_vdev_enqueue_exp_cmd)
-		ret = vdev_mlme->ops->mlme_vdev_enqueue_exp_cmd(vdev_mlme,
-								cmd_type);
-	return ret;
-}
-
 #endif

+ 43 - 0
umac/mlme/mlme_objmgr/dispatcher/inc/wlan_pdev_mlme_main.h

@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2019 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: Define PDEV MLME structure and APIs
+ */
+#ifndef _WLAN_PDEV_MLME_MAIN_H_
+#define _WLAN_PDEV_MLME_MAIN_H_
+
+/**
+ * wlan_pdev_mlme_init - Initializes PDEV MLME component
+ *
+ * Registers callbacks with object manager for create/destroy
+ *
+ * Return: SUCCESS on successful registration
+ *         FAILURE, if registration fails
+ */
+QDF_STATUS wlan_pdev_mlme_init(void);
+
+/**
+ * wlan_pdev_mlme_deinit - Uninitializes PDEV MLME component
+ *
+ * Unregisters callbacks with object manager for create/destroy
+ *
+ * Return: SUCCESS on successful registration
+ *         FAILURE, if registration fails
+ */
+QDF_STATUS wlan_pdev_mlme_deinit(void);
+
+#endif

+ 14 - 16
umac/mlme/mlme_objmgr/dispatcher/inc/wlan_vdev_mlme_main.h

@@ -1,19 +1,17 @@
 /*
  * Copyright (c) 2018-2019 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.
+ * 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.
+ * 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.
  */
 
 /**
@@ -89,7 +87,7 @@ enum wlan_vdev_state {
  * @WLAN_VDEV_SM_EV_STOP_FAIL:           Notification of stop req failure
  * @WLAN_VDEV_SM_EV_DOWN_FAIL:           Notification of down failure
  * @WLAN_VDEV_SM_EV_DISCONNECT_COMPLETE: Notification of Peer cleanup complete
- * @WLAN_VDEV_SM_EV_SUPSEND_RESTART:     Invokes suspend restart operation
+ * @WLAN_VDEV_SM_EV_SUSPEND_RESTART:     Invokes suspend restart operation
  * @WLAN_VDEV_SM_EV_HOST_RESTART:        Invokes host only restart operation
  * @WLAN_VDEV_SM_EV_UP_HOST_RESTART:     Moves to UP state without sending UP
  *                                       command to lower layers
@@ -123,7 +121,7 @@ enum wlan_vdev_sm_evt {
 	WLAN_VDEV_SM_EV_STOP_FAIL = 15,
 	WLAN_VDEV_SM_EV_DOWN_FAIL = 16,
 	WLAN_VDEV_SM_EV_DISCONNECT_COMPLETE = 17,
-	WLAN_VDEV_SM_EV_SUPSEND_RESTART = 18,
+	WLAN_VDEV_SM_EV_SUSPEND_RESTART = 18,
 	WLAN_VDEV_SM_EV_HOST_RESTART = 19,
 	WLAN_VDEV_SM_EV_UP_HOST_RESTART = 20,
 	WLAN_VDEV_SM_EV_FW_VDEV_RESTART = 21,
@@ -164,7 +162,7 @@ enum wlan_vdev_state {
 #ifdef CMN_VDEV_MLME_CMPT_ENABLE
 
 /**
- * wlan_vdev_mlme_init - Initializes MLME component
+ * wlan_vdev_mlme_init - Initializes VDEV MLME component
  *
  * Registers callbacks with object manager for create/destroy
  *
@@ -174,7 +172,7 @@ enum wlan_vdev_state {
 QDF_STATUS wlan_vdev_mlme_init(void);
 
 /**
- * wlan_vdev_mlme_deinit - Uninitializes MLME component
+ * wlan_vdev_mlme_deinit - Uninitializes VDEV MLME component
  *
  * Unregisters callbacks with object manager for create/destroy
  *

+ 171 - 0
umac/mlme/mlme_objmgr/dispatcher/src/wlan_cmn_mlme_main.c

@@ -0,0 +1,171 @@
+/*
+ * Copyright (c) 2019 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 MLME global APIs
+ */
+
+#include "wlan_objmgr_cmn.h"
+#include "include/wlan_mlme_cmn.h"
+#include "include/wlan_pdev_mlme.h"
+#include "include/wlan_vdev_mlme.h"
+#include "include/wlan_mlme_cmn.h"
+#include "wlan_pdev_mlme_main.h"
+#include "wlan_vdev_mlme_main.h"
+
+struct mlme_ext_ops *glbl_ops;
+mlme_get_global_ops_cb glbl_ops_cb;
+
+QDF_STATUS wlan_cmn_mlme_init(void)
+{
+	QDF_STATUS status;
+
+	status = wlan_pdev_mlme_init();
+	if (status != QDF_STATUS_SUCCESS)
+		return status;
+
+	status = wlan_vdev_mlme_init();
+	if (status != QDF_STATUS_SUCCESS)
+		return status;
+
+	if (glbl_ops_cb)
+		glbl_ops = glbl_ops_cb();
+
+	return QDF_STATUS_SUCCESS;
+}
+
+QDF_STATUS wlan_cmn_mlme_deinit(void)
+{
+	QDF_STATUS status;
+
+	status = wlan_vdev_mlme_deinit();
+	if (status != QDF_STATUS_SUCCESS)
+		return status;
+
+	status = wlan_pdev_mlme_deinit();
+	if (status != QDF_STATUS_SUCCESS)
+		return status;
+
+	return QDF_STATUS_SUCCESS;
+}
+
+QDF_STATUS mlme_pdev_ops_ext_hdl_create(struct pdev_mlme_obj *pdev_mlme)
+{
+	QDF_STATUS ret = QDF_STATUS_SUCCESS;
+
+	if ((glbl_ops) && glbl_ops->mlme_pdev_ext_hdl_create)
+		ret = glbl_ops->mlme_pdev_ext_hdl_create(pdev_mlme);
+
+	return ret;
+}
+
+QDF_STATUS mlme_pdev_ops_ext_hdl_destroy(struct pdev_mlme_obj *pdev_mlme)
+{
+	QDF_STATUS ret = QDF_STATUS_SUCCESS;
+
+	if ((glbl_ops) && glbl_ops->mlme_pdev_ext_hdl_destroy)
+		ret = glbl_ops->mlme_pdev_ext_hdl_destroy(pdev_mlme);
+
+	return ret;
+}
+
+QDF_STATUS mlme_vdev_ops_ext_hdl_create(struct vdev_mlme_obj *vdev_mlme)
+{
+	QDF_STATUS ret = QDF_STATUS_SUCCESS;
+
+	if ((glbl_ops) && glbl_ops->mlme_vdev_ext_hdl_create)
+		ret = glbl_ops->mlme_vdev_ext_hdl_create(vdev_mlme);
+
+	return ret;
+}
+
+QDF_STATUS mlme_vdev_ops_ext_hdl_post_create(struct vdev_mlme_obj *vdev_mlme)
+{
+	QDF_STATUS ret = QDF_STATUS_SUCCESS;
+
+	if ((glbl_ops) && glbl_ops->mlme_vdev_ext_hdl_post_create)
+		ret = glbl_ops->mlme_vdev_ext_hdl_post_create(vdev_mlme);
+
+	return ret;
+}
+
+QDF_STATUS mlme_vdev_ops_ext_hdl_destroy(struct vdev_mlme_obj *vdev_mlme)
+{
+	QDF_STATUS ret = QDF_STATUS_SUCCESS;
+
+	if ((glbl_ops) && glbl_ops->mlme_vdev_ext_hdl_destroy)
+		ret = glbl_ops->mlme_vdev_ext_hdl_destroy(vdev_mlme);
+
+	return ret;
+}
+
+QDF_STATUS mlme_vdev_ops_start_fw_send(struct wlan_objmgr_vdev *vdev,
+				       uint8_t restart)
+{
+	QDF_STATUS ret = QDF_STATUS_SUCCESS;
+
+	if (glbl_ops && glbl_ops->mlme_vdev_start_fw_send)
+		ret = glbl_ops->mlme_vdev_start_fw_send(vdev, restart);
+
+	return ret;
+}
+
+QDF_STATUS mlme_vdev_ops_multivdev_restart_fw_cmd_send(
+						struct wlan_objmgr_pdev *pdev)
+{
+	QDF_STATUS ret = QDF_STATUS_SUCCESS;
+
+	if ((glbl_ops) && glbl_ops->mlme_multivdev_restart_fw_send)
+		glbl_ops->mlme_multivdev_restart_fw_send(pdev);
+
+	return ret;
+}
+
+QDF_STATUS mlme_vdev_ops_stop_fw_send(struct wlan_objmgr_vdev *vdev)
+{
+	QDF_STATUS ret = QDF_STATUS_SUCCESS;
+
+	if (glbl_ops && glbl_ops->mlme_vdev_stop_fw_send)
+		ret = glbl_ops->mlme_vdev_stop_fw_send(vdev);
+
+	return ret;
+}
+
+QDF_STATUS mlme_vdev_ops_down_fw_send(struct wlan_objmgr_vdev *vdev)
+{
+	QDF_STATUS ret = QDF_STATUS_SUCCESS;
+
+	if (glbl_ops && glbl_ops->mlme_vdev_down_fw_send)
+		ret = glbl_ops->mlme_vdev_down_fw_send(vdev);
+
+	return ret;
+}
+
+QDF_STATUS mlme_vdev_enqueue_exp_ser_cmd(struct vdev_mlme_obj *vdev_mlme,
+					 uint8_t cmd_type)
+{
+	QDF_STATUS ret = QDF_STATUS_SUCCESS;
+
+	if (glbl_ops && glbl_ops->mlme_vdev_enqueue_exp_cmd)
+		ret = glbl_ops->mlme_vdev_enqueue_exp_cmd(vdev_mlme, cmd_type);
+
+	return ret;
+}
+
+void mlme_set_ops_register_cb(mlme_get_global_ops_cb ops_cb)
+{
+	glbl_ops_cb = ops_cb;
+}

+ 122 - 0
umac/mlme/mlme_objmgr/dispatcher/src/wlan_pdev_mlme_main.c

@@ -0,0 +1,122 @@
+/*
+ * Copyright (c) 2019 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 PDEV MLME APIs
+ */
+
+#include <wlan_objmgr_cmn.h>
+#include <wlan_objmgr_global_obj.h>
+#include <wlan_objmgr_pdev_obj.h>
+#include <wlan_mlme_dbg.h>
+#include "include/wlan_mlme_cmn.h"
+#include "include/wlan_pdev_mlme.h"
+#include "wlan_pdev_mlme_main.h"
+#include "wlan_pdev_mlme_api.h"
+
+static QDF_STATUS mlme_pdev_obj_create_handler(struct wlan_objmgr_pdev *pdev,
+					       void *arg)
+{
+	struct pdev_mlme_obj *pdev_mlme;
+
+	if (!pdev) {
+		mlme_err(" PDEV is NULL");
+		return QDF_STATUS_E_FAILURE;
+	}
+
+	pdev_mlme = qdf_mem_malloc(sizeof(*pdev_mlme));
+	if (!pdev_mlme) {
+		mlme_err(" MLME component object alloc failed");
+		return QDF_STATUS_E_NOMEM;
+	}
+
+	pdev_mlme->pdev = pdev;
+
+	if (mlme_pdev_ops_ext_hdl_create(pdev_mlme) != QDF_STATUS_SUCCESS)
+		goto init_failed;
+
+	wlan_objmgr_pdev_component_obj_attach(pdev, WLAN_UMAC_COMP_MLME,
+					      (void *)pdev_mlme,
+					      QDF_STATUS_SUCCESS);
+
+	return QDF_STATUS_SUCCESS;
+
+init_failed:
+	qdf_mem_free(pdev_mlme);
+
+	return QDF_STATUS_E_FAILURE;
+}
+
+static QDF_STATUS mlme_pdev_obj_destroy_handler(struct wlan_objmgr_pdev *pdev,
+						void *arg)
+{
+	struct pdev_mlme_obj *pdev_mlme;
+
+	pdev_mlme = wlan_pdev_mlme_get_cmpt_obj(pdev);
+	if (!pdev_mlme) {
+		mlme_info(" PDEV MLME component object is NULL");
+		return QDF_STATUS_SUCCESS;
+	}
+
+	mlme_pdev_ops_ext_hdl_destroy(pdev_mlme);
+
+	wlan_objmgr_pdev_component_obj_detach(pdev, WLAN_UMAC_COMP_MLME,
+					      (void *)pdev_mlme);
+	qdf_mem_free(pdev_mlme);
+
+	return QDF_STATUS_SUCCESS;
+}
+
+QDF_STATUS wlan_pdev_mlme_init(void)
+{
+	if (wlan_objmgr_register_pdev_create_handler
+				(WLAN_UMAC_COMP_MLME,
+				 mlme_pdev_obj_create_handler, NULL)
+						!= QDF_STATUS_SUCCESS)
+		return QDF_STATUS_E_FAILURE;
+
+	if (wlan_objmgr_register_pdev_destroy_handler
+				(WLAN_UMAC_COMP_MLME,
+				 mlme_pdev_obj_destroy_handler, NULL)
+						!= QDF_STATUS_SUCCESS) {
+		if (wlan_objmgr_unregister_pdev_create_handler
+					(WLAN_UMAC_COMP_MLME,
+					 mlme_pdev_obj_create_handler, NULL)
+						!= QDF_STATUS_SUCCESS)
+			return QDF_STATUS_E_FAILURE;
+
+		return QDF_STATUS_E_FAILURE;
+	}
+
+	return QDF_STATUS_SUCCESS;
+}
+
+QDF_STATUS wlan_pdev_mlme_deinit(void)
+{
+	if (wlan_objmgr_unregister_pdev_create_handler
+				(WLAN_UMAC_COMP_MLME,
+				 mlme_pdev_obj_create_handler, NULL)
+					!= QDF_STATUS_SUCCESS)
+		return QDF_STATUS_E_FAILURE;
+
+	if (wlan_objmgr_unregister_pdev_destroy_handler
+				(WLAN_UMAC_COMP_MLME,
+				 mlme_pdev_obj_destroy_handler, NULL)
+						!= QDF_STATUS_SUCCESS)
+		return QDF_STATUS_E_FAILURE;
+
+	return QDF_STATUS_SUCCESS;
+}

+ 46 - 33
umac/mlme/mlme_objmgr/dispatcher/src/wlan_vdev_mlme_main.c

@@ -1,19 +1,17 @@
 /*
  * Copyright (c) 2018-2019 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.
+ * 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.
+ * 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.
  */
 
 /**
@@ -24,8 +22,12 @@
 #include <wlan_objmgr_global_obj.h>
 #include <wlan_objmgr_vdev_obj.h>
 #include <wlan_mlme_dbg.h>
+#include "include/wlan_mlme_cmn.h"
 #include "include/wlan_vdev_mlme.h"
+#include "include/wlan_pdev_mlme.h"
 #include "vdev_mgr/core/src/vdev_mlme_sm.h"
+#include "wlan_pdev_mlme_api.h"
+#include "wlan_vdev_mlme_api.h"
 #include "wlan_serialization_api.h"
 #include "wlan_utility.h"
 
@@ -34,6 +36,7 @@ static QDF_STATUS mlme_vdev_obj_create_handler(struct wlan_objmgr_vdev *vdev,
 {
 	struct vdev_mlme_obj *vdev_mlme;
 	struct wlan_objmgr_pdev *pdev;
+	struct pdev_mlme_obj *pdev_mlme;
 
 	if (!vdev) {
 		mlme_err(" VDEV is NULL");
@@ -46,6 +49,12 @@ static QDF_STATUS mlme_vdev_obj_create_handler(struct wlan_objmgr_vdev *vdev,
 		return QDF_STATUS_E_FAILURE;
 	}
 
+	pdev_mlme = wlan_pdev_mlme_get_cmpt_obj(pdev);
+	if (!pdev_mlme) {
+		mlme_err(" PDEV MLME is NULL");
+		return QDF_STATUS_E_FAILURE;
+	}
+
 	vdev_mlme = qdf_mem_malloc(sizeof(*vdev_mlme));
 	if (!vdev_mlme) {
 		mlme_err(" MLME component object alloc failed");
@@ -54,8 +63,7 @@ static QDF_STATUS mlme_vdev_obj_create_handler(struct wlan_objmgr_vdev *vdev,
 
 	vdev_mlme->vdev = vdev;
 
-	if (pdev->pdev_mlme.mlme_register_ops(vdev_mlme)
-							!= QDF_STATUS_SUCCESS) {
+	if (pdev_mlme->mlme_register_ops(vdev_mlme) != QDF_STATUS_SUCCESS) {
 		mlme_err("Callbacks registration is failed");
 		goto init_failed;
 	}
@@ -65,7 +73,8 @@ static QDF_STATUS mlme_vdev_obj_create_handler(struct wlan_objmgr_vdev *vdev,
 		goto init_failed;
 	}
 
-	if (mlme_vdev_ext_hdl_create(vdev_mlme) != QDF_STATUS_SUCCESS) {
+	if (mlme_vdev_ops_ext_hdl_create(vdev_mlme) !=
+						QDF_STATUS_SUCCESS) {
 		mlme_err("Legacy vdev object creation failed");
 		goto ext_hdl_create_failed;
 	}
@@ -75,7 +84,8 @@ static QDF_STATUS mlme_vdev_obj_create_handler(struct wlan_objmgr_vdev *vdev,
 					      (void *)vdev_mlme,
 					      QDF_STATUS_SUCCESS);
 
-	if (mlme_vdev_ext_hdl_post_create(vdev_mlme) != QDF_STATUS_SUCCESS) {
+	if (mlme_vdev_ops_ext_hdl_post_create(vdev_mlme) !=
+						QDF_STATUS_SUCCESS) {
 		mlme_err("Legacy vdev object post creation failed");
 		goto ext_hdl_post_create_failed;
 	}
@@ -83,7 +93,7 @@ static QDF_STATUS mlme_vdev_obj_create_handler(struct wlan_objmgr_vdev *vdev,
 	return QDF_STATUS_SUCCESS;
 
 ext_hdl_post_create_failed:
-	mlme_vdev_ext_hdl_destroy(vdev_mlme);
+	mlme_vdev_ops_ext_hdl_destroy(vdev_mlme);
 	wlan_objmgr_vdev_component_obj_detach(vdev, WLAN_UMAC_COMP_MLME,
 					      vdev_mlme);
 ext_hdl_create_failed:
@@ -104,16 +114,15 @@ static QDF_STATUS mlme_vdev_obj_destroy_handler(struct wlan_objmgr_vdev *vdev,
 		return QDF_STATUS_E_FAILURE;
 	}
 
-	vdev_mlme = wlan_objmgr_vdev_get_comp_private_obj(vdev,
-							  WLAN_UMAC_COMP_MLME);
+	vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
 	if (!vdev_mlme) {
-		mlme_err(" VDEV MLME component object is NULL");
-		return QDF_STATUS_E_FAILURE;
+		mlme_info(" VDEV MLME component object is NULL");
+		return QDF_STATUS_SUCCESS;
 	}
 
 	mlme_vdev_sm_destroy(vdev_mlme);
 
-	mlme_vdev_ext_hdl_destroy(vdev_mlme);
+	mlme_vdev_ops_ext_hdl_destroy(vdev_mlme);
 
 	wlan_objmgr_vdev_component_obj_detach(vdev, WLAN_UMAC_COMP_MLME,
 					      vdev_mlme);
@@ -182,17 +191,19 @@ QDF_STATUS wlan_mlme_psoc_disable(struct wlan_objmgr_psoc *psoc)
 
 QDF_STATUS wlan_vdev_mlme_init(void)
 {
-	if (wlan_objmgr_register_vdev_create_handler(WLAN_UMAC_COMP_MLME,
-				mlme_vdev_obj_create_handler, NULL)
+	if (wlan_objmgr_register_vdev_create_handler
+				(WLAN_UMAC_COMP_MLME,
+				 mlme_vdev_obj_create_handler, NULL)
 						!= QDF_STATUS_SUCCESS)
 		return QDF_STATUS_E_FAILURE;
 
-	if (wlan_objmgr_register_vdev_destroy_handler(WLAN_UMAC_COMP_MLME,
-				mlme_vdev_obj_destroy_handler, NULL)
+	if (wlan_objmgr_register_vdev_destroy_handler
+				(WLAN_UMAC_COMP_MLME,
+				 mlme_vdev_obj_destroy_handler, NULL)
 						!= QDF_STATUS_SUCCESS) {
-		if (wlan_objmgr_unregister_vdev_create_handler(
-					WLAN_UMAC_COMP_MLME,
-					mlme_vdev_obj_create_handler, NULL)
+		if (wlan_objmgr_unregister_vdev_create_handler
+					(WLAN_UMAC_COMP_MLME,
+					 mlme_vdev_obj_create_handler, NULL)
 						!= QDF_STATUS_SUCCESS)
 			return QDF_STATUS_E_FAILURE;
 
@@ -204,13 +215,15 @@ QDF_STATUS wlan_vdev_mlme_init(void)
 
 QDF_STATUS wlan_vdev_mlme_deinit(void)
 {
-	if (wlan_objmgr_unregister_vdev_create_handler(WLAN_UMAC_COMP_MLME,
-				mlme_vdev_obj_create_handler, NULL)
+	if (wlan_objmgr_unregister_vdev_create_handler
+				(WLAN_UMAC_COMP_MLME,
+				 mlme_vdev_obj_create_handler, NULL)
 					!= QDF_STATUS_SUCCESS)
 		return QDF_STATUS_E_FAILURE;
 
-	if (wlan_objmgr_unregister_vdev_destroy_handler(WLAN_UMAC_COMP_MLME,
-				mlme_vdev_obj_destroy_handler, NULL)
+	if (wlan_objmgr_unregister_vdev_destroy_handler
+				(WLAN_UMAC_COMP_MLME,
+				 mlme_vdev_obj_destroy_handler, NULL)
 						!= QDF_STATUS_SUCCESS)
 		return QDF_STATUS_E_FAILURE;
 

+ 13 - 16
umac/mlme/mlme_utils/wlan_vdev_mlme_ser_if.c

@@ -1,19 +1,17 @@
 /*
- * Copyright (c) 2018 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2018-2019 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.
+ * 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.
+ * 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.
  */
 
 /**
@@ -29,7 +27,7 @@
 #include <wlan_objmgr_vdev_obj.h>
 #include <wlan_cmn.h>
 #include <wlan_mlme_dbg.h>
-#include <include/wlan_vdev_mlme.h>
+#include <include/wlan_mlme_cmn.h>
 #include <wlan_vdev_mlme_api.h>
 #include <wlan_vdev_mlme_ser_if.h>
 
@@ -149,8 +147,7 @@ wlan_vdev_mlme_ser_connect(struct wlan_serialization_command *cmd)
 			WLAN_SER_CANCEL_VDEV_NON_SCAN_CMD_TYPE);
 
 	if (wlan_serialization_is_cmd_present_in_active_queue(NULL, cmd)) {
-		vdev_mlme = wlan_objmgr_vdev_get_comp_private_obj(
-				cmd->vdev, WLAN_UMAC_COMP_MLME);
+		vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(cmd->vdev);
 		if (mlme_vdev_enqueue_exp_ser_cmd(vdev_mlme,
 					WLAN_SER_CMD_VDEV_DISCONNECT)) {
 			mlme_err("Unable to add the exception cmd request");

+ 44 - 0
umac/mlme/pdev_mgr/dispatcher/inc/wlan_pdev_mlme_api.h

@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2019 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: Define PDEV MLME public APIs
+ */
+
+#ifndef _WLAN_PDEV_MLME_API_H_
+#define _WLAN_PDEV_MLME_API_H_
+
+/**
+ * wlan_pdev_mlme_get_cmpt_obj - Returns MLME component object
+ *
+ * Retrieves MLME component object from PDEV object
+ *
+ * Return: comp handle on SUCCESS
+ *         NULL, if it fails to retrieve
+ */
+struct pdev_mlme_obj *wlan_pdev_mlme_get_cmpt_obj(
+						struct wlan_objmgr_pdev *pdev);
+/**
+ * wlan_pdev_mlme_get_ext_hdl - Returns legacy handle
+ *
+ * Retrieves legacy handle from pdev mlme component object
+ *
+ * Return: legacy handle on SUCCESS
+ *         NULL, if it fails to retrieve
+ */
+void *wlan_pdev_mlme_get_ext_hdl(struct wlan_objmgr_pdev *pdev);
+
+#endif

+ 58 - 0
umac/mlme/pdev_mgr/dispatcher/src/wlan_pdev_mlme_api.c

@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 2019 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 PDEV MLME public APIs
+ */
+
+#include <wlan_objmgr_pdev_obj.h>
+#include <wlan_mlme_dbg.h>
+#include "include/wlan_pdev_mlme.h"
+#include <wlan_pdev_mlme_api.h>
+#include <qdf_module.h>
+
+struct pdev_mlme_obj *wlan_pdev_mlme_get_cmpt_obj(struct wlan_objmgr_pdev *pdev)
+{
+	struct pdev_mlme_obj *pdev_mlme;
+
+	if (!pdev) {
+		mlme_err("pdev is NULL");
+		return NULL;
+	}
+
+	pdev_mlme = wlan_objmgr_pdev_get_comp_private_obj(pdev,
+							  WLAN_UMAC_COMP_MLME);
+	if (!pdev_mlme) {
+		mlme_err(" MLME component object is NULL");
+		return NULL;
+	}
+
+	return pdev_mlme;
+}
+
+void *wlan_pdev_mlme_get_ext_hdl(struct wlan_objmgr_pdev *pdev)
+{
+	struct pdev_mlme_obj *pdev_mlme;
+
+	pdev_mlme = wlan_pdev_mlme_get_cmpt_obj(pdev);
+	if (pdev_mlme)
+		return pdev_mlme->ext_pdev_ptr;
+
+	return NULL;
+}
+
+qdf_export_symbol(wlan_pdev_mlme_get_ext_hdl);
+

+ 45 - 44
umac/mlme/vdev_mgr/core/src/vdev_mlme_sm.c

@@ -1,19 +1,17 @@
 /*
  * Copyright (c) 2018-2019 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.
+ * 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.
  */
 
 /**
@@ -168,6 +166,9 @@ static bool mlme_vdev_state_init_event(void *ctx, uint16_t event,
 			mlme_err(
 			"failed to validate vdev init params to move to START state");
 			status = true;
+			mlme_vdev_notify_down_complete(vdev_mlme,
+						       event_data_len,
+						       event_data);
 		}
 		break;
 
@@ -439,7 +440,7 @@ static bool mlme_vdev_state_up_event(void *ctx, uint16_t event,
 		status = true;
 		break;
 
-	case WLAN_VDEV_SM_EV_SUPSEND_RESTART:
+	case WLAN_VDEV_SM_EV_SUSPEND_RESTART:
 	case WLAN_VDEV_SM_EV_HOST_RESTART:
 	case WLAN_VDEV_SM_EV_CSA_RESTART:
 		/* These events are not supported in STA mode */
@@ -559,7 +560,7 @@ static bool mlme_vdev_state_suspend_event(void *ctx, uint16_t event,
 		status = true;
 		break;
 
-	case WLAN_VDEV_SM_EV_SUPSEND_RESTART:
+	case WLAN_VDEV_SM_EV_SUSPEND_RESTART:
 		mlme_vdev_sm_transition_to(vdev_mlme,
 					  WLAN_VDEV_SS_SUSPEND_SUSPEND_RESTART);
 		mlme_vdev_sm_deliver_event(vdev_mlme, event,
@@ -1186,7 +1187,7 @@ static bool mlme_vdev_subst_suspend_suspend_restart_event(void *ctx,
 	bool status;
 
 	switch (event) {
-	case WLAN_VDEV_SM_EV_SUPSEND_RESTART:
+	case WLAN_VDEV_SM_EV_SUSPEND_RESTART:
 		mlme_vdev_disconnect_peers(vdev_mlme,
 					   event_data_len, event_data);
 		status = true;
@@ -1592,34 +1593,34 @@ static bool mlme_vdev_subst_stop_down_progress_event(void *ctx,
 
 
 static const char *vdev_sm_event_names[] = {
-	"VDEV_SM_EV_START",
-	"VDEV_SM_EV_START_REQ",
-	"VDEV_SM_EV_RESTART_REQ",
-	"VDEV_SM_EV_START_RESP",
-	"VDEV_SM_EV_RESTART_RESP",
-	"VDEV_SM_EV_START_REQ_FAIL",
-	"VDEV_SM_EV_RESTART_REQ_FAIL",
-	"VDEV_SM_EV_START_SUCCESS",
-	"VDEV_SM_EV_CONN_PROGRESS",
-	"VDEV_SM_EV_STA_CONN_START",
-	"VDEV_SM_EV_DFS_CAC_WAIT",
-	"VDEV_SM_EV_DFS_CAC_COMPLETED",
-	"VDEV_SM_EV_DOWN",
-	"VDEV_SM_EV_CONNECTION_FAIL",
-	"VDEV_SM_EV_STOP_RESP",
-	"VDEV_SM_EV_STOP_FAIL",
-	"VDEV_SM_EV_DOWN_FAIL",
-	"VDEV_SM_EV_DISCONNECT_COMPLETE",
-	"VDEV_SM_EV_SUPSEND_RESTART",
-	"VDEV_SM_EV_HOST_RESTART",
-	"VDEV_SM_EV_UP_HOST_RESTART",
-	"VDEV_SM_EV_FW_VDEV_RESTART",
-	"VDEV_SM_EV_UP_FAIL",
-	"VDEV_SM_EV_RADAR_DETECTED",
-	"VDEV_SM_EV_CSA_RESTART",
-	"VDEV_SM_EV_CSA_COMPLETE",
-	"VDEV_SM_EV_MLME_DOWN_REQ",
-	"VDEV_SM_EV_DOWN_COMPLETE",
+	"EV_START",
+	"EV_START_REQ",
+	"EV_RESTART_REQ",
+	"EV_START_RESP",
+	"EV_RESTART_RESP",
+	"EV_START_REQ_FAIL",
+	"EV_RESTART_REQ_FAIL",
+	"EV_START_SUCCESS",
+	"EV_CONN_PROGRESS",
+	"EV_STA_CONN_START",
+	"EV_DFS_CAC_WAIT",
+	"EV_DFS_CAC_COMPLETED",
+	"EV_DOWN",
+	"EV_CONNECTION_FAIL",
+	"EV_STOP_RESP",
+	"EV_STOP_FAIL",
+	"EV_DOWN_FAIL",
+	"EV_DISCONNECT_COMPLETE",
+	"EV_SUSPEND_RESTART",
+	"EV_HOST_RESTART",
+	"EV_UP_HOST_RESTART",
+	"EV_FW_VDEV_RESTART",
+	"EV_UP_FAIL",
+	"EV_RADAR_DETECTED",
+	"EV_CSA_RESTART",
+	"EV_CSA_COMPLETE",
+	"EV_MLME_DOWN_REQ",
+	"EV_DOWN_COMPLETE",
 };
 
 struct wlan_sm_state_info sm_info[] = {

+ 44 - 13
umac/mlme/vdev_mgr/dispatcher/inc/wlan_vdev_mlme_api.h

@@ -1,19 +1,17 @@
 /*
  * Copyright (c) 2018-2019 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.
+ * 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.
  */
 
 /**
@@ -124,6 +122,17 @@ QDF_STATUS wlan_vdev_mlme_is_active(struct wlan_objmgr_vdev *vdev);
  */
 QDF_STATUS wlan_vdev_chan_config_valid(struct wlan_objmgr_vdev *vdev);
 
+/**
+ * wlan_vdev_mlme_is_csa_restart() - Checks whether VDEV MLME SM is in CSA
+ * @vdev: Object manager VDEV object
+ *
+ * API to checks the VDEV MLME SM state for CSA_RESTART substate
+ *
+ * Return: SUCCESS: if it is in CSA_RESTART sub state
+ *         FAILURE: otherwise failure
+ */
+QDF_STATUS wlan_vdev_mlme_is_csa_restart(struct wlan_objmgr_vdev *vdev);
+
 /**
  * wlan_vdev_is_going_down() - Checks whether VDEV is being brought down
  * @vdev: Object manager VDEV object
@@ -135,6 +144,28 @@ QDF_STATUS wlan_vdev_chan_config_valid(struct wlan_objmgr_vdev *vdev);
  */
 QDF_STATUS wlan_vdev_is_going_down(struct wlan_objmgr_vdev *vdev);
 
+/**
+ * wlan_vdev_is_restart_progress() - Checks VDEV restart is in progress
+ * @vdev: Object manager VDEV object
+ *
+ * API to check whether restarts is in progress
+ *
+ * Return: SUCCESS: if restart is in progress
+ *         FAILURE: otherwise failure
+ */
+QDF_STATUS wlan_vdev_is_restart_progress(struct wlan_objmgr_vdev *vdev);
+
+/**
+ * wlan_vdev_is_dfs_cac_wait() - Checks VDEV is in cac wait state
+ * @vdev: Object manager VDEV object
+ *
+ * API to check whether state is cac wait state
+ *
+ * Return: SUCCESS: if state is cac wait state
+ *         FAILURE: otherwise failure
+ */
+QDF_STATUS wlan_vdev_is_dfs_cac_wait(struct wlan_objmgr_vdev *vdev);
+
 /**
  * wlan_vdev_mlme_cmd_lock - Acquire lock for command queuing atomicity
  *

+ 48 - 13
umac/mlme/vdev_mgr/dispatcher/src/wlan_vdev_mlme_api.c

@@ -1,19 +1,17 @@
 /*
  * Copyright (c) 2018-2019 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.
+ * 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.
+ * 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.
  */
 
 /**
@@ -163,6 +161,22 @@ QDF_STATUS wlan_vdev_chan_config_valid(struct wlan_objmgr_vdev *vdev)
 	return QDF_STATUS_E_FAILURE;
 }
 
+qdf_export_symbol(wlan_vdev_chan_config_valid);
+
+QDF_STATUS wlan_vdev_mlme_is_csa_restart(struct wlan_objmgr_vdev *vdev)
+{
+	enum wlan_vdev_state state;
+	enum wlan_vdev_state substate;
+
+	state = wlan_vdev_mlme_get_state(vdev);
+	substate = wlan_vdev_mlme_get_substate(vdev);
+	if ((state == WLAN_VDEV_S_SUSPEND) &&
+	    (substate == WLAN_VDEV_SS_SUSPEND_CSA_RESTART))
+		return QDF_STATUS_SUCCESS;
+
+	return QDF_STATUS_E_FAILURE;
+}
+
 QDF_STATUS wlan_vdev_is_going_down(struct wlan_objmgr_vdev *vdev)
 {
 	enum wlan_vdev_state state;
@@ -178,6 +192,28 @@ QDF_STATUS wlan_vdev_is_going_down(struct wlan_objmgr_vdev *vdev)
 	return QDF_STATUS_E_FAILURE;
 }
 
+QDF_STATUS wlan_vdev_is_restart_progress(struct wlan_objmgr_vdev *vdev)
+{
+	enum wlan_vdev_state state;
+	enum wlan_vdev_state substate;
+
+	state = wlan_vdev_mlme_get_state(vdev);
+	substate = wlan_vdev_mlme_get_substate(vdev);
+	if ((state == WLAN_VDEV_S_START) &&
+	    (substate == WLAN_VDEV_SS_START_RESTART_PROGRESS))
+		return QDF_STATUS_SUCCESS;
+
+	return QDF_STATUS_E_FAILURE;
+}
+
+QDF_STATUS wlan_vdev_is_dfs_cac_wait(struct wlan_objmgr_vdev *vdev)
+{
+	if (wlan_vdev_mlme_get_state(vdev) == WLAN_VDEV_S_DFS_CAC_WAIT)
+		return QDF_STATUS_SUCCESS;
+
+	return QDF_STATUS_E_FAILURE;
+}
+
 void wlan_vdev_mlme_cmd_lock(struct wlan_objmgr_vdev *vdev)
 {
 	struct vdev_mlme_obj *vdev_mlme;
@@ -215,5 +251,4 @@ QDF_STATUS wlan_vdev_mlme_is_scan_allowed(struct wlan_objmgr_vdev *vdev)
 
 	return QDF_STATUS_E_FAILURE;
 }
-
 #endif

+ 11 - 13
umac/scan/dispatcher/src/wlan_scan_ucfg_api.c

@@ -1,19 +1,17 @@
 /*
  * Copyright (c) 2017-2019 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.
+ * 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.
+ * 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.
  */
 
 /*
@@ -582,7 +580,7 @@ static void ucfg_scan_req_update_concurrency_params(
 		req->scan_req.idle_time = scan_obj->scan_def.conc_idle_time;
 	}
 
-	if (!wlan_vdev_is_up(req->vdev))
+	if (wlan_vdev_is_up(req->vdev) != QDF_STATUS_SUCCESS)
 		req->scan_req.adaptive_dwell_time_mode =
 			scan_obj->scan_def.adaptive_dwell_time_mode_nc;
 	/*