Ver Fonte

qcacmn: Check if inter-band switch is allowed in random channel selection

During DFS random channel selection, in the function
utils_dfs_get_channel_list, check if inter-band channel switch is
allowed before adding the inter-band channels in the channel list,
from which a random channel is selected as the target channel.

Change-Id: I3f6c88788819039c4b562b462a922edf1baafe12
CRs-Fixed: 2771640
Hariharan Basuthkar há 4 anos atrás
pai
commit
b820d97f13

+ 9 - 0
umac/dfs/dispatcher/inc/wlan_dfs_mlme_api.h

@@ -443,6 +443,15 @@ void dfs_mlme_handle_dfs_scan_violation(struct wlan_objmgr_pdev *pdev)
  */
 bool dfs_mlme_is_opmode_sta(struct wlan_objmgr_pdev *pdev);
 
+/**
+ * dfs_mlme_is_inter_band_chan_switch_allowed() - Check if inter-band channel
+ * switch is allowed.
+ * @pdev: Pointer to DFS pdev object.
+ *
+ * Return: true if inter-band channel switch is allowed.
+ */
+bool dfs_mlme_is_inter_band_chan_switch_allowed(struct wlan_objmgr_pdev *pdev);
+
 /**
  * dfs_mlme_acquire_radar_mode_switch_lock() - Acquire lock for radar processing
  * over mode switch handling.

+ 2 - 0
umac/dfs/dispatcher/inc/wlan_dfs_ucfg_api.h

@@ -256,6 +256,8 @@ struct dfs_to_mlme {
 			(struct wlan_objmgr_pdev *pdev,
 			 uint16_t freq,
 			 enum WLAN_DFS_EVENTS event);
+	bool (*mlme_is_inter_band_chan_switch_allowed)
+			(struct wlan_objmgr_pdev *pdev);
 	void (*mlme_acquire_radar_mode_switch_lock)
 			(struct wlan_objmgr_pdev *pdev);
 	void (*mlme_release_radar_mode_switch_lock)

+ 2 - 0
umac/dfs/dispatcher/src/wlan_dfs_init_deinit_api.c

@@ -161,6 +161,8 @@ void register_dfs_callbacks(void)
 		mlme_dfs_bringdown_vaps;
 	tmp_dfs_to_mlme->mlme_dfs_deliver_event =
 		mlme_dfs_deliver_event;
+	tmp_dfs_to_mlme->mlme_is_inter_band_chan_switch_allowed =
+		mlme_is_inter_band_chan_switch_allowed;
 
 	tmp_dfs_to_mlme->mlme_acquire_radar_mode_switch_lock =
 		mlme_acquire_radar_mode_switch_lock;

+ 8 - 0
umac/dfs/dispatcher/src/wlan_dfs_mlme_api.c

@@ -536,6 +536,14 @@ void dfs_mlme_handle_dfs_scan_violation(struct wlan_objmgr_pdev *pdev)
 }
 #endif
 
+bool dfs_mlme_is_inter_band_chan_switch_allowed(struct wlan_objmgr_pdev *pdev)
+{
+	if (!global_dfs_to_mlme.mlme_is_inter_band_chan_switch_allowed)
+		return false;
+
+	return global_dfs_to_mlme.mlme_is_inter_band_chan_switch_allowed(pdev);
+}
+
 bool dfs_mlme_is_opmode_sta(struct wlan_objmgr_pdev *pdev)
 {
 	if (!global_dfs_to_mlme.mlme_is_opmode_sta)

+ 16 - 9
umac/dfs/dispatcher/src/wlan_dfs_utils_api.c

@@ -773,10 +773,10 @@ static void utils_dfs_get_channel_list(struct wlan_objmgr_pdev *pdev,
 {
 	struct dfs_channel *tmp_chan_list = NULL;
 	struct wlan_dfs *dfs;
-	bool is_curchan_6g;
 	bool is_curchan_5g;
 	bool is_curchan_24g;
 	bool is_curchan_49g;
+	bool is_inter_band_switch_allowed;
 	uint8_t chan_num;
 	uint16_t center_freq;
 	uint16_t flagext;
@@ -796,10 +796,11 @@ static void utils_dfs_get_channel_list(struct wlan_objmgr_pdev *pdev,
 
 	chan_num = dfs->dfs_curchan->dfs_ch_ieee;
 	center_freq = dfs->dfs_curchan->dfs_ch_freq;
-	is_curchan_6g = WLAN_REG_IS_6GHZ_CHAN_FREQ(center_freq);
 	is_curchan_5g = WLAN_REG_IS_5GHZ_CH_FREQ(center_freq);
 	is_curchan_24g = WLAN_REG_IS_24GHZ_CH_FREQ(center_freq);
 	is_curchan_49g = WLAN_REG_IS_49GHZ_FREQ(center_freq);
+	is_inter_band_switch_allowed =
+		dfs_mlme_is_inter_band_chan_switch_allowed(dfs->dfs_pdev_obj);
 
 	for (i = 0; i < *num_chan; i++) {
 		chan_num = tmp_chan_list[i].dfs_ch_ieee;
@@ -809,13 +810,19 @@ static void utils_dfs_get_channel_list(struct wlan_objmgr_pdev *pdev,
 		if (!dfs_mlme_check_allowed_prim_chanlist(pdev, center_freq))
 			continue;
 
-		if (((is_curchan_5g) || is_curchan_6g) &&
-		    (WLAN_REG_IS_5GHZ_CH_FREQ(center_freq) ||
-		     WLAN_REG_IS_6GHZ_CHAN_FREQ(center_freq))) {
-			chan_list[j].dfs_ch_ieee = chan_num;
-			chan_list[j].dfs_ch_freq = center_freq;
-			chan_list[j].dfs_ch_flagext = flagext;
-			j++;
+		if (is_curchan_5g) {
+			/*
+			 * Always add 5G channels.
+			 * If inter band is allowed, add 6G also.
+			 */
+			if (WLAN_REG_IS_5GHZ_CH_FREQ(center_freq) ||
+			    (is_inter_band_switch_allowed &&
+			     WLAN_REG_IS_6GHZ_CHAN_FREQ(center_freq))) {
+				chan_list[j].dfs_ch_ieee = chan_num;
+				chan_list[j].dfs_ch_freq = center_freq;
+				chan_list[j].dfs_ch_flagext = flagext;
+				j++;
+			}
 		} else if ((is_curchan_24g) &&
 				WLAN_REG_IS_24GHZ_CH_FREQ(center_freq)) {
 			chan_list[j].dfs_ch_ieee = chan_num;