Browse Source

qcacmn: Refactor dfs cac timer and other logic in dfs component

It is possible to use host based cac timer even for the dfs
offload, So make sure to do all initialization for cac timers.

Also store dfs offload flag in dfs component.

Change-Id: Id30730fb1f84285e225c4221fde9846fbfd960cc
CRs-Fixed: 2069362
Arif Hussain 7 years ago
parent
commit
877f3236d8

+ 2 - 0
umac/dfs/core/src/dfs.h

@@ -729,6 +729,7 @@ struct dfs_event_log {
  * @dfs_precac_required_list: PreCAC required list.
  * @dfs_precac_done_list:  PreCAC done list.
  * @dfs_precac_nol_list:   PreCAC NOL List.
+ * @dfs_is_offload_enabled: Set if DFS offload enabled.
  */
 struct wlan_dfs {
 	uint32_t  dfs_debug_mask;
@@ -817,6 +818,7 @@ struct wlan_dfs {
 	TAILQ_HEAD(, dfs_precac_entry) dfs_precac_nol_list;
 	struct dfs_ieee80211_channel *dfs_curchan;
 	struct wlan_objmgr_pdev *dfs_pdev_obj;
+	bool dfs_is_offload_enabled;
 };
 
 /**

+ 10 - 6
umac/dfs/core/src/misc/dfs.c

@@ -285,7 +285,7 @@ int dfs_main_attach(struct wlan_dfs *dfs)
 	dfs->dfs_phyerr_queued_count = 0;
 	dfs->dfs_phyerr_w53_counter  = 0;
 	dfs->dfs_pri_multiplier      = 2;
-	dfs->wlan_dfs_nol_timeout = DFS_NOL_TIMEOUT_S;
+	dfs_get_radars(dfs);
 
 	return 0;
 
@@ -315,10 +315,13 @@ int dfs_attach(struct wlan_dfs *dfs)
 {
 	int ret;
 
-	ret = dfs_main_attach(dfs);
-	if (ret)
-		return ret;
-
+	if (!dfs->dfs_is_offload_enabled) {
+		ret = dfs_main_attach(dfs);
+		if (ret) {
+			DFS_PRINTK("%s: dfs_main_attach failed\n", __func__);
+			return ret;
+		}
+	}
 	dfs_cac_attach(dfs);
 	dfs_zero_cac_attach(dfs);
 	dfs_nol_attach(dfs);
@@ -421,7 +424,8 @@ void dfs_main_detach(struct wlan_dfs *dfs)
 
 void dfs_detach(struct wlan_dfs *dfs)
 {
-	dfs_main_detach(dfs);
+	if (!dfs->dfs_is_offload_enabled)
+		dfs_main_detach(dfs);
 	dfs_zero_cac_detach(dfs);
 }
 

+ 1 - 0
umac/dfs/core/src/misc/dfs_nol.c

@@ -106,6 +106,7 @@ void dfs_nol_timer_init(struct wlan_dfs *dfs)
 
 void dfs_nol_attach(struct wlan_dfs *dfs)
 {
+	dfs->wlan_dfs_nol_timeout = DFS_NOL_TIMEOUT_S;
 	dfs_nol_timer_init(dfs);
 }
 

+ 1 - 1
umac/dfs/core/src/misc/dfs_process_radar_found_ind.c

@@ -100,7 +100,7 @@ static void dfs_radar_add_to_nol(struct wlan_dfs *dfs,
 		}
 		last_chan = freq_offset->chan_num[i];
 		dfs_nol_addchan(dfs, (uint16_t)freq_offset->freq[i],
-				DFS_NOL_TIMEOUT_S);
+				dfs->wlan_dfs_nol_timeout);
 		nollist[num_ch++] = last_chan;
 		DFS_PRINTK("%s: ch=%d Added to NOL\n", __func__, last_chan);
 	}

+ 7 - 10
umac/dfs/dispatcher/src/wlan_dfs_init_deinit_api.c

@@ -141,7 +141,6 @@ QDF_STATUS wlan_dfs_pdev_obj_create_notification(struct wlan_objmgr_pdev *pdev,
 {
 	struct wlan_dfs *dfs = NULL;
 	struct wlan_objmgr_psoc *psoc;
-	bool dfs_offload = false;
 
 	if (pdev == NULL) {
 		DFS_PRINTK("%s: null pdev\n", __func__);
@@ -161,17 +160,15 @@ QDF_STATUS wlan_dfs_pdev_obj_create_notification(struct wlan_objmgr_pdev *pdev,
 		DFS_PRINTK("%s: null psoc\n", __func__);
 		return QDF_STATUS_E_FAILURE;
 	}
-	dfs_offload =
+	dfs->dfs_is_offload_enabled =
 		DFS_OFFLOAD_IS_ENABLED(psoc->service_param.service_bitmap);
-	DFS_PRINTK("%s: dfs_offload %d\n", __func__, dfs_offload);
+	DFS_PRINTK("%s: dfs_offload %d\n", __func__,
+		dfs->dfs_is_offload_enabled);
 	dfs = wlan_pdev_get_dfs_obj(pdev);
-	if (!dfs_offload) {
-		if (dfs_attach(dfs) == 1) {
-			DFS_PRINTK("%s: dfs_attch failed\n", __func__);
-			dfs_destroy_object(dfs);
-			return QDF_STATUS_E_FAILURE;
-		}
-		dfs_get_radars(dfs);
+	if (dfs_attach(dfs) == 1) {
+		DFS_PRINTK("%s: dfs_attch failed\n", __func__);
+		dfs_destroy_object(dfs);
+		return QDF_STATUS_E_FAILURE;
 	}
 	dfs_init_nol(pdev);
 	dfs_print_nol(dfs);