Ver código fonte

qcacld-3.0: Replace channel with freq in hdd_connection_info

Replace channel with freq in hdd_connection_info

Change-Id: I0831e9cdc5cf39c7cdd6b35928fac23e4f582539
CRs-Fixed: 2495115
Jingxiang Ge 5 anos atrás
pai
commit
ce7c547b92

+ 20 - 16
core/hdd/src/wlan_hdd_assoc.c

@@ -337,14 +337,14 @@ bool hdd_adapter_is_connected_sta(struct hdd_adapter *adapter)
 
 enum band_info hdd_conn_get_connected_band(struct hdd_station_ctx *sta_ctx)
 {
-	uint8_t staChannel = 0;
+	uint32_t sta_freq = 0;
 
 	if (eConnectionState_Associated == sta_ctx->conn_info.conn_state)
-		staChannel = sta_ctx->conn_info.channel;
+		sta_freq = sta_ctx->conn_info.freq;
 
-	if (staChannel > 0 && staChannel < 14)
+	if (wlan_reg_is_24ghz_ch_freq(sta_freq))
 		return BAND_2G;
-	else if (staChannel >= 36 && staChannel <= 184)
+	else if (wlan_reg_is_5ghz_ch_freq(sta_freq))
 		return BAND_5G;
 	else   /* If station is not connected return as BAND_ALL */
 		return BAND_ALL;
@@ -903,8 +903,6 @@ static void hdd_save_bss_info(struct hdd_adapter *adapter,
 	struct hdd_station_ctx *hdd_sta_ctx =
 		WLAN_HDD_GET_STATION_CTX_PTR(adapter);
 
-	hdd_sta_ctx->conn_info.freq = cds_chan_to_freq(
-		hdd_sta_ctx->conn_info.channel);
 	if (roam_info->vht_caps.present) {
 		hdd_sta_ctx->conn_info.conn_flag.vht_present = true;
 		hdd_copy_vht_caps(&hdd_sta_ctx->conn_info.vht_caps,
@@ -1015,6 +1013,8 @@ hdd_conn_save_connect_info(struct hdd_adapter *adapter,
 
 			sta_ctx->conn_info.channel =
 			    roam_info->u.pConnectedProfile->operationChannel;
+			sta_ctx->conn_info.freq =
+				roam_info->u.pConnectedProfile->op_freq;
 
 			/* Save the ssid for the connection */
 			qdf_mem_copy(&sta_ctx->conn_info.ssid.SSID,
@@ -2789,6 +2789,7 @@ hdd_association_completion_handler(struct hdd_adapter *adapter,
 	tSirResultCodes timeout_reason = 0;
 	bool ok;
 	mac_handle_t mac_handle;
+	uint8_t conn_info_channel;
 	void *soc = cds_get_context(QDF_MODULE_ID_SOC);
 
 	if (!hdd_ctx) {
@@ -2941,18 +2942,22 @@ hdd_association_completion_handler(struct hdd_adapter *adapter,
 		wlan_hdd_auto_shutdown_enable(hdd_ctx, false);
 #endif
 
+		conn_info_channel =
+			wlan_reg_freq_to_chan(hdd_ctx->pdev,
+					      sta_ctx->conn_info.freq);
+
 		hdd_debug("check if STA chan ok for DNBS");
 		if (policy_mgr_is_chan_ok_for_dnbs(hdd_ctx->psoc,
-					sta_ctx->conn_info.channel,
+					conn_info_channel,
 					&ok)) {
-			hdd_err("Unable to check DNBS eligibility for chan:%d",
-					sta_ctx->conn_info.channel);
+			hdd_err("Unable to check DNBS eligibility for chan(freq):%u",
+				sta_ctx->conn_info.freq);
 			return QDF_STATUS_E_FAILURE;
 		}
 
 		if (!ok) {
-			hdd_err("Chan:%d not suitable for DNBS",
-				sta_ctx->conn_info.channel);
+			hdd_err("Chan(freq):%u not suitable for DNBS",
+				sta_ctx->conn_info.freq);
 			wlan_hdd_netif_queue_control(adapter,
 				WLAN_NETIF_CARRIER_OFF,
 				WLAN_CONTROL_PATH);
@@ -3135,8 +3140,7 @@ hdd_association_completion_handler(struct hdd_adapter *adapter,
 
 						cdp_hl_fc_set_td_limit(soc,
 						adapter->vdev_id,
-						sta_ctx->
-						conn_info.channel);
+						conn_info_channel);
 
 						hdd_send_roamed_ind(
 								dev,
@@ -3184,7 +3188,7 @@ hdd_association_completion_handler(struct hdd_adapter *adapter,
 						 ft_carrier_on);
 					cdp_hl_fc_set_td_limit(soc,
 					adapter->vdev_id,
-					sta_ctx->conn_info.channel);
+					conn_info_channel);
 					hdd_connect_result(dev,
 							   roam_info->
 							   bssid.bytes,
@@ -3242,7 +3246,7 @@ hdd_association_completion_handler(struct hdd_adapter *adapter,
 					}
 					cdp_hl_fc_set_td_limit(soc,
 					adapter->vdev_id,
-					sta_ctx->conn_info.channel);
+					conn_info_channel);
 				}
 			}
 			if (!hddDisconInProgress) {
@@ -3279,7 +3283,7 @@ hdd_association_completion_handler(struct hdd_adapter *adapter,
 
 			cdp_hl_fc_set_td_limit(soc,
 				adapter->vdev_id,
-				sta_ctx->conn_info.channel);
+				conn_info_channel);
 			hdd_send_re_assoc_event(dev, adapter, roam_info,
 						reqRsnIe, reqRsnLength);
 			/* Reassoc successfully */

+ 17 - 6
core/hdd/src/wlan_hdd_cfg80211.c

@@ -4330,6 +4330,7 @@ static bool wlan_hdd_check_dfs_channel_for_adapter(struct hdd_context *hdd_ctx,
 	struct hdd_adapter *adapter;
 	struct hdd_ap_ctx *ap_ctx;
 	struct hdd_station_ctx *sta_ctx;
+	uint8_t conn_info_channel;
 
 	hdd_for_each_adapter(hdd_ctx, adapter) {
 		if ((device_mode == adapter->device_mode) &&
@@ -4357,6 +4358,10 @@ static bool wlan_hdd_check_dfs_channel_for_adapter(struct hdd_context *hdd_ctx,
 			sta_ctx =
 				WLAN_HDD_GET_STATION_CTX_PTR(adapter);
 
+			conn_info_channel =
+				wlan_reg_freq_to_chan(
+					hdd_ctx->pdev,
+					sta_ctx->conn_info.freq);
 			/*
 			 *  if STA is already connected on DFS channel,
 			 *  do not disable scan on dfs channels
@@ -4364,7 +4369,7 @@ static bool wlan_hdd_check_dfs_channel_for_adapter(struct hdd_context *hdd_ctx,
 			if (hdd_conn_is_connected(sta_ctx) &&
 				(CHANNEL_STATE_DFS ==
 				wlan_reg_get_channel_state(hdd_ctx->pdev,
-					sta_ctx->conn_info.channel))) {
+					conn_info_channel))) {
 				hdd_err("client connected on DFS channel");
 				return true;
 			}
@@ -8858,8 +8863,7 @@ static int __wlan_hdd_cfg80211_get_link_properties(struct wiphy *wiphy,
 		}
 
 		nss  = hdd_sta_ctx->conn_info.nss;
-		freq = cds_chan_to_freq(
-				hdd_sta_ctx->conn_info.channel);
+		freq = hdd_sta_ctx->conn_info.freq;
 		rate_flags = hdd_sta_ctx->conn_info.rate_flags;
 	} else if (adapter->device_mode == QDF_P2P_GO_MODE ||
 		   adapter->device_mode == QDF_SAP_MODE) {
@@ -18967,9 +18971,10 @@ static int __wlan_hdd_cfg80211_join_ibss(struct wiphy *wiphy,
 		WLAN_HDD_GET_STATION_CTX_PTR(adapter);
 	struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
 	struct qdf_mac_addr bssid;
-	u8 channelNum = 0;
+	uint8_t channelNum = 0;
 	mac_handle_t mac_handle;
 	struct wlan_mlme_ibss_cfg ibss_cfg = {0};
+	uint8_t conn_info_channel;
 
 	hdd_enter();
 
@@ -19100,6 +19105,9 @@ static int __wlan_hdd_cfg80211_join_ibss(struct wiphy *wiphy,
 		hdd_debug("set channel %d", channelNum);
 		roam_profile->ChannelInfo.numOfChannels = 1;
 		sta_ctx->conn_info.channel = channelNum;
+		sta_ctx->conn_info.freq =
+			wlan_reg_chan_to_freq(hdd_ctx->pdev,
+					      channelNum);
 		roam_profile->ChannelInfo.ChannelList =
 			&sta_ctx->conn_info.channel;
 	}
@@ -19111,12 +19119,15 @@ static int __wlan_hdd_cfg80211_join_ibss(struct wiphy *wiphy,
 		return status;
 	}
 
+	conn_info_channel =
+		wlan_reg_freq_to_chan(
+			hdd_ctx->pdev,
+			sta_ctx->conn_info.freq);
 	/* Issue connect start */
 	status = wlan_hdd_cfg80211_connect_start(adapter, params->ssid,
 						 params->ssid_len,
 						 bssid.bytes, NULL,
-						 sta_ctx->conn_info.
-						 channel,
+						 conn_info_channel,
 						 params->chandef.width);
 
 	if (0 > status) {

+ 5 - 2
core/hdd/src/wlan_hdd_hostapd.c

@@ -3173,8 +3173,8 @@ QDF_STATUS wlan_hdd_get_channel_for_sap_restart(
 		if (QDF_IS_STATUS_ERROR(
 			policy_mgr_valid_sap_conc_channel_check(
 				hdd_ctx->psoc, &intf_ch, sap_ch, vdev_id))) {
-			hdd_debug("can't move sap to %d",
-				hdd_sta_ctx->conn_info.channel);
+			hdd_debug("can't move sap to chan(freq): %u",
+				  hdd_sta_ctx->conn_info.freq);
 			return QDF_STATUS_E_FAILURE;
 		}
 	}
@@ -3697,6 +3697,9 @@ int wlan_hdd_set_channel(struct wiphy *wiphy,
 		roam_profile = hdd_roam_profile(adapter);
 		num_ch = roam_profile->ChannelInfo.numOfChannels = 1;
 		sta_ctx->conn_info.channel = channel;
+		sta_ctx->conn_info.freq =
+			wlan_reg_chan_to_freq(hdd_ctx->pdev,
+					      channel);
 		roam_profile->ChannelInfo.ChannelList =
 			&sta_ctx->conn_info.channel;
 	} else if ((adapter->device_mode == QDF_SAP_MODE)

+ 15 - 11
core/hdd/src/wlan_hdd_ioctl.c

@@ -747,7 +747,8 @@ int hdd_reassoc(struct hdd_adapter *adapter, const uint8_t *bssid,
 	if (!memcmp(bssid, sta_ctx->conn_info.bssid.bytes,
 			QDF_MAC_ADDR_SIZE)) {
 		hdd_warn("Reassoc BSSID is same as currently associated AP bssid");
-		channel = sta_ctx->conn_info.channel;
+		channel = wlan_reg_freq_to_chan(hdd_ctx->pdev,
+						sta_ctx->conn_info.freq);
 	}
 
 	/* Check channel number is a valid channel number */
@@ -915,6 +916,7 @@ hdd_sendactionframe(struct hdd_adapter *adapter, const uint8_t *bssid,
 		    const int payload_len, const uint8_t *payload)
 {
 	struct ieee80211_channel chan;
+	uint8_t conn_info_channel;
 	int frame_len, ret = 0;
 	uint8_t *frame;
 	struct ieee80211_hdr_3addr *hdr;
@@ -962,17 +964,18 @@ hdd_sendactionframe(struct hdd_adapter *adapter, const uint8_t *bssid,
 		static const uint8_t oui[] = { 0x00, 0x00, 0xf0 };
 
 		if (!qdf_mem_cmp(vendor->Oui, oui, 3)) {
+			conn_info_channel = wlan_reg_freq_to_chan(
+						hdd_ctx->pdev,
+						sta_ctx->conn_info.freq);
 			/*
 			 * if the channel number is different from operating
 			 * channel then no need to send action frame
 			 */
 			if (channel != 0) {
-				if (channel !=
-				    sta_ctx->conn_info.channel) {
-					hdd_warn("channel(%d) is different from operating channel(%d)",
-						  channel,
-						  sta_ctx->conn_info.
-						  channel);
+				if (channel != conn_info_channel) {
+					hdd_warn("channel(%u) is different from operating channel(%u)",
+						 channel,
+						 conn_info_channel);
 					ret = -EINVAL;
 					goto exit;
 				}
@@ -991,9 +994,7 @@ hdd_sendactionframe(struct hdd_adapter *adapter, const uint8_t *bssid,
 				 * 0 is accepted as current home channel,
 				 * delayed transmission of action frame is ok.
 				 */
-				chan.center_freq =
-					sme_chn_to_freq(sta_ctx->conn_info.
-							channel);
+				chan.center_freq = sta_ctx->conn_info.freq;
 			}
 		}
 	}
@@ -4340,6 +4341,7 @@ static int drv_cmd_fast_reassoc(struct hdd_adapter *adapter,
 	}
 
 	sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
+	hdd_ctx = WLAN_HDD_GET_CTX(adapter);
 
 	/* if not associated, no need to proceed with reassoc */
 	if (eConnectionState_Associated != sta_ctx->conn_info.conn_state) {
@@ -4365,7 +4367,9 @@ static int drv_cmd_fast_reassoc(struct hdd_adapter *adapter,
 			 QDF_MAC_ADDR_SIZE)) {
 		hdd_warn("Reassoc BSSID is same as currently associated AP bssid");
 		if (roaming_offload_enabled(hdd_ctx)) {
-			channel = sta_ctx->conn_info.channel;
+			channel = wlan_reg_freq_to_chan(
+					hdd_ctx->pdev,
+					sta_ctx->conn_info.freq);
 			hdd_wma_send_fastreassoc_cmd(adapter, bssid,
 						     channel);
 		} else {

+ 6 - 4
core/hdd/src/wlan_hdd_ipa.c

@@ -76,8 +76,9 @@ void hdd_ipa_set_tx_flow_info(void)
 			sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
 			if (eConnectionState_Associated ==
 			    sta_ctx->conn_info.conn_state) {
-				staChannel =
-					sta_ctx->conn_info.channel;
+				staChannel = wlan_reg_freq_to_chan(
+						hdd_ctx->pdev,
+						sta_ctx->conn_info.freq);
 				qdf_copy_macaddr(&staBssid,
 						 &sta_ctx->conn_info.bssid);
 #ifdef QCA_LL_LEGACY_TX_FLOW_CONTROL
@@ -89,8 +90,9 @@ void hdd_ipa_set_tx_flow_info(void)
 			sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
 			if (eConnectionState_Associated ==
 			    sta_ctx->conn_info.conn_state) {
-				p2pChannel =
-					sta_ctx->conn_info.channel;
+				p2pChannel = wlan_reg_freq_to_chan(
+					hdd_ctx->pdev,
+					sta_ctx->conn_info.freq);
 				qdf_copy_macaddr(&p2pBssid,
 						&sta_ctx->conn_info.bssid);
 				p2pMode = "CLI";

+ 1 - 2
core/hdd/src/wlan_hdd_lpass.c

@@ -140,8 +140,7 @@ static int wlan_hdd_gen_wlan_status_pack(struct wlan_status_data *data,
 	if (sta_ctx) {
 		data->is_connected = is_connected;
 		data->rssi = adapter->rssi;
-		data->freq =
-			cds_chan_to_freq(sta_ctx->conn_info.channel);
+		data->freq = sta_ctx->conn_info.freq;
 		if (WLAN_SVC_MAX_SSID_LEN >=
 		    sta_ctx->conn_info.ssid.SSID.length) {
 			data->ssid_len = sta_ctx->conn_info.ssid.SSID.length;

+ 14 - 1
core/hdd/src/wlan_hdd_main.c

@@ -893,6 +893,13 @@ int hdd_validate_channel_and_bandwidth(struct hdd_adapter *adapter,
 uint8_t hdd_get_adapter_home_channel(struct hdd_adapter *adapter)
 {
 	uint8_t home_channel = 0;
+	struct hdd_context *hdd_ctx;
+
+	hdd_ctx = WLAN_HDD_GET_CTX(adapter);
+	if (!hdd_ctx) {
+		hdd_err("hdd context is NULL");
+		return 0;
+	}
 
 	if ((adapter->device_mode == QDF_SAP_MODE ||
 	     adapter->device_mode == QDF_P2P_GO_MODE) &&
@@ -903,7 +910,9 @@ uint8_t hdd_get_adapter_home_channel(struct hdd_adapter *adapter)
 		   adapter->session.station.conn_info.conn_state ==
 		   eConnectionState_Associated) {
 		home_channel =
-			adapter->session.station.conn_info.channel;
+			wlan_reg_freq_to_chan(
+				hdd_ctx->pdev,
+				adapter->session.station.conn_info.freq);
 	}
 
 	return home_channel;
@@ -4584,6 +4593,10 @@ QDF_STATUS hdd_init_station_mode(struct hdd_adapter *adapter)
 	/* Set the default operation channel */
 	sta_ctx->conn_info.channel =
 		hdd_ctx->config->operating_channel;
+	sta_ctx->conn_info.freq =
+		wlan_reg_chan_to_freq(
+			hdd_ctx->pdev,
+			hdd_ctx->config->operating_channel);
 
 	/* Make the default Auth Type as OPEN */
 	sta_ctx->conn_info.auth_type = eCSR_AUTH_TYPE_OPEN_SYSTEM;

+ 3 - 1
core/hdd/src/wlan_hdd_wext.c

@@ -7439,7 +7439,9 @@ static int __iw_setnone_getnone(struct net_device *dev,
 		tSirMacAddr bssid;
 		uint32_t roam_id = INVALID_ROAM_ID;
 		uint8_t operating_ch =
-			adapter->session.station.conn_info.channel;
+			wlan_reg_freq_to_chan(
+				hdd_ctx->pdev,
+				adapter->session.station.conn_info.freq);
 		tCsrRoamModifyProfileFields mod_fields;
 
 		sme_get_modify_profile_fields(mac_handle, adapter->vdev_id,