Parcourir la source

qcacld-3.0: Handle host roam start req

Handle host roam start req from firmware.

Change-Id: I53455c011e3737c9b4a52d54797e3224b98a628e
CRs-Fixed: 2888383
gaurank kathpalia il y a 4 ans
Parent
commit
88fddb8238

+ 67 - 58
components/umac/mlme/connection_mgr/core/src/wlan_cm_roam_offload.c

@@ -4237,6 +4237,73 @@ void cm_roam_start_init_on_connect(struct wlan_objmgr_pdev *pdev,
 }
 
 #ifdef FEATURE_CM_ENABLE
+QDF_STATUS cm_start_roam_invoke(struct wlan_objmgr_psoc *psoc,
+				struct wlan_objmgr_vdev *vdev,
+				struct qdf_mac_addr *bssid,
+				qdf_freq_t chan_freq,
+				enum wlan_cm_source source)
+{
+	struct cm_req *cm_req;
+	QDF_STATUS status;
+	uint8_t roam_control_bitmap;
+	uint8_t vdev_id = vdev->vdev_objmgr.vdev_id;
+	bool roam_offload_enabled = cm_roam_offload_enabled(psoc);
+
+	roam_control_bitmap = mlme_get_operations_bitmap(psoc, vdev_id);
+	if (roam_offload_enabled && (roam_control_bitmap ||
+	    !MLME_IS_ROAM_INITIALIZED(psoc, vdev_id))) {
+		mlme_debug("ROAM: RSO Disabled internaly: vdev[%d] bitmap[0x%x]",
+			   vdev_id, roam_control_bitmap);
+		return QDF_STATUS_E_FAILURE;
+	}
+
+	cm_req = qdf_mem_malloc(sizeof(*cm_req));
+	if (!cm_req)
+		return QDF_STATUS_E_NOMEM;
+
+	/* Ignore BSSID and channel validation for FW host roam */
+	if (source == CM_ROAMING_FW)
+		goto send_evt;
+
+	if (qdf_is_macaddr_zero(bssid) ||
+	    cm_req->roam_req.req.source == CM_ROAMING_NUD_FAILURE) {
+		if (!wlan_mlme_is_data_stall_recovery_fw_supported(psoc)) {
+			mlme_debug("FW does not support data stall recovery, aborting roam invoke");
+			qdf_mem_free(cm_req);
+			return QDF_STATUS_E_NOSUPPORT;
+		}
+		cm_req->roam_req.req.forced_roaming = true;
+		source = CM_ROAMING_NUD_FAILURE;
+		goto send_evt;
+	}
+
+	if (!chan_freq || qdf_is_macaddr_zero(bssid)) {
+		mlme_debug("bssid " QDF_MAC_ADDR_FMT " chan_freq %d",
+			   QDF_MAC_ADDR_REF(bssid->bytes), chan_freq);
+		qdf_mem_free(cm_req);
+		return QDF_STATUS_E_FAILURE;
+	}
+
+	qdf_copy_macaddr(&cm_req->roam_req.req.bssid, bssid);
+	cm_req->roam_req.req.chan_freq = chan_freq;
+
+send_evt:
+	cm_req->roam_req.req.source = source;
+
+	cm_req->roam_req.req.vdev_id = vdev_id;
+	/*
+	 * For LFR3 WLAN_CM_SM_EV_ROAM_REQ will be converted to
+	 * WLAN_CM_SM_EV_ROAM_INVOKE.
+	 */
+	status = cm_sm_deliver_event(vdev, WLAN_CM_SM_EV_ROAM_REQ,
+				     sizeof(*cm_req), cm_req);
+
+	if (QDF_IS_STATUS_ERROR(status))
+		qdf_mem_free(cm_req);
+
+	return status;
+}
+
 #ifdef WLAN_FEATURE_ROAM_OFFLOAD
 static QDF_STATUS
 cm_find_roam_candidate(struct wlan_objmgr_pdev *pdev,
@@ -4314,64 +4381,6 @@ cm_find_roam_candidate(struct wlan_objmgr_pdev *pdev,
 	return QDF_STATUS_SUCCESS;
 }
 
-QDF_STATUS cm_start_roam_invoke(struct wlan_objmgr_psoc *psoc,
-				struct wlan_objmgr_vdev *vdev,
-				struct qdf_mac_addr *bssid,
-				qdf_freq_t chan_freq)
-{
-	struct cm_req *cm_req;
-	QDF_STATUS status;
-	uint8_t roam_control_bitmap;
-	uint8_t vdev_id = vdev->vdev_objmgr.vdev_id;
-
-	roam_control_bitmap = mlme_get_operations_bitmap(psoc, vdev_id);
-	if (roam_control_bitmap ||
-	    !MLME_IS_ROAM_INITIALIZED(psoc, vdev_id)) {
-		mlme_debug("ROAM: RSO Disabled internaly: vdev[%d] bitmap[0x%x]",
-			   vdev_id, roam_control_bitmap);
-		return QDF_STATUS_E_FAILURE;
-	}
-
-	cm_req = qdf_mem_malloc(sizeof(*cm_req));
-	if (!cm_req)
-		return QDF_STATUS_E_NOMEM;
-
-	if (qdf_is_macaddr_zero(bssid)) {
-		if (!wlan_mlme_is_data_stall_recovery_fw_supported(psoc)) {
-			mlme_debug("FW does not support data stall recovery, aborting roam invoke");
-			qdf_mem_free(cm_req);
-			return QDF_STATUS_E_NOSUPPORT;
-		}
-		cm_req->roam_req.req.forced_roaming = true;
-		goto send_evt;
-	}
-
-	if (!chan_freq || qdf_is_macaddr_zero(bssid)) {
-		mlme_debug("bssid " QDF_MAC_ADDR_FMT " chan_freq %d",
-			   QDF_MAC_ADDR_REF(bssid->bytes), chan_freq);
-		qdf_mem_free(cm_req);
-		return QDF_STATUS_E_FAILURE;
-	}
-
-	qdf_copy_macaddr(&cm_req->roam_req.req.bssid, bssid);
-	cm_req->roam_req.req.chan_freq = chan_freq;
-
-send_evt:
-	if (cm_req->roam_req.req.forced_roaming)
-		cm_req->roam_req.req.source = CM_ROAMING_NUD_FAILURE;
-	else
-		cm_req->roam_req.req.source = CM_ROAMING_HOST;
-
-	cm_req->roam_req.req.vdev_id = vdev_id;
-	status = cm_sm_deliver_event(vdev, WLAN_CM_SM_EV_ROAM_INVOKE,
-				     sizeof(*cm_req), cm_req);
-
-	if (QDF_IS_STATUS_ERROR(status))
-		qdf_mem_free(cm_req);
-
-	return status;
-}
-
 QDF_STATUS
 cm_send_roam_invoke_req(struct cnx_mgr *cm_ctx, struct cm_req *req)
 {

+ 4 - 11
components/umac/mlme/connection_mgr/core/src/wlan_cm_roam_offload.h

@@ -109,13 +109,14 @@ cm_roam_fill_rssi_change_params(struct wlan_objmgr_psoc *psoc, uint8_t vdev_id,
  */
 void cm_dump_freq_list(struct rso_chan_info *chan_info);
 
-#if defined(WLAN_FEATURE_ROAM_OFFLOAD) && defined(FEATURE_CM_ENABLE)
+#ifdef FEATURE_CM_ENABLE
 /**
  * cm_start_roam_invoke() - Validate and send Roam invoke req to CM
  * @pdev: Pdev pointer
  * @vdev: vdev
  * @bssid: Target bssid
  * @chan_freq: channel frequency on which reassoc should be send
+ * @source: source of the roam invoke
  *
  * Return: QDF_STATUS
  */
@@ -123,16 +124,8 @@ QDF_STATUS
 cm_start_roam_invoke(struct wlan_objmgr_psoc *psoc,
 		     struct wlan_objmgr_vdev *vdev,
 		     struct qdf_mac_addr *bssid,
-		     uint32_t chan_freq);
-#else
-static inline QDF_STATUS
-cm_start_roam_invoke(struct wlan_objmgr_psoc *psoc,
-		     struct wlan_objmgr_vdev *vdev,
-		     struct qdf_mac_addr *bssid,
-		     uint32_t chan_freq)
-{
-	return QDF_STATUS_SUCCESS;
-}
+		     uint32_t chan_freq,
+		     enum wlan_cm_source source);
 #endif
 #endif
 

+ 10 - 0
components/umac/mlme/connection_mgr/core/src/wlan_cm_vdev_api.h

@@ -125,6 +125,16 @@ struct cm_peer_create_req {
 	struct qdf_mac_addr peer_mac;
 };
 
+/**
+ * struct cm_host_roam_start_ind - roam start ind for host roam from FW
+ * @vdev_id: vdev id
+ * @pdev: pdev object
+ */
+struct cm_host_roam_start_ind {
+	uint8_t vdev_id;
+	struct wlan_objmgr_pdev *pdev;
+};
+
 /**
  * struct cm_ext_obj - Connection manager legacy object
  * @rso_cfg: connect info to be used in RSO.

+ 20 - 1
components/umac/mlme/connection_mgr/dispatcher/inc/wlan_cm_roam_api.h

@@ -615,13 +615,32 @@ void cm_roam_start_init_on_connect(struct wlan_objmgr_pdev *pdev,
  * @vdev_id: vdev_id
  * @bssid: Target bssid
  * @chan_freq: channel frequency on which reassoc should be send
+ * @source: source of roam
  *
  * Return: QDF_STATUS
  */
 QDF_STATUS
 wlan_cm_roam_invoke(struct wlan_objmgr_pdev *pdev, uint8_t vdev_id,
-		    struct qdf_mac_addr *bssid, qdf_freq_t chan_freq);
+		    struct qdf_mac_addr *bssid, qdf_freq_t chan_freq,
+		    enum wlan_cm_source source);
 
+#ifdef WLAN_FEATURE_HOST_ROAM
+/**
+ * wlan_cm_host_roam_start() - fw host roam start handler
+ * @msg: msg pointer
+ *
+ * Return: QDF_STATUS
+ */
+QDF_STATUS wlan_cm_host_roam_start(struct scheduler_msg *msg);
+#else
+static inline QDF_STATUS wlan_cm_host_roam_start(struct scheduler_msg *msg)
+{
+	if (msg && msg->bodyptr)
+		qdf_mem_free(msg->bodyptr);
+
+	return QDF_STATUS_SUCCESS;
+}
+#endif
 #endif
 
 #ifdef WLAN_FEATURE_ROAM_OFFLOAD

+ 3 - 1
components/umac/mlme/connection_mgr/dispatcher/inc/wlan_cm_roam_ucfg_api.h

@@ -112,12 +112,14 @@ ucfg_cm_update_roam_scan_scheme_bitmap(struct wlan_objmgr_psoc *psoc,
  * @vdev_id: vdev id
  * @bssid: Pointer to bssid to look for in scan cache
  * @ch_freq: channel on which reassoc should be send
+ * @source: source of roam
  *
  * Return: true or false
  */
 QDF_STATUS
 ucfg_wlan_cm_roam_invoke(struct wlan_objmgr_pdev *pdev, uint8_t vdev_id,
-			 struct qdf_mac_addr *bssid, qdf_freq_t ch_freq);
+			 struct qdf_mac_addr *bssid, qdf_freq_t ch_freq,
+			 enum wlan_cm_source source);
 
 #ifdef WLAN_FEATURE_FILS_SK
 QDF_STATUS

+ 18 - 8
components/umac/mlme/connection_mgr/dispatcher/src/wlan_cm_roam_api.c

@@ -1308,7 +1308,8 @@ QDF_STATUS cm_roam_release_lock(struct wlan_objmgr_vdev *vdev)
 
 QDF_STATUS
 wlan_cm_roam_invoke(struct wlan_objmgr_pdev *pdev, uint8_t vdev_id,
-		    struct qdf_mac_addr *bssid, qdf_freq_t chan_freq)
+		    struct qdf_mac_addr *bssid, qdf_freq_t chan_freq,
+		    enum wlan_cm_source source)
 {
 	QDF_STATUS status;
 	struct wlan_objmgr_psoc *psoc;
@@ -1327,18 +1328,27 @@ wlan_cm_roam_invoke(struct wlan_objmgr_pdev *pdev, uint8_t vdev_id,
 		return QDF_STATUS_E_NULL_VALUE;
 	}
 
-	if (cm_roam_offload_enabled(psoc)) {
-		status = cm_start_roam_invoke(psoc, vdev, bssid, chan_freq);
-	} else {
-		/* Add host roam support (LFR2) */
-		status = QDF_STATUS_E_FAILURE;
-	}
-
+	status = cm_start_roam_invoke(psoc, vdev, bssid, chan_freq, source);
 	wlan_objmgr_vdev_release_ref(vdev, WLAN_MLME_NB_ID);
 
 	return status;
 }
 
