diff --git a/Kbuild b/Kbuild index e955704c959a..634908c16cfc 100644 --- a/Kbuild +++ b/Kbuild @@ -726,6 +726,14 @@ IPA_OBJS := $(IPA_DIR)/dispatcher/src/wlan_ipa_ucfg_api.o \ $(IPA_DIR)/core/src/wlan_ipa_rm.o endif + +######## MLME ############## +MLME_DIR := components/mlme +MLME_INC := -I$(WLAN_ROOT)/$(MLME_DIR)/core/inc \ + -I$(WLAN_ROOT)/$(MLME_DIR)/dispatcher/inc + +MLME_OBJS := $(MLME_DIR)/core/src/wlan_mlme_main.o + ########## CLD TARGET_IF ####### CLD_TARGET_IF_DIR := components/target_if @@ -1433,6 +1441,7 @@ INCS += $(PLD_INC) INCS += $(OCB_INC) INCS += $(IPA_INC) +INCS += $(MLME_INC) ifeq ($(CONFIG_REMOVE_PKT_LOG), n) INCS += $(PKTLOG_INC) @@ -1509,6 +1518,7 @@ OBJS += $(NLINK_OBJS) OBJS += $(PTT_OBJS) OBJS += $(UMAC_SER_OBJS) OBJS += $(PLD_OBJS) +OBJS += $(MLME_OBJS) ifeq ($(CONFIG_WLAN_FEATURE_DSRC), y) OBJS += $(OCB_OBJS) diff --git a/components/mlme/core/inc/wlan_mlme_main.h b/components/mlme/core/inc/wlan_mlme_main.h new file mode 100644 index 000000000000..812f634d0c90 --- /dev/null +++ b/components/mlme/core/inc/wlan_mlme_main.h @@ -0,0 +1,89 @@ +/* + * Copyright (c) 2018 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: declare utility API related to the pmo component + * called by other components + */ + +#ifndef _WLAN_MLME_MAIN_H_ +#define _WLAN_MLME_MAIN_H_ + +#include +#include +#include +#include +#include +#include +#include + +#define mlme_fatal(params...) QDF_TRACE_FATAL(QDF_MODULE_ID_MLME, params) +#define mlme_err(params...) QDF_TRACE_ERROR(QDF_MODULE_ID_MLME, params) +#define mlme_warn(params...) QDF_TRACE_WARN(QDF_MODULE_ID_MLME, params) +#define mlme_info(params...) QDF_TRACE_INFO(QDF_MODULE_ID_MLME, params) +#define mlme_debug(params...) QDF_TRACE_DEBUG(QDF_MODULE_ID_MLME, params) + +/** + * struct wlan_mlme_psoc_obj -MLME psoc priv object + * @cfg: cfg items + */ +struct wlan_mlme_psoc_obj { + struct wlan_mlme_cfg cfg; +}; + +/** + * mlme_init() - initialize mlme_ctx context. + * + * This function initializes the mlme context. + * + * Return: QDF_STATUS_SUCCESS - in case of success else return error + */ +QDF_STATUS mlme_init(void); + +/** + * mlme_deinit() - De initialize mlme_ctx context. + * + * This function De initializes mlme contex. + * + * Return: QDF_STATUS_SUCCESS - in case of success else return error + */ +QDF_STATUS mlme_deinit(void); + +/** + * mlme_psoc_object_created_notification(): mlme psoc create handler + * @psoc: psoc which is going to created by objmgr + * @arg: argument for vdev create handler + * + * Register this api with objmgr to detect psoc is created + * + * Return QDF_STATUS status in case of success else return error + */ +QDF_STATUS mlme_psoc_object_created_notification( + struct wlan_objmgr_psoc *psoc, void *arg); + +/** + * mlme_psoc_object_destroyed_notification(): mlme psoc delete handler + * @psoc: psoc which is going to delete by objmgr + * @arg: argument for vdev delete handler + * + * Register this api with objmgr to detect psoc is deleted + * + * Return QDF_STATUS status in case of success else return error + */ +QDF_STATUS mlme_psoc_object_destroyed_notification( + struct wlan_objmgr_psoc *psoc, void *arg); +#endif diff --git a/components/mlme/core/src/wlan_mlme_main.c b/components/mlme/core/src/wlan_mlme_main.c new file mode 100644 index 000000000000..6e160085f10b --- /dev/null +++ b/components/mlme/core/src/wlan_mlme_main.c @@ -0,0 +1,135 @@ +/* + * Copyright (c) 2018 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 utility API related to the mlme component + * called by other components + */ + +#include "wlan_mlme_main.h" + +/** + * wlan_psoc_get_mlme_obj() - private API to get mlme object from psoc + * @psoc: psoc object + * + * Return: mlme object + */ +static inline struct wlan_mlme_psoc_obj * +wlan_psoc_get_mlme_obj(struct wlan_objmgr_psoc *psoc) +{ + struct wlan_mlme_psoc_obj *mlme_obj; + + mlme_obj = (struct wlan_mlme_psoc_obj *) + wlan_objmgr_psoc_get_comp_private_obj(psoc, + WLAN_UMAC_COMP_MLME); + + return mlme_obj; +} + +QDF_STATUS mlme_init(void) +{ + QDF_STATUS status; + + status = wlan_objmgr_register_psoc_create_handler( + WLAN_UMAC_COMP_MLME, + mlme_psoc_object_created_notification, + NULL); + if (status != QDF_STATUS_SUCCESS) { + mlme_err("unable to register psoc create handle"); + return status; + } + + status = wlan_objmgr_register_psoc_destroy_handler( + WLAN_UMAC_COMP_MLME, + mlme_psoc_object_destroyed_notification, + NULL); + if (status != QDF_STATUS_SUCCESS) + mlme_err("unable to register psoc create handle"); + + return status; +} + +QDF_STATUS mlme_deinit(void) +{ + QDF_STATUS status; + + status = wlan_objmgr_unregister_psoc_create_handler( + WLAN_UMAC_COMP_MLME, + mlme_psoc_object_created_notification, + NULL); + if (status != QDF_STATUS_SUCCESS) { + mlme_err("unable to unregister psoc create handle"); + return status; + } + + status = wlan_objmgr_unregister_psoc_destroy_handler( + WLAN_UMAC_COMP_MLME, + mlme_psoc_object_destroyed_notification, + NULL); + if (status != QDF_STATUS_SUCCESS) + mlme_err("unable to unregister psoc destroy handle"); + + return status; +} + +QDF_STATUS mlme_psoc_object_created_notification( + struct wlan_objmgr_psoc *psoc, void *arg) +{ + QDF_STATUS status; + struct wlan_mlme_psoc_obj *mlme_obj; + + mlme_obj = qdf_mem_malloc(sizeof(struct wlan_mlme_psoc_obj)); + if (!mlme_obj) { + mlme_err("Failed to allocate memory"); + return QDF_STATUS_E_NOMEM; + } + + status = wlan_objmgr_psoc_component_obj_attach(psoc, + WLAN_UMAC_COMP_MLME, + mlme_obj, + QDF_STATUS_SUCCESS); + if (status != QDF_STATUS_SUCCESS) { + mlme_err("Failed to attach psoc_ctx with psoc"); + qdf_mem_free(mlme_obj); + } + + return status; +} + +QDF_STATUS mlme_psoc_object_destroyed_notification( + struct wlan_objmgr_psoc *psoc, void *arg) +{ + struct wlan_mlme_psoc_obj *mlme_obj = NULL; + QDF_STATUS status; + + mlme_obj = wlan_psoc_get_mlme_obj(psoc); + + status = wlan_objmgr_psoc_component_obj_detach(psoc, + WLAN_UMAC_COMP_MLME, + mlme_obj); + if (status != QDF_STATUS_SUCCESS) { + mlme_err("Failed to detach psoc_ctx from psoc"); + status = QDF_STATUS_E_FAILURE; + goto out; + } + + qdf_mem_free(mlme_obj); + +out: + return status; +} + diff --git a/components/mlme/dispatcher/inc/wlan_mlme_public_struct.h b/components/mlme/dispatcher/inc/wlan_mlme_public_struct.h new file mode 100644 index 000000000000..67b1e3614184 --- /dev/null +++ b/components/mlme/dispatcher/inc/wlan_mlme_public_struct.h @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2018 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: contains mlme structure definations + */ + +#ifndef _WLAN_MLME_STRUCT_H_ +#define _WLAN_MLME_STRUCT_H_ + +#include + +/** + * struct wlan_mlme_cfg -MLME config items + * @cfg: cfg items + */ +struct wlan_mlme_cfg { + uint8_t test; + /* VHT config */ + /* HT config */ +}; + +#endif diff --git a/core/hdd/src/wlan_hdd_main.c b/core/hdd/src/wlan_hdd_main.c index 0bc2e7799a46..3e8c7b0040e0 100644 --- a/core/hdd/src/wlan_hdd_main.c +++ b/core/hdd/src/wlan_hdd_main.c @@ -134,7 +134,7 @@ #include "wlan_hdd_apf.h" #include "wlan_hdd_twt.h" #include "qc_sap_ioctl.h" - +#include "wlan_mlme_main.h" #ifdef CNSS_GENL #include #endif @@ -12334,6 +12334,7 @@ static void wlan_hdd_state_ctrl_param_destroy(void) */ static void component_init(void) { + mlme_init(); pmo_init(); disa_init(); ucfg_ocb_init(); @@ -12351,6 +12352,7 @@ static void component_deinit(void) ucfg_ocb_deinit(); pmo_deinit(); disa_deinit(); + mlme_deinit(); } void hdd_component_psoc_enable(struct wlan_objmgr_psoc *psoc)