Pārlūkot izejas kodu

qcacld-3.0: Register PE NDP event handler callback with WMA

Register PE NDP event handler callback with WMA. NAN even handlers at WMA are
already running in MC thread context and callback avoids unnecessary message
posting from WMA to PE for processing of NDP firmware events.

Change-Id: I94328ef69a3ee4ae6e7af2978bfad5a7ddcb385d
CRs-Fixed: 962367
Naveen Rawat 8 gadi atpakaļ
vecāks
revīzija
0fc3f69974

+ 11 - 3
core/mac/src/pe/lim/lim_api.c

@@ -69,6 +69,7 @@
 #include "cds_utils.h"
 #include "sys_startup.h"
 #include "cds_concurrency.h"
+#include "nan_datapath.h"
 
 static void __lim_init_scan_vars(tpAniSirGlobal pMac)
 {
@@ -1032,13 +1033,15 @@ QDF_STATUS pe_handle_mgmt_frame(void *p_cds_gctx, void *cds_buff)
 }
 
 /**
- * pe_register_wma_handle() - register management frame handler to WMA
+ * pe_register_callbacks_with_wma() - register SME and PE callback functions to
+ * WMA.
  * @pMac: mac global ctx
- * @ready_req: Ready request parameters
+ * @ready_req: Ready request parameters, containing callback pointers
  *
  * Return: None
  */
-void pe_register_wma_handle(tpAniSirGlobal pMac, tSirSmeReadyReq *ready_req)
+void pe_register_callbacks_with_wma(tpAniSirGlobal pMac,
+				    tSirSmeReadyReq *ready_req)
 {
 	void *p_cds_gctx;
 	QDF_STATUS retStatus;
@@ -1057,6 +1060,11 @@ void pe_register_wma_handle(tpAniSirGlobal pMac, tSirSmeReadyReq *ready_req)
 	if (retStatus != QDF_STATUS_SUCCESS)
 		lim_log(pMac, LOGP,
 			FL("Registering roaming callbacks with WMA failed"));
+
+	retStatus = wma_register_ndp_cb(lim_handle_ndp_event_message);
+	if (retStatus != QDF_STATUS_SUCCESS)
+		lim_log(pMac, LOGE,
+			FL("Registering NDP callbacks with WMA failed"));
 }
 
 /**

+ 2 - 2
core/mac/src/pe/lim/lim_process_sme_req_messages.c

@@ -114,7 +114,7 @@ static void lim_process_modify_add_ies(tpAniSirGlobal pMac, uint32_t *pMsg);
 
 static void lim_process_update_add_ies(tpAniSirGlobal pMac, uint32_t *pMsg);
 
-extern void pe_register_wma_handle(tpAniSirGlobal pMac,
+extern void pe_register_callbacks_with_wma(tpAniSirGlobal pMac,
 		tSirSmeReadyReq *ready_req);
 static void lim_process_ext_change_channel(tpAniSirGlobal mac_ctx,
 						uint32_t *msg);
@@ -545,7 +545,7 @@ static bool __lim_process_sme_sys_ready_ind(tpAniSirGlobal pMac, uint32_t *pMsgB
 
 	if (ANI_DRIVER_TYPE(pMac) != eDRIVER_TYPE_MFG) {
 		ready_req->pe_roam_synch_cb = pe_roam_synch_callback;
-		pe_register_wma_handle(pMac, ready_req);
+		pe_register_callbacks_with_wma(pMac, ready_req);
 		pMac->lim.add_bssdescr_callback = ready_req->add_bssdescr_cb;
 	}
 	PELOGW(lim_log(pMac, LOGW, FL("sending WMA_SYS_READY_IND msg to HAL"));)

+ 2 - 2
core/mac/src/pe/nan/nan_datapath.c

@@ -43,13 +43,13 @@ QDF_STATUS handle_ndp_request_message(tpAniSirGlobal mac_ctx, tpSirMsgQ msg)
 }
 
 /**
- * handle_ndp_event_message() - Handler for NDP events from WMA
+ * lim_handle_ndp_event_message() - Handler for NDP events from WMA
  * @mac_ctx: handle to mac structure
  * @msg: pointer to message
  *
  * Return: QDF_STATUS_SUCCESS on success; error number otherwise
  */
-QDF_STATUS handle_ndp_event_message(tpAniSirGlobal mac_ctx, tpSirMsgQ msg)
+QDF_STATUS lim_handle_ndp_event_message(tpAniSirGlobal mac_ctx, tpSirMsgQ msg)
 {
 	return QDF_STATUS_SUCCESS;
 }