+#ifdef WLAN_FEATURE_HOST_ROAM
+QDF_STATUS wlan_cm_host_roam_start(struct scheduler_msg *msg)
+{
+	struct cm_host_roam_start_ind *req;
+	struct qdf_mac_addr bssid = QDF_MAC_ADDR_ZERO_INIT;
+
+	if (!msg || !msg->bodyptr)
+		return QDF_STATUS_E_FAILURE;
+
+	req = msg->bodyptr;
+	return wlan_cm_roam_invoke(req->pdev, req->vdev_id, &bssid, 0,
+				   CM_ROAMING_FW);
+}
+#endif
+
 #else
 struct rso_config *wlan_cm_get_rso_config_fl(struct wlan_objmgr_vdev *vdev,
 					     const char *func, uint32_t line)

+ 3 - 2
components/umac/mlme/connection_mgr/dispatcher/src/wlan_cm_roam_ucfg_api.c

@@ -242,9 +242,10 @@ ucfg_cm_update_fils_config(struct wlan_objmgr_psoc *psoc,
 
 QDF_STATUS
 ucfg_wlan_cm_roam_invoke(struct wlan_objmgr_pdev *pdev, uint8_t vdev_id,
-			 struct qdf_mac_addr *bssid, qdf_freq_t ch_freq)
+			 struct qdf_mac_addr *bssid, qdf_freq_t ch_freq,
+			 enum wlan_cm_source source)
 {
-	return wlan_cm_roam_invoke(pdev, vdev_id, bssid, ch_freq);
+	return wlan_cm_roam_invoke(pdev, vdev_id, bssid, ch_freq, source);
 }
 
 #endif

