Browse Source

qcacld-3.0: Support roam ho fail and roam invoke fail ind in CM

Add change to support roam ho fail and roam invoke fail
indication in connection manager.

Change-Id: I8e4fed2ca4b9c6e95da86b0c37e39da8f2bc4953
CRs-Fixed: 2906319
Amruta Kulkarni 4 năm trước cách đây
mục cha
commit
6c678097a0

+ 156 - 0
components/umac/mlme/connection_mgr/core/src/wlan_cm_roam_fw_sync.c

@@ -38,6 +38,7 @@
 #include "wlan_mlme_vdev_mgr_interface.h"
 #include "wlan_pkt_capture_ucfg_api.h"
 #include "cds_utils.h"
+#include "wlan_roam_debug.h"
 #ifdef FEATURE_CM_ENABLE
 #include "connection_mgr/core/src/wlan_cm_roam.h"
 #include "connection_mgr/core/src/wlan_cm_main.h"
@@ -767,4 +768,159 @@ QDF_STATUS cm_fw_roam_complete(struct cnx_mgr *cm_ctx, void *data)
 end:
 	return status;
 }
+
+QDF_STATUS cm_fw_roam_invoke_fail(struct wlan_objmgr_psoc *psoc,
+				  uint8_t vdev_id)
+{
+	QDF_STATUS status;
+	struct wlan_objmgr_vdev *vdev;
+	wlan_cm_id cm_id;
+	enum wlan_cm_source source;
+	struct cnx_mgr *cm_ctx;
+	struct cm_roam_req *roam_req = NULL;
+
+	vdev = wlan_objmgr_get_vdev_by_id_from_psoc(psoc,
+						    vdev_id,
+						    WLAN_MLME_SB_ID);
+
+	if (!vdev) {
+		mlme_err("vdev object is NULL");
+		return QDF_STATUS_E_NULL_VALUE;
+	}
+
+	cm_ctx = cm_get_cm_ctx(vdev);
+	if (!cm_ctx) {
+		status = QDF_STATUS_E_NULL_VALUE;
+		goto error;
+	}
+
+	roam_req = cm_get_first_roam_command(vdev);
+	if (!roam_req) {
+		mlme_err("Failed to find roam req from list");
+		status = QDF_STATUS_E_FAILURE;
+		goto error;
+	}
+
+	cm_id = roam_req->cm_id;
+	source = roam_req->req.source;
+
+	status = cm_sm_deliver_event(vdev, WLAN_CM_SM_EV_ROAM_INVOKE_FAIL,
+				     sizeof(wlan_cm_id), &cm_id);
+
+	if (source == CM_ROAMING_HOST ||
+	    source == CM_ROAMING_NUD_FAILURE)
+		status = cm_disconnect(psoc, vdev_id,
+				       CM_ROAM_DISCONNECT,
+				       REASON_USER_TRIGGERED_ROAM_FAILURE,
+				       NULL);
+
+	if (QDF_IS_STATUS_ERROR(status))
+		cm_remove_cmd(cm_ctx, &cm_id);
+
+error:
+	wlan_objmgr_vdev_release_ref(vdev, WLAN_MLME_SB_ID);
+	return status;
+}
+
+static QDF_STATUS cm_handle_ho_fail(struct scheduler_msg *msg)
+{
+	QDF_STATUS status;
+	struct cm_ho_fail_ind *ind = NULL;
+	struct wlan_objmgr_vdev *vdev;
+	struct wlan_objmgr_pdev *pdev;
+	struct cnx_mgr *cm_ctx;
+	wlan_cm_id cm_id;
+	struct reject_ap_info ap_info;
+	struct cm_roam_req *roam_req = NULL;
+
+	if (!msg || !msg->bodyptr)
+		return QDF_STATUS_E_FAILURE;
+
+	ind = msg->bodyptr;
+
+	vdev = wlan_objmgr_get_vdev_by_id_from_psoc(ind->psoc, ind->vdev_id,
+						    WLAN_MLME_CM_ID);
+	if (!vdev) {
+		mlme_err("vdev_id: %d : vdev not found", ind->vdev_id);
+		qdf_mem_free(ind);
+		return QDF_STATUS_E_INVAL;
+	}
+
+	pdev = wlan_vdev_get_pdev(vdev);
+	if (!pdev) {
+		mlme_err("pdev object is NULL");
+		status = QDF_STATUS_E_NULL_VALUE;
+		goto error;
+	}
+
+	cm_ctx = cm_get_cm_ctx(vdev);
+	if (!cm_ctx) {
+		status = QDF_STATUS_E_NULL_VALUE;
+		goto error;
+	}
+
+	roam_req = cm_get_first_roam_command(vdev);
+	if (!roam_req) {
+		mlme_err("Failed to find roam req from list");
+		status = QDF_STATUS_E_FAILURE;
+		goto error;
+	}
+
+	cm_id = roam_req->cm_id;
+	cm_sm_deliver_event(vdev, WLAN_CM_SM_EV_ROAM_HO_FAIL,
+			    sizeof(wlan_cm_id), &cm_id);
+
+	ap_info.bssid = ind->bssid;
+	ap_info.reject_ap_type = DRIVER_AVOID_TYPE;
+	ap_info.reject_reason = REASON_ROAM_HO_FAILURE;
+	ap_info.source = ADDED_BY_DRIVER;
+	wlan_blm_add_bssid_to_reject_list(pdev, &ap_info);
+
+	wlan_roam_debug_log(ind->vdev_id,
+			    DEBUG_ROAM_SYNCH_FAIL,
+			    DEBUG_INVALID_PEER_ID, NULL, NULL, 0, 0);
+
+	status = cm_disconnect(ind->psoc, ind->vdev_id,
+			       CM_MLME_DISCONNECT,
+			       REASON_FW_TRIGGERED_ROAM_FAILURE,
+			       NULL);
+
+	if (QDF_IS_STATUS_ERROR(status))
+		cm_remove_cmd(cm_ctx, &cm_id);
+
+error:
+	wlan_objmgr_vdev_release_ref(vdev, WLAN_MLME_CM_ID);
+	qdf_mem_free(ind);
+
+	return QDF_STATUS_SUCCESS;
+}
+
+void cm_fw_ho_fail_req(struct wlan_objmgr_psoc *psoc,
+		       uint8_t vdev_id, struct qdf_mac_addr bssid)
+{
+	QDF_STATUS status;
+	struct scheduler_msg ind_msg = {0};
+	struct cm_ho_fail_ind *ind = NULL;
+
+	ind = qdf_mem_malloc(sizeof(*ind));
+	if (!ind)
+		return;
+
+	ind->vdev_id = vdev_id;
+	ind->psoc = psoc;
+	ind->bssid = bssid;
+
+	ind_msg.bodyptr = ind;
+	ind_msg.callback = cm_handle_ho_fail;
+
+	status = scheduler_post_message(QDF_MODULE_ID_MLME, QDF_MODULE_ID_OS_IF,
+					QDF_MODULE_ID_OS_IF, &ind_msg);
+
+	if (QDF_IS_STATUS_ERROR(status)) {
+		mlme_err("Failed to post HO fail indication on vdev_id %d",
+			 vdev_id);
+		qdf_mem_free(ind);
+		return;
+	}
+}
 #endif // FEATURE_CM_ENABLE

