Ver Fonte

qcacld-3.0: Use wlan_reg_legacy_chan_to_freq for conversion

Use wlan_reg_legacy_chan_to_freq api for channel to
frequency conversion instead of wlan_reg_chan_to_freq.

Change-Id: I06a2638a1e402dc6a750c672ed803e8dbfa254fc
CRs-Fixed: 2853575
sheenam monga há 4 anos atrás
pai
commit
07ecaebeb7

+ 1 - 1
components/mlme/dispatcher/src/wlan_mlme_ucfg_api.c

@@ -159,7 +159,7 @@ static uint32_t ucfg_mlme_convert_power_cfg_chan_to_freq(
 	mlme_legacy_debug("max_length %d length %zu", max_length, length);
 	while ((rem_length >= 3) &&
 	       (copied_length <= (max_length - (sizeof(struct pwr_channel_info))))) {
-		pwr_cfg_data[i].first_freq = wlan_reg_chan_to_freq(
+		pwr_cfg_data[i].first_freq = wlan_reg_legacy_chan_to_freq(
 						pdev,
 						power_chan_data[count++]);
 		pwr_cfg_data[i].num_chan = power_chan_data[count++];

+ 1 - 1
components/umac/mlme/connection_mgr/dispatcher/src/wlan_cm_roam_api.c

@@ -1054,7 +1054,7 @@ static void cm_rso_chan_to_freq_list(struct wlan_objmgr_pdev *pdev,
 
 	for (count = 0; count < chan_list_len; count++)
 		freq_list[count] =
-			wlan_reg_chan_to_freq(pdev, chan_list[count]);
+			wlan_reg_legacy_chan_to_freq(pdev, chan_list[count]);
 }
 
 QDF_STATUS wlan_cm_rso_config_init(struct wlan_objmgr_vdev *vdev,

+ 3 - 6
core/hdd/src/wlan_hdd_hostapd.c

@@ -3842,7 +3842,6 @@ int wlan_hdd_set_channel(struct wiphy *wiphy,
 {
 	struct hdd_adapter *adapter = NULL;
 	uint32_t num_ch = 0;
-	int channel = 0;
 	int channel_seg2 = 0;
 	struct hdd_context *hdd_ctx;
 	int status;
@@ -3881,8 +3880,6 @@ int wlan_hdd_set_channel(struct wiphy *wiphy,
 		return -EINVAL;
 	}
 
-	channel = ieee80211_frequency_to_channel(chandef->chan->center_freq);
-
 	if (NL80211_CHAN_WIDTH_80P80 == chandef->width) {
 		if ((wlan_reg_min_chan_freq() > chandef->center_freq2) ||
 		    (wlan_reg_max_chan_freq() < chandef->center_freq2)) {
@@ -3901,8 +3898,8 @@ int wlan_hdd_set_channel(struct wiphy *wiphy,
 	num_ch = CFG_VALID_CHANNEL_LIST_LEN;
 
 	if (QDF_STATUS_SUCCESS !=  wlan_hdd_validate_operation_channel(
-	    adapter, wlan_reg_chan_to_freq(hdd_ctx->pdev, channel))) {
-		hdd_err("Invalid Channel: %d", channel);
+	    adapter, chandef->chan->center_freq)) {
+		hdd_err("Invalid freq: %d", chandef->chan->center_freq);
 		return -EINVAL;
 	}
 
@@ -4908,7 +4905,7 @@ int wlan_hdd_restore_channels(struct hdd_context *hdd_ctx,
 	}
 
 	for (i = 0; i < cache_chann->num_channels; i++) {
-		freq = wlan_reg_chan_to_freq(
+		freq = wlan_reg_legacy_chan_to_freq(
 				hdd_ctx->pdev,
 				cache_chann->channel_info[i].channel_num);
 		if (!freq)

+ 3 - 2
core/hdd/src/wlan_hdd_ioctl.c

@@ -1341,7 +1341,8 @@ hdd_parse_set_roam_scan_channels_v2(struct hdd_adapter *adapter,
 			ret = -EINVAL;
 			goto exit;
 		}
-		channel_freq_list[i] = wlan_reg_chan_to_freq(hdd_ctx->pdev,
+		channel_freq_list[i] = wlan_reg_legacy_chan_to_freq(
+							     hdd_ctx->pdev,
 							     channel);
 	}
 
@@ -2637,7 +2638,7 @@ static int hdd_parse_ese_beacon_req(struct wlan_objmgr_pdev *pdev,
 					return -EINVAL;
 				}
 				req->bcnReq[j].ch_freq =
-				wlan_reg_chan_to_freq(pdev, temp_int);
+				wlan_reg_legacy_chan_to_freq(pdev, temp_int);
 				break;
 
 			case 2: /* Scan mode */

+ 9 - 11
core/hdd/src/wlan_hdd_nan_datapath.c

@@ -203,12 +203,12 @@ static bool hdd_is_ndp_allowed(struct hdd_context *hdd_ctx)
 /**
  * hdd_ndi_start_bss() - Start BSS on NAN data interface
  * @adapter: adapter context
- * @operating_channel: channel on which the BSS to be started
+ * @oper_freq: freq on which the BSS to be started
  *
  * Return: 0 on success, error value on failure
  */
 static int hdd_ndi_start_bss(struct hdd_adapter *adapter,
-				uint8_t operating_channel)
+			     qdf_freq_t oper_freq)
 {
 	QDF_STATUS status;
 	uint32_t roam_id;
@@ -217,7 +217,6 @@ static int hdd_ndi_start_bss(struct hdd_adapter *adapter,
 	uint8_t wmm_mode = 0;
 	struct hdd_context *hdd_ctx;
 	uint8_t value = 0;
-	uint32_t oper_freq;
 
 	hdd_enter();
 
@@ -245,12 +244,11 @@ static int hdd_ndi_start_bss(struct hdd_adapter *adapter,
 
 	roam_profile->csrPersona = adapter->device_mode;
 
-	if (!operating_channel)
-		operating_channel = NAN_SOCIAL_CHANNEL_2_4GHZ;
-	oper_freq = wlan_reg_chan_to_freq(hdd_ctx->pdev, operating_channel);
+	if (!oper_freq)
+		oper_freq = NAN_SOCIAL_FREQ_2_4GHZ;
 
 	roam_profile->ChannelInfo.numOfChannels = 1;
-	roam_profile->ChannelInfo.freq_list = &oper_freq;
+	roam_profile->ChannelInfo.freq_list = (uint32_t *)&oper_freq;
 
 	roam_profile->SSIDs.numOfSSIDs = 1;
 	roam_profile->SSIDs.SSIDList->SSID.length = 0;
@@ -625,7 +623,7 @@ int hdd_ndi_start(char *iface_name, uint16_t transaction_id)
 {
 	int ret;
 	QDF_STATUS status;
-	uint8_t op_channel;
+	qdf_freq_t op_freq;
 	struct hdd_adapter *adapter;
 	struct hdd_context *hdd_ctx = cds_get_context(QDF_MODULE_ID_HDD);
 	struct wlan_objmgr_vdev *vdev;
@@ -674,11 +672,11 @@ int hdd_ndi_start(char *iface_name, uint16_t transaction_id)
 	 */
 
 	if (hdd_is_5g_supported(hdd_ctx))
-		op_channel = NAN_SOCIAL_CHANNEL_5GHZ_LOWER_BAND;
+		op_freq = NAN_SOCIAL_FREQ_5GHZ_LOWER_BAND;
 	else
-		op_channel = NAN_SOCIAL_CHANNEL_2_4GHZ;
+		op_freq = NAN_SOCIAL_FREQ_2_4GHZ;
 
-	if (hdd_ndi_start_bss(adapter, op_channel)) {
+	if (hdd_ndi_start_bss(adapter, op_freq)) {
 		hdd_err("NDI start bss failed");
 		ret = -EFAULT;
 		goto err_handler;

+ 5 - 5
core/hdd/src/wlan_hdd_nan_datapath.h

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016-2020 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2016-2021 The Linux Foundation. All rights reserved.
  *
  * Permission to use, copy, modify, and/or distribute this software for
  * any purpose with or without fee is hereby granted, provided that the
@@ -29,10 +29,10 @@ struct hdd_config;
 struct hdd_adapter;
 struct wireless_dev;
 
-/* NAN Social channels */
-#define NAN_SOCIAL_CHANNEL_2_4GHZ 6
-#define NAN_SOCIAL_CHANNEL_5GHZ_LOWER_BAND 44
-#define NAN_SOCIAL_CHANNEL_5GHZ_UPPER_BAND 149
+/* NAN Social frequencies */
+#define NAN_SOCIAL_FREQ_2_4GHZ 2437
+#define NAN_SOCIAL_FREQ_5GHZ_LOWER_BAND 5220
+#define NAN_SOCIAL_FREQ_5GHZ_UPPER_BAND 5745
 
 #define NDP_BROADCAST_STAID           (0)
 

+ 3 - 1
core/sap/src/sap_api_link_cntl.c

@@ -794,7 +794,9 @@ static void wlansap_update_vendor_acs_chan(struct mac_context *mac_ctx,
 	}
 
 	mac_ctx->sap.SapDfsInfo.target_chan_freq =
-				wlan_reg_chan_to_freq(mac_ctx->pdev, sap_ctx->dfs_vendor_channel);
+				wlan_reg_legacy_chan_to_freq(
+						mac_ctx->pdev,
+						sap_ctx->dfs_vendor_channel);
 
 	mac_ctx->sap.SapDfsInfo.new_chanWidth =
 				sap_ctx->dfs_vendor_chan_bw;