Prechádzať zdrojové kódy

qcacld-3.0: SAP in CAC, block concurrency

At the time of starting / stopping 2nd or 3rd connection,
Host sends WMI_PDEV_SET_HW_CMDID command to FW to change
HW mode to DBS / Single-Mac based on concurrency rule.
FW upon receiving this command turns off TXRX chainmask
which means that radar pulses might get missed for
20ms - 50ms during CAC period. To fix this, Host should
block new connection when existing SAP is performing CAC
on DFS channel.

Change-Id: I51eb117afa763a6ef54211808875419026c9075b
CRs-Fixed: 2533717
Rachit Kankane 5 rokov pred
rodič
commit
914b79a337

+ 1 - 0
components/cmn_services/policy_mgr/inc/wlan_policy_mgr_api.h

@@ -1309,6 +1309,7 @@ struct policy_mgr_hdd_cbacks {
 	enum QDF_OPMODE (*hdd_get_device_mode)(uint32_t session_id);
 	bool (*hdd_wapi_security_sta_exist)(void);
 	bool (*hdd_is_chan_switch_in_progress)(void);
+	bool (*hdd_is_cac_in_progress)(void);
 	void (*wlan_hdd_set_sap_csa_reason)(struct wlan_objmgr_psoc *psoc,
 					    uint8_t vdev_id, uint8_t reason);
 };

+ 11 - 0
components/cmn_services/policy_mgr/src/wlan_policy_mgr_action.c

@@ -165,6 +165,17 @@ QDF_STATUS policy_mgr_pdev_set_hw_mode(struct wlan_objmgr_psoc *psoc,
 		return QDF_STATUS_E_FAILURE;
 	}
 
+	/* Don't send WMI_PDEV_SET_HW_MODE_CMDID to FW if existing SAP / GO is
+	 * in CAC-in-progress state. Host is blocking this command as FW is
+	 * having design limitation and FW don't expect this command when CAC
+	 * is in progress state.
+	 */
+	if (pm_ctx->hdd_cbacks.hdd_is_cac_in_progress &&
+	    pm_ctx->hdd_cbacks.hdd_is_cac_in_progress()) {
+		policy_mgr_err("SAP CAC_IN_PROGRESS state, drop WMI_PDEV_SET_HW_MODE_CMDID");
+		return QDF_STATUS_E_FAILURE;
+	}
+
 	msg.hw_mode_index = hw_mode_index;
 	msg.set_hw_mode_cb = (void *)policy_mgr_pdev_set_hw_mode_cb;
 	msg.reason = reason;

+ 8 - 1
components/cmn_services/policy_mgr/src/wlan_policy_mgr_core.c

@@ -1464,6 +1464,7 @@ void pm_dbs_opportunistic_timer_handler(void *data)
 	uint32_t session_id;
 	struct wlan_objmgr_psoc *psoc = (struct wlan_objmgr_psoc *)data;
 	enum policy_mgr_conn_update_reason reason;