+ 5 - 3
core/hdd/src/wlan_hdd_ioctl.c

@@ -704,7 +704,8 @@ static int hdd_parse_reassoc_v1(struct hdd_adapter *adapter, const char *command
 	qdf_mem_copy(target_bssid.bytes, bssid, sizeof(tSirMacAddr));
 	status = ucfg_wlan_cm_roam_invoke(hdd_ctx->pdev,
 					  adapter->vdev_id,
-					  &target_bssid, freq);
+					  &target_bssid, freq,
+					  CM_ROAMING_HOST);
 	return qdf_status_to_os_return(status);
 #else
 	ret = hdd_reassoc(adapter, bssid, freq, REASSOC);
@@ -766,7 +767,8 @@ static int hdd_parse_reassoc_v2(struct hdd_adapter *adapter,
 		qdf_mem_copy(target_bssid.bytes, bssid, sizeof(tSirMacAddr));
 		status = ucfg_wlan_cm_roam_invoke(hdd_ctx->pdev,
 						  adapter->vdev_id,
-						  &target_bssid, freq);
+						  &target_bssid, freq,
+						  CM_ROAMING_HOST);
 		ret = qdf_status_to_os_return(status);
 #else
 		ret = hdd_reassoc(adapter, bssid, freq, REASSOC);
