qcacld-3.0: Fix monitor mode set channel wrong for HT40-

At present, driver doesn't check the set mon channel parameters
for HT40-, driver always set HT40+ for 2G channel 5 at present
by command "iw dev wlan0 set 5 HT40-".
Fix by check secondary channel offset from set channel parameters.

Change-Id: Ia69f193c72e9e97a4d6988e86bcfd3727089452e
CRs-Fixed: 3019982
This commit is contained in:
Liangwei Dong 2021-08-23 10:37:31 +08:00 • committed by Madan Koyyalamudi
commit b2799e38c3
3 changed files with 35 additions and 23 deletions

View file

@ -19083,16 +19083,8 @@ void hdd_mon_select_cbmode(struct hdd_adapter *adapter,
}
#endif
/**
* hdd_select_cbmode() - select channel bonding mode
* @adapter: Pointer to adapter
* @oper_freq: Operating frequency (MHz)
* @ch_params: channel info struct to populate
*
* Return: none
*/
void hdd_select_cbmode(struct hdd_adapter *adapter, qdf_freq_t oper_freq,
struct ch_params *ch_params)
qdf_freq_t sec_ch_2g_freq, struct ch_params *ch_params)
{
uint32_t sec_ch_freq = 0;
struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
@ -19103,10 +19095,14 @@ void hdd_select_cbmode(struct hdd_adapter *adapter, qdf_freq_t oper_freq,
*/
if ((ch_params->ch_width == CH_WIDTH_40MHZ) &&
(WLAN_REG_IS_24GHZ_CH_FREQ(oper_freq))) {
if (oper_freq >= 2412 && oper_freq <= 2432)
sec_ch_freq = oper_freq + 20;
else if (oper_freq >= 2437 && oper_freq <= 2472)
sec_ch_freq = oper_freq - 20;
if (sec_ch_2g_freq) {
sec_ch_freq = sec_ch_2g_freq;
} else {
if (oper_freq >= 2412 && oper_freq <= 2432)
sec_ch_freq = oper_freq + 20;
else if (oper_freq >= 2437 && oper_freq <= 2472)
sec_ch_freq = oper_freq - 20;
}
}
/* This call decides required channel bonding mode */
@ -24018,11 +24014,12 @@ static int __wlan_hdd_cfg80211_set_mon_ch(struct wiphy *wiphy,
mac_handle_t mac_handle;
struct qdf_mac_addr bssid;
struct csr_roam_profile roam_profile;
struct ch_params ch_params;
struct ch_params ch_params = {0};
int ret;
enum channel_state chan_freq_state;
uint8_t max_fw_bw;
enum phy_ch_width ch_width;
qdf_freq_t sec_ch_2g_freq = 0;
hdd_enter();
@ -24074,17 +24071,25 @@ static int __wlan_hdd_cfg80211_set_mon_ch(struct wiphy *wiphy,
roam_profile.ChannelInfo.numOfChannels = 1;
roam_profile.phyMode = ch_info->phy_mode;
roam_profile.ch_params.ch_width = ch_width;
hdd_select_cbmode(adapter, chandef->chan->center_freq,
if (WLAN_REG_IS_24GHZ_CH_FREQ(chandef->chan->center_freq) &&
chandef->width == NL80211_CHAN_WIDTH_40 &&
chandef->center_freq1) {
if (chandef->center_freq1 > chandef->chan->center_freq)
sec_ch_2g_freq = chandef->chan->center_freq + 20;
else if (chandef->center_freq1 < chandef->chan->center_freq)
sec_ch_2g_freq = chandef->chan->center_freq - 20;
}
hdd_debug("set mon ch:width=%d, freq %d sec_ch_2g_freq=%d",
chandef->width, chandef->chan->center_freq, sec_ch_2g_freq);
hdd_select_cbmode(adapter, chandef->chan->center_freq, sec_ch_2g_freq,
&roam_profile.ch_params);
qdf_mem_copy(bssid.bytes, adapter->mac_addr.bytes,
QDF_MAC_ADDR_SIZE);
ch_params.ch_width = ch_width;
wlan_reg_set_channel_params_for_freq(hdd_ctx->pdev,
chandef->chan->center_freq,
0, &ch_params);
sec_ch_2g_freq, &ch_params);
if (wlan_hdd_change_hw_mode_for_given_chnl(adapter,
chandef->chan->center_freq,
POLICY_MGR_UPDATE_REASON_SET_OPER_CHAN)) {

View file

@ -433,8 +433,17 @@ void hdd_reg_notifier(struct wiphy *wiphy,
QDF_STATUS wlan_hdd_validate_operation_channel(struct hdd_adapter *adapter,
uint32_t ch_freq);
void hdd_select_cbmode(struct hdd_adapter *adapter, uint32_t oper_freq,
struct ch_params *ch_params);
/**
* hdd_select_cbmode() - select channel bonding mode
* @adapter: Pointer to adapter
* @oper_freq: Operating frequency (MHz)
* @sec_ch_2g_freq: secondary channel freq
* @ch_params: channel info struct to populate
*
* Return: none
*/
void hdd_select_cbmode(struct hdd_adapter *adapter, qdf_freq_t oper_freq,
qdf_freq_t sec_ch_2g_freq, struct ch_params *ch_params);
/**
* wlan_hdd_is_ap_supports_immediate_power_save() - to find certain vendor APs

View file

@ -8392,9 +8392,7 @@ int wlan_hdd_set_mon_chan(struct hdd_adapter *adapter, qdf_freq_t freq,
roam_profile.ChannelInfo.numOfChannels = 1;
roam_profile.phyMode = ch_info->phy_mode;
roam_profile.ch_params.ch_width = bandwidth;
hdd_select_cbmode(adapter, freq,
&roam_profile.ch_params);
hdd_select_cbmode(adapter, freq, 0, &roam_profile.ch_params);
qdf_mem_copy(bssid.bytes, adapter->mac_addr.bytes,
QDF_MAC_ADDR_SIZE);