Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2e155a88 authored by Ashish Kumar Dhanotiya's avatar Ashish Kumar Dhanotiya Committed by Madan Koyyalamudi
Browse files

qcacld-3.0: Replace channel num with freq in wlan_hdd_set_channel api

Currently api wlan_hdd_set_channel is using channel number to validate
requested frequency, this function converts center frequency to
channel number and again converts this channel number to frequency
to validate this channel, which may cause issues when 6GHz SAP
tries to come up.
For example if center freq is 6015 and current country is set
to US, with current logic first this frequency is converted to
channel number which comes to be channel number 13 and then this
channel number is converted back to freq and gets validated. As
channel 13 is invalid in US this validation fails even though
freq 6015 is valid frequency in US.

TO address above issue, remove this converion of center freq to
chan num and chan num to freq, instead used center frequency
directly for any kind of validatoin.

Change-Id: Iec86c7f42e3f7e786f89df28f53ca71f67defc24
CRs-Fixed: 2970037
parent d9ace944
Loading
Loading
Loading
Loading
+2 −4
Original line number Diff line number Diff line
@@ -3861,7 +3861,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;
@@ -3900,7 +3899,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) ||
@@ -3920,8 +3918,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;
	}