Browse Source

qcacmn: Use regdb channels to fill etsi precac required list

Use regdb channels to fill etsi precac required list.

Change-Id: I4b9462c0c69150cf2288e17be0c46029d89e4765
CRs-Fixed: 2318558
Abhijit Pradhan 6 years ago
parent
commit
9da501e634

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

@@ -38,13 +38,13 @@
 /**
  * struct dfs_etsi_precac_entry - PreCAC entry for ETSI domain
  * @pe_list:           ETSI PreCAC entry.
- * @freq:              primary freq.
+ * @ieee:              channel number
  * @etsi_caclst_ticks  start tick, OS speicfic.
  * @dfs:               Pointer to wlan_dfs structure.
  */
 struct dfs_etsi_precac_entry {
 	TAILQ_ENTRY(dfs_etsi_precac_entry) pe_list;
-	uint16_t          freq;
+	uint16_t          ieee;
 	unsigned long     etsi_caclst_ticks;
 	struct wlan_dfs   *dfs;
 };

+ 26 - 29
umac/dfs/core/src/misc/dfs_etsi_precac.c

@@ -60,7 +60,7 @@ int dfs_is_subchan_in_etsi_precac_done_list(struct wlan_dfs *dfs,
 				   pe_list, tmp_precac_entry) {
 			diff_ms = qdf_system_ticks_to_msecs(qdf_system_ticks() -
 					precac_entry->etsi_caclst_ticks);
-			if (channel == precac_entry->freq &&
+			if (channel == precac_entry->ieee &&
 			    diff_ms < ETSI_CAC_TIME_OUT_MS) {
 				found = 1;
 				break;
@@ -117,7 +117,7 @@ void dfs_mark_etsi_precac_dfs(struct wlan_dfs *dfs, uint8_t *channels,
 	for (i = 0; i < num_channels; i++) {
 		TAILQ_FOREACH_SAFE(precac_entry, &dfs->dfs_etsiprecac_done_list,
 				   pe_list, tmp_precac_entry) {
-			if (channels[i] != precac_entry->freq)
+			if (channels[i] != precac_entry->ieee)
 				continue;
 
 		TAILQ_REMOVE(&dfs->dfs_etsiprecac_done_list,
@@ -135,6 +135,7 @@ void dfs_init_etsi_precac_list(struct wlan_dfs *dfs)
 	uint8_t found;
 	struct dfs_etsi_precac_entry *tmp_precac_entry;
 	int nchans = 0;
+	struct dfs_channel *chan_list = NULL;
 
 	/*
 	 * We need to prepare list of unique VHT20 center frequencies.
@@ -147,32 +148,30 @@ void dfs_init_etsi_precac_list(struct wlan_dfs *dfs)
 	TAILQ_INIT(&dfs->dfs_etsiprecac_done_list);
 	TAILQ_INIT(&dfs->dfs_etsiprecac_required_list);
 
-	dfs_mlme_get_dfs_ch_nchans(dfs->dfs_pdev_obj, &nchans);
+	nchans = dfs_get_num_chans();
+
+	chan_list = qdf_mem_malloc(nchans * sizeof(*chan_list));
+	if (!chan_list)
+		return;
+
+	utils_dfs_get_chan_list(dfs->dfs_pdev_obj, (void *)chan_list, &nchans);
+	if (!nchans) {
+		dfs_err(dfs, WLAN_DEBUG_DFS_ALWAYS,  "zero channels");
+		qdf_mem_free(chan_list);
+		return;
+	}
 
 	PRECAC_LIST_LOCK(dfs);
-	/* Fill the  precac-required-list with unique elements */
 	for (i = 0; i < nchans; i++) {
-		struct dfs_channel *ichan = NULL, lc;
-
-		ichan = &lc;
-		dfs_mlme_get_dfs_ch_channels(dfs->dfs_pdev_obj,
-					     &ichan->dfs_ch_freq,
-					     &ichan->dfs_ch_flags,
-					     &ichan->dfs_ch_flagext,
-					     &ichan->dfs_ch_ieee,
-					     &ichan->dfs_ch_vhtop_ch_freq_seg1,
-					     &ichan->dfs_ch_vhtop_ch_freq_seg2,
-					     i);
-
-		if (!WLAN_IS_CHAN_DFS(ichan))
+		if (!WLAN_IS_CHAN_DFS(&chan_list[i]))
 			continue;
 
 		found = 0;
 		TAILQ_FOREACH(tmp_precac_entry,
 			      &dfs->dfs_etsiprecac_required_list,
 			      pe_list) {
-			if (tmp_precac_entry->freq ==
-			   ichan->dfs_ch_vhtop_ch_freq_seg1) {
+			if (tmp_precac_entry->ieee ==
+					chan_list[i].dfs_ch_ieee) {
 				found = 1;
 				break;
 			}
@@ -187,8 +186,7 @@ void dfs_init_etsi_precac_list(struct wlan_dfs *dfs)
 					"etsi precac entry alloc fail");
 				continue;
 			}
-			etsi_precac_entry->freq =
-				ichan->dfs_ch_vhtop_ch_freq_seg1;
+			etsi_precac_entry->ieee = chan_list[i].dfs_ch_ieee;
 			etsi_precac_entry->dfs = dfs;
 			TAILQ_INSERT_TAIL(&dfs->dfs_etsiprecac_required_list,
 					  etsi_precac_entry, pe_list);
@@ -201,8 +199,9 @@ void dfs_init_etsi_precac_list(struct wlan_dfs *dfs)
 	TAILQ_FOREACH(tmp_precac_entry,
 		      &dfs->dfs_etsiprecac_required_list,
 			pe_list)
-	dfs_info(dfs, WLAN_DEBUG_DFS, "freq=%u",
-		 tmp_precac_entry->freq);
+	dfs_info(dfs, WLAN_DEBUG_DFS, "ieee=%u", tmp_precac_entry->ieee);
+
+	qdf_mem_free(chan_list);
 }
 
 void dfs_deinit_etsi_precac_list(struct wlan_dfs *dfs)
@@ -265,8 +264,7 @@ void dfs_print_etsi_precaclists(struct wlan_dfs *dfs)
 		      &dfs->dfs_etsiprecac_required_list,
 			pe_list) {
 		dfs_info(dfs, WLAN_DEBUG_DFS_ALWAYS,
-			 "freq=%u ",
-				tmp_precac_entry->freq);
+			 "ieee=%u ", tmp_precac_entry->ieee);
 	}
 
 	/* Print the ETSI Pre-CAC done List */
@@ -280,9 +278,8 @@ void dfs_print_etsi_precaclists(struct wlan_dfs *dfs)
 					tmp_precac_entry->etsi_caclst_ticks);
 
 		dfs_info(dfs, WLAN_DEBUG_DFS_ALWAYS,
-			 "freq=%u added at (msec): %lu",
-				tmp_precac_entry->freq,
-				time_added);
+			 "ieee=%u added at (msec): %lu", tmp_precac_entry->ieee,
+			 time_added);
 	}
 	PRECAC_LIST_UNLOCK(dfs);
 }
@@ -312,7 +309,7 @@ int dfs_add_chan_to_etsi_done_list(struct wlan_dfs *dfs, uint8_t channel)
 	TAILQ_FOREACH_SAFE(precac_entry,
 			   &dfs->dfs_etsiprecac_required_list,
 			   pe_list, tmp_precac_entry) {
-		if (channel == precac_entry->freq) {
+		if (channel == precac_entry->ieee) {
 			TAILQ_REMOVE(&dfs->dfs_etsiprecac_required_list,
 				     precac_entry, pe_list);
 			TAILQ_INSERT_TAIL(&dfs->dfs_etsiprecac_done_list,

+ 17 - 0
umac/dfs/dispatcher/inc/wlan_dfs_utils_api.h

@@ -623,4 +623,21 @@ QDF_STATUS utils_dfs_is_spoof_check_failed(struct wlan_objmgr_pdev *pdev,
 	return QDF_STATUS_SUCCESS;
 }
 #endif
+
+/**
+ * dfs_get_num_chans() - Get the number of channels supported by the regulatory.
+ *
+ * Return: Number of supported channels.
+ */
+int dfs_get_num_chans(void);
+
+/**
+ * utils_dfs_get_chan_list() - Get channel list from regdb.
+ * @pdev: Pointer to DFS pdev object.
+ * @clist: Pointer to current channel list
+ * @num_chan: number of channels in the current channel list.
+ */
+void utils_dfs_get_chan_list(struct wlan_objmgr_pdev *pdev,
+			     void *clist,
+			     uint32_t *num_chan);
 #endif /* _WLAN_DFS_UTILS_API_H_ */

+ 13 - 13
umac/dfs/dispatcher/src/wlan_dfs_utils_api.c

@@ -526,21 +526,15 @@ static void utils_dfs_get_max_sup_width(struct wlan_objmgr_pdev *pdev,
 	return;
 }
 
-/**
- * utils_dfs_get_chan_list() - Get channel list from regdb based on current
- *                             operating channel.
- * @pdev: Pointer to DFS pdev object.
- * @chan_list: Pointer to current channel list
- * @num_chan: number of channels in the current channel list.
- */
 #ifndef QCA_DFS_USE_POLICY_MANAGER
-static void utils_dfs_get_chan_list(struct wlan_objmgr_pdev *pdev,
-	struct dfs_channel *chan_list, uint32_t *num_chan)
+void utils_dfs_get_chan_list(struct wlan_objmgr_pdev *pdev,
+			     void *clist, uint32_t *num_chan)
 {
 	int i = 0, j = 0;
 	enum channel_state state;
 	struct regulatory_channel *cur_chan_list;
 	struct wlan_dfs *dfs;
+	struct dfs_channel *chan_list = (struct dfs_channel *)clist;
 
 	dfs = global_dfs_to_mlme.pdev_get_comp_private_obj(pdev);
 	if (!dfs)
@@ -617,7 +611,7 @@ static void utils_dfs_get_channel_list(struct wlan_objmgr_pdev *pdev,
 		return;
 	}
 
-	utils_dfs_get_chan_list(pdev, tmp_chan_list, num_chan);
+	utils_dfs_get_chan_list(pdev, (void *)tmp_chan_list, num_chan);
 
 	chan_num = dfs->dfs_curchan->dfs_ch_ieee;
 	center_freq = dfs->dfs_curchan->dfs_ch_freq;
@@ -658,8 +652,8 @@ static void utils_dfs_get_channel_list(struct wlan_objmgr_pdev *pdev,
 
 #else
 
-static void utils_dfs_get_chan_list(struct wlan_objmgr_pdev *pdev,
-	struct dfs_channel *chan_list, uint32_t *num_chan)
+void utils_dfs_get_chan_list(struct wlan_objmgr_pdev *pdev,
+			     void *clist, uint32_t *num_chan)
 {
 	uint8_t pcl_ch[QDF_MAX_NUM_CHAN] = {0};
 	uint8_t weight_list[QDF_MAX_NUM_CHAN] = {0};
@@ -668,6 +662,7 @@ static void utils_dfs_get_chan_list(struct wlan_objmgr_pdev *pdev,
 	int i;
 	struct wlan_objmgr_psoc *psoc;
 	uint32_t conn_count = 0;
+	struct dfs_channel *chan_list = (struct dfs_channel *)clist;
 
 	psoc = wlan_pdev_get_psoc(pdev);
 	if (!psoc) {
@@ -714,7 +709,7 @@ static void utils_dfs_get_chan_list(struct wlan_objmgr_pdev *pdev,
 static void utils_dfs_get_channel_list(struct wlan_objmgr_pdev *pdev,
 	struct dfs_channel *chan_list, uint32_t *num_chan)
 {
-	utils_dfs_get_chan_list(pdev, chan_list, num_chan);
+	utils_dfs_get_chan_list(pdev, (void *)chan_list, num_chan);
 }
 #endif
 
@@ -1088,3 +1083,8 @@ QDF_STATUS utils_dfs_is_spoof_check_failed(struct wlan_objmgr_pdev *pdev,
 
 qdf_export_symbol(utils_dfs_is_spoof_check_failed);
 #endif
+
+int dfs_get_num_chans(void)
+{
+	return NUM_CHANNELS;
+}