Przeglądaj źródła

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
Jeff Johnson 7 lat temu
rodzic
commit
2bc0b727e3

+ 1 - 1
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;

+ 1 - 1
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;

+ 25 - 1
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,

+ 1 - 10
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;