소스 검색

qcacld-3.0: Move pre cac failure code to pre cac component

Move pre cac failure code to pre cac component.

Change-Id: Ie27c93737fff89a4f5f3c2ceaa51223bd246e43b
CRs-Fixed: 3199950
Dundi Raviteja 2 년 전
부모
커밋
a52b682bcb

+ 20 - 0
components/pre_cac/core/src/wlan_pre_cac_main.c

@@ -159,6 +159,26 @@ static void pre_cac_conditional_csa_ind(struct wlan_objmgr_psoc *psoc,
 							vdev_id, status);
 }
 
+static void pre_cac_handle_failure(void *data)
+{
+	struct wlan_objmgr_vdev *vdev = (struct wlan_objmgr_vdev *)data;
+
+	pre_cac_complete(vdev, false);
+}
+
+void pre_cac_handle_radar_ind(struct wlan_objmgr_vdev *vdev)
+{
+	struct wlan_objmgr_psoc *psoc = wlan_vdev_get_psoc(vdev);
+	struct pre_cac_psoc_priv *psoc_priv = pre_cac_psoc_get_priv(psoc);
+
+	pre_cac_conditional_csa_ind(psoc, vdev->vdev_objmgr.vdev_id, false);
+
+	qdf_create_work(0, &psoc_priv->pre_cac_work,
+			pre_cac_handle_failure,
+			vdev);
+	qdf_sched_work(0, &psoc_priv->pre_cac_work);
+}
+
 void pre_cac_handle_cac_end(struct wlan_objmgr_vdev *vdev)
 {
 	struct wlan_objmgr_psoc *psoc = wlan_vdev_get_psoc(vdev);

+ 8 - 0
components/pre_cac/core/src/wlan_pre_cac_main.h

@@ -313,4 +313,12 @@ void pre_cac_set_freq(struct wlan_objmgr_vdev *vdev,
  * Return: pre cac frequency
  */
 qdf_freq_t pre_cac_get_freq(struct wlan_objmgr_vdev *vdev);
+
+/**
+ * pre_cac_handle_radar_ind() - Handle pre cac radar indication
+ * @vdev: vdev object manager
+ *
+ * Return: None
+ */
+void pre_cac_handle_radar_ind(struct wlan_objmgr_vdev *vdev);
 #endif /* end of _WLAN_PRE_CAC_MAIN_H_ */

+ 8 - 0
components/pre_cac/dispatcher/inc/wlan_pre_cac_api.h

@@ -85,6 +85,14 @@ void wlan_pre_cac_set_freq_before_pre_cac(struct wlan_objmgr_vdev *vdev,
  */
 qdf_freq_t
 wlan_pre_cac_get_freq_before_pre_cac(struct wlan_objmgr_vdev *vdev);
+
+/**
+ * wlan_pre_cac_handle_radar_ind() - Handle pre cac radar indication
+ * @vdev: vdev object manager
+ *
+ * Return: None
+ */
+void wlan_pre_cac_handle_radar_ind(struct wlan_objmgr_vdev *vdev);
 #else
 static inline bool wlan_pre_cac_get_status(struct wlan_objmgr_psoc *psoc)
 {

+ 5 - 0
components/pre_cac/dispatcher/src/wlan_pre_cac_api.c

@@ -53,6 +53,11 @@ bool wlan_pre_cac_complete_get(struct wlan_objmgr_vdev *vdev)
 	return pre_cac_complete_get(vdev);
 }
 
+void wlan_pre_cac_handle_radar_ind(struct wlan_objmgr_vdev *vdev)
+{
+	pre_cac_handle_radar_ind(vdev);
+}
+
 void wlan_pre_cac_handle_cac_end(struct wlan_objmgr_vdev *vdev)
 {
 	pre_cac_handle_cac_end(vdev);

+ 2 - 8
core/hdd/src/wlan_hdd_hostapd.c

@@ -2250,7 +2250,7 @@ QDF_STATUS hdd_hostapd_sap_event_cb(struct sap_event *sap_event,
  * The code under this macro will be removed
  * once pre_cac componentization is done
  */
-#ifdef PRE_CAC_SUPPORT
+#if defined(PRE_CAC_SUPPORT) && !defined(PRE_CAC_COMP)
 	case eSAP_DFS_RADAR_DETECT_DURING_PRE_CAC:
 		hdd_debug("notification for radar detect during pre cac:%d",
 			adapter->vdev_id);
@@ -2263,11 +2263,6 @@ QDF_STATUS hdd_hostapd_sap_event_cb(struct sap_event *sap_event,
 		qdf_sched_work(0, &hdd_ctx->sap_pre_cac_work);
 		hdd_son_deliver_cac_status_event(adapter, true);
 		break;
-/*
- * Code under PRE_CAC_COMP will be cleaned up
- * once pre cac component is done
- */
-#ifndef PRE_CAC_COMP
 	case eSAP_DFS_PRE_CAC_END:
 		hdd_debug("pre cac end notification received:%d",
 			adapter->vdev_id);
@@ -2283,8 +2278,7 @@ QDF_STATUS hdd_hostapd_sap_event_cb(struct sap_event *sap_event,
 				(void *)adapter);
 		qdf_sched_work(0, &hdd_ctx->sap_pre_cac_work);
 		break;
-#endif /* PRE_CAC_COMP */
-#endif
+#endif /* PRE_CAC_SUPPORT and PRE_CAC_COMP */
 	case eSAP_DFS_NO_AVAILABLE_CHANNEL:
 		wlan_hdd_send_svc_nlink_msg
 			(hdd_ctx->radio_index,

+ 28 - 14
core/hdd/src/wlan_hdd_pre_cac.c

@@ -22,6 +22,7 @@
 #include "osif_pre_cac.h"
 #include "wlan_pre_cac_ucfg_api.h"
 #include "wlan_ipa_ucfg_api.h"
+#include "wlan_hdd_son.h"
 
 void hdd_send_conditional_chan_switch_status(struct hdd_context *hdd_ctx,
 					     struct wireless_dev *wdev,
@@ -92,7 +93,15 @@ static int wlan_hdd_set_pre_cac_complete_status(struct hdd_adapter *ap_adapter,
  *
  * Return: None
  */
+/*
+ * Code under PRE_CAC_COMP will be cleaned up
+ * once pre cac component is done
+ */
+#ifndef PRE_CAC_COMP
 static void __wlan_hdd_sap_pre_cac_failure(struct hdd_adapter *adapter)
+#else
+static void wlan_hdd_pre_cac_failure(struct hdd_adapter *adapter)
+#endif
 {
 	struct hdd_context *hdd_ctx;
 
@@ -107,6 +116,11 @@ static void __wlan_hdd_sap_pre_cac_failure(struct hdd_adapter *adapter)
 	hdd_exit();
 }
 
+/*
+ * Code under PRE_CAC_COMP will be cleaned up
+ * once pre cac component is done
+ */
+#ifndef PRE_CAC_COMP
 /**
  * wlan_hdd_sap_pre_cac_failure() - Process the pre cac failure
  * @data: AP adapter
@@ -130,11 +144,6 @@ void wlan_hdd_sap_pre_cac_failure(void *data)
 	osif_vdev_sync_trans_stop(vdev_sync);
 }
 
-/*
- * Code under PRE_CAC_COMP will be cleaned up
- * once pre cac component is done
- */
-#ifndef PRE_CAC_COMP
 /**
  * __wlan_hdd_sap_pre_cac_success() - Process the pre cac result
  * @adapter: AP adapter
@@ -879,23 +888,25 @@ wlan_hdd_pre_cac_conditional_freq_switch_ind(struct wlan_objmgr_vdev *vdev,
 					     bool completed)
 {
 	struct wlan_objmgr_psoc *psoc = wlan_vdev_get_psoc(vdev);
+	uint8_t vdev_id = vdev->vdev_objmgr.vdev_id;
 	struct hdd_adapter *adapter;
 	struct hdd_ap_ctx *ap_ctx;
 
-	if (completed) {
-		uint8_t vdev_id = vdev->vdev_objmgr.vdev_id;
-
-		adapter = wlan_hdd_get_adapter_from_vdev(psoc, vdev_id);
-		if (!adapter) {
-			hdd_err("Invalid adapter");
-			return;
-		}
+	adapter = wlan_hdd_get_adapter_from_vdev(psoc, vdev_id);
+	if (!adapter) {
+		hdd_err("Invalid adapter");
+		return;
+	}
 
+	if (completed) {
 		ap_ctx = WLAN_HDD_GET_AP_CTX_PTR(adapter);
 		ap_ctx->dfs_cac_block_tx = false;
 		ucfg_ipa_set_dfs_cac_tx(adapter->hdd_ctx->pdev,
 					ap_ctx->dfs_cac_block_tx);
 		adapter->hdd_ctx->dev_dfs_cac_status = DFS_CAC_ALREADY_DONE;
+	} else {
+		adapter->hdd_ctx->dev_dfs_cac_status = DFS_CAC_NEVER_DONE;
+		hdd_son_deliver_cac_status_event(adapter, true);
 	}
 }
 
@@ -913,7 +924,10 @@ wlan_hdd_pre_cac_complete(struct wlan_objmgr_vdev *vdev,
 		return;
 	}
 
-	wlan_hdd_pre_cac_success(adapter);
+	if (QDF_IS_STATUS_SUCCESS(status))
+		wlan_hdd_pre_cac_success(adapter);
+	else
+		wlan_hdd_pre_cac_failure(adapter);
 }
 
 struct osif_pre_cac_legacy_ops pre_cac_legacy_ops = {

+ 21 - 0
core/sap/src/sap_api_link_cntl.c

@@ -1013,6 +1013,11 @@ static bool sap_is_csa_restart_state(struct wlan_objmgr_psoc *psoc,
 }
 
 #ifdef PRE_CAC_SUPPORT
+/*
+ * Code under PRE_CAC_COMP will be cleaned up
+ * once pre cac component is done
+ */
+#ifndef PRE_CAC_COMP
 static void wlan_sap_pre_cac_radar_ind(struct sap_context *sap_ctx,
 				       struct mac_context *mac_ctx)
 {
@@ -1030,6 +1035,22 @@ static void wlan_sap_pre_cac_radar_ind(struct sap_context *sap_ctx,
 			     (void *)eSAP_STATUS_SUCCESS);
 }
 #else
+static void wlan_sap_pre_cac_radar_ind(struct sap_context *sap_ctx,
+				       struct mac_context *mac_ctx)
+{
+	qdf_mc_timer_t *dfs_timer = &mac_ctx->sap.SapDfsInfo.sap_dfs_cac_timer;
+
+	sap_debug("sapdfs: Radar detect on pre cac:%d", sap_ctx->sessionId);
+	if (!sap_ctx->dfs_cac_offload) {
+		qdf_mc_timer_stop(dfs_timer);
+		qdf_mc_timer_destroy(dfs_timer);
+	}
+
+	mac_ctx->sap.SapDfsInfo.is_dfs_cac_timer_running = false;
+	wlan_pre_cac_handle_radar_ind(sap_ctx->vdev);
+}
+#endif /* PRE_CAC_COMP */
+#else
 static inline void
 wlan_sap_pre_cac_radar_ind(struct sap_context *sap_ctx,
 			   struct mac_context *mac_ctx)