Browse Source

qcacld-3.0: Support LFR2.0 with new scan module

1\ Register the lim_process_rx_scan_handler with api
   ucfg_scan_register_requester;
2\ Redefine function lim_send_preauth_scan_offload
   to use api ucfg_scan_start;

Change-Id: I43a0b28c3abcce907575717dc3a4bfb190a32ec2
CRs-Fixed: 2144630
Paul Zhang 7 years ago
parent
commit
2f1077c10a

+ 1 - 0
core/mac/inc/ani_global.h

@@ -834,6 +834,7 @@ typedef struct sAniSirLim {
 	uint8_t retry_packet_cnt;
 	uint8_t scan_disabled;
 	uint8_t beacon_probe_rsp_cnt_per_scan;
+	wlan_scan_requester req_id;
 } tAniSirLim, *tpAniSirLim;
 
 struct mgmt_frm_reg_info {

+ 0 - 15
core/mac/inc/sir_api.h

@@ -3691,21 +3691,6 @@ typedef struct sAniHandoffReq {
 	uint8_t handoff_src;
 } tAniHandoffReq, *tpAniHandoffReq;
 
-/*
- * @scan_id:
- * @scan_requestor_id:
- *     Scan id and scan requestor id are used by firmware to track each scan
- *     request. A new scan id is generated for each request. Requestor id
- *     shows the purpose of scan.
- *
- * @USER_SCAN_REQUESTOR_ID: Normal scan request from supplicant to HDD/SME.
- * @PREAUTH_REQUESTOR_ID: Used by LIM for preauth operation.
- *
- */
-
-#define USER_SCAN_REQUESTOR_ID  0xA000
-#define PREAUTH_REQUESTOR_ID    0xC000
-
 typedef struct sSirScanOffloadReq {
 	uint8_t sessionId;
 	struct qdf_mac_addr bssId;

+ 2 - 2
core/mac/src/pe/include/lim_ft.h

@@ -71,7 +71,7 @@ void lim_preauth_scan_event_handler(tpAniSirGlobal mac_ctx,
 				uint8_t session_id,
 				uint32_t scan_id);
 QDF_STATUS lim_send_preauth_scan_offload(tpAniSirGlobal mac_ctx,
-		uint8_t session_id, tSirFTPreAuthReq *ft_preauth_req);
+		tpPESession session_entry, tSirFTPreAuthReq *ft_preauth_req);
 #else
 static inline void lim_ft_cleanup_pre_auth_info(tpAniSirGlobal pMac,
 		tpPESession psessionEntry)
@@ -114,7 +114,7 @@ void lim_ft_prepare_add_bss_req(tpAniSirGlobal pMac, uint8_t updateEntry,
 		tpPESession pftSessionEntry,
 		tpSirBssDescription bssDescription);
 QDF_STATUS lim_send_preauth_scan_offload(tpAniSirGlobal mac_ctx,
-		uint8_t session_id, tSirFTPreAuthReq *ft_preauth_req);
+		tpPESession session_entry, tSirFTPreAuthReq *ft_preauth_req);
 #else
 static inline void lim_fill_ft_session(tpAniSirGlobal pMac,
 		tpSirBssDescription pbssDescription,

+ 7 - 0
core/mac/src/pe/lim/lim_api.c

@@ -75,6 +75,7 @@
 #include "wlan_mgmt_txrx_utils_api.h"
 #include "wlan_objmgr_psoc_obj.h"
 #include "os_if_nan.h"
+#include <wlan_scan_ucfg_api.h>
 
 static void __lim_init_scan_vars(tpAniSirGlobal pMac)
 {
@@ -513,6 +514,11 @@ tSirRetStatus lim_start(tpAniSirGlobal pMac)
 		retCode = eSIR_FAILURE;
 	}
 
+	pMac->lim.req_id =
+		ucfg_scan_register_requester(pMac->psoc,
+					     "LIM",
+					     lim_process_rx_scan_handler,
+					     pMac);
 	return retCode;
 }
 
