From 75e74413db3a77f2a135249b1c6b5789fa43e875 Mon Sep 17 00:00:00 2001 From: Himanshu Agarwal Date: Thu, 1 Feb 2018 20:51:47 +0530 Subject: [PATCH] qcacld-3.0: Avoid selection of irrelevant channel in 80/160MHz config When channel list contains all channels from channel 1 to channel 165 and ch width is 80MHz, the channel to be selected as part of ACS algorithm should be a 5GHz channel as 2.4GHz channels does not support 80MHz but 2.4GHz channel gets selected with channel width as 40MHz. Similarly when ch width is 160Mhz, the 160Mhz bonding can be made only by 36-64 and 100-128 channels but 2.4Ghz channel or some other 5Ghz channel gets selected as a result of ACS algorithm. Assign max weight to all the 2.4GHz channels in 80Mhz and to all 2.4 Ghz channels and 5Ghz channels not in the range 36-64 and 100-128 in 160 Mhz so that only a valid channel is selected after the ACS algorithm is completed. Change-Id: I00c40e5d000a1cf8b79397fd4e361838a60b363d CRs-Fixed: 2182011 --- core/hdd/src/wlan_hdd_cfg80211.c | 8 ++++++-- core/sap/src/sap_ch_select.c | 22 ++++++++++++++++------ 2 files changed, 22 insertions(+), 8 deletions(-) diff --git a/core/hdd/src/wlan_hdd_cfg80211.c b/core/hdd/src/wlan_hdd_cfg80211.c index dcd1fe4e3dbb..8e0d07dbed72 100644 --- a/core/hdd/src/wlan_hdd_cfg80211.c +++ b/core/hdd/src/wlan_hdd_cfg80211.c @@ -2577,7 +2577,9 @@ static int __wlan_hdd_cfg80211_do_acs(struct wiphy *wiphy, } hdd_debug("channel width =%d", ch_width); - if (ch_width == 80) + if (ch_width == 160) + sap_config->acs_cfg.ch_width = CH_WIDTH_160MHZ; + else if (ch_width == 80) sap_config->acs_cfg.ch_width = CH_WIDTH_80MHZ; else if (ch_width == 40) sap_config->acs_cfg.ch_width = CH_WIDTH_40MHZ; @@ -2886,7 +2888,9 @@ void wlan_hdd_cfg80211_acs_ch_select_evt(struct hdd_adapter *adapter) return; } - if (sap_cfg->acs_cfg.ch_width == CH_WIDTH_80MHZ) + if (sap_cfg->acs_cfg.ch_width == CH_WIDTH_160MHZ) + ch_width = 160; + else if (sap_cfg->acs_cfg.ch_width == CH_WIDTH_80MHZ) ch_width = 80; else if (sap_cfg->acs_cfg.ch_width == CH_WIDTH_40MHZ) ch_width = 40; diff --git a/core/sap/src/sap_ch_select.c b/core/sap/src/sap_ch_select.c index 2046cd88a991..058a6fd57b31 100644 --- a/core/sap/src/sap_ch_select.c +++ b/core/sap/src/sap_ch_select.c @@ -1911,12 +1911,16 @@ static void sap_sort_chl_weight_ht80(tSapChSelSpectInfo *pSpectInfoParams) } } + /* + * Assign max weight(SAP_ACS_WEIGHT_MAX * 4) to 2.4 Ghz channels + * and channel 165 as they cannot be part of a 80Mhz channel bonding. + */ pSpectInfo = pSpectInfoParams->pSpectCh; for (j = 0; j < pSpectInfoParams->numSpectChans; j++) { - if (CHANNEL_165 == pSpectInfo[j].chNum) { + if ((pSpectInfo[j].chNum >= WLAN_REG_CH_NUM(CHAN_ENUM_1) && + pSpectInfo[j].chNum <= WLAN_REG_CH_NUM(CHAN_ENUM_14)) || + (CHANNEL_165 == pSpectInfo[j].chNum)) pSpectInfo[j].weight = SAP_ACS_WEIGHT_MAX * 4; - break; - } } sap_sort_chl_weight(pSpectInfoParams); @@ -2051,12 +2055,18 @@ static void sap_sort_chl_weight_vht160(tSapChSelSpectInfo *pSpectInfoParams) pSpectInfo[j + minIdx].weight = acs_vht160_channels[i].weight; } + /* + * Assign max weight(SAP_ACS_WEIGHT_MAX * 8) to 2.4 Ghz channels + * and channel 132-165 as they cannot be part of a 160Mhz channel + * bonding. + */ pSpectInfo = pSpectInfoParams->pSpectCh; for (j = 0; j < pSpectInfoParams->numSpectChans; j++) { - if (CHANNEL_165 == pSpectInfo[j].chNum) { + if ((pSpectInfo[j].chNum >= WLAN_REG_CH_NUM(CHAN_ENUM_1) && + pSpectInfo[j].chNum <= WLAN_REG_CH_NUM(CHAN_ENUM_14)) || + (pSpectInfo[j].chNum >= WLAN_REG_CH_NUM(CHAN_ENUM_132) && + pSpectInfo[j].chNum <= WLAN_REG_CH_NUM(CHAN_ENUM_165))) pSpectInfo[j].weight = SAP_ACS_WEIGHT_MAX * 8; - break; - } } sap_sort_chl_weight(pSpectInfoParams);