Sfoglia il codice sorgente

qcacmn: Compute freq for channels in other 6G power type

The API reg_compute_chan_to_freq() computes frequencies only for channels
present in master channel list. A 6G channel may not belong to the current
(current power type's) master channel but be present in different 6g power
type's master channel list.

So if a 6G channel is not found in the current (current power type's)
master channel list, then search for the channel in all the 6g power's
master channel list to compute the frequency.

Change-Id: I7ccdaeb1f9de8d9baabe59ad673d445ed36a6a2d
Hariharan Basuthkar 3 anni fa
parent
commit
8d8e72cf71

+ 4 - 15
umac/regulatory/core/src/reg_build_chan_list.c

@@ -1995,19 +1995,10 @@ const struct ap_cli_pwr_mode_info reg_pwr_enum_2_ap_cli_pwrmode[] = {
 							REG_VERY_LOW_POWER_AP},
 };
 
-/**
- * reg_get_reg_maschan_lst_frm_6g_pwr_mode() - Return the mas_chan_list entry
- * for based on the channel index and input power mode
- * @supp_pwr_mode: 6G supported power mode
- * @pdev_priv_obj: Pointer to pdev_priv_obj
- * @chan_idx: Channel index
- *
- * Return: Pointer to struct regulatory_channel
- */
-static struct regulatory_channel *reg_get_reg_maschan_lst_frm_6g_pwr_mode(
-		enum supported_6g_pwr_types supp_pwr_mode,
-		struct wlan_regulatory_pdev_priv_obj *pdev_priv_obj,
-		uint16_t chan_idx)
+struct regulatory_channel *reg_get_reg_maschan_lst_frm_6g_pwr_mode(
+			enum supported_6g_pwr_types supp_pwr_mode,
+			struct wlan_regulatory_pdev_priv_obj *pdev_priv_obj,
+			uint16_t chan_idx)
 {
 	struct regulatory_channel *mas_chan_list = NULL;
 	bool is_ap_chan_lst;
@@ -2708,7 +2699,6 @@ QDF_STATUS reg_get_pwrmode_chan_list(struct wlan_objmgr_pdev *pdev,
 				     enum supported_6g_pwr_types in_6g_pwr_mode)
 {
 	struct wlan_regulatory_pdev_priv_obj *pdev_priv_obj;
-	struct wlan_objmgr_psoc *psoc;
 
 	if (!pdev) {
 		reg_err_rl("invalid pdev");
@@ -2721,7 +2711,6 @@ QDF_STATUS reg_get_pwrmode_chan_list(struct wlan_objmgr_pdev *pdev,
 	}
 
 	pdev_priv_obj = reg_get_pdev_obj(pdev);
-	psoc = wlan_pdev_get_psoc(pdev);
 
 	/* Get the current channel list */
 	qdf_mem_copy(chan_list, pdev_priv_obj->cur_chan_list,

+ 14 - 0
umac/regulatory/core/src/reg_build_chan_list.h

@@ -238,4 +238,18 @@ reg_get_secondary_current_chan_list(struct wlan_objmgr_pdev *pdev,
  * Return - True,  the channel is disabled, but not due to radar, else false.
  */
 bool reg_is_chan_disabled_and_not_nol(struct regulatory_channel *chan);
+
+/**
+ * reg_get_reg_maschan_lst_frm_6g_pwr_mode() - Return the mas_chan_list entry
+ * for based on the channel index and input power mode
+ * @supp_pwr_mode: 6G supported power mode
+ * @pdev_priv_obj: Pointer to pdev_priv_obj
+ * @chan_idx: Channel index
+ *
+ * Return: Pointer to struct regulatory_channel
+ */
+struct regulatory_channel *reg_get_reg_maschan_lst_frm_6g_pwr_mode(
+			enum supported_6g_pwr_types supp_pwr_mode,
+			struct wlan_regulatory_pdev_priv_obj *pdev_priv_obj,
+			uint16_t chan_idx);
 #endif

+ 69 - 20
umac/regulatory/core/src/reg_services_common.c

@@ -1529,28 +1529,13 @@ end:
 	return 0;
 }
 
-static uint16_t reg_compute_chan_to_freq(struct wlan_objmgr_pdev *pdev,
-					 uint8_t chan_num,
-					 enum channel_enum min_chan_range,
-					 enum channel_enum max_chan_range)
+static uint16_t
+reg_compute_chan_to_freq_for_chlist(struct regulatory_channel *chan_list,
+				    uint8_t chan_num,
+				    enum channel_enum min_chan_range,
+				    enum channel_enum max_chan_range)
 {
 	uint16_t count;
-	struct regulatory_channel *chan_list;
-	struct wlan_regulatory_pdev_priv_obj *pdev_priv_obj;
-
-	pdev_priv_obj = reg_get_pdev_obj(pdev);
-
-	if (!IS_VALID_PDEV_REG_OBJ(pdev_priv_obj)) {
-		reg_err("reg pdev priv obj is NULL");
-		return 0;
-	}
-
-	if (min_chan_range < MIN_CHANNEL || max_chan_range > MAX_CHANNEL) {
-		reg_err_rl("Channel range is invalid");
-		return 0;
-	}
-
-	chan_list = pdev_priv_obj->mas_chan_list;
 
 	for (count = min_chan_range; count <= max_chan_range; count++) {
 		if ((chan_list[count].state != CHANNEL_STATE_DISABLE) &&
@@ -1596,6 +1581,70 @@ end:
 	return 0;
 }
 
+static uint16_t reg_compute_chan_to_freq(struct wlan_objmgr_pdev *pdev,
+					 uint8_t chan_num,
+					 enum channel_enum min_chan_range,
+					 enum channel_enum max_chan_range)
+{
+	struct regulatory_channel *chan_list;
+	struct wlan_regulatory_pdev_priv_obj *pdev_priv_obj;
+	uint16_t freq;
+	enum supported_6g_pwr_types input_6g_pwr_mode;
+
+	pdev_priv_obj = reg_get_pdev_obj(pdev);
+
+	if (!IS_VALID_PDEV_REG_OBJ(pdev_priv_obj)) {
+		reg_err("reg pdev priv obj is NULL");
+		return 0;
+	}
+
+	if (min_chan_range < MIN_CHANNEL || max_chan_range > MAX_CHANNEL) {
+		reg_err_rl("Channel range is invalid");
+		return 0;
+	}
+
+	chan_list = pdev_priv_obj->mas_chan_list;
+
+	freq = reg_compute_chan_to_freq_for_chlist(chan_list, chan_num,
+						   min_chan_range,
+						   max_chan_range);
+
+	/* If the frequency is a 2G or 5G frequency, then it should be found
+	 * in the regulatory mas_chan_list.
+	 * If a valid 6G frequency has been returned with the current power mode
+	 * itself, then return the freq computed.
+	 */
+	if (freq)
+		return freq;
+
+	min_chan_range = reg_convert_enum_to_6g_idx(min_chan_range);
+	max_chan_range = reg_convert_enum_to_6g_idx(max_chan_range);
+	if ((min_chan_range == INVALID_CHANNEL) ||
+	    (max_chan_range == INVALID_CHANNEL))
+		return freq;
+
+	/* If a valid 6G frequency has not been found, then search in a
+	 * power mode's master channel list.
+	 */
+	input_6g_pwr_mode = REG_AP_LPI;
+	while (input_6g_pwr_mode <= REG_CLI_SUB_VLP) {
+		chan_list = reg_get_reg_maschan_lst_frm_6g_pwr_mode(
+							input_6g_pwr_mode,
+							pdev_priv_obj, 0);
+		if (!chan_list)
+			return 0;
+
+		freq = reg_compute_chan_to_freq_for_chlist(chan_list, chan_num,
+							   min_chan_range,
+							   max_chan_range);
+		if (freq)
+			break;
+		input_6g_pwr_mode++;
+	}
+
+	return freq;
+}
+
 uint16_t reg_legacy_chan_to_freq(struct wlan_objmgr_pdev *pdev,
 				 uint8_t chan_num)
 {