@@ -647,6 +653,7 @@ void lim_cleanup(tpAniSirGlobal pMac)
 
 	lim_ft_cleanup_all_ft_sessions(pMac);
 
+	ucfg_scan_unregister_requester(pMac->psoc, pMac->lim.req_id);
 } /*** end lim_cleanup() ***/
 
 /**

+ 64 - 49
core/mac/src/pe/lim/lim_ft_preauth.c

@@ -33,6 +33,7 @@
 #include <lim_session.h>
 #include <lim_session_utils.h>
 #include <lim_admit_control.h>
+#include <wlan_scan_ucfg_api.h>
 #include "wma.h"
 
 /**
@@ -197,8 +198,8 @@ int lim_process_ft_pre_auth_req(tpAniSirGlobal mac_ctx,
 		/* Need to suspend link only if the channels are different */
 		pe_debug("Performing pre-auth on diff channel(session %pK)",
 			session);
-		lim_send_preauth_scan_offload(mac_ctx, session->peSessionId,
-				session->ftPEContext.pFTPreAuthReq);
+		lim_send_preauth_scan_offload(mac_ctx, session,
+					session->ftPEContext.pFTPreAuthReq);
 	} else {
 		pe_debug("Performing pre-auth on same channel (session %pK)",
 			session);
@@ -653,69 +654,83 @@ void lim_post_ft_pre_auth_rsp(tpAniSirGlobal mac_ctx,
  * lim_send_preauth_scan_offload() - Send scan command to handle preauth.
  *
  * @mac_ctx: Pointer to Global MAC structure
- * @session_id: pe session id
+ * @session_entry: pe session
  * @ft_preauth_req: Preauth request with parameters
  *
- * Builds a single channel scan request and sends it to WMA.
+ * Builds a single channel scan request and sends it to scan module.
  * Scan dwell time is the time allocated to go to preauth candidate
  * channel for auth frame exchange.
  *
- * Return: Status of sending message to WMA.
+ * Return: Status of sending message to scan module.
  */
 QDF_STATUS lim_send_preauth_scan_offload(tpAniSirGlobal mac_ctx,
-			uint8_t session_id,
-			tSirFTPreAuthReq *ft_preauth_req)
+					 tpPESession session_entry,
+					 tSirFTPreAuthReq *ft_preauth_req)
 {
-	tSirScanOffloadReq *scan_offload_req;
-	tSirRetStatus rc = eSIR_SUCCESS;
-	struct scheduler_msg msg = {0};
+	struct scan_start_request *req;
+	struct wlan_objmgr_vdev *vdev;
+	uint8_t session_id;
+	QDF_STATUS status = QDF_STATUS_SUCCESS;
 
-	scan_offload_req = qdf_mem_malloc(sizeof(tSirScanOffloadReq));
-	if (NULL == scan_offload_req) {
-		pe_err("Memory allocation failed for pScanOffloadReq");
-		return QDF_STATUS_E_NOMEM;
+	if (session_entry == NULL) {
+		QDF_TRACE(QDF_MODULE_ID_PE, QDF_TRACE_LEVEL_ERROR,
+			  FL("Session entry is NULL"));
+		return QDF_STATUS_E_FAILURE;
 	}
 
-	msg.type = WMA_START_SCAN_OFFLOAD_REQ;
-	msg.bodyptr = scan_offload_req;
-	msg.bodyval = 0;
+	session_id = session_entry->smeSessionId;
 
-	qdf_mem_copy((uint8_t *) &scan_offload_req->selfMacAddr.bytes,
-		     (uint8_t *) ft_preauth_req->self_mac_addr,
-		     sizeof(tSirMacAddr));
+	req = qdf_mem_malloc(sizeof(*req));
+	if (!req) {
+		QDF_TRACE(QDF_MODULE_ID_PE, QDF_TRACE_LEVEL_ERROR,
+			  FL("Failed to allocate memory"));
+		return QDF_STATUS_E_NOMEM;
+	}
 
-	qdf_mem_copy((uint8_t *) &scan_offload_req->bssId.bytes,
-		     (uint8_t *) ft_preauth_req->currbssId,
-		     sizeof(tSirMacAddr));
-	scan_offload_req->scanType = eSIR_PASSIVE_SCAN;
-	/*
-	 * P2P_SCAN_TYPE_LISTEN tells firmware to allow mgt frames to/from
-	 * mac address that is not of connected AP.
-	 */
-	scan_offload_req->p2pScanType = P2P_SCAN_TYPE_LISTEN;
-	scan_offload_req->restTime = 0;
-	scan_offload_req->minChannelTime = LIM_FT_PREAUTH_SCAN_TIME;
-	scan_offload_req->maxChannelTime = LIM_FT_PREAUTH_SCAN_TIME;
-	scan_offload_req->sessionId = session_id;
-	scan_offload_req->channelList.numChannels = 1;
-	scan_offload_req->channelList.channelNumber[0] =
-		ft_preauth_req->preAuthchannelNum;
-	wma_get_scan_id(&ft_preauth_req->scan_id);
-	scan_offload_req->scan_id = ft_preauth_req->scan_id;
-	scan_offload_req->scan_requestor_id = PREAUTH_REQUESTOR_ID;
-
-	pe_debug("Scan request: duration %u, session %hu, chan %hu",
-		scan_offload_req->maxChannelTime, session_id,
-		ft_preauth_req->preAuthchannelNum);
-
-	rc = wma_post_ctrl_msg(mac_ctx, &msg);
-	if (rc != eSIR_SUCCESS) {
-		pe_err("START_SCAN_OFFLOAD failed %u", rc);
-		qdf_mem_free(scan_offload_req);
+	qdf_mem_zero(req, sizeof(*req));
+
+	vdev = wlan_objmgr_get_vdev_by_id_from_pdev(mac_ctx->pdev,
+						    session_id, WLAN_OSIF_ID);
+	if (vdev == NULL) {
+		QDF_TRACE(QDF_MODULE_ID_PE, QDF_TRACE_LEVEL_ERROR,
+			  FL("vdev object is NULL"));
+		qdf_mem_free(req);
 		return QDF_STATUS_E_FAILURE;
 	}
 
-	return QDF_STATUS_SUCCESS;
+	ucfg_scan_init_default_params(vdev, req);
+
+	qdf_mem_copy(req->scan_req.bssid_list,
+		     (uint8_t *)ft_preauth_req->currbssId,
+		     QDF_MAC_ADDR_SIZE);
+
+	req->scan_req.scan_id = ucfg_scan_get_scan_id(mac_ctx->psoc);
+	if (!req->scan_req.scan_id) {
+		wlan_objmgr_vdev_release_ref(vdev, WLAN_OSIF_ID);
+		qdf_mem_free(req);
+		QDF_TRACE(QDF_MODULE_ID_PE, QDF_TRACE_LEVEL_ERROR,
+			  FL("Invalid scan ID"));
+		return QDF_STATUS_E_FAILURE;
+	}
+	req->scan_req.vdev_id = session_id;
+	req->scan_req.scan_req_id = mac_ctx->lim.req_id | PREAUTH_REQUESTOR_ID;
+	req->scan_req.scan_priority = WMI_SCAN_PRIORITY_VERY_HIGH;
+	req->scan_req.scan_f_passive = true;
+
+	req->scan_req.chan_list.num_chan = 1;
+	req->scan_req.chan_list.chan[0].freq =
+			cds_chan_to_freq(ft_preauth_req->preAuthchannelNum);
+
+	req->scan_req.dwell_time_active = LIM_FT_PREAUTH_SCAN_TIME;
+	req->scan_req.dwell_time_passive = LIM_FT_PREAUTH_SCAN_TIME;
+
+	status = ucfg_scan_start(req);
+	if (status != QDF_STATUS_SUCCESS)
+		/* Don't free req here, ucfg_scan_start will do free */
+		QDF_TRACE(QDF_MODULE_ID_PE, QDF_TRACE_LEVEL_INFO_HIGH,
+			  FL("Issue scan req failed"));
+	wlan_objmgr_vdev_release_ref(vdev, WLAN_OSIF_ID);
+	return status;
 }
 
 /**

+ 41 - 0
core/mac/src/pe/lim/lim_send_frames_host_roam.c

@@ -798,3 +798,44 @@ end:
 
 }
 
+void lim_process_rx_scan_handler(struct wlan_objmgr_vdev *vdev,
+				 struct scan_event *event,
+				 void *arg)
+{
+	tpAniSirGlobal mac_ctx;
+	enum sir_scan_event_type event_type;
+
+	QDF_TRACE(QDF_MODULE_ID_PE, QDF_TRACE_LEVEL_DEBUG,
+		  "event: %u, id: 0x%x, requestor: 0x%x, freq: %u, reason: %u",
+		  event->type, event->scan_id, event->requester,
+		  event->chan_freq, event->reason);
+
+	mac_ctx = (tpAniSirGlobal)arg;
+	event_type = 0x1 << event->type;
+
+	switch (event_type) {
+	case SIR_SCAN_EVENT_STARTED:
+		break;
+	case SIR_SCAN_EVENT_COMPLETED:
+		QDF_TRACE(QDF_MODULE_ID_PE, QDF_TRACE_LEVEL_DEBUG,
+			  "No.of beacons and probe response received per scan %d",
+			  mac_ctx->lim.beacon_probe_rsp_cnt_per_scan);
+	/* Fall through */
+	case SIR_SCAN_EVENT_FOREIGN_CHANNEL:
+	case SIR_SCAN_EVENT_START_FAILED:
+		if ((mac_ctx->lim.req_id | PREAUTH_REQUESTOR_ID) ==
+		    event->requester)
+			lim_preauth_scan_event_handler(mac_ctx,
+						       event_type,
+						       event->vdev_id,
+						       event->scan_id);
+		break;
+	case SIR_SCAN_EVENT_BSS_CHANNEL:
+	case SIR_SCAN_EVENT_DEQUEUED:
+	case SIR_SCAN_EVENT_PREEMPTED:
+	default:
+		QDF_TRACE(QDF_MODULE_ID_PE, QDF_TRACE_LEVEL_DEBUG,
+			  "Received unhandled scan event %u",
+			  event_type);
+	}
+}

+ 14 - 0
core/mac/src/pe/lim/lim_types.h

@@ -488,6 +488,17 @@ void lim_send_reassoc_req_with_ft_ies_mgmt_frame(tpAniSirGlobal pMac,
 		tLimMlmReassocReq *pMlmReassocReq, tpPESession psessionEntry);
 void lim_send_reassoc_req_mgmt_frame(tpAniSirGlobal, tLimMlmReassocReq *,
 				     tpPESession);
+/**
+ * lim_process_rx_scan_handler() -
+ *	process the event for scan which is issued by LIM
+ * @vdev: wlan objmgr vdev pointer
+ * @event: scan event
+ * @arg: global mac context pointer
+ *
+ * Return: void
+ */
+void lim_process_rx_scan_handler(struct wlan_objmgr_vdev *vdev,
+				 struct scan_event *event, void *arg);
 #else
 static inline void lim_send_reassoc_req_with_ft_ies_mgmt_frame(
 		tpAniSirGlobal pMac, tLimMlmReassocReq *pMlmReassocReq,
@@ -496,6 +507,9 @@ static inline void lim_send_reassoc_req_with_ft_ies_mgmt_frame(
 static inline void lim_send_reassoc_req_mgmt_frame(tpAniSirGlobal mac_ctx,
 		tLimMlmReassocReq *reassoc_req, tpPESession pe_session)
 {}
+static inline void lim_process_rx_scan_handler(struct wlan_objmgr_vdev *vdev,
+				 struct scan_event *event, void *arg)
+{}
 #endif
 #ifdef WLAN_FEATURE_11AX_BSS_COLOR
 /**