|
@@ -1,5 +1,5 @@
|
|
|
/*
|
|
|
- * Copyright (c) 2016-2020 The Linux Foundation. All rights reserved.
|
|
|
+ * Copyright (c) 2016-2021 The Linux Foundation. All rights reserved.
|
|
|
* Copyright (c) 2011, Atheros Communications Inc.
|
|
|
*
|
|
|
* Permission to use, copy, modify, and/or distribute this software for any
|
|
@@ -130,77 +130,6 @@ struct dfs_state *dfs_getchanstate(struct wlan_dfs *dfs, uint8_t *index,
|
|
|
|
|
|
return NULL;
|
|
|
}
|
|
|
-#else
|
|
|
-#ifdef CONFIG_CHAN_NUM_API
|
|
|
-struct dfs_state *dfs_getchanstate(struct wlan_dfs *dfs, uint8_t *index,
|
|
|
- int ext_chan_flag)
|
|
|
-{
|
|
|
- struct dfs_state *rs = NULL;
|
|
|
- struct dfs_channel *cmp_ch, cmp_ch1;
|
|
|
- int i;
|
|
|
- QDF_STATUS err;
|
|
|
-
|
|
|
- if (!dfs) {
|
|
|
- dfs_err(dfs, WLAN_DEBUG_DFS_ALWAYS, "dfs is NULL");
|
|
|
- return NULL;
|
|
|
- }
|
|
|
- cmp_ch = &cmp_ch1;
|
|
|
- if (ext_chan_flag) {
|
|
|
- err = dfs_mlme_get_extchan(dfs->dfs_pdev_obj,
|
|
|
- &(cmp_ch->dfs_ch_freq),
|
|
|
- &(cmp_ch->dfs_ch_flags),
|
|
|
- &(cmp_ch->dfs_ch_flagext),
|
|
|
- &(cmp_ch->dfs_ch_ieee),
|
|
|
- &(cmp_ch->dfs_ch_vhtop_ch_freq_seg1),
|
|
|
- &(cmp_ch->dfs_ch_vhtop_ch_freq_seg2));
|
|
|
-
|
|
|
- if (err == QDF_STATUS_SUCCESS) {
|
|
|
- dfs_debug(dfs, WLAN_DEBUG_DFS2,
|
|
|
- "Extension channel freq = %u flags=0x%x",
|
|
|
- cmp_ch->dfs_ch_freq,
|
|
|
- cmp_ch->dfs_ch_flagext);
|
|
|
- } else
|
|
|
- return NULL;
|
|
|
- } else {
|
|
|
- cmp_ch = dfs->dfs_curchan;
|
|
|
- dfs_debug(dfs, WLAN_DEBUG_DFS2,
|
|
|
- "Primary channel freq = %u flags=0x%x",
|
|
|
- cmp_ch->dfs_ch_freq, cmp_ch->dfs_ch_flagext);
|
|
|
- }
|
|
|
-
|
|
|
- for (i = 0; i < DFS_NUM_RADAR_STATES; i++) {
|
|
|
- if ((dfs->dfs_radar[i].rs_chan.dfs_ch_freq ==
|
|
|
- cmp_ch->dfs_ch_freq) &&
|
|
|
- (dfs->dfs_radar[i].rs_chan.dfs_ch_flags ==
|
|
|
- cmp_ch->dfs_ch_flags)
|
|
|
- ) {
|
|
|
- if (index)
|
|
|
- *index = (uint8_t)i;
|
|
|
- return &(dfs->dfs_radar[i]);
|
|
|
- }
|
|
|
- }
|
|
|
- /* No existing channel found, look for first free channel state entry.*/
|
|
|
- for (i = 0; i < DFS_NUM_RADAR_STATES; i++) {
|
|
|
- if (dfs->dfs_radar[i].rs_chan.dfs_ch_freq == 0) {
|
|
|
- rs = &(dfs->dfs_radar[i]);
|
|
|
- /* Found one, set channel info and default thresholds.*/
|
|
|
- rs->rs_chan = *cmp_ch;
|
|
|
-
|
|
|
- /* Copy the parameters from the default set. */
|
|
|
- dfs_phyerr_param_copy(&rs->rs_param,
|
|
|
- &dfs->dfs_defaultparams);
|
|
|
-
|
|
|
- if (index)
|
|
|
- *index = (uint8_t)i;
|
|
|
-
|
|
|
- return rs;
|
|
|
- }
|
|
|
- }
|
|
|
- dfs_debug(dfs, WLAN_DEBUG_DFS2, "No more radar states left.");
|
|
|
-
|
|
|
- return NULL;
|
|
|
-}
|
|
|
-#endif
|
|
|
#endif
|
|
|
|
|
|
#ifdef CONFIG_CHAN_FREQ_API
|
|
@@ -295,99 +224,6 @@ void dfs_radar_enable(struct wlan_dfs *dfs, int no_cac, uint32_t opmode)
|
|
|
"No more radar states left");
|
|
|
}
|
|
|
}
|
|
|
-#else
|
|
|
-#ifdef CONFIG_CHAN_NUM_API
|
|
|
-void dfs_radar_enable(struct wlan_dfs *dfs, int no_cac, uint32_t opmode)
|
|
|
-{
|
|
|
- int is_ext_ch;
|
|
|
- int is_fastclk = 0;
|
|
|
- struct dfs_channel *ext_ch, extchan;
|
|
|
- QDF_STATUS err = QDF_STATUS_E_FAILURE;
|
|
|
-
|
|
|
- if (!dfs) {
|
|
|
- dfs_err(dfs, WLAN_DEBUG_DFS_ALWAYS, "dfs is NULL");
|
|
|
- return;
|
|
|
- }
|
|
|
-
|
|
|
- is_ext_ch = WLAN_IS_CHAN_11N_HT40(dfs->dfs_curchan);
|
|
|
- lmac_dfs_disable(dfs->dfs_pdev_obj, no_cac);
|
|
|
- /*
|
|
|
- * In all modes, if the primary is DFS then we have to
|
|
|
- * enable radar detection. In HT80_80, we can have
|
|
|
- * primary non-DFS 80MHz with extension 80MHz DFS.
|
|
|
- */
|
|
|
- if ((WLAN_IS_CHAN_DFS(dfs->dfs_curchan) ||
|
|
|
- ((WLAN_IS_CHAN_11AC_VHT160(dfs->dfs_curchan) ||
|
|
|
- WLAN_IS_CHAN_11AC_VHT80_80(dfs->dfs_curchan))
|
|
|
- &&
|
|
|
- WLAN_IS_CHAN_DFS_CFREQ2(dfs->dfs_curchan))) ||
|
|
|
- (dfs_is_precac_timer_running(dfs))) {
|
|
|
- struct dfs_state *rs_pri = NULL, *rs_ext = NULL;
|
|
|
- uint8_t index_pri, index_ext;
|
|
|
-
|
|
|
- dfs->dfs_proc_phyerr |= DFS_AR_EN;
|
|
|
- dfs->dfs_proc_phyerr |= DFS_RADAR_EN;
|
|
|
- dfs->dfs_proc_phyerr |= DFS_SECOND_SEGMENT_RADAR_EN;
|
|
|
-
|
|
|
- ext_ch = &extchan;
|
|
|
- if (is_ext_ch)
|
|
|
- err = dfs_mlme_get_extchan(dfs->dfs_pdev_obj,
|
|
|
- &(ext_ch->dfs_ch_freq),
|
|
|
- &(ext_ch->dfs_ch_flags),
|
|
|
- &(ext_ch->dfs_ch_flagext),
|
|
|
- &(ext_ch->dfs_ch_ieee),
|
|
|
- &(ext_ch->dfs_ch_vhtop_ch_freq_seg1),
|
|
|
- &(ext_ch->dfs_ch_vhtop_ch_freq_seg2));
|
|
|
-
|
|
|
-
|
|
|
- dfs_reset_alldelaylines(dfs);
|
|
|
-
|
|
|
- rs_pri = dfs_getchanstate(dfs, &index_pri, 0);
|
|
|
- if (err == QDF_STATUS_SUCCESS)
|
|
|
- rs_ext = dfs_getchanstate(dfs, &index_ext, 1);
|
|
|
-
|
|
|
- if (rs_pri && ((err == QDF_STATUS_E_FAILURE) ||
|
|
|
- (rs_ext))) {
|
|
|
- struct wlan_dfs_phyerr_param pe;
|
|
|
-
|
|
|
- qdf_mem_set(&pe, sizeof(pe), '\0');
|
|
|
-
|
|
|
- if (index_pri != dfs->dfs_curchan_radindex)
|
|
|
- dfs_reset_alldelaylines(dfs);
|
|
|
-
|
|
|
- dfs->dfs_curchan_radindex = (int16_t)index_pri;
|
|
|
-
|
|
|
- if (rs_ext)
|
|
|
- dfs->dfs_extchan_radindex = (int16_t)index_ext;
|
|
|
-
|
|
|
- dfs_phyerr_param_copy(&pe, &rs_pri->rs_param);
|
|
|
- dfs_debug(dfs, WLAN_DEBUG_DFS3,
|
|
|
- "firpwr=%d, rssi=%d, height=%d, prssi=%d, inband=%d, relpwr=%d, relstep=%d, maxlen=%d",
|
|
|
- pe.pe_firpwr,
|
|
|
- pe.pe_rrssi, pe.pe_height,
|
|
|
- pe.pe_prssi, pe.pe_inband,
|
|
|
- pe.pe_relpwr, pe.pe_relstep,
|
|
|
- pe.pe_maxlen);
|
|
|
-
|
|
|
- lmac_dfs_enable(dfs->dfs_pdev_obj, &is_fastclk,
|
|
|
- &pe, dfs->dfsdomain);
|
|
|
- dfs_debug(dfs, WLAN_DEBUG_DFS,
|
|
|
- "Enabled radar detection on channel %d",
|
|
|
- dfs->dfs_curchan->dfs_ch_freq);
|
|
|
-
|
|
|
- dfs->dur_multiplier = is_fastclk ?
|
|
|
- DFS_FAST_CLOCK_MULTIPLIER :
|
|
|
- DFS_NO_FAST_CLOCK_MULTIPLIER;
|
|
|
-
|
|
|
- dfs_debug(dfs, WLAN_DEBUG_DFS3,
|
|
|
- "duration multiplier is %d",
|
|
|
- dfs->dur_multiplier);
|
|
|
- } else
|
|
|
- dfs_debug(dfs, WLAN_DEBUG_DFS,
|
|
|
- "No more radar states left");
|
|
|
- }
|
|
|
-}
|
|
|
-#endif
|
|
|
#endif
|
|
|
|
|
|
int dfs_set_thresholds(struct wlan_dfs *dfs, const uint32_t threshtype,
|