|
@@ -89,7 +89,8 @@
|
|
|
(((weights) & 0xf00) >> 8) + \
|
|
|
(((weights) & 0xf000) >> 12) + \
|
|
|
(((weights) & 0xf0000) >> 16) + \
|
|
|
- (((weights) & 0xf00000) >> 20))
|
|
|
+ (((weights) & 0xf00000) >> 20) + \
|
|
|
+ (((weights) & 0xf000000) >> 24))
|
|
|
|
|
|
/*
|
|
|
* LSH/RSH 4 to enhance the accurate since
|
|
@@ -124,6 +125,9 @@
|
|
|
#define ACS_WEIGHT_SOFTAP_TX_POWER_THROUGHPUT_CFG(weights) \
|
|
|
(((weights) & 0xf00000) >> 20)
|
|
|
|
|
|
+#define ACS_WEIGHT_SOFTAP_REG_MAX_POWER_CFG(weights) \
|
|
|
+ (((weights) & 0xf000000) >> 24)
|
|
|
+
|
|
|
typedef struct {
|
|
|
uint16_t chStartNum;
|
|
|
uint32_t weight;
|
|
@@ -401,6 +405,7 @@ uint32_t sap_select_preferred_channel_from_channel_list(uint32_t best_ch_freq,
|
|
|
* @mac_handle: Opaque handle to the global MAC context
|
|
|
* @pSpectInfoParams: Pointer to tSapChSelSpectInfo structure
|
|
|
* @sap_ctx: Pointer to SAP Context
|
|
|
+ * @ignore_acs_range: Whether ignore channel which is out of acs range
|
|
|
*
|
|
|
* Function sap_chan_sel_init allocates the memory, initializes the
|
|
|
* structures used by the channel selection algorithm
|
|
@@ -409,7 +414,8 @@ uint32_t sap_select_preferred_channel_from_channel_list(uint32_t best_ch_freq,
|
|
|
*/
|
|
|
static bool sap_chan_sel_init(mac_handle_t mac_handle,
|
|
|
tSapChSelSpectInfo *pSpectInfoParams,
|
|
|
- struct sap_context *sap_ctx)
|
|
|
+ struct sap_context *sap_ctx,
|
|
|
+ bool ignore_acs_range)
|
|
|
{
|
|
|
tSapSpectChInfo *pSpectCh = NULL;
|
|
|
uint32_t *pChans = NULL;
|
|
@@ -523,9 +529,10 @@ static bool sap_chan_sel_init(mac_handle_t mac_handle,
|
|
|
* Skip the channels which are not in ACS config from user
|
|
|
* space
|
|
|
*/
|
|
|
- if (!wlansap_is_channel_present_in_acs_list(*pChans,
|
|
|
- sap_ctx->acs_cfg->freq_list,
|
|
|
- sap_ctx->acs_cfg->ch_list_count))
|
|
|
+ if (!ignore_acs_range &&
|
|
|
+ !wlansap_is_channel_present_in_acs_list(
|
|
|
+ *pChans, sap_ctx->acs_cfg->freq_list,
|
|
|
+ sap_ctx->acs_cfg->ch_list_count))
|
|
|
continue;
|
|
|
|
|
|
pSpectCh->valid = true;
|
|
@@ -592,9 +599,6 @@ uint32_t sapweight_rssi_count(struct sap_context *sap_ctx, int8_t rssi,
|
|
|
|
|
|
rssicountWeight = rssiWeight + countWeight;
|
|
|
|
|
|
- sap_debug("rssiWeight=%d, countWeight=%d, rssicountWeight=%d",
|
|
|
- rssiWeight, countWeight, rssicountWeight);
|
|
|
-
|
|
|
return rssicountWeight;
|
|
|
}
|
|
|
|
|
@@ -726,13 +730,13 @@ static uint32_t sap_weight_channel_free(struct sap_context *sap_ctx,
|
|
|
if (channel_free_weight > softap_channel_free_weight_local)
|
|
|
channel_free_weight = softap_channel_free_weight_local;
|
|
|
|
|
|
- sap_debug("rcc=%d, cc=%d, tc=%d, rc=%d, cfwc=%d, cfwl=%d, cfw=%d",
|
|
|
- rx_clear_count, cycle_count,
|
|
|
- channel_stat->tx_frame_count,
|
|
|
- channel_stat->rx_frame_count,
|
|
|
- softap_channel_free_weight_cfg,
|
|
|
- softap_channel_free_weight_local,
|
|
|
- channel_free_weight);
|
|
|
+ sap_debug_rl("rcc=%d, cc=%d, tc=%d, rc=%d, cfwc=%d, cfwl=%d, cfw=%d",
|
|
|
+ rx_clear_count, cycle_count,
|
|
|
+ channel_stat->tx_frame_count,
|
|
|
+ channel_stat->rx_frame_count,
|
|
|
+ softap_channel_free_weight_cfg,
|
|
|
+ softap_channel_free_weight_local,
|
|
|
+ channel_free_weight);
|
|
|
|
|
|
return channel_free_weight;
|
|
|
}
|
|
@@ -775,11 +779,11 @@ static uint32_t sap_weight_channel_txpwr_range(struct sap_context *sap_ctx,
|
|
|
if (txpwr_weight_low_speed > softap_txpwr_range_weight_local)
|
|
|
txpwr_weight_low_speed = softap_txpwr_range_weight_local;
|
|
|
|
|
|
- sap_debug("tpr=%d, tprwc=%d, tprwl=%d, tprw=%d",
|
|
|
- channel_stat->chan_tx_pwr_range,
|
|
|
- softap_txpwr_range_weight_cfg,
|
|
|
- softap_txpwr_range_weight_local,
|
|
|
- txpwr_weight_low_speed);
|
|
|
+ sap_debug_rl("tpr=%d, tprwc=%d, tprwl=%d, tprw=%d",
|
|
|
+ channel_stat->chan_tx_pwr_range,
|
|
|
+ softap_txpwr_range_weight_cfg,
|
|
|
+ softap_txpwr_range_weight_local,
|
|
|
+ txpwr_weight_low_speed);
|
|
|
|
|
|
return txpwr_weight_low_speed;
|
|
|
}
|
|
@@ -822,11 +826,11 @@ static uint32_t sap_weight_channel_txpwr_tput(struct sap_context *sap_ctx,
|
|
|
if (txpwr_weight_high_speed > softap_txpwr_tput_weight_local)
|
|
|
txpwr_weight_high_speed = softap_txpwr_tput_weight_local;
|
|
|
|
|
|
- sap_debug("tpt=%d, tptwc=%d, tptwl=%d, tptw=%d",
|
|
|
- channel_stat->chan_tx_pwr_throughput,
|
|
|
- softap_txpwr_tput_weight_cfg,
|
|
|
- softap_txpwr_tput_weight_local,
|
|
|
- txpwr_weight_high_speed);
|
|
|
+ sap_debug_rl("tpt=%d, tptwc=%d, tptwl=%d, tptw=%d",
|
|
|
+ channel_stat->chan_tx_pwr_throughput,
|
|
|
+ softap_txpwr_tput_weight_cfg,
|
|
|
+ softap_txpwr_tput_weight_local,
|
|
|
+ txpwr_weight_high_speed);
|
|
|
|
|
|
return txpwr_weight_high_speed;
|
|
|
}
|
|
@@ -1297,6 +1301,134 @@ sap_upd_chan_spec_params(struct scan_cache_node *scan_entry,
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+/**
|
|
|
+ * sap_weight_channel_reg_max_power() - API to calculate channel weight of max
|
|
|
+ * tx power allowed
|
|
|
+ * @sap_ctx: SAP context
|
|
|
+ * @freq: channel frequency
|
|
|
+ *
|
|
|
+ * This function get channel tx power limit from secondary current channel
|
|
|
+ * list and calculate weight with power factor configure
|
|
|
+ *
|
|
|
+ * Return: channel power weight
|
|
|
+ */
|
|
|
+static uint32_t
|
|
|
+sap_weight_channel_reg_max_power(struct sap_context *sap_ctx, qdf_freq_t freq)
|
|
|
+{
|
|
|
+ struct wlan_objmgr_pdev *pdev;
|
|
|
+ int32_t power_weight;
|
|
|
+ uint8_t power_weight_cfg, power_weight_local;
|
|
|
+ uint16_t eirp_pwr, psd_pwr;
|
|
|
+ bool is_psd;
|
|
|
+ uint32_t chan_flags;
|
|
|
+ QDF_STATUS status;
|
|
|
+
|
|
|
+ power_weight_cfg = ACS_WEIGHT_SOFTAP_REG_MAX_POWER_CFG(
|
|
|
+ sap_ctx->auto_channel_select_weight);
|
|
|
+
|
|
|
+ /* reg max power factor not configure, return zero weight */
|
|
|
+ if (!power_weight_cfg)
|
|
|
+ return 0;
|
|
|
+
|
|
|
+ power_weight_local = ACS_WEIGHT_CFG_TO_LOCAL(
|
|
|
+ sap_ctx->auto_channel_select_weight, power_weight_cfg);
|
|
|
+
|
|
|
+ if (!sap_ctx->vdev) {
|
|
|
+ sap_err("sap ctx vdev is null.");
|
|
|
+ return power_weight_local;
|
|
|
+ }
|
|
|
+ pdev = wlan_vdev_get_pdev(sap_ctx->vdev);
|
|
|
+ status = wlan_reg_get_chan_pwr_attr_from_secondary_list_for_freq(
|
|
|
+ pdev, freq, &is_psd, &eirp_pwr, &psd_pwr, &chan_flags);
|
|
|
+ if (status != QDF_STATUS_SUCCESS) {
|
|
|
+ sap_err("fail to get power attribute.");
|
|
|
+ return power_weight_local;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (eirp_pwr > REG_MAX_EIRP_POWER) {
|
|
|
+ sap_debug("eirp_pwr %d exceed max", eirp_pwr);
|
|
|
+ eirp_pwr = REG_MAX_EIRP_POWER;
|
|
|
+ }
|
|
|
+ if (eirp_pwr < REG_MIN_EIRP_POWER) {
|
|
|
+ sap_debug("eirp_pwr %d below min", eirp_pwr);
|
|
|
+ eirp_pwr = REG_MIN_EIRP_POWER;
|
|
|
+ }
|
|
|
+
|
|
|
+ power_weight = ACS_WEIGHT_COMPUTE(
|
|
|
+ sap_ctx->auto_channel_select_weight,
|
|
|
+ power_weight_cfg,
|
|
|
+ REG_MAX_EIRP_POWER - eirp_pwr,
|
|
|
+ REG_MAX_EIRP_POWER - REG_MIN_EIRP_POWER);
|
|
|
+
|
|
|
+ if (power_weight > power_weight_local)
|
|
|
+ power_weight = power_weight_local;
|
|
|
+ else if (power_weight < 0)
|
|
|
+ power_weight = 0;
|
|
|
+
|
|
|
+ return power_weight;
|
|
|
+}
|
|
|
+
|
|
|
+static void
|
|
|
+sap_normalize_channel_weight_with_factors(struct mac_context *mac,
|
|
|
+ tSapSpectChInfo *spect_ch)
|
|
|
+{
|
|
|
+ uint32_t normalized_weight;
|
|
|
+ uint8_t normalize_factor = 100;
|
|
|
+ uint8_t dfs_normalize_factor;
|
|
|
+ uint32_t chan_freq, i;
|
|
|
+ struct acs_weight *weight_list =
|
|
|
+ mac->mlme_cfg->acs.normalize_weight_chan;
|
|
|
+ struct acs_weight_range *range_list =
|
|
|
+ mac->mlme_cfg->acs.normalize_weight_range;
|
|
|
+ bool freq_present_in_list = false;
|
|
|
+
|
|
|
+ chan_freq = spect_ch->chan_freq;
|
|
|
+
|
|
|
+ /* Check if the freq is present in range list */
|
|
|
+ for (i = 0; i < mac->mlme_cfg->acs.num_weight_range; i++) {
|
|
|
+ if (chan_freq >= range_list[i].start_freq &&
|
|
|
+ chan_freq <= range_list[i].end_freq) {
|
|
|
+ normalize_factor = range_list[i].normalize_weight;
|
|
|
+ sap_debug_rl("Range list, freq %d normalize weight factor %d",
|
|
|
+ chan_freq, normalize_factor);
|
|
|
+ freq_present_in_list = true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /* Check if user wants a special factor for this freq */
|
|
|
+ for (i = 0; i < mac->mlme_cfg->acs.normalize_weight_num_chan; i++) {
|
|
|
+ if (chan_freq == weight_list[i].chan_freq) {
|
|
|
+ normalize_factor = weight_list[i].normalize_weight;
|
|
|
+ sap_debug("freq %d normalize weight factor %d",
|
|
|
+ chan_freq, normalize_factor);
|
|
|
+ freq_present_in_list = true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (wlan_reg_is_dfs_for_freq(mac->pdev, chan_freq)) {
|
|
|
+ dfs_normalize_factor = MLME_GET_DFS_CHAN_WEIGHT(
|
|
|
+ mac->mlme_cfg->acs.np_chan_weightage);
|
|
|
+ if (freq_present_in_list)
|
|
|
+ normalize_factor = qdf_min(dfs_normalize_factor,
|
|
|
+ normalize_factor);
|
|
|
+ else
|
|
|
+ normalize_factor = dfs_normalize_factor;
|
|
|
+ freq_present_in_list = true;
|
|
|
+ sap_debug_rl("DFS channel weightage %d min %d",
|
|
|
+ dfs_normalize_factor, normalize_factor);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (freq_present_in_list) {
|
|
|
+ normalized_weight =
|
|
|
+ ((SAP_ACS_WEIGHT_MAX - spect_ch->weight) *
|
|
|
+ (100 - normalize_factor)) / 100;
|
|
|
+ sap_debug_rl("freq %d old weight %d new weight %d",
|
|
|
+ chan_freq, spect_ch->weight,
|
|
|
+ spect_ch->weight + normalized_weight);
|
|
|
+ spect_ch->weight += normalized_weight;
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
/**
|
|
|
* sap_compute_spect_weight() - Compute spectrum weight
|
|
|
* @pSpectInfoParams: Pointer to the tSpectInfoParams structure
|
|
@@ -1318,7 +1450,7 @@ static void sap_compute_spect_weight(tSapChSelSpectInfo *pSpectInfoParams,
|
|
|
tSapSpectChInfo *pSpectCh = pSpectInfoParams->pSpectCh;
|
|
|
tSirMacHTChannelWidth ch_width = 0;
|
|
|
uint16_t secondaryChannelOffset;
|
|
|
- uint32_t center_freq0, center_freq1;
|
|
|
+ uint32_t center_freq0, center_freq1, chan_freq;
|
|
|
uint8_t i;
|
|
|
bool found;
|
|
|
struct mac_context *mac = MAC_CONTEXT(mac_handle);
|
|
@@ -1327,15 +1459,7 @@ static void sap_compute_spect_weight(tSapChSelSpectInfo *pSpectInfoParams,
|
|
|
pSpectInfoParams->numSpectChans;
|
|
|
qdf_list_node_t *cur_lst = NULL, *next_lst = NULL;
|
|
|
struct scan_cache_node *cur_node = NULL;
|
|
|
- uint32_t normalized_weight;
|
|
|
- uint8_t normalize_factor = 100;
|
|
|
- uint8_t dfs_normalize_factor;
|
|
|
- uint32_t chan_freq;
|
|
|
- struct acs_weight *weight_list =
|
|
|
- mac->mlme_cfg->acs.normalize_weight_chan;
|
|
|
- struct acs_weight_range *range_list =
|
|
|
- mac->mlme_cfg->acs.normalize_weight_range;
|
|
|
- bool freq_present_in_list = false;
|
|
|
+ uint32_t rssi_bss_weight = 0, chan_status_weight = 0, power_weight = 0;
|
|
|
|
|
|
sap_debug("Computing spectral weight");
|
|
|
|
|
@@ -1432,83 +1556,42 @@ static void sap_compute_spect_weight(tSapChSelSpectInfo *pSpectInfoParams,
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- if (found)
|
|
|
- pSpectCh->weight =
|
|
|
- SAPDFS_NORMALISE_1000 *
|
|
|
- (sapweight_rssi_count(sap_ctx, rssi,
|
|
|
- pSpectCh->bssCount) + sap_weight_channel_status(
|
|
|
- sap_ctx, sap_get_channel_status(
|
|
|
- mac, pSpectCh->chan_freq)));
|
|
|
- else {
|
|
|
+ rssi_bss_weight = 0;
|
|
|
+ chan_status_weight = 0;
|
|
|
+ power_weight = 0;
|
|
|
+ if (found) {
|
|
|
+ rssi_bss_weight = sapweight_rssi_count(
|
|
|
+ sap_ctx,
|
|
|
+ rssi,
|
|
|
+ pSpectCh->bssCount);
|
|
|
+ chan_status_weight = sap_weight_channel_status(
|
|
|
+ sap_ctx,
|
|
|
+ sap_get_channel_status(
|
|
|
+ mac, pSpectCh->chan_freq));
|
|
|
+ power_weight = sap_weight_channel_reg_max_power(
|
|
|
+ sap_ctx, pSpectCh->chan_freq);
|
|
|
+ pSpectCh->weight = SAPDFS_NORMALISE_1000 *
|
|
|
+ (rssi_bss_weight + chan_status_weight
|
|
|
+ + power_weight);
|
|
|
+ } else {
|
|
|
pSpectCh->weight = SAP_ACS_WEIGHT_MAX;
|
|
|
pSpectCh->rssiAgr = SOFTAP_MIN_RSSI;
|
|
|
rssi = SOFTAP_MIN_RSSI;
|
|
|
pSpectCh->bssCount = SOFTAP_MIN_COUNT;
|
|
|
}
|
|
|
|
|
|
- chan_freq = pSpectCh->chan_freq;
|
|
|
-
|
|
|
- /* Check if the freq is present in range list */
|
|
|
- for (i = 0; i < mac->mlme_cfg->acs.num_weight_range; i++) {
|
|
|
- if (chan_freq >= range_list[i].start_freq &&
|
|
|
- chan_freq <= range_list[i].end_freq) {
|
|
|
- normalize_factor =
|
|
|
- range_list[i].normalize_weight;
|
|
|
- sap_debug_rl("Range list, freq %d normalize weight factor %d",
|
|
|
- chan_freq, normalize_factor);
|
|
|
- freq_present_in_list = true;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- /* Check if user wants a special factor for this freq */
|
|
|
-
|
|
|
- for (i = 0; i < mac->mlme_cfg->acs.normalize_weight_num_chan;
|
|
|
- i++) {
|
|
|
- if (chan_freq == weight_list[i].chan_freq) {
|
|
|
- normalize_factor =
|
|
|
- weight_list[i].normalize_weight;
|
|
|
- sap_debug("freq %d normalize weight factor %d",
|
|
|
- chan_freq, normalize_factor);
|
|
|
- freq_present_in_list = true;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- if (wlan_reg_is_dfs_for_freq(mac->pdev, chan_freq)) {
|
|
|
- dfs_normalize_factor =
|
|
|
- MLME_GET_DFS_CHAN_WEIGHT(
|
|
|
- mac->mlme_cfg->acs.np_chan_weightage);
|
|
|
- if (freq_present_in_list)
|
|
|
- normalize_factor =
|
|
|
- qdf_min(dfs_normalize_factor,
|
|
|
- normalize_factor);
|
|
|
- else
|
|
|
- normalize_factor = dfs_normalize_factor;
|
|
|
- freq_present_in_list = true;
|
|
|
- sap_debug_rl("DFS channel weightage %d min %d",
|
|
|
- dfs_normalize_factor, normalize_factor);
|
|
|
- }
|
|
|
-
|
|
|
- if (freq_present_in_list) {
|
|
|
- normalized_weight =
|
|
|
- ((SAP_ACS_WEIGHT_MAX - pSpectCh->weight) *
|
|
|
- (100 - normalize_factor)) / 100;
|
|
|
- sap_debug_rl("freq %d old weight %d new weight %d",
|
|
|
- chan_freq, pSpectCh->weight,
|
|
|
- pSpectCh->weight + normalized_weight);
|
|
|
- pSpectCh->weight += normalized_weight;
|
|
|
- freq_present_in_list = false;
|
|
|
- }
|
|
|
+ sap_normalize_channel_weight_with_factors(mac, pSpectCh);
|
|
|
|
|
|
if (pSpectCh->weight > SAP_ACS_WEIGHT_MAX)
|
|
|
pSpectCh->weight = SAP_ACS_WEIGHT_MAX;
|
|
|
pSpectCh->weight_copy = pSpectCh->weight;
|
|
|
|
|
|
debug_info:
|
|
|
- QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_TRACE,
|
|
|
- "%s: freq = %d, weight = %d rssi = %d bss count = %d factor %d",
|
|
|
- __func__, pSpectCh->chan_freq, pSpectCh->weight,
|
|
|
- pSpectCh->rssiAgr, pSpectCh->bssCount,
|
|
|
- normalize_factor);
|
|
|
+ sap_debug("freq %d valid %d weight %d(%d,%d,%d) rssi %d bss %d",
|
|
|
+ pSpectCh->chan_freq, pSpectCh->valid,
|
|
|
+ pSpectCh->weight, rssi_bss_weight,
|
|
|
+ chan_status_weight, power_weight,
|
|
|
+ pSpectCh->rssiAgr, pSpectCh->bssCount);
|
|
|
|
|
|
pSpectCh++;
|
|
|
}
|
|
@@ -1598,11 +1681,12 @@ static void sap_sort_chl_weight(tSapChSelSpectInfo *pSpectInfoParams)
|
|
|
* @pSpectInfoParams: Pointer to the tSapChSelSpectInfo structure
|
|
|
* Function to sort the channels with the least weight first for HT80 channels
|
|
|
*
|
|
|
- * Return: none
|
|
|
+ * Return: QDF STATUS
|
|
|
*/
|
|
|
-static void sap_sort_chl_weight_80_mhz(struct mac_context *mac_ctx,
|
|
|
- struct sap_context *sap_ctx,
|
|
|
- tSapChSelSpectInfo *pSpectInfoParams)
|
|
|
+static QDF_STATUS
|
|
|
+sap_sort_chl_weight_80_mhz(struct mac_context *mac_ctx,
|
|
|
+ struct sap_context *sap_ctx,
|
|
|
+ tSapChSelSpectInfo *pSpectInfoParams)
|
|
|
{
|
|
|
uint8_t i, j;
|
|
|
tSapSpectChInfo *pSpectInfo;
|
|
@@ -1611,6 +1695,7 @@ static void sap_sort_chl_weight_80_mhz(struct mac_context *mac_ctx,
|
|
|
int8_t center_freq_diff;
|
|
|
uint32_t combined_weight;
|
|
|
uint32_t min_ch_weight;
|
|
|
+ uint32_t valid_chans = 0;
|
|
|
|
|
|
pSpectInfo = pSpectInfoParams->pSpectCh;
|
|
|
|
|
@@ -1705,24 +1790,22 @@ static void sap_sort_chl_weight_80_mhz(struct mac_context *mac_ctx,
|
|
|
|
|
|
pSpectInfo[j + minIdx].weight = combined_weight;
|
|
|
|
|
|
+ valid_chans++;
|
|
|
+
|
|
|
sap_debug("best freq = %d for 80mhz center freq %d combined weight = %d",
|
|
|
pSpectInfo[j + minIdx].chan_freq,
|
|
|
acs_ch_params.mhz_freq_seg0,
|
|
|
combined_weight);
|
|
|
}
|
|
|
|
|
|
- sap_sort_chl_weight(pSpectInfoParams);
|
|
|
-
|
|
|
- pSpectInfo = pSpectInfoParams->pSpectCh;
|
|
|
+ if (!valid_chans) {
|
|
|
+ sap_debug("no valid chan bonding with CH_WIDTH_80MHZ");
|
|
|
+ return QDF_STATUS_E_INVAL;
|
|
|
+ }
|
|
|
|
|
|
- for (j = 0; j < (pSpectInfoParams->numSpectChans); j++) {
|
|
|
- QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_TRACE,
|
|
|
- "%s: freq = %d weight = %d rssi = %d bss count = %d",
|
|
|
- __func__, pSpectInfo->chan_freq, pSpectInfo->weight,
|
|
|
- pSpectInfo->rssiAgr, pSpectInfo->bssCount);
|
|
|
+ sap_sort_chl_weight(pSpectInfoParams);
|
|
|
|
|
|
- pSpectInfo++;
|
|
|
- }
|
|
|
+ return QDF_STATUS_SUCCESS;
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -1733,11 +1816,12 @@ static void sap_sort_chl_weight_80_mhz(struct mac_context *mac_ctx,
|
|
|
*
|
|
|
* Function to sort the channels with the least weight first for VHT160 channels
|
|
|
*
|
|
|
- * Return: none
|
|
|
+ * Return: QDF STATUS
|
|
|
*/
|
|
|
-static void sap_sort_chl_weight_160_mhz(struct mac_context *mac_ctx,
|
|
|
- struct sap_context *sap_ctx,
|
|
|
- tSapChSelSpectInfo *pSpectInfoParams)
|
|
|
+static QDF_STATUS
|
|
|
+sap_sort_chl_weight_160_mhz(struct mac_context *mac_ctx,
|
|
|
+ struct sap_context *sap_ctx,
|
|
|
+ tSapChSelSpectInfo *pSpectInfoParams)
|
|
|
{
|
|
|
uint8_t i, j;
|
|
|
tSapSpectChInfo *pSpectInfo;
|
|
@@ -1746,6 +1830,7 @@ static void sap_sort_chl_weight_160_mhz(struct mac_context *mac_ctx,
|
|
|
int8_t center_freq_diff;
|
|
|
uint32_t combined_weight;
|
|
|
uint32_t min_ch_weight;
|
|
|
+ uint32_t valid_chans = 0;
|
|
|
|
|
|
pSpectInfo = pSpectInfoParams->pSpectCh;
|
|
|
|
|
@@ -1851,7 +1936,6 @@ static void sap_sort_chl_weight_160_mhz(struct mac_context *mac_ctx,
|
|
|
continue;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
/* We have 8 channels to calculate cumulative weight */
|
|
|
|
|
|
combined_weight = pSpectInfo[j].weight +
|
|
@@ -1877,23 +1961,22 @@ static void sap_sort_chl_weight_160_mhz(struct mac_context *mac_ctx,
|
|
|
|
|
|
pSpectInfo[j + minIdx].weight = combined_weight;
|
|
|
|
|
|
+ valid_chans++;
|
|
|
+
|
|
|
sap_debug("best freq = %d for 160mhz center freq %d combined weight = %d",
|
|
|
pSpectInfo[j + minIdx].chan_freq,
|
|
|
acs_ch_params.mhz_freq_seg1,
|
|
|
combined_weight);
|
|
|
}
|
|
|
|
|
|
- sap_sort_chl_weight(pSpectInfoParams);
|
|
|
+ if (!valid_chans) {
|
|
|
+ sap_debug("no valid chan bonding with CH_WIDTH_160MHZ");
|
|
|
+ return QDF_STATUS_E_INVAL;
|
|
|
+ }
|
|
|
|
|
|
- pSpectInfo = pSpectInfoParams->pSpectCh;
|
|
|
- for (j = 0; j < (pSpectInfoParams->numSpectChans); j++) {
|
|
|
- QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_TRACE,
|
|
|
- "%s: freq = %d weight = %d rssi = %d bss count = %d",
|
|
|
- __func__, pSpectInfo->chan_freq, pSpectInfo->weight,
|
|
|
- pSpectInfo->rssiAgr, pSpectInfo->bssCount);
|
|
|
+ sap_sort_chl_weight(pSpectInfoParams);
|
|
|
|
|
|
- pSpectInfo++;
|
|
|
- }
|
|
|
+ return QDF_STATUS_SUCCESS;
|
|
|
}
|
|
|
|
|
|
#if defined(WLAN_FEATURE_11BE)
|
|
@@ -1905,11 +1988,12 @@ static void sap_sort_chl_weight_160_mhz(struct mac_context *mac_ctx,
|
|
|
*
|
|
|
* Function to sort the channels with the least weight first for 320MHz channels
|
|
|
*
|
|
|
- * Return: none
|
|
|
+ * Return: QDF STATUS
|
|
|
*/
|
|
|
-static void sap_sort_chl_weight_320_mhz(struct mac_context *mac_ctx,
|
|
|
- struct sap_context *sap_ctx,
|
|
|
- tSapChSelSpectInfo *pSpectInfoParams)
|
|
|
+static QDF_STATUS
|
|
|
+sap_sort_chl_weight_320_mhz(struct mac_context *mac_ctx,
|
|
|
+ struct sap_context *sap_ctx,
|
|
|
+ tSapChSelSpectInfo *pSpectInfoParams)
|
|
|
{
|
|
|
uint8_t i, j;
|
|
|
tSapSpectChInfo *pSpectInfo;
|
|
@@ -1918,6 +2002,7 @@ static void sap_sort_chl_weight_320_mhz(struct mac_context *mac_ctx,
|
|
|
int8_t center_freq_diff;
|
|
|
uint32_t combined_weight;
|
|
|
uint32_t min_ch_weight;
|
|
|
+ uint32_t valid_chans = 0;
|
|
|
|
|
|
pSpectInfo = pSpectInfoParams->pSpectCh;
|
|
|
|
|
@@ -2118,23 +2203,22 @@ static void sap_sort_chl_weight_320_mhz(struct mac_context *mac_ctx,
|
|
|
|
|
|
pSpectInfo[j + minIdx].weight = combined_weight;
|
|
|
|
|
|
+ valid_chans++;
|
|
|
+
|
|
|
sap_debug("best freq = %d for 320mhz center freq %d combined weight = %d",
|
|
|
pSpectInfo[j + minIdx].chan_freq,
|
|
|
acs_ch_params.mhz_freq_seg1,
|
|
|
combined_weight);
|
|
|
}
|
|
|
|
|
|
- sap_sort_chl_weight(pSpectInfoParams);
|
|
|
+ if (!valid_chans) {
|
|
|
+ sap_debug("no valid chan bonding with CH_WIDTH_320MHZ");
|
|
|
+ return QDF_STATUS_E_INVAL;
|
|
|
+ }
|
|
|
|
|
|
- pSpectInfo = pSpectInfoParams->pSpectCh;
|
|
|
- for (j = 0; j < (pSpectInfoParams->numSpectChans); j++) {
|
|
|
- QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_TRACE,
|
|
|
- "%s: freq = %d weight = %d rssi = %d bss count = %d",
|
|
|
- __func__, pSpectInfo->chan_freq, pSpectInfo->weight,
|
|
|
- pSpectInfo->rssiAgr, pSpectInfo->bssCount);
|
|
|
+ sap_sort_chl_weight(pSpectInfoParams);
|
|
|
|
|
|
- pSpectInfo++;
|
|
|
- }
|
|
|
+ return QDF_STATUS_SUCCESS;
|
|
|
}
|
|
|
#endif /* WLAN_FEATURE_11BE */
|
|
|
|
|
@@ -2334,8 +2418,18 @@ static void sap_sort_chl_weight_ht40_24_g(struct mac_context *mac_ctx,
|
|
|
sap_sort_chl_weight(pSpectInfoParams);
|
|
|
}
|
|
|
|
|
|
-static void sap_sort_chl_weight_40_mhz(struct mac_context *mac_ctx,
|
|
|
- tSapChSelSpectInfo *pSpectInfoParams)
|
|
|
+/**
|
|
|
+ * sap_sort_chl_weight_40_mhz() - To sort 5 GHz channel in 40 MHz bandwidth
|
|
|
+ * @mac_ctx: mac context handle
|
|
|
+ * @sap_ctx: pointer to SAP context
|
|
|
+ * @pSpectInfoParams: pointer to the tSapChSelSpectInfo structure
|
|
|
+ *
|
|
|
+ * Return: QDF STATUS
|
|
|
+ */
|
|
|
+static QDF_STATUS
|
|
|
+sap_sort_chl_weight_40_mhz(struct mac_context *mac_ctx,
|
|
|
+ struct sap_context *sap_ctx,
|
|
|
+ tSapChSelSpectInfo *pSpectInfoParams)
|
|
|
{
|
|
|
uint8_t i, j;
|
|
|
tSapSpectChInfo *pSpectInfo;
|
|
@@ -2344,6 +2438,7 @@ static void sap_sort_chl_weight_40_mhz(struct mac_context *mac_ctx,
|
|
|
int8_t center_freq_diff;
|
|
|
uint32_t combined_weight;
|
|
|
uint32_t min_ch_weight;
|
|
|
+ uint32_t valid_chans = 0;
|
|
|
|
|
|
pSpectInfo = pSpectInfoParams->pSpectCh;
|
|
|
|
|
@@ -2423,22 +2518,39 @@ static void sap_sort_chl_weight_40_mhz(struct mac_context *mac_ctx,
|
|
|
|
|
|
pSpectInfo[j + minIdx].weight = combined_weight;
|
|
|
|
|
|
+ valid_chans++;
|
|
|
+
|
|
|
sap_debug("best freq = %d for 40mhz center freq %d combined weight = %d",
|
|
|
pSpectInfo[j + minIdx].chan_freq,
|
|
|
acs_ch_params.mhz_freq_seg0,
|
|
|
combined_weight);
|
|
|
}
|
|
|
|
|
|
+ if (!valid_chans) {
|
|
|
+ sap_debug("no valid chan bonding with CH_WIDTH_40MHZ");
|
|
|
+ return QDF_STATUS_E_INVAL;
|
|
|
+ }
|
|
|
+
|
|
|
sap_sort_chl_weight(pSpectInfoParams);
|
|
|
|
|
|
- pSpectInfo = pSpectInfoParams->pSpectCh;
|
|
|
- for (j = 0; j < (pSpectInfoParams->numSpectChans); j++) {
|
|
|
- QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_TRACE,
|
|
|
- "%s: freq = %d weight = %d rssi = %d bss count = %d",
|
|
|
- __func__, pSpectInfo->chan_freq, pSpectInfo->weight,
|
|
|
- pSpectInfo->rssiAgr, pSpectInfo->bssCount);
|
|
|
+ return QDF_STATUS_SUCCESS;
|
|
|
+}
|
|
|
|
|
|
- pSpectInfo++;
|
|
|
+/**
|
|
|
+ * sap_restore_chan_weight() - Restore every channel weight to original
|
|
|
+ * @spect_info: pointer to the tSapChSelSpectInfo structure
|
|
|
+ *
|
|
|
+ * Return: None
|
|
|
+ */
|
|
|
+static void sap_restore_chan_weight(tSapChSelSpectInfo *spect_info)
|
|
|
+{
|
|
|
+ uint32_t i;
|
|
|
+ tSapSpectChInfo *spect_ch = spect_info->pSpectCh;
|
|
|
+
|
|
|
+ for (i = 0; i < spect_info->numSpectChans; i++) {
|
|
|
+ spect_ch->weight = spect_ch->weight_copy;
|
|
|
+ spect_ch->weight_calc_done = false;
|
|
|
+ spect_ch++;
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -2466,14 +2578,14 @@ static void sap_sort_chl_weight_all(struct mac_context *mac_ctx,
|
|
|
struct sap_context *sap_ctx,
|
|
|
tSapChSelSpectInfo *pSpectInfoParams,
|
|
|
uint32_t operatingBand,
|
|
|
- v_REGDOMAIN_t domain)
|
|
|
+ v_REGDOMAIN_t domain,
|
|
|
+ enum phy_ch_width *bw)
|
|
|
{
|
|
|
- tSapSpectChInfo *pSpectCh = NULL;
|
|
|
- uint32_t j = 0;
|
|
|
+ QDF_STATUS status = QDF_STATUS_SUCCESS;
|
|
|
+ enum phy_ch_width ch_width = *bw;
|
|
|
|
|
|
- pSpectCh = pSpectInfoParams->pSpectCh;
|
|
|
-
|
|
|
- switch (sap_ctx->acs_cfg->ch_width) {
|
|
|
+next_bw:
|
|
|
+ switch (ch_width) {
|
|
|
case CH_WIDTH_40MHZ:
|
|
|
/*
|
|
|
* Assign max weight to all 5Ghz channels when operating band
|
|
@@ -2482,41 +2594,52 @@ static void sap_sort_chl_weight_all(struct mac_context *mac_ctx,
|
|
|
*/
|
|
|
if (eCSR_DOT11_MODE_11g == operatingBand) {
|
|
|
sap_allocate_max_weight_40_mhz(pSpectInfoParams);
|
|
|
- sap_sort_chl_weight_ht40_24_g(mac_ctx,
|
|
|
- pSpectInfoParams,
|
|
|
- domain);
|
|
|
+ sap_sort_chl_weight_ht40_24_g(
|
|
|
+ mac_ctx,
|
|
|
+ pSpectInfoParams,
|
|
|
+ domain);
|
|
|
} else {
|
|
|
sap_allocate_max_weight_40_mhz_24_g(pSpectInfoParams);
|
|
|
- sap_sort_chl_weight_40_mhz(mac_ctx, pSpectInfoParams);
|
|
|
+ status = sap_sort_chl_weight_40_mhz(mac_ctx,
|
|
|
+ sap_ctx,
|
|
|
+ pSpectInfoParams);
|
|
|
}
|
|
|
break;
|
|
|
case CH_WIDTH_80MHZ:
|
|
|
case CH_WIDTH_80P80MHZ:
|
|
|
- sap_sort_chl_weight_80_mhz(mac_ctx, sap_ctx, pSpectInfoParams);
|
|
|
+ status = sap_sort_chl_weight_80_mhz(mac_ctx,
|
|
|
+ sap_ctx,
|
|
|
+ pSpectInfoParams);
|
|
|
break;
|
|
|
case CH_WIDTH_160MHZ:
|
|
|
- sap_sort_chl_weight_160_mhz(mac_ctx, sap_ctx, pSpectInfoParams);
|
|
|
+ status = sap_sort_chl_weight_160_mhz(mac_ctx,
|
|
|
+ sap_ctx,
|
|
|
+ pSpectInfoParams);
|
|
|
break;
|
|
|
#if defined(WLAN_FEATURE_11BE)
|
|
|
case CH_WIDTH_320MHZ:
|
|
|
- sap_sort_chl_weight_320_mhz(mac_ctx, sap_ctx, pSpectInfoParams);
|
|
|
+ status = sap_sort_chl_weight_320_mhz(mac_ctx,
|
|
|
+ sap_ctx,
|
|
|
+ pSpectInfoParams);
|
|
|
break;
|
|
|
#endif
|
|
|
case CH_WIDTH_20MHZ:
|
|
|
default:
|
|
|
/* Sorting the channels as per weights as 20MHz channels */
|
|
|
sap_sort_chl_weight(pSpectInfoParams);
|
|
|
+ status = QDF_STATUS_SUCCESS;
|
|
|
}
|
|
|
|
|
|
- pSpectCh = pSpectInfoParams->pSpectCh;
|
|
|
- for (j = 0; j < (pSpectInfoParams->numSpectChans); j++) {
|
|
|
- QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_TRACE,
|
|
|
- "%s: Freq = %d weight = %d rssi aggr = %d bss count = %d",
|
|
|
- __func__, pSpectCh->chan_freq, pSpectCh->weight,
|
|
|
- pSpectCh->rssiAgr, pSpectCh->bssCount);
|
|
|
- pSpectCh++;
|
|
|
+ if (status != QDF_STATUS_SUCCESS) {
|
|
|
+ ch_width = wlan_reg_get_next_lower_bandwidth(ch_width);
|
|
|
+ sap_restore_chan_weight(pSpectInfoParams);
|
|
|
+ goto next_bw;
|
|
|
}
|
|
|
|
|
|
+ if (ch_width != *bw) {
|
|
|
+ sap_info("channel width change from %d to %d", *bw, ch_width);
|
|
|
+ *bw = ch_width;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -2565,11 +2688,12 @@ uint32_t sap_select_channel(mac_handle_t mac_handle,
|
|
|
uint32_t operating_band = 0;
|
|
|
struct mac_context *mac_ctx;
|
|
|
uint32_t best_chan_freq = 0;
|
|
|
+ enum phy_ch_width cur_bw = sap_ctx->acs_cfg->ch_width;
|
|
|
|
|
|
mac_ctx = MAC_CONTEXT(mac_handle);
|
|
|
|
|
|
/* Initialize the structure pointed by spect_info */
|
|
|
- if (sap_chan_sel_init(mac_handle, spect_info, sap_ctx) != true) {
|
|
|
+ if (sap_chan_sel_init(mac_handle, spect_info, sap_ctx, false) != true) {
|
|
|
sap_err("Ch Select initialization failed");
|
|
|
return SAP_CHANNEL_NOT_SELECTED;
|
|
|
}
|
|
@@ -2589,7 +2713,8 @@ uint32_t sap_select_channel(mac_handle_t mac_handle,
|
|
|
|
|
|
/* Sort the ch lst as per the computed weights, lesser weight first. */
|
|
|
sap_sort_chl_weight_all(mac_ctx, sap_ctx, spect_info, operating_band,
|
|
|
- domain);
|
|
|
+ domain, &cur_bw);
|
|
|
+ sap_ctx->acs_cfg->ch_width = cur_bw;
|
|
|
|
|
|
/*Loop till get the best channel in the given range */
|
|
|
for (count = 0; count < spect_info->numSpectChans; count++) {
|
|
@@ -2675,6 +2800,7 @@ next_bw:
|
|
|
if (ch_params.ch_width != pref_bw)
|
|
|
continue;
|
|
|
best_chan_freq = cal_chan_freq;
|
|
|
+ sap_ctx->acs_cfg->ch_width = pref_bw;
|
|
|
sap_debug("Changed best freq to %d Preferred freq bw %d",
|
|
|
best_chan_freq, pref_bw);
|
|
|
break;
|
|
@@ -2739,3 +2865,192 @@ sap_ch_sel_end:
|
|
|
|
|
|
return best_chan_freq;
|
|
|
}
|
|
|
+
|
|
|
+#ifdef CONFIG_AFC_SUPPORT
|
|
|
+/**
|
|
|
+ * sap_max_weight_invalidate_2ghz_channels() - Invalidate 2 GHz channel and set
|
|
|
+ * max channel weight
|
|
|
+ * @spect_info: pointer to array of channel spectrum info
|
|
|
+ *
|
|
|
+ * Return: None
|
|
|
+ */
|
|
|
+static void
|
|
|
+sap_max_weight_invalidate_2ghz_channels(tSapChSelSpectInfo *spect_info)
|
|
|
+{
|
|
|
+ uint32_t i;
|
|
|
+ tSapSpectChInfo *spect_ch;
|
|
|
+
|
|
|
+ spect_ch = spect_info->pSpectCh;
|
|
|
+ for (i = 0; i < spect_info->numSpectChans; i++) {
|
|
|
+ if (WLAN_REG_IS_24GHZ_CH_FREQ(spect_ch[i].chan_freq)) {
|
|
|
+ spect_ch[i].weight = SAP_ACS_WEIGHT_MAX;
|
|
|
+ spect_ch[i].valid = false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+/**
|
|
|
+ * sap_compute_spect_max_power_weight() - Compute channel weight use max power
|
|
|
+ * factor
|
|
|
+ * @spect_info: pointer to SAP channel select structure of spectrum info
|
|
|
+ * @mac_handle: mac handle
|
|
|
+ * @sap_ctx: pointer to SAP context
|
|
|
+ *
|
|
|
+ * Return: None
|
|
|
+ */
|
|
|
+static void
|
|
|
+sap_compute_spect_max_power_weight(tSapChSelSpectInfo *spect_info,
|
|
|
+ mac_handle_t mac_handle,
|
|
|
+ struct sap_context *sap_ctx)
|
|
|
+{
|
|
|
+ struct mac_context *mac = MAC_CONTEXT(mac_handle);
|
|
|
+ uint32_t i;
|
|
|
+ tSapSpectChInfo *spect_ch = spect_info->pSpectCh;
|
|
|
+
|
|
|
+ for (i = 0; i < spect_info->numSpectChans; i++) {
|
|
|
+ if (spect_ch[i].weight == SAP_ACS_WEIGHT_MAX) {
|
|
|
+ spect_ch[i].weight_copy = spect_ch[i].weight;
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ spect_ch[i].weight = SAPDFS_NORMALISE_1000 *
|
|
|
+ sap_weight_channel_reg_max_power(sap_ctx,
|
|
|
+ spect_ch[i].chan_freq);
|
|
|
+
|
|
|
+ sap_normalize_channel_weight_with_factors(mac, &spect_ch[i]);
|
|
|
+
|
|
|
+ if (spect_ch[i].weight > SAP_ACS_WEIGHT_MAX)
|
|
|
+ spect_ch[i].weight = SAP_ACS_WEIGHT_MAX;
|
|
|
+ spect_ch[i].weight_copy = spect_ch[i].weight;
|
|
|
+
|
|
|
+ sap_debug("freq = %d, weight = %d",
|
|
|
+ spect_ch[i].chan_freq, spect_ch[i].weight);
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+/**
|
|
|
+ * sap_afc_dcs_target_chan() - Select best channel frequency from sorted list
|
|
|
+ * @mac_ctx: pointer to mac context
|
|
|
+ * @sap_ctx: pointer to SAP context
|
|
|
+ * @spect_info: pointer to SAP channel select structure of spectrum info
|
|
|
+ * @cur_freq: SAP current home channel frequency
|
|
|
+ * @cur_bw: SAP current channel bandwidth
|
|
|
+ * @pref_bw: SAP target channel bandwidth can switch to
|
|
|
+ *
|
|
|
+ * Return: Best home channel frequency, if no available channel return 0.
|
|
|
+ */
|
|
|
+static qdf_freq_t
|
|
|
+sap_afc_dcs_target_chan(struct mac_context *mac_ctx,
|
|
|
+ struct sap_context *sap_ctx,
|
|
|
+ tSapChSelSpectInfo *spect_info,
|
|
|
+ qdf_freq_t cur_freq,
|
|
|
+ enum phy_ch_width cur_bw,
|
|
|
+ enum phy_ch_width pref_bw)
|
|
|
+{
|
|
|
+ uint32_t i, best_weight;
|
|
|
+ qdf_freq_t best_chan_freq;
|
|
|
+ tSapSpectChInfo *spect_ch = spect_info->pSpectCh;
|
|
|
+
|
|
|
+ best_weight = spect_ch[0].weight;
|
|
|
+ best_chan_freq = spect_ch[0].chan_freq;
|
|
|
+
|
|
|
+ /*
|
|
|
+ * If current channel is already best channel and no bandwidth
|
|
|
+ * change, return the current channel so no channel switch happen.
|
|
|
+ */
|
|
|
+ if (cur_bw == pref_bw) {
|
|
|
+ for (i = 1; i < spect_info->numSpectChans; i++) {
|
|
|
+ if (!spect_ch[i].valid)
|
|
|
+ continue;
|
|
|
+ if (spect_ch[i].weight <= best_weight) {
|
|
|
+ sap_debug("best freq = %d, weight = %d",
|
|
|
+ spect_ch[i].chan_freq,
|
|
|
+ spect_ch[i].weight);
|
|
|
+ if (spect_ch[i].chan_freq == cur_freq)
|
|
|
+ return cur_freq;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return best_chan_freq;
|
|
|
+}
|
|
|
+
|
|
|
+#ifdef WLAN_FEATURE_AFC_DCS_SKIP_ACS_RANGE
|
|
|
+/**
|
|
|
+ * is_sap_afc_dcs_skip_acs() - API to get whether to skip ACS range
|
|
|
+ * when doing automatically channel selection for AFC DCS.
|
|
|
+ * @sap_ctx: SAP context pointer
|
|
|
+ *
|
|
|
+ * Return: True if skip ACS range and can select channel out of it.
|
|
|
+ */
|
|
|
+static bool is_sap_afc_dcs_skip_acs(struct sap_context *sap_ctx)
|
|
|
+{
|
|
|
+ struct sap_acs_cfg *acs_cfg;
|
|
|
+ uint32_t i;
|
|
|
+
|
|
|
+ if (!sap_ctx || !sap_ctx->acs_cfg)
|
|
|
+ return false;
|
|
|
+
|
|
|
+ acs_cfg = sap_ctx->acs_cfg;
|
|
|
+ for (i = 0; i < acs_cfg->ch_list_count; i++) {
|
|
|
+ if (WLAN_REG_IS_6GHZ_CHAN_FREQ(acs_cfg->freq_list[i]))
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ return true;
|
|
|
+}
|
|
|
+#else
|
|
|
+static bool is_sap_afc_dcs_skip_acs(struct sap_context *sap_ctx)
|
|
|
+{
|
|
|
+ return false;
|
|
|
+}
|
|
|
+#endif
|
|
|
+
|
|
|
+qdf_freq_t sap_afc_dcs_sel_chan(struct sap_context *sap_ctx,
|
|
|
+ qdf_freq_t cur_freq,
|
|
|
+ enum phy_ch_width cur_bw,
|
|
|
+ enum phy_ch_width *pref_bw)
|
|
|
+{
|
|
|
+ struct mac_context *mac_ctx;
|
|
|
+ mac_handle_t mac_handle;
|
|
|
+ tSapChSelSpectInfo spect_info_obj = {NULL, 0};
|
|
|
+ tSapChSelSpectInfo *spect_info = &spect_info_obj;
|
|
|
+ qdf_freq_t target_freq;
|
|
|
+
|
|
|
+ if (!sap_ctx || !pref_bw)
|
|
|
+ return SAP_CHANNEL_NOT_SELECTED;
|
|
|
+
|
|
|
+ if (!sap_ctx->acs_cfg || !sap_ctx->acs_cfg->acs_mode) {
|
|
|
+ sap_debug("SAP session id %d acs not enable",
|
|
|
+ sap_ctx->sessionId);
|
|
|
+ return SAP_CHANNEL_NOT_SELECTED;
|
|
|
+ }
|
|
|
+
|
|
|
+ mac_handle = cds_get_context(QDF_MODULE_ID_SME);
|
|
|
+ mac_ctx = MAC_CONTEXT(mac_handle);
|
|
|
+ if (!mac_ctx)
|
|
|
+ return SAP_CHANNEL_NOT_SELECTED;
|
|
|
+
|
|
|
+ /*
|
|
|
+ * If AFC response received after SAP started, SP channels are
|
|
|
+ * not included in current ACS range, ignore ACS range check
|
|
|
+ * in this scenario so that SAP can move to new SP channel.
|
|
|
+ */
|
|
|
+ sap_chan_sel_init(mac_handle, spect_info, sap_ctx,
|
|
|
+ is_sap_afc_dcs_skip_acs(sap_ctx));
|
|
|
+
|
|
|
+ sap_max_weight_invalidate_2ghz_channels(spect_info);
|
|
|
+
|
|
|
+ sap_compute_spect_max_power_weight(spect_info, mac_handle, sap_ctx);
|
|
|
+
|
|
|
+ sap_sort_chl_weight_all(mac_ctx, sap_ctx, spect_info,
|
|
|
+ eCSR_DOT11_MODE_11a, REGDOMAIN_FCC, pref_bw);
|
|
|
+
|
|
|
+ target_freq = sap_afc_dcs_target_chan(mac_ctx,
|
|
|
+ sap_ctx,
|
|
|
+ spect_info,
|
|
|
+ cur_freq,
|
|
|
+ cur_bw,
|
|
|
+ *pref_bw);
|
|
|
+ sap_chan_sel_exit(spect_info);
|
|
|
+ return target_freq;
|
|
|
+}
|
|
|
+#endif
|