@@ -4619,7 +4621,7 @@ static int drv_cmd_fast_reassoc(struct hdd_adapter *adapter,
 #ifdef FEATURE_CM_ENABLE
 	qdf_mem_copy(target_bssid.bytes, bssid, sizeof(tSirMacAddr));
 	ucfg_wlan_cm_roam_invoke(hdd_ctx->pdev, adapter->vdev_id,
-				 &target_bssid, freq);
+				 &target_bssid, freq, CM_ROAMING_HOST);
 #else
 	mac_handle = hdd_ctx->mac_handle;
 	chan_freq = wlan_get_operation_chan_freq(adapter->vdev);

+ 1 - 1
core/hdd/src/wlan_hdd_nud_tracking.c

@@ -271,7 +271,7 @@ hdd_handle_nud_fail_sta(struct hdd_context *hdd_ctx,
 		qdf_zero_macaddr(&bssid);
 		ucfg_wlan_cm_roam_invoke(hdd_ctx->pdev,
 					 adapter->vdev_id,
-					 &bssid, 0);
+					 &bssid, 0, CM_ROAMING_NUD_FAILURE);
 #endif
 	}
 }

+ 1 - 1
core/hdd/src/wlan_hdd_sysfs_reassoc.c

@@ -62,7 +62,7 @@ __wlan_hdd_store_reassoc_sysfs(struct net_device *net_dev, char const *buf,
 
 #ifdef FEATURE_CM_ENABLE
 	ucfg_wlan_cm_roam_invoke(hdd_ctx->pdev, adapter->vdev_id,
-				 &target_bssid, operating_ch);
+				 &target_bssid, operating_ch, CM_ROAMING_HOST);
 #else
 	sme_get_modify_profile_fields(mac_handle, adapter->vdev_id,
 				      &mod_fields);

+ 2 - 1
core/hdd/src/wlan_hdd_wext.c