+	struct policy_mgr_psoc_priv_obj *pm_ctx = policy_mgr_get_context(psoc);
 
 	if (!psoc) {
 		policy_mgr_err("Invalid Context");
@@ -1473,8 +1474,14 @@ void pm_dbs_opportunistic_timer_handler(void *data)
 	/* if we still need it */
 	action = policy_mgr_need_opportunistic_upgrade(psoc, &reason);
 	policy_mgr_debug("action:%d", action);
-	if (!action)
+	if (!action) {
 		return;
+	} else if (pm_ctx->hdd_cbacks.hdd_is_cac_in_progress &&
+		   pm_ctx->hdd_cbacks.hdd_is_cac_in_progress()) {
+		policy_mgr_debug("SAP is in CAC_IN_PROGRESS state, restarting");
+		policy_mgr_restart_opportunistic_timer(psoc, false);
+		return;
+	}
 	session_id = pm_get_vdev_id_of_first_conn_idx(psoc);
 	policy_mgr_next_actions(psoc, session_id, action,
 				reason);

+ 4 - 0
components/cmn_services/policy_mgr/src/wlan_policy_mgr_init_deinit.c

@@ -610,6 +610,8 @@ QDF_STATUS policy_mgr_register_hdd_cb(struct wlan_objmgr_psoc *psoc,
 		hdd_cbacks->hdd_wapi_security_sta_exist;
 	pm_ctx->hdd_cbacks.hdd_is_chan_switch_in_progress =
 		hdd_cbacks->hdd_is_chan_switch_in_progress;
+	pm_ctx->hdd_cbacks.hdd_is_cac_in_progress =
+		hdd_cbacks->hdd_is_cac_in_progress;
 
 	return QDF_STATUS_SUCCESS;
 }
@@ -628,6 +630,8 @@ QDF_STATUS policy_mgr_deregister_hdd_cb(struct wlan_objmgr_psoc *psoc)
 	pm_ctx->hdd_cbacks.wlan_hdd_get_channel_for_sap_restart = NULL;
 	pm_ctx->hdd_cbacks.get_mode_for_non_connected_vdev = NULL;
 	pm_ctx->hdd_cbacks.hdd_get_device_mode = NULL;
+	pm_ctx->hdd_cbacks.hdd_is_chan_switch_in_progress = NULL;
+	pm_ctx->hdd_cbacks.hdd_is_cac_in_progress = NULL;
 
 	return QDF_STATUS_SUCCESS;
 }

+ 15 - 0
core/hdd/src/wlan_hdd_main.c

@@ -2957,6 +2957,19 @@ static bool hdd_is_chan_switch_in_progress(void)
 	return false;
 }
 
+/**
+ * hdd_is_cac_in_progress() - Check if any SAP connection is performing
+ * CAC on DFS channel
+ *
+ * Return: true, if any of existing SAP is performing CAC
+ * or else false
+ */
+static bool hdd_is_cac_in_progress(void)
+{
+	struct hdd_context *hdd_ctx = cds_get_context(QDF_MODULE_ID_HDD);
+
+	return (hdd_ctx->dev_dfs_cac_status == DFS_CAC_IN_PROGRESS);
+}
 
 static void hdd_register_policy_manager_callback(
 			struct wlan_objmgr_psoc *psoc)
@@ -2975,6 +2988,8 @@ static void hdd_register_policy_manager_callback(
 		hdd_wapi_security_sta_exist;
 	hdd_cbacks.hdd_is_chan_switch_in_progress =
 				hdd_is_chan_switch_in_progress;
+	hdd_cbacks.hdd_is_cac_in_progress =
+				hdd_is_cac_in_progress;
 	hdd_cbacks.wlan_hdd_set_sap_csa_reason =
 				wlan_hdd_set_sap_csa_reason;
 

+ 10 - 4
core/sap/src/sap_api_link_cntl.c

@@ -1278,10 +1278,16 @@ QDF_STATUS wlansap_roam_callback(void *ctx,
 		wlansap_roam_process_ch_change_success(mac_ctx, sap_ctx,
 						csr_roam_info, &qdf_ret_status);
 
-		qdf_ret_status =
-			sap_signal_hdd_event(sap_ctx, csr_roam_info,
-					     eSAP_CHANNEL_CHANGE_RESP,
-					     (void *)QDF_STATUS_SUCCESS);
+		if (QDF_IS_STATUS_ERROR(qdf_ret_status))
+			qdf_ret_status =
+				sap_signal_hdd_event(sap_ctx, csr_roam_info,
+						     eSAP_CHANNEL_CHANGE_RESP,
+						   (void *)eSAP_STATUS_FAILURE);
+		else
+			qdf_ret_status =
+				sap_signal_hdd_event(sap_ctx, csr_roam_info,
+						     eSAP_CHANNEL_CHANGE_RESP,
+						   (void *)QDF_STATUS_SUCCESS);
 		break;
 	case eCSR_ROAM_RESULT_CHANNEL_CHANGE_FAILURE:
 		/* This is much more serious issue, we have to vacate the