From 2bc0b727e388363667a07ddf9d67aa70722b1055 Mon Sep 17 00:00:00 2001 From: Jeff Johnson Date: Mon, 25 Sep 2017 08:51:43 -0700 Subject: [PATCH] qcacld-3.0: Refine API wlansap_open() At one time the WLAN driver only supported a single SAP. At that time most SAP APIs took the global context pointer as a param, and from that they could extract the pointer to the one & only SAP context. Later the MBSSID feature was added, and conditional compilation was introduced such that either the global context pointer or a per-BSS SAP context pointer was used. Finally in qcacld-3.0 the conditional compilation was removed, leaving just the MBSSID behavior. However one of the artifacts that was left behind was that the SAP APIs are currently defined to take a void *context which prevents the compiler from performing proper type checking. Update wlansap_open() to return the true struct pointer type so that it can then be used by other SAP APIs. Change-Id: I216ed653e4feb9960357a168d4981e7a7a92411e CRs-Fixed: 2116267 --- core/hdd/inc/wlan_hdd_main.h | 2 +- core/hdd/src/wlan_hdd_hostapd.c | 2 +- core/sap/inc/sap_api.h | 26 +++++++++++++++++++++++++- core/sap/src/sap_module.c | 11 +---------- 4 files changed, 28 insertions(+), 13 deletions(-) diff --git a/core/hdd/inc/wlan_hdd_main.h b/core/hdd/inc/wlan_hdd_main.h index 4696d9770002..41f41945ead6 100644 --- a/core/hdd/inc/wlan_hdd_main.h +++ b/core/hdd/inc/wlan_hdd_main.h @@ -948,7 +948,7 @@ struct hdd_ap_ctx { bool bApActive; /* SAP Context */ - void *sapContext; + struct sap_context *sapContext; bool dfs_cac_block_tx; qdf_mc_timer_t vendor_acs_timer; diff --git a/core/hdd/src/wlan_hdd_hostapd.c b/core/hdd/src/wlan_hdd_hostapd.c index 730974d20150..52fadfd9b29b 100644 --- a/core/hdd/src/wlan_hdd_hostapd.c +++ b/core/hdd/src/wlan_hdd_hostapd.c @@ -6087,7 +6087,7 @@ QDF_STATUS hdd_init_ap_mode(struct hdd_adapter *pAdapter, bool reinit) struct net_device *dev = pAdapter->dev; struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(pAdapter); QDF_STATUS status; - v_CONTEXT_t sapContext = NULL; + struct sap_context *sapContext = NULL; int ret; enum tQDF_ADAPTER_MODE mode; enum dfs_mode acs_dfs_mode; diff --git a/core/sap/inc/sap_api.h b/core/sap/inc/sap_api.h index 58dc3e8b5239..4a24ce4804da 100644 --- a/core/sap/inc/sap_api.h +++ b/core/sap/inc/sap_api.h @@ -778,6 +778,31 @@ typedef struct { bool isSafe; } sapSafeChannelType; #endif /* FEATURE_WLAN_CH_AVOID */ + +/** + * struct sap_context - per-BSS Context for SAP + * + * struct sap_context is used to share per-BSS context between SAP and + * its clients. A context is generated by wlansap_open() and is + * destroyed by wlansap_close(). During the lifetime of the BSS the + * SAP context is passed as the primary parameter to SAP APIs. Note + * that by design the contents of the structure are opaque to the + * clients and a SAP context pointer must only be dereferenced by SAP. + */ +struct sap_context; + +/** + * wlansap_open() - WLAN SAP open function call + * + * Called at BSS initialization to generate a context for the BSS. SAP + * will initialize all its internal resources and will wait for the + * call to wlan_start() to register with the other modules. + * + * Return: Pointer to the SAP context, or NULL if a context could not + * be allocated + */ +struct sap_context *wlansap_open(void); + void sap_cleanup_channel_list(void *sapContext); /** @@ -788,7 +813,6 @@ void sap_cleanup_channel_list(void *sapContext); */ bool sap_is_auto_channel_select(void *pvos_gctx); -void *wlansap_open(void); QDF_STATUS wlansap_global_init(void); QDF_STATUS wlansap_global_deinit(void); QDF_STATUS wlansap_start(void *p_cds_gctx, enum tQDF_ADAPTER_MODE mode, diff --git a/core/sap/src/sap_module.c b/core/sap/src/sap_module.c index 5982f651e5b9..a5d6d4c586fe 100644 --- a/core/sap/src/sap_module.c +++ b/core/sap/src/sap_module.c @@ -251,16 +251,7 @@ void wlansap_context_put(struct sap_context *ctx) qdf_mutex_release(&sap_context_lock); } -/** - * wlansap_open() - WLAN SAP open function call - * - * Called at driver initialization (cds_open). SAP will initialize - * all its internal resources and will wait for the call to start to - * register with the other modules. - * - * Return: Pointer to the SAP context - */ -void *wlansap_open(void) +struct sap_context *wlansap_open(void) { struct sap_context *pSapCtx; QDF_STATUS status;