@@ -6631,7 +6631,8 @@ static int __iw_setnone_getnone(struct net_device *dev,
 					    &target_bssid);
 #ifdef FEATURE_CM_ENABLE
 		ucfg_wlan_cm_roam_invoke(hdd_ctx->pdev, adapter->vdev_id,
-					 &target_bssid, operating_ch);
+					 &target_bssid, operating_ch,
+					 CM_ROAMING_HOST);
 #else
 
 		sme_get_modify_profile_fields(mac_handle, adapter->vdev_id,

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

@@ -2108,12 +2108,14 @@ struct sir_antenna_mode_resp {
 	enum set_antenna_mode_status status;
 };
 
+#ifndef FEATURE_CM_ENABLE
 /* / Definition for Candidate found indication from FW */
 typedef struct sSirSmeCandidateFoundInd {
 	uint16_t messageType;   /* eWNI_SME_CANDIDATE_FOUND_IND */
 	uint16_t length;
 	uint8_t sessionId;      /* Session Identifier */
 } tSirSmeCandidateFoundInd, *tpSirSmeCandidateFoundInd;
+#endif
 
 #ifdef WLAN_FEATURE_11W
 typedef struct sSirWlanExcludeUnencryptParam {

+ 2 - 1
core/sme/src/qos/sme_qos.c

@@ -7601,7 +7601,8 @@ static QDF_STATUS sme_qos_request_reassoc(struct mac_context *mac,
 	wlan_mlme_get_bssid_vdev_id(mac->pdev, sessionId, &bssid);
 	ch_freq = wlan_get_operation_chan_freq_vdev_id(mac->pdev, sessionId);
 #ifdef FEATURE_CM_ENABLE
-	status = wlan_cm_roam_invoke(mac->pdev, sessionId, &bssid, ch_freq);
+	status = wlan_cm_roam_invoke(mac->pdev, sessionId, &bssid, ch_freq,
+				     CM_ROAMING_HOST);
 #else
 	status = ucfg_mlme_get_roaming_offload(mac->psoc, &roam_offload_enable);
 	if (QDF_IS_STATUS_ERROR(status))

+ 29 - 11
core/wma/src/wma_scan_roam.c

@@ -4186,11 +4186,31 @@ QDF_STATUS wma_scan_probe_setoui(tp_wma_handle wma,
  */
 void wma_roam_better_ap_handler(tp_wma_handle wma, uint32_t vdev_id)
 {
-#ifndef FEATURE_CM_ENABLE
-	struct scheduler_msg cds_msg = {0};
-	tSirSmeCandidateFoundInd *candidate_ind;
+	struct scheduler_msg msg = {0};
 	QDF_STATUS status;
+#ifdef FEATURE_CM_ENABLE
+	struct cm_host_roam_start_ind *ind;
+#else
+	tSirSmeCandidateFoundInd *candidate_ind;
+#endif
+
+#ifdef FEATURE_CM_ENABLE
+	ind = qdf_mem_malloc(sizeof(*ind));
+	if (!ind)
+		return;
 
+	wma->interfaces[vdev_id].roaming_in_progress = true;
+	ind->pdev = wma->pdev;
+	ind->vdev_id = vdev_id;
+	msg.bodyptr = ind;
+	msg.callback = wlan_cm_host_roam_start;
+	wma_debug("Posting ROam start ind to connection manager, vdev %d",
+		  vdev_id);
+	status = scheduler_post_message(QDF_MODULE_ID_WMA,
+					QDF_MODULE_ID_OS_IF,
+					QDF_MODULE_ID_SCAN, &msg);
+
+#else
 	candidate_ind = qdf_mem_malloc(sizeof(tSirSmeCandidateFoundInd));
 	if (!candidate_ind)
 		return;
@@ -4200,18 +4220,16 @@ void wma_roam_better_ap_handler(tp_wma_handle wma, uint32_t vdev_id)
 	candidate_ind->sessionId = vdev_id;
 	candidate_ind->length = sizeof(tSirSmeCandidateFoundInd);
 
-	cds_msg.type = eWNI_SME_CANDIDATE_FOUND_IND;
-	cds_msg.bodyptr = candidate_ind;
-	cds_msg.callback = sme_mc_process_handler;
+	msg.type = eWNI_SME_CANDIDATE_FOUND_IND;
+	msg.bodyptr = candidate_ind;
+	msg.callback = sme_mc_process_handler;
 	wma_debug("Posting candidate ind to SME, vdev %d", vdev_id);
 
 	status = scheduler_post_message(QDF_MODULE_ID_WMA, QDF_MODULE_ID_SME,
-					QDF_MODULE_ID_SCAN,  &cds_msg);
-	if (QDF_IS_STATUS_ERROR(status))
-		qdf_mem_free(candidate_ind);
-#else
-	/* post to osif queue to call cm API for LFR2 */
+					QDF_MODULE_ID_SCAN,  &msg);
 #endif
+	if (QDF_IS_STATUS_ERROR(status))
+		qdf_mem_free(msg.bodyptr);
 }
 
 /**