diff --git a/os_if/linux/wlan_cfg80211.c b/os_if/linux/wlan_cfg80211.c index 4a608f84d8..8fa6f0ec7d 100644 --- a/os_if/linux/wlan_cfg80211.c +++ b/os_if/linux/wlan_cfg80211.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 The Linux Foundation. All rights reserved. + * Copyright (c) 2016-2017 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 @@ -19,16 +19,3 @@ /** * DOC: defines driver functions interfacing with linux kernel */ - -#include "wlan_cfg80211.h" - -int wlan_cfg80211_scan(struct wiphy *wiphy, -#if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 6, 0)) - struct net_device *dev, -#endif - struct cfg80211_scan_request *request) -{ - qdf_print("%s \n", __func__); - - return 0; -} diff --git a/umac/scan/core/src/wlan_scan_cache_db.c b/umac/scan/core/src/wlan_scan_cache_db.c index ee680f8f78..917e9e0b8d 100644 --- a/umac/scan/core/src/wlan_scan_cache_db.c +++ b/umac/scan/core/src/wlan_scan_cache_db.c @@ -19,4 +19,17 @@ /* * DOC: contains scan cache api and functionality */ +#include +#include "wlan_scan_cache_db.h" +#include +#include +QDF_STATUS scm_db_init(struct wlan_objmgr_psoc *psoc) +{ + return QDF_STATUS_SUCCESS; +} + +QDF_STATUS scm_db_deinit(struct wlan_objmgr_psoc *psoc) +{ + return QDF_STATUS_SUCCESS; +} diff --git a/umac/scan/core/src/wlan_scan_main.c b/umac/scan/core/src/wlan_scan_main.c index 7c8c38efbd..2c7d425817 100644 --- a/umac/scan/core/src/wlan_scan_main.c +++ b/umac/scan/core/src/wlan_scan_main.c @@ -19,4 +19,54 @@ /* * DOC: contains core scan function definitions */ +#include +#include +#include "wlan_scan_main.h" +QDF_STATUS wlan_scan_psoc_created_notification(struct wlan_objmgr_psoc *psoc, + void *arg_list) +{ + struct wlan_scan_obj *scan_obj; + QDF_STATUS status = QDF_STATUS_SUCCESS; + + scan_obj = qdf_mem_malloc(sizeof(struct wlan_scan_obj)); + if (scan_obj == NULL) { + scm_err("Failed to allocate memory"); + return QDF_STATUS_E_NOMEM; + } + + /* Attach scan private date to psoc */ + status = wlan_objmgr_psoc_component_obj_attach(psoc, + WLAN_UMAC_COMP_SCAN, (void *)scan_obj, + QDF_STATUS_SUCCESS); + if (QDF_IS_STATUS_ERROR(status)) + scm_err("Failed to attach psoc scan component"); + else + scm_info("Scan object attach to psoc successful"); + + return status; +} + +QDF_STATUS wlan_scan_psoc_destroyed_notification( + struct wlan_objmgr_psoc *psoc, + void *arg_list) +{ + void *scan_obj = NULL; + QDF_STATUS status = QDF_STATUS_SUCCESS; + + scan_obj = wlan_objmgr_psoc_get_comp_private_obj(psoc, + WLAN_UMAC_COMP_SCAN); + if (!scan_obj) { + scm_err("Failed to detach scan in psoc ctx"); + return QDF_STATUS_E_FAILURE; + } + + status = wlan_objmgr_psoc_component_obj_detach(psoc, + WLAN_UMAC_COMP_SCAN, scan_obj); + if (QDF_IS_STATUS_ERROR(status)) + scm_err("Failed to detach psoc scan component"); + + qdf_mem_free(scan_obj); + + return status; +} diff --git a/umac/scan/core/src/wlan_scan_main.h b/umac/scan/core/src/wlan_scan_main.h index 0166feb344..e9701c0bdd 100644 --- a/umac/scan/core/src/wlan_scan_main.h +++ b/umac/scan/core/src/wlan_scan_main.h @@ -24,7 +24,8 @@ #define _WLAN_SCAN_MAIN_API_H_ #include -#include +#include +#include #include "wlan_scan_cache_db.h" #define scm_log(level, args...) \ @@ -402,6 +403,6 @@ QDF_STATUS wlan_scan_psoc_created_notification(struct wlan_objmgr_psoc *psoc, * * Return: QDF_STATUS */ -QDF_STATUS wlan_scan_psoc_deleted_notification(struct wlan_objmgr_psoc *psoc, +QDF_STATUS wlan_scan_psoc_destroyed_notification(struct wlan_objmgr_psoc *psoc, void *arg_list); #endif diff --git a/umac/scan/dispatcher/src/wlan_scan_ucfg_api.c b/umac/scan/dispatcher/src/wlan_scan_ucfg_api.c index 338043c303..5877a08af9 100644 --- a/umac/scan/dispatcher/src/wlan_scan_ucfg_api.c +++ b/umac/scan/dispatcher/src/wlan_scan_ucfg_api.c @@ -19,3 +19,136 @@ /* * DOC: contains scan north bound interface definitions */ + +#include +#include +#include +#include "../../core/src/wlan_scan_main.h" +#include + +QDF_STATUS ucfg_scan_init(void) +{ + QDF_STATUS status; + + status = wlan_objmgr_register_psoc_create_handler(WLAN_UMAC_COMP_SCAN, + wlan_scan_psoc_created_notification, NULL); + if (QDF_IS_STATUS_ERROR(status)) { + scm_err("Failed to register psoc create handler"); + goto fail_create_psoc; + } + + status = wlan_objmgr_register_psoc_destroy_handler(WLAN_UMAC_COMP_SCAN, + wlan_scan_psoc_destroyed_notification, NULL); + if (QDF_IS_STATUS_SUCCESS(status)) { + scm_info("scan create and delete handler registered with objmgr"); + return QDF_STATUS_SUCCESS; + } + scm_err("Failed to create psoc delete handler"); + + wlan_objmgr_unregister_psoc_create_handler(WLAN_UMAC_COMP_SCAN, + wlan_scan_psoc_created_notification, NULL); +fail_create_psoc: + return status; +} + +QDF_STATUS ucfg_scan_deinit(void) +{ + QDF_STATUS status = QDF_STATUS_SUCCESS; + + status = wlan_objmgr_unregister_psoc_create_handler(WLAN_UMAC_COMP_SCAN, + wlan_scan_psoc_created_notification, NULL); + if (status != QDF_STATUS_SUCCESS) + scm_err("Failed to unregister psoc create handler"); + + status = wlan_objmgr_unregister_psoc_destroy_handler( + WLAN_UMAC_COMP_SCAN, + wlan_scan_psoc_destroyed_notification, NULL); + if (status != QDF_STATUS_SUCCESS) + scm_err("Failed to unregister psoc delete handler"); + + return status; +} + +static QDF_STATUS wlan_scan_global_init(struct wlan_scan_obj *scan_obj) +{ + + scan_obj->scan_def.active_dwell = SCAN_ACTIVE_DWELL_TIME; + scan_obj->scan_def.passive_dwell = SCAN_PASSIVE_DWELL_TIME; + scan_obj->scan_def.max_rest_time = SCAN_MAX_REST_TIME; + scan_obj->scan_def.min_rest_time = SCAN_MIN_REST_TIME; + scan_obj->scan_def.conc_active_dwell = SCAN_CONC_ACTIVE_DWELL_TIME; + scan_obj->scan_def.conc_passive_dwell = SCAN_CONC_PASSIVE_DWELL_TIME; + scan_obj->scan_def.conc_max_rest_time = SCAN_CONC_MAX_REST_TIME; + scan_obj->scan_def.conc_min_rest_time = SCAN_CONC_MIN_REST_TIME; + scan_obj->scan_def.conc_idle_time = SCAN_CONC_IDLE_TIME; + scan_obj->scan_def.repeat_probe_time = SCAN_REPEAT_PROBE_TIME; + scan_obj->scan_def.probe_spacing_time = SCAN_PROBE_SPACING_TIME; + scan_obj->scan_def.probe_delay = SCAN_PROBE_DELAY; + scan_obj->scan_def.burst_duration = SCAN_BURST_DURATION; + scan_obj->scan_def.max_scan_time = SCAN_MAX_SCAN_TIME; + scan_obj->scan_def.num_probes = SCAN_NUM_PROBES; + scan_obj->scan_def.scan_cache_aging_time = SCAN_CACHE_AGING_TIME; + scan_obj->scan_def.max_bss_per_pdev = SCAN_MAX_BSS_PDEV; + scan_obj->scan_def.max_num_scan_allowed = SCAN_MAX_NUM_SCAN_ALLOWED; + scan_obj->scan_def.scan_priority = SCAN_PRIORITY; + scan_obj->scan_def.idle_time = SCAN_NETWORK_IDLE_TIMEOUT; + /* scan contrl flags */ + scan_obj->scan_def.scan_f_passive = true; + scan_obj->scan_def.scan_f_2ghz = true; + scan_obj->scan_def.scan_f_5ghz = true; + /* scan event flags */ + scan_obj->scan_def.scan_ev_started = true; + scan_obj->scan_def.scan_ev_completed = true; + scan_obj->scan_def.scan_ev_bss_chan = true; + scan_obj->scan_def.scan_ev_foreign_chan = true; + scan_obj->scan_def.scan_ev_dequeued = true; + + qdf_atomic_init(&scan_obj->scan_ids); + + return QDF_STATUS_SUCCESS; +} + +QDF_STATUS ucfg_scan_psoc_enable(struct wlan_objmgr_psoc *psoc) +{ + return QDF_STATUS_SUCCESS; +} + +QDF_STATUS ucfg_scan_psoc_disable(struct wlan_objmgr_psoc *psoc) +{ + return QDF_STATUS_SUCCESS; +} + + +QDF_STATUS ucfg_scan_psoc_open(struct wlan_objmgr_psoc *psoc) +{ + QDF_STATUS status = QDF_STATUS_SUCCESS; + struct wlan_scan_obj *scan_obj; + + scan_obj = wlan_psoc_get_scan_obj(psoc); + if (scan_obj == NULL) { + scm_err("Failed to get scan object"); + return QDF_STATUS_E_FAILURE; + } + /* Initialize the scan Globals */ + wlan_scan_global_init(scan_obj); + + scm_db_init(psoc); + + return status; +} + +QDF_STATUS ucfg_scan_psoc_close(struct wlan_objmgr_psoc *psoc) +{ + QDF_STATUS status = QDF_STATUS_SUCCESS; + struct wlan_scan_obj *scan_obj; + + scan_obj = wlan_psoc_get_scan_obj(psoc); + if (scan_obj == NULL) { + scm_err("Failed to get scan object"); + return QDF_STATUS_E_FAILURE; + } + + scm_db_deinit(psoc); + + return status; +}