+ 2 - 3
core/mac/src/pe/nan/nan_datapath.h

@@ -104,8 +104,7 @@ struct ndp_peer_node {
 QDF_STATUS lim_handle_ndp_request_message(tpAniSirGlobal mac_ctx,
 					tpSirMsgQ msg);
 /* Function to process NDP events */
-QDF_STATUS lim_handle_ndp_event_message(tpAniSirGlobal mac_ctx,
-					tpSirMsgQ msg);
+QDF_STATUS lim_handle_ndp_event_message(tpAniSirGlobal mac_ctx, tpSirMsgQ msg);
 void lim_process_ndi_mlm_add_bss_rsp(tpAniSirGlobal mac_ctx,
 				     tpSirMsgQ lim_msg_q,
 				     tpPESession session_entry);
@@ -121,7 +120,7 @@ static inline QDF_STATUS lim_handle_ndp_request_message(tpAniSirGlobal mac_ctx,
 }
 /* Function to process NDP events */
 static inline QDF_STATUS lim_handle_ndp_event_message(tpAniSirGlobal mac_ctx,
-					tpSirMsgQ msg)
+						      tpSirMsgQ msg)
 {
 	return QDF_STATUS_SUCCESS;
 }

+ 2 - 0
core/wma/inc/wma.h

@@ -1432,6 +1432,8 @@ typedef struct {
 	struct wma_valid_channels saved_chan;
 	/* NAN datapath support enabled in firmware */
 	bool nan_datapath_enabled;
+	QDF_STATUS (*pe_ndp_event_handler)(tpAniSirGlobal mac_ctx,
+					   tpSirMsgQ msg);
 } t_wma_handle, *tp_wma_handle;
 
 /**

+ 14 - 0
core/wma/inc/wma_api.h

@@ -250,4 +250,18 @@ static inline QDF_STATUS wma_send_egap_conf_params(WMA_HANDLE handle,
 #endif
 QDF_STATUS wma_set_tx_power_scale(uint8_t vdev_id, int value);
 QDF_STATUS wma_set_tx_power_scale_decr_db(uint8_t vdev_id, int value);
+
+#ifdef WLAN_FEATURE_NAN_DATAPATH
+QDF_STATUS wma_register_ndp_cb(QDF_STATUS (*pe_ndp_event_handler)
+					  (tpAniSirGlobal mac_ctx,
+					  tpSirMsgQ msg));
+#else
+static inline QDF_STATUS wma_register_ndp_cb(QDF_STATUS (*pe_ndp_event_handler)
+							(tpAniSirGlobal mac_ctx,
+							tpSirMsgQ msg))
+{
+	return QDF_STATUS_SUCCESS;
+}
+#endif
+
 #endif

+ 25 - 0
core/wma/src/wma_nan_datapath.c

@@ -393,3 +393,28 @@ void wma_delete_all_nan_remote_peers(tp_wma_handle wma, uint32_t vdev_id)
 	wma_remove_peer(wma, peer->mac_addr.raw, vdev_id, peer,
 			false);
 }
+
+/**
+ * wma_register_ndp_cb() - Register NDP callbacks
+ * @pe_ndp_event_handler: PE NDP callback routine pointer
+ *
+ * Register the PE callback NDP routines with WMA for
+ * handling NDP events
+ *
+ * Return: Success or Failure Status
+ */
+QDF_STATUS wma_register_ndp_cb(QDF_STATUS (*pe_ndp_event_handler)
+				(tpAniSirGlobal mac_ctx, tpSirMsgQ msg))
+{
+
+	tp_wma_handle wma = cds_get_context(QDF_MODULE_ID_WMA);
+
+	if (!wma) {
+		WMA_LOGE("%s: Failed to get WMA context", __func__);
+		return QDF_STATUS_E_FAILURE;
+	}
+	wma->pe_ndp_event_handler = pe_ndp_event_handler;
+	WMA_LOGD("Registered NDP callbacks with WMA successfully");
+	return QDF_STATUS_SUCCESS;
+}
+

+ 0 - 1
core/wma/src/wma_nan_datapath.h

@@ -73,6 +73,5 @@ static inline void wma_ndp_register_all_event_handlers(
 					tp_wma_handle wma_handle) {}
 static inline void wma_ndp_unregister_all_event_handlers(
 					tp_wma_handle wma_handle) {}
-
 #endif /* WLAN_FEATURE_NAN_DATAPATH */
 #endif /* __WMA_NAN_DATAPATH_H */