+ 34 - 0
components/umac/mlme/connection_mgr/core/src/wlan_cm_roam_i.h

@@ -140,6 +140,40 @@ cm_fw_roam_sync_start_ind(struct wlan_objmgr_vdev *vdev,
 QDF_STATUS
 cm_fw_roam_sync_propagation(struct wlan_objmgr_psoc *psoc, uint8_t vdev_id,
 			    struct roam_offload_synch_ind *roam_synch_data);
+
+/**
+ * cm_fw_ho_fail_req() - Post roam ho fail req to CM SM
+ * @psoc: psoc pointer
+ * @vdev_id: vdev id
+ * @bssid: bssid mac addr
+ *
+ * This function posts roam ho fail event change to
+ * connection manager state machine
+ *
+ * Return: void
+ */
+void cm_fw_ho_fail_req(struct wlan_objmgr_psoc *psoc,
+		       uint8_t vdev_id, struct qdf_mac_addr bssid);
+
+/**
+ * cm_fw_roam_invoke_fail() - Post roam invoke fail to CM SM
+ * @psoc: psoc pointer
+ * @vdev_id: vdev id
+ *
+ * This function posts roam invoke fail event change to
+ * connection manager state machine
+ *
+ * Return: QDF_STATUS
+ */
+QDF_STATUS cm_fw_roam_invoke_fail(struct wlan_objmgr_psoc *psoc,
+				  uint8_t vdev_id);
+#else
+static inline
+QDF_STATUS cm_fw_roam_invoke_fail(struct wlan_objmgr_psoc *psoc,
+				  uint8_t vdev_id)
+{
+	return QDF_STATUS_E_NOSUPPORT;
+}
 #endif /*WLAN_FEATURE_ROAM_OFFLOAD */
 #endif /* FEATURE_CM_ENABLE */
 #endif /* _WLAN_CM_ROAM_I_H_ */

+ 12 - 0
components/umac/mlme/connection_mgr/dispatcher/inc/wlan_cm_roam_public_struct.h

@@ -1758,6 +1758,18 @@ struct cm_roam_values_copy {
 /* This should not be greater than MAX_NUMBER_OF_CONC_CONNECTIONS */
 #define MAX_VDEV_SUPPORTED 4
 
+/**
+ * struct cm_ho_fail_ind - ho fail indication to CM
+ * @vdev_id: vdev id
+ * @psoc: psoc object
+ * @bssid: bssid addr
+ */
+struct cm_ho_fail_ind {
+	uint8_t vdev_id;
+	struct wlan_objmgr_psoc *psoc;
+	struct qdf_mac_addr bssid;
+};
+
 /**
  * struct policy_mgr_vdev_mac_map - vdev id-mac id map
  * @vdev_id: VDEV id

+ 2 - 0
core/hdd/src/wlan_hdd_cfg.c

@@ -922,7 +922,9 @@ QDF_STATUS hdd_set_sme_config(struct hdd_context *hdd_ctx)
 	 */
 	sme_config->csr_config.phyMode =
 		hdd_cfg_xlate_to_csr_phy_mode(config->dot11Mode);
+#ifndef FEATURE_CM_ENABLE
 	sme_update_nud_config(mac_handle, config->enable_nud_tracking);
+#endif
 	if (config->dot11Mode == eHDD_DOT11_MODE_abg ||
 	    config->dot11Mode == eHDD_DOT11_MODE_11b ||
 	    config->dot11Mode == eHDD_DOT11_MODE_11g ||

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

@@ -746,7 +746,9 @@ struct mac_context {
 	struct wlan_mlme_chain_cfg fw_chain_cfg;
 	struct wlan_mlme_cfg *mlme_cfg;
 	tAniSirLim lim;
+#ifndef FEATURE_CM_ENABLE
 	uint8_t nud_fail_behaviour;
+#endif
 	struct sch_context sch;
 	tAniSirSys sys;
 

+ 2 - 2
core/sme/inc/sme_api.h

@@ -432,14 +432,14 @@ void sme_cleanup_session(mac_handle_t mac_handle, uint8_t vdev_id);
  */
 void sme_set_curr_device_mode(mac_handle_t mac_handle,
 			      enum QDF_OPMODE curr_device_mode);
-
+#ifndef FEATURE_CM_ENABLE
 /**
  * sme_update_nud_config() - update nud config
  * @mac_handle: The handle returned by mac_open.
  * @nud_fail_behavior: Vlaue of nud fail behaviour
  */
 void sme_update_nud_config(mac_handle_t mac_handle, uint8_t nud_fail_behavior);
-
+#endif
 /**
  * sme_update_roam_params() - Store/Update the roaming params
  * @mac_handle: Opaque handle to the global MAC context

+ 2 - 1
core/sme/src/common/sme_api.c

@@ -918,13 +918,14 @@ void sme_update_fine_time_measurement_capab(mac_handle_t mac_handle,
 	}
 }
 
+#ifndef FEATURE_CM_ENABLE
 void sme_update_nud_config(mac_handle_t mac_handle, uint8_t nud_fail_behavior)
 {
 	struct mac_context *mac = MAC_CONTEXT(mac_handle);
 
 	mac->nud_fail_behaviour = nud_fail_behavior;
 }
-
+#endif
 /*
  * sme_update_config() - Change configurations for all SME moduels
  * The function updates some configuration for modules in SME, CSR, etc

+ 9 - 3
core/wma/src/wma_scan_roam.c

@@ -2416,6 +2416,7 @@ int wma_rssi_breached_event_handler(void *handle,
 }
 #endif /* FEATURE_RSSI_MONITOR */
 
+#ifndef FEATURE_CM_ENABLE
 #ifdef WLAN_FEATURE_ROAM_OFFLOAD
 /**
  * wma_roam_ho_fail_handler() - LFR3.0 roam hand off failed handler
@@ -2453,7 +2454,6 @@ wma_roam_ho_fail_handler(tp_wma_handle wma, uint32_t vdev_id,
 	}
 }
 
-#ifndef FEATURE_CM_ENABLE
 /**
  * wma_process_roam_synch_complete() - roam synch complete command to fw.
  * @handle: wma handle
@@ -2490,8 +2490,8 @@ void wma_process_roam_synch_complete(WMA_HANDLE handle, uint8_t vdev_id)
 			    DEBUG_INVALID_PEER_ID, NULL, NULL, 0, 0);
 
 }
-#endif
 #endif /* WLAN_FEATURE_ROAM_OFFLOAD */
+#endif /* FEATURE_CM_ENABLE */
 
 QDF_STATUS wma_pre_chan_switch_setup(uint8_t vdev_id)
 {
@@ -4448,7 +4448,11 @@ int wma_roam_event_callback(WMA_HANDLE handle, uint8_t *event_buf,
 		wma_debug("mac addr to avoid "QDF_MAC_ADDR_FMT,
 			  QDF_MAC_ADDR_REF(bssid.bytes));
 		wma_handle_hw_mode_transition(wma_handle, param_buf);
+#ifdef FEATURE_CM_ENABLE
+		cm_fw_ho_fail_req(wma_handle->psoc, wmi_event->vdev_id, bssid);
+#else
 		wma_roam_ho_fail_handler(wma_handle, wmi_event->vdev_id, bssid);
+#endif
 		lim_sae_auth_cleanup_retry(wma_handle->mac_context,
 					   wmi_event->vdev_id);
 		break;
@@ -4469,7 +4473,9 @@ int wma_roam_event_callback(WMA_HANDLE handle, uint8_t *event_buf,
 		lim_sae_auth_cleanup_retry(wma_handle->mac_context,
 					   wmi_event->vdev_id);
 		roam_synch_data->roamed_vdev_id = wmi_event->vdev_id;
-#ifndef FEATURE_CM_ENABLE
+#ifdef FEATURE_CM_ENABLE
+		cm_fw_roam_invoke_fail(wma_handle->psoc, wmi_event->vdev_id);
+#else
 		wma_handle->csr_roam_synch_cb(wma_handle->mac_context,
 					      roam_synch_data, NULL,
 					      SIR_ROAMING_INVOKE_FAIL);