Эх сурвалжийг харах

qcacmn: Add preference to HT40+ over HT40- in 2G channels till 8

In reg_set_channel_params for 2G, if the input mode is HT40,
the primary channel is <= channel 8 (2447) and the secondary frequency
is not provided, add an API to fetch the secondary frequency,
giving preference to HT40+ over HT40- mode.

Change-Id: If1538e14f9ab427c9f9a12ee2eb0d9e28bbf8b86
CRs-Fixed: 3050678
Vignesh Mohan 3 жил өмнө
parent
commit
862db46074

+ 44 - 8
umac/regulatory/core/src/reg_services_common.c

@@ -4141,6 +4141,48 @@ update_bw:
 	}
 	}
 }
 }
 
 
+#ifdef CONFIG_REG_CLIENT
+static qdf_freq_t reg_get_sec_ch_2g_freq(struct wlan_objmgr_pdev *pdev,
+					 qdf_freq_t primary_freq)
+{
+	qdf_freq_t sec_ch_2g_freq = 0;
+
+	if (primary_freq >= TWOG_CHAN_1_IN_MHZ &&
+	    primary_freq <= TWOG_CHAN_5_IN_MHZ)
+		sec_ch_2g_freq = primary_freq + HT40_SEC_OFFSET;
+	else if (primary_freq >= TWOG_CHAN_6_IN_MHZ &&
+		 primary_freq <= TWOG_CHAN_13_IN_MHZ)
+		sec_ch_2g_freq = primary_freq - HT40_SEC_OFFSET;
+
+	return sec_ch_2g_freq;
+}
+#else
+static qdf_freq_t reg_get_sec_ch_2g_freq(struct wlan_objmgr_pdev *pdev,
+					 qdf_freq_t primary_freq)
+{
+	qdf_freq_t sec_ch_2g_freq;
+
+	if (primary_freq < TWOG_CHAN_1_IN_MHZ ||
+	    primary_freq > TWOG_CHAN_13_IN_MHZ)
+		return 0;
+
+	sec_ch_2g_freq = primary_freq + HT40_SEC_OFFSET;
+
+	/* For 2G primary frequencies > 2452 (IEEE9), return HT40-. */
+	if (primary_freq > TWOG_CHAN_9_IN_MHZ)
+		sec_ch_2g_freq = primary_freq - HT40_SEC_OFFSET;
+
+	/*
+	 * For 2G primary frequencies <= 2452 (IEEE9), return HT40+ if
+	 * the secondary is available, else return HT40-.
+	 */
+	else if (!reg_is_freq_present_in_cur_chan_list(pdev, sec_ch_2g_freq))
+		sec_ch_2g_freq = primary_freq - HT40_SEC_OFFSET;
+
+	return sec_ch_2g_freq;
+}
+#endif
+
 void reg_set_2g_channel_params_for_freq(struct wlan_objmgr_pdev *pdev,
 void reg_set_2g_channel_params_for_freq(struct wlan_objmgr_pdev *pdev,
 					uint16_t oper_freq,
 					uint16_t oper_freq,
 					struct ch_params *ch_params,
 					struct ch_params *ch_params,
@@ -4165,14 +4207,8 @@ void reg_set_2g_channel_params_for_freq(struct wlan_objmgr_pdev *pdev,
 
 
 	if (ch_params->ch_width >= CH_WIDTH_MAX)
 	if (ch_params->ch_width >= CH_WIDTH_MAX)
 		ch_params->ch_width = CH_WIDTH_40MHZ;
 		ch_params->ch_width = CH_WIDTH_40MHZ;
-	if ((reg_get_bw_value(ch_params->ch_width) > 20) && !sec_ch_2g_freq) {
-		if (oper_freq >= TWOG_CHAN_1_IN_MHZ && oper_freq <=
-				TWOG_CHAN_5_IN_MHZ)
-			sec_ch_2g_freq = oper_freq + 20;
-		else if (oper_freq >= TWOG_CHAN_6_IN_MHZ && oper_freq <=
-				TWOG_CHAN_13_IN_MHZ)
-			sec_ch_2g_freq = oper_freq - 20;
-	}
+	if ((reg_get_bw_value(ch_params->ch_width) > 20) && !sec_ch_2g_freq)
+		sec_ch_2g_freq = reg_get_sec_ch_2g_freq(pdev, oper_freq);
 
 
 	max_bw = pdev_priv_obj->cur_chan_list[chan_enum].max_bw;
 	max_bw = pdev_priv_obj->cur_chan_list[chan_enum].max_bw;
 
 

+ 3 - 0
umac/regulatory/dispatcher/inc/reg_services_public_struct.h

@@ -1591,8 +1591,11 @@ struct reg_sched_payload {
 #define TWOG_CHAN_1_IN_MHZ         2412
 #define TWOG_CHAN_1_IN_MHZ         2412
 #define TWOG_CHAN_5_IN_MHZ         2432
 #define TWOG_CHAN_5_IN_MHZ         2432
 #define TWOG_CHAN_6_IN_MHZ         2437
 #define TWOG_CHAN_6_IN_MHZ         2437
+#define TWOG_CHAN_9_IN_MHZ         2452
 #define TWOG_CHAN_13_IN_MHZ        2472
 #define TWOG_CHAN_13_IN_MHZ        2472
 
 
+#define HT40_SEC_OFFSET            20
+
 /**
 /**
  * struct reg_ctl_params - reg ctl and regd info
  * struct reg_ctl_params - reg ctl and regd info
  * @regd: regdomain pair
  * @regd: regdomain pair