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

Commit 825c6962 authored by Ashish Kumar Dhanotiya's avatar Ashish Kumar Dhanotiya Committed by Gerrit - the friendly Code Review server
Browse files

qcacmn: Fill correct max BW to set channel params

Currently wifi positioning api to update channel bandwidth
info is invoking regulatory component api to set the channel
params with BW as CH_WIDTH_MAX, because of which regulatory
component is returning the maximum BW supported for the current
regdomain which is 160MHz. If target does not support 160MHz in
that case it may lead to undefined behavior.

To address this issue, pass max supported BW by target as
argument to regulatory component so that regulatory component
does not return the BW greater then the target supported BW.

CRs-Fixed: 2730665
Change-Id: I6051336ab2f3ea902a70ed80290e5a5f060de5b9
parent 9c063d5b
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -315,4 +315,12 @@ void init_deinit_wakeup_host_wait(
		 struct wlan_objmgr_psoc *psoc,
		 struct target_psoc_info *tgt_info);

/**
 * init_deinit_get_vht_ch_width - return vht channel width
 * @psoc: PSOC object
 *
 * Return: return max vht channel width supported by FW
 */
enum phy_ch_width init_deinit_get_vht_ch_width(struct wlan_objmgr_psoc *psoc);

#endif /* _SERVICE_READY_UTIL_H_*/
+22 −0
Original line number Diff line number Diff line
@@ -863,3 +863,25 @@ void init_deinit_wakeup_host_wait(
	}
	qdf_event_set(&tgt_hdl->info.event);
}

enum phy_ch_width init_deinit_get_vht_ch_width(struct wlan_objmgr_psoc *psoc)
{
	enum phy_ch_width fw_ch_wd = CH_WIDTH_80MHZ;
	struct target_psoc_info *tgt_hdl;
	int vht_cap_info;

	if (!psoc)
		return fw_ch_wd;

	tgt_hdl = wlan_psoc_get_tgt_if_handle(psoc);
	if (!tgt_hdl)
		return fw_ch_wd;

	vht_cap_info = target_if_get_vht_cap_info(tgt_hdl);
	if (vht_cap_info & WMI_VHT_CAP_CH_WIDTH_80P80_160MHZ)
		fw_ch_wd = CH_WIDTH_80P80MHZ;
	else if (vht_cap_info & WMI_VHT_CAP_CH_WIDTH_160MHZ)
		fw_ch_wd = CH_WIDTH_160MHZ;

	return fw_ch_wd;
}
+3 −2
Original line number Diff line number Diff line
@@ -35,6 +35,7 @@
#include "wlan_ptt_sock_svc.h"

#include "wlan_reg_services_api.h"
#include "service_ready_util.h"
/* forward declartion */
struct regulatory_channel;

@@ -355,8 +356,8 @@ static void wifi_update_channel_bw_info(struct wlan_objmgr_psoc *psoc,
		return;
	}

	/* Passing CH_WIDTH_MAX will give the max bandwidth supported */
	ch_params.ch_width = CH_WIDTH_MAX;
	ch_params.ch_width = init_deinit_get_vht_ch_width(psoc);

	wlan_reg_set_channel_params_for_freq(pdev, freq,
					     sec_ch_2g, &ch_params);
	chan_info->band_center_freq1 = ch_params.mhz_freq_seg0;