|
@@ -15,515 +15,306 @@
|
|
|
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
|
*/
|
|
|
|
|
|
-/**
|
|
|
- * DOC: This file has radar table and initialization function for Beeliner
|
|
|
- * family of chipsets.
|
|
|
- */
|
|
|
-
|
|
|
#include "../dfs.h"
|
|
|
+#include "../dfs_zero_cac.h"
|
|
|
#include "wlan_dfs_mlme_api.h"
|
|
|
-#include "wlan_dfs_utils_api.h"
|
|
|
#include "wlan_dfs_lmac_api.h"
|
|
|
+#include "../dfs_partial_offload_radar.h"
|
|
|
+#include "../dfs_direct_attach_radar.h"
|
|
|
#include "../dfs_internal.h"
|
|
|
|
|
|
-/**
|
|
|
- * struct dfs_pulse dfs_fcc_radars - FCC radar table for Offload chipsets.
|
|
|
- */
|
|
|
-struct dfs_pulse dfs_fcc_radars[] = {
|
|
|
- /* FCC TYPE 1 */
|
|
|
- {18, 1, 700, 700, 0, 4, 5, 0, 1, 18, 0, 3, 1, 5, 0, 0},
|
|
|
- {18, 1, 350, 350, 0, 4, 5, 0, 1, 18, 0, 3, 0, 5, 0, 0},
|
|
|
-
|
|
|
- /* FCC TYPE 6 */
|
|
|
- {9, 1, 3003, 3003, 1, 7, 5, 0, 1, 18, 0, 0, 1, 1000, 0, 1},
|
|
|
-
|
|
|
- /* FCC TYPE 2 */
|
|
|
- {23, 5, 4347, 6666, 0, 4, 11, 0, 7, 22, 0, 3, 0, 5, 0, 2},
|
|
|
-
|
|
|
- /* FCC TYPE 3 */
|
|
|
- {18, 10, 2000, 5000, 0, 4, 8, 6, 13, 22, 0, 3, 0, 5, 0, 5},
|
|
|
-
|
|
|
- /* FCC TYPE 4 */
|
|
|
- {16, 15, 2000, 5000, 0, 4, 7, 11, 23, 22, 0, 3, 0, 5, 0, 11},
|
|
|
-
|
|
|
- /* FCC NEW TYPE 1 */
|
|
|
- /* 518us to 938us pulses (min 56 pulses) */
|
|
|
- {57, 1, 1066, 1930, 0, 4, 20, 0, 1, 22, 0, 3, 0, 5, 0, 21},
|
|
|
-
|
|
|
- /* 938us to 2000 pulses (min 26 pulses) */
|
|
|
- {27, 1, 500, 1066, 0, 4, 13, 0, 1, 22, 0, 3, 0, 5, 0, 22},
|
|
|
-
|
|
|
- /* 2000 to 3067us pulses (min 17 pulses) */
|
|
|
- {18, 1, 325, 500, 0, 4, 9, 0, 1, 22, 0, 3, 0, 5, 0, 23},
|
|
|
-};
|
|
|
-
|
|
|
-/**
|
|
|
- * struct dfs_pulse dfs_mkk4_radars - MKK4 radar table for Offload chipsets.
|
|
|
- */
|
|
|
-struct dfs_pulse dfs_mkk4_radars[] = {
|
|
|
-
|
|
|
- /* following two filters are specific to Japan/MKK4 */
|
|
|
- /* 1389 +/- 6 us */
|
|
|
- {18, 1, 720, 720, 0, 4, 6, 0, 1, 18, 0, 3, 0, 5, 0, 17},
|
|
|
-
|
|
|
- /* 4000 +/- 6 us */
|
|
|
- {18, 4, 250, 250, 0, 4, 5, 1, 6, 18, 0, 3, 0, 5, 0, 18},
|
|
|
-
|
|
|
- /* 3846 +/- 7 us */
|
|
|
- {18, 5, 260, 260, 0, 4, 6, 1, 6, 18, 0, 3, 1, 5, 0, 19},
|
|
|
-
|
|
|
- /* following filters are common to both FCC and JAPAN */
|
|
|
-
|
|
|
- /* FCC TYPE 1 */
|
|
|
- {18, 1, 700, 700, 0, 4, 5, 0, 1, 18, 0, 3, 1, 5, 0, 0},
|
|
|
- {18, 1, 350, 350, 0, 4, 5, 0, 1, 18, 0, 3, 0, 5, 0, 0},
|
|
|
+void dfs_get_radars(struct wlan_dfs *dfs)
|
|
|
+{
|
|
|
+ struct wlan_objmgr_psoc *psoc;
|
|
|
|
|
|
- /* FCC TYPE 6 */
|
|
|
- {9, 1, 3003, 3003, 1, 7, 5, 0, 1, 18, 0, 0, 1, 1000, 0, 1},
|
|
|
+ if (!dfs) {
|
|
|
+ dfs_err(dfs, WLAN_DEBUG_DFS_ALWAYS, "dfs is NULL");
|
|
|
+ return;
|
|
|
+ }
|
|
|
|
|
|
- /* FCC TYPE 2 */
|
|
|
- {23, 5, 4347, 6666, 0, 4, 11, 0, 7, 22, 0, 3, 0, 5, 0, 2},
|
|
|
+ psoc = wlan_pdev_get_psoc(dfs->dfs_pdev_obj);
|
|
|
+ if (!psoc) {
|
|
|
+ dfs_err(dfs, WLAN_DEBUG_DFS_ALWAYS, "psoc is NULL");
|
|
|
+ return;
|
|
|
+ }
|
|
|
|
|
|
- /* FCC TYPE 3 */
|
|
|
- {18, 10, 2000, 5000, 0, 4, 8, 6, 13, 22, 0, 3, 0, 5, 0, 5},
|
|
|
+ if (wlan_objmgr_psoc_get_dev_type(psoc) == WLAN_DEV_OL) {
|
|
|
+ /* For Partial offload */
|
|
|
+ dfs_get_po_radars(dfs);
|
|
|
+ } else {
|
|
|
+ /* For Direct Attach (DA) */
|
|
|
+ dfs_get_da_radars(dfs);
|
|
|
+ }
|
|
|
+}
|
|
|
|
|
|
- /* FCC TYPE 4 */
|
|
|
- {16, 15, 2000, 5000, 0, 4, 7, 11, 23, 22, 0, 3, 0, 5, 0, 11},
|
|
|
-};
|
|
|
+int dfs_radar_disable(struct wlan_dfs *dfs)
|
|
|
+{
|
|
|
+ dfs->dfs_proc_phyerr &= ~DFS_AR_EN;
|
|
|
+ dfs->dfs_proc_phyerr &= ~DFS_RADAR_EN;
|
|
|
|
|
|
-/**
|
|
|
- * struct dfs_bin5pulse dfs_fcc_bin5pulses - FCC BIN5 pulses for Offload
|
|
|
- * chipsets.
|
|
|
- */
|
|
|
-struct dfs_bin5pulse dfs_fcc_bin5pulses[] = {
|
|
|
- {6, 28, 105, 12, 18, 5},
|
|
|
-};
|
|
|
+ return 0;
|
|
|
+}
|
|
|
|
|
|
-/**
|
|
|
- * struct dfs_bin5pulse dfs_jpn_bin5pulses - JAPAN BIN5 pulses for Offload
|
|
|
- * chipsets.
|
|
|
- */
|
|
|
-struct dfs_bin5pulse dfs_jpn_bin5pulses[] = {
|
|
|
- {5, 28, 105, 12, 22, 5},
|
|
|
-};
|
|
|
+void dfs_phyerr_param_copy(struct wlan_dfs_phyerr_param *dst,
|
|
|
+ struct wlan_dfs_phyerr_param *src)
|
|
|
+{
|
|
|
+ qdf_mem_copy(dst, src, sizeof(*dst));
|
|
|
+}
|
|
|
|
|
|
-/**
|
|
|
- * dfs_bin5pulse dfs_fcc_bin5pulses_ar900b - FCC BIN5 pulses for AR9300
|
|
|
- * chipsets.
|
|
|
- *
|
|
|
- * WAR : IR 42631
|
|
|
- * Beeliner 2 is tested at -65dbm as opposed to -62 dbm.
|
|
|
- * For FCC/JPN chirping pulses, HW reports RSSI value that is lower by 2dbm
|
|
|
- * when we enable noise floor claibration. This is specially true for
|
|
|
- * frequencies that are greater than center frequency and in VHT80 mode.
|
|
|
- */
|
|
|
+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;
|
|
|
|
|
|
-struct dfs_bin5pulse dfs_fcc_bin5pulses_ar900b[] = {
|
|
|
- {5, 28, 105, 12, 20, 5},
|
|
|
-};
|
|
|
+ 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);
|
|
|
+ }
|
|
|
|
|
|
-/**
|
|
|
- * dfs_bin5pulse dfs_jpn_bin5pulses_ar900b - JAPAN BIN5 pulses for AR9300
|
|
|
- * chipsets.
|
|
|
- */
|
|
|
-struct dfs_bin5pulse dfs_jpn_bin5pulses_ar900b[] = {
|
|
|
- {5, 28, 105, 12, 20, 5},
|
|
|
-};
|
|
|
-
|
|
|
-/**
|
|
|
- * dfs_bin5pulse dfs_fcc_bin5pulses_qca9984 - FCC BIN5 pulses for QCA9984
|
|
|
- * chipsets.
|
|
|
- * WAR : IR-83400
|
|
|
- * Cascade is tested at -65dbm as opposed to -62 dbm.
|
|
|
- * For FCC/JPN chirping pulses, HW reports RSSI value that is significantly
|
|
|
- * lower at left edge especially in HT80_80 mode. Also, duration may be
|
|
|
- * significantly low. This can result in false detection and we may have to
|
|
|
- * raise the threshold.
|
|
|
- */
|
|
|
-struct dfs_bin5pulse dfs_fcc_bin5pulses_qca9984[] = {
|
|
|
- {5, 20, 105, 12, 20, 0},
|
|
|
-};
|
|
|
+ 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 != NULL)
|
|
|
+ *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;
|
|
|
|
|
|
-/**
|
|
|
- * dfs_bin5pulse dfs_jpn_bin5pulses_qca9984 - JAPAN BIN5 pulses for QCA9984
|
|
|
- * chipsets.
|
|
|
- */
|
|
|
-struct dfs_bin5pulse dfs_jpn_bin5pulses_qca9984[] = {
|
|
|
- {5, 20, 105, 12, 20, 0},
|
|
|
-};
|
|
|
+ /* Copy the parameters from the default set. */
|
|
|
+ dfs_phyerr_param_copy(&rs->rs_param,
|
|
|
+ &dfs->dfs_defaultparams);
|
|
|
|
|
|
-/**
|
|
|
- * dfs_pulse dfs_etsi_radars - ETSI radar table.
|
|
|
- */
|
|
|
-struct dfs_pulse dfs_etsi_radars[] = {
|
|
|
-
|
|
|
- /* EN 302 502 frequency hopping pulse */
|
|
|
- /* PRF 3000, 1us duration, 9 pulses per burst */
|
|
|
- {9, 1, 3000, 3000, 1, 4, 5, 0, 1, 18, 0, 0, 1, 1000, 0, 40},
|
|
|
- /* PRF 4500, 20us duration, 9 pulses per burst */
|
|
|
- {9, 20, 4500, 4500, 1, 4, 5, 19, 21, 18, 0, 0, 1, 1000, 0, 41},
|
|
|
-
|
|
|
- /* TYPE staggered pulse */
|
|
|
- /* Type 5*/
|
|
|
- /* 0.8-2us, 2-3 bursts,300-400 PRF, 10 pulses each */
|
|
|
- {30, 2, 300, 400, 2, 30, 3, 0, 5, 15, 0, 0, 1, 5, 0, 31},
|
|
|
- /* Type 6 */
|
|
|
- /* 0.8-2us, 2-3 bursts, 400-1200 PRF, 15 pulses each */
|
|
|
- {30, 2, 400, 1200, 2, 30, 7, 0, 5, 15, 0, 0, 0, 5, 0, 32},
|
|
|
-
|
|
|
- /* constant PRF based */
|
|
|
- /* Type 1 */
|
|
|
- /* 0.8-5us, 200 300 PRF, 10 pulses */
|
|
|
- {10, 5, 200, 400, 0, 4, 5, 0, 8, 15, 0, 0, 2, 5, 0, 33},
|
|
|
- {10, 5, 400, 600, 0, 4, 5, 0, 8, 15, 0, 0, 2, 5, 0, 37},
|
|
|
- {10, 5, 600, 800, 0, 4, 5, 0, 8, 15, 0, 0, 2, 5, 0, 38},
|
|
|
- {10, 5, 800, 1000, 0, 4, 5, 0, 8, 15, 0, 0, 2, 5, 0, 39},
|
|
|
- /* {10, 5, 200, 1000, 0, 6, 5, 0, 8, 15, 0, 0, 2, 5, 33}, */
|
|
|
-
|
|
|
- /* Type 2 */
|
|
|
- /* 0.8-15us, 200-1600 PRF, 15 pulses */
|
|
|
- {15, 15, 200, 1600, 0, 4, 8, 0, 18, 24, 0, 0, 0, 5, 0, 34},
|
|
|
-
|
|
|
- /* Type 3 */
|
|
|
- /* 0.8-15us, 2300-4000 PRF, 25 pulses*/
|
|
|
- {25, 15, 2300, 4000, 0, 4, 10, 0, 18, 24, 0, 0, 0, 5, 0, 35},
|
|
|
-
|
|
|
- /* Type 4 */
|
|
|
- /* 20-30us, 2000-4000 PRF, 20 pulses*/
|
|
|
- {20, 30, 2000, 4000, 0, 4, 6, 19, 33, 24, 0, 0, 0, 24, 1, 36},
|
|
|
-};
|
|
|
-
|
|
|
-/**
|
|
|
- * dfs_pulse dfs_china_radars - CHINA radar table.
|
|
|
- */
|
|
|
-struct dfs_pulse dfs_china_radars[] = {
|
|
|
-
|
|
|
- /* TYPE staggered pulse */
|
|
|
- /* Type 5*/
|
|
|
- /* 0.8-2us, 2-3 bursts,300-400 PRF, 12 pulses each */
|
|
|
- {36, 2, 300, 400, 2, 30, 3, 0, 5, 15, 0, 0, 1, 51},
|
|
|
- /* Type 6 */
|
|
|
- /* 0.8-2us, 2-3 bursts, 400-1200 PRF, 16 pulses each */
|
|
|
- {48, 2, 400, 1200, 2, 30, 7, 0, 5, 15, 0, 0, 0, 52},
|
|
|
-
|
|
|
- /* constant PRF based */
|
|
|
- /* Type 1 */
|
|
|
- /* 0.5-5us, 200 1000 PRF, 12 pulses */
|
|
|
- {12, 5, 200, 400, 0, 24, 5, 0, 8, 15, 0, 0, 2, 53},
|
|
|
- {12, 5, 400, 600, 0, 24, 5, 0, 8, 15, 0, 0, 2, 57},
|
|
|
- {12, 5, 600, 800, 0, 24, 5, 0, 8, 15, 0, 0, 2, 58},
|
|
|
- {12, 5, 800, 1000, 0, 24, 5, 0, 8, 15, 0, 0, 2, 59},
|
|
|
-
|
|
|
- /* Type 2 */
|
|
|
- /* 0.5-15us, 200-1600 PRF, 16 pulses */
|
|
|
- {16, 15, 200, 1600, 0, 24, 8, 0, 18, 24, 0, 0, 0, 54},
|
|
|
-
|
|
|
- /* Type 3 */
|
|
|
- /* 0.5-30us, 2300-4000 PRF, 24 pulses*/
|
|
|
- {24, 15, 2300, 4000, 0, 24, 10, 0, 33, 24, 0, 0, 0, 55},
|
|
|
-
|
|
|
- /* Type 4 */
|
|
|
- /* 20-30us, 2000-4000 PRF, 20 pulses*/
|
|
|
- {20, 30, 2000, 4000, 0, 24, 6, 19, 33, 24, 0, 0, 0, 56},
|
|
|
-
|
|
|
- /* 1us, 1000 PRF, 20 pulses */
|
|
|
- /* 1000 us PRI */
|
|
|
- {20, 1, 1000, 1000, 0, 6, 6, 0, 1, 18, 0, 3, 0, 50},
|
|
|
-};
|
|
|
-
|
|
|
-/**
|
|
|
- * dfs_pulse dfs_korea_radars - KOREA radar table.
|
|
|
- */
|
|
|
-struct dfs_pulse dfs_korea_radars[] = {
|
|
|
- /* Korea Type 1 */
|
|
|
- {18, 1, 700, 700, 0, 4, 5, 0, 1, 18, 0, 3, 1, 5, 0, 40},
|
|
|
+ if (index != NULL)
|
|
|
+ *index = (uint8_t)i;
|
|
|
|
|
|
- /* Korea Type 2 */
|
|
|
- {10, 1, 1800, 1800, 0, 4, 4, 0, 1, 18, 0, 3, 1, 5, 0, 41},
|
|
|
+ return rs;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ dfs_debug(dfs, WLAN_DEBUG_DFS2, "No more radar states left.");
|
|
|
|
|
|
- /* Korea Type 3 */
|
|
|
- {70, 1, 330, 330, 0, 4, 20, 0, 2, 18, 0, 3, 1, 5, 0, 42},
|
|
|
+ return NULL;
|
|
|
+}
|
|
|
|
|
|
- /* Korea Type 4 */
|
|
|
- {3, 1, 3003, 3003, 1, 7, 2, 0, 1, 18, 0, 0, 1, 1000, 0, 43},
|
|
|
-};
|
|
|
+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;
|
|
|
|
|
|
-#define RSSI_THERSH_AR900B 15
|
|
|
+ if (!dfs) {
|
|
|
+ dfs_err(dfs, WLAN_DEBUG_DFS_ALWAYS, "dfs is NULL");
|
|
|
+ return;
|
|
|
+ }
|
|
|
|
|
|
-/**
|
|
|
- * dfs_assign_fcc_pulse_table() - Assign FCC pulse table
|
|
|
- * @rinfo: Pointer to wlan_dfs_radar_tab_info structure.
|
|
|
- * @target_type: Target type.
|
|
|
- * @tx_ops: target tx ops.
|
|
|
- */
|
|
|
-static inline void dfs_assign_fcc_pulse_table(
|
|
|
- struct wlan_dfs_radar_tab_info *rinfo,
|
|
|
- uint32_t target_type,
|
|
|
- struct wlan_lmac_if_target_tx_ops *tx_ops)
|
|
|
-{
|
|
|
- rinfo->dfs_radars = dfs_fcc_radars;
|
|
|
- rinfo->numradars = QDF_ARRAY_SIZE(dfs_fcc_radars);
|
|
|
-
|
|
|
- if (tx_ops->tgt_is_tgt_type_ar900b(target_type) ||
|
|
|
- tx_ops->tgt_is_tgt_type_ipq4019(target_type)) {
|
|
|
- rinfo->b5pulses = dfs_fcc_bin5pulses_ar900b;
|
|
|
- rinfo->numb5radars = QDF_ARRAY_SIZE(dfs_fcc_bin5pulses_ar900b);
|
|
|
- } else if (tx_ops->tgt_is_tgt_type_qca9984(target_type) ||
|
|
|
- tx_ops->tgt_is_tgt_type_qca9888(target_type)) {
|
|
|
- rinfo->b5pulses = dfs_fcc_bin5pulses_qca9984;
|
|
|
- rinfo->numb5radars =
|
|
|
- QDF_ARRAY_SIZE(dfs_fcc_bin5pulses_qca9984);
|
|
|
- } else {
|
|
|
- rinfo->b5pulses = dfs_fcc_bin5pulses;
|
|
|
- rinfo->numb5radars = QDF_ARRAY_SIZE(dfs_fcc_bin5pulses);
|
|
|
+ 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 != NULL && ((err == QDF_STATUS_E_FAILURE) ||
|
|
|
+ (rs_ext != NULL))) {
|
|
|
+ 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");
|
|
|
}
|
|
|
}
|
|
|
-void ol_if_dfs_configure(struct wlan_dfs *dfs)
|
|
|
-{
|
|
|
- struct wlan_dfs_radar_tab_info rinfo;
|
|
|
- struct wlan_objmgr_psoc *psoc;
|
|
|
- struct wlan_lmac_if_target_tx_ops *tx_ops;
|
|
|
- int i;
|
|
|
- uint32_t target_type;
|
|
|
- int dfsdomain = DFS_FCC_DOMAIN;
|
|
|
- uint16_t ch_freq;
|
|
|
- uint16_t regdmn;
|
|
|
|
|
|
- /* Fetch current radar patterns from the lmac */
|
|
|
- qdf_mem_zero(&rinfo, sizeof(rinfo));
|
|
|
+int dfs_set_thresholds(struct wlan_dfs *dfs, const uint32_t threshtype,
|
|
|
+ const uint32_t value)
|
|
|
+{
|
|
|
+ int16_t chanindex;
|
|
|
+ struct dfs_state *rs;
|
|
|
+ struct wlan_dfs_phyerr_param pe;
|
|
|
+ int is_fastclk = 0;
|
|
|
|
|
|
- /*
|
|
|
- * Look up the current DFS regulatory domain and decide
|
|
|
- * which radar pulses to use.
|
|
|
- */
|
|
|
- dfsdomain = utils_get_dfsdomain(dfs->dfs_pdev_obj);
|
|
|
- target_type = lmac_get_target_type(dfs->dfs_pdev_obj);
|
|
|
+ if (!dfs) {
|
|
|
+ dfs_err(dfs, WLAN_DEBUG_DFS_ALWAYS, "dfs is NULL");
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
|
|
|
- psoc = wlan_pdev_get_psoc(dfs->dfs_pdev_obj);
|
|
|
- if (!psoc) {
|
|
|
- dfs_err(dfs, WLAN_DEBUG_DFS_ALWAYS, "psoc is NULL");
|
|
|
- return;
|
|
|
+ chanindex = dfs->dfs_curchan_radindex;
|
|
|
+ if ((chanindex < 0) || (chanindex >= DFS_NUM_RADAR_STATES)) {
|
|
|
+ dfs_debug(dfs, WLAN_DEBUG_DFS1,
|
|
|
+ "%s: chanindex = %d, DFS_NUM_RADAR_STATES=%d\n",
|
|
|
+ __func__,
|
|
|
+ chanindex,
|
|
|
+ DFS_NUM_RADAR_STATES);
|
|
|
+ return 0;
|
|
|
}
|
|
|
|
|
|
- tx_ops = &(psoc->soc_cb.tx_ops.target_tx_ops);
|
|
|
- switch (dfsdomain) {
|
|
|
- case DFS_FCC_DOMAIN:
|
|
|
- dfs_info(dfs, WLAN_DEBUG_DFS_ALWAYS, "FCC domain");
|
|
|
- rinfo.dfsdomain = DFS_FCC_DOMAIN;
|
|
|
- dfs_assign_fcc_pulse_table(&rinfo, target_type, tx_ops);
|
|
|
+ dfs_debug(dfs, WLAN_DEBUG_DFS,
|
|
|
+ "threshtype=%d, value=%d", threshtype, value);
|
|
|
+
|
|
|
+ wlan_dfs_phyerr_init_noval(&pe);
|
|
|
+
|
|
|
+ rs = &(dfs->dfs_radar[chanindex]);
|
|
|
+ switch (threshtype) {
|
|
|
+ case DFS_PARAM_FIRPWR:
|
|
|
+ rs->rs_param.pe_firpwr = (int32_t) value;
|
|
|
+ pe.pe_firpwr = value;
|
|
|
break;
|
|
|
- case DFS_CN_DOMAIN:
|
|
|
- dfs_info(dfs, WLAN_DEBUG_DFS_ALWAYS,
|
|
|
- "FCC domain -- Country China(156) override FCC radar pattern"
|
|
|
- );
|
|
|
- rinfo.dfsdomain = DFS_FCC_DOMAIN;
|
|
|
- /*
|
|
|
- * China uses a radar pattern that is similar to ETSI but it
|
|
|
- * follows FCC in all other respect like transmit power, CCA
|
|
|
- * threshold etc.
|
|
|
- */
|
|
|
- rinfo.dfs_radars = dfs_china_radars;
|
|
|
- rinfo.numradars = QDF_ARRAY_SIZE(dfs_china_radars);
|
|
|
- rinfo.b5pulses = NULL;
|
|
|
- rinfo.numb5radars = 0;
|
|
|
+ case DFS_PARAM_RRSSI:
|
|
|
+ rs->rs_param.pe_rrssi = value;
|
|
|
+ pe.pe_rrssi = value;
|
|
|
break;
|
|
|
- case DFS_ETSI_DOMAIN:
|
|
|
- dfs_info(dfs, WLAN_DEBUG_DFS_ALWAYS, "ETSI domain");
|
|
|
- rinfo.dfsdomain = DFS_ETSI_DOMAIN;
|
|
|
-
|
|
|
- ch_freq = dfs->dfs_curchan->dfs_ch_freq;
|
|
|
- regdmn = utils_dfs_get_cur_rd(dfs->dfs_pdev_obj);
|
|
|
-
|
|
|
- if ((regdmn == ETSI11_WORLD_REGDMN_PAIR_ID) &&
|
|
|
- DFS_CURCHAN_IS_58GHz(ch_freq)) {
|
|
|
- rinfo.dfs_radars = dfs_etsi_radars;
|
|
|
- rinfo.numradars = QDF_ARRAY_SIZE(dfs_etsi_radars);
|
|
|
- } else {
|
|
|
- uint8_t offset = ETSI_LEGACY_PULSE_ARR_OFFSET;
|
|
|
-
|
|
|
- rinfo.dfs_radars = &dfs_etsi_radars[offset];
|
|
|
- rinfo.numradars =
|
|
|
- QDF_ARRAY_SIZE(dfs_etsi_radars) - offset;
|
|
|
- }
|
|
|
- rinfo.b5pulses = NULL;
|
|
|
- rinfo.numb5radars = 0;
|
|
|
+ case DFS_PARAM_HEIGHT:
|
|
|
+ rs->rs_param.pe_height = value;
|
|
|
+ pe.pe_height = value;
|
|
|
break;
|
|
|
- case DFS_KR_DOMAIN:
|
|
|
- dfs_info(dfs, WLAN_DEBUG_DFS_ALWAYS,
|
|
|
- "ETSI domain -- Korea(412)");
|
|
|
- rinfo.dfsdomain = DFS_ETSI_DOMAIN;
|
|
|
-
|
|
|
- /*
|
|
|
- * So far we have treated Korea as part of ETSI and did not
|
|
|
- * support any radar patters specific to Korea other than
|
|
|
- * standard ETSI radar patterns. Ideally we would want to
|
|
|
- * treat Korea as a different domain. This is something that
|
|
|
- * we will address in the future. However, for now override
|
|
|
- * ETSI tables for Korea.
|
|
|
- */
|
|
|
- rinfo.dfs_radars = dfs_korea_radars;
|
|
|
- rinfo.numradars = QDF_ARRAY_SIZE(dfs_korea_radars);
|
|
|
- rinfo.b5pulses = NULL;
|
|
|
- rinfo.numb5radars = 0;
|
|
|
+ case DFS_PARAM_PRSSI:
|
|
|
+ rs->rs_param.pe_prssi = value;
|
|
|
+ pe.pe_prssi = value;
|
|
|
break;
|
|
|
- case DFS_MKK4_DOMAIN:
|
|
|
- dfs_info(dfs, WLAN_DEBUG_DFS_ALWAYS, "MKK4 domain");
|
|
|
- rinfo.dfsdomain = DFS_MKK4_DOMAIN;
|
|
|
- rinfo.dfs_radars = dfs_mkk4_radars;
|
|
|
- rinfo.numradars = QDF_ARRAY_SIZE(dfs_mkk4_radars);
|
|
|
-
|
|
|
- if (tx_ops->tgt_is_tgt_type_ar900b(target_type) ||
|
|
|
- tx_ops->tgt_is_tgt_type_ipq4019(target_type)) {
|
|
|
- rinfo.b5pulses = dfs_jpn_bin5pulses_ar900b;
|
|
|
- rinfo.numb5radars = QDF_ARRAY_SIZE(
|
|
|
- dfs_jpn_bin5pulses_ar900b);
|
|
|
- } else if (tx_ops->tgt_is_tgt_type_qca9984(target_type) ||
|
|
|
- tx_ops->tgt_is_tgt_type_qca9888(target_type)) {
|
|
|
- rinfo.b5pulses = dfs_jpn_bin5pulses_qca9984;
|
|
|
- rinfo.numb5radars = QDF_ARRAY_SIZE
|
|
|
- (dfs_jpn_bin5pulses_qca9984);
|
|
|
- } else {
|
|
|
- rinfo.b5pulses = dfs_jpn_bin5pulses;
|
|
|
- rinfo.numb5radars = QDF_ARRAY_SIZE(
|
|
|
- dfs_jpn_bin5pulses);
|
|
|
- }
|
|
|
+ case DFS_PARAM_INBAND:
|
|
|
+ rs->rs_param.pe_inband = value;
|
|
|
+ pe.pe_inband = value;
|
|
|
+ break;
|
|
|
+ /* 5413 specific */
|
|
|
+ case DFS_PARAM_RELPWR:
|
|
|
+ rs->rs_param.pe_relpwr = value;
|
|
|
+ pe.pe_relpwr = value;
|
|
|
+ break;
|
|
|
+ case DFS_PARAM_RELSTEP:
|
|
|
+ rs->rs_param.pe_relstep = value;
|
|
|
+ pe.pe_relstep = value;
|
|
|
+ break;
|
|
|
+ case DFS_PARAM_MAXLEN:
|
|
|
+ rs->rs_param.pe_maxlen = value;
|
|
|
+ pe.pe_maxlen = value;
|
|
|
break;
|
|
|
default:
|
|
|
- dfs_info(dfs, WLAN_DEBUG_DFS_ALWAYS, "UNINIT domain");
|
|
|
- rinfo.dfsdomain = DFS_UNINIT_DOMAIN;
|
|
|
- rinfo.dfs_radars = NULL;
|
|
|
- rinfo.numradars = 0;
|
|
|
- rinfo.b5pulses = NULL;
|
|
|
- rinfo.numb5radars = 0;
|
|
|
+ dfs_debug(dfs, WLAN_DEBUG_DFS1,
|
|
|
+ "unknown threshtype (%d)", threshtype);
|
|
|
break;
|
|
|
}
|
|
|
|
|
|
- if (tx_ops->tgt_is_tgt_type_ar900b(target_type) ||
|
|
|
- tx_ops->tgt_is_tgt_type_ipq4019(target_type) ||
|
|
|
- tx_ops->tgt_is_tgt_type_qca9984(target_type) ||
|
|
|
- tx_ops->tgt_is_tgt_type_qca9888(target_type)) {
|
|
|
- /* Beeliner WAR: lower RSSI threshold to improve detection of
|
|
|
- * certian radar types
|
|
|
- */
|
|
|
- /* Cascade WAR:
|
|
|
- * Cascade can report lower RSSI near the channel boundary then
|
|
|
- * expected. It can also report significantly low RSSI at center
|
|
|
- * (as low as 16) at center. So we are lowering threshold for
|
|
|
- * all types of radar for * Cascade.
|
|
|
- * This may increase the possibility of false radar detection.
|
|
|
- * IR -- 083703, 083398, 083387
|
|
|
- */
|
|
|
-
|
|
|
- for (i = 0; i < rinfo.numradars; i++)
|
|
|
- rinfo.dfs_radars[i].rp_rssithresh = RSSI_THERSH_AR900B;
|
|
|
- }
|
|
|
|
|
|
- dfs_init_radar_filters(dfs, &rinfo);
|
|
|
+ /*
|
|
|
+ * The driver layer dfs_enable routine is tasked with translating
|
|
|
+ * values from the global format to the per-device (HAL, offload)
|
|
|
+ * format.
|
|
|
+ */
|
|
|
+ lmac_dfs_enable(dfs->dfs_pdev_obj, &is_fastclk,
|
|
|
+ &pe, dfs->dfsdomain);
|
|
|
+
|
|
|
+ return 1;
|
|
|
}
|
|
|
|
|
|
-void dfs_get_radars(struct wlan_dfs *dfs)
|
|
|
+int dfs_get_thresholds(struct wlan_dfs *dfs,
|
|
|
+ struct wlan_dfs_phyerr_param *param)
|
|
|
{
|
|
|
-#define AR5212_DEVID_IBM 0x1014 /* IBM minipci ID */
|
|
|
-#define AR5212_AR2413 0x001a /* AR2413 aka Griffin-lite */
|
|
|
-#define AR5212_AR2413 0x001a /* AR2413 aka Griffin-lite */
|
|
|
-#define AR5212_AR5413 0x001b /* Eagle */
|
|
|
-#define AR5212_AR5424 0x001c /* Condor (PCI express) */
|
|
|
-#define AR5212_DEVID_FF19 0xff19 /* PCI express */
|
|
|
-#define AR5212_AR2417 0x001d /* Nala, PCI */
|
|
|
-#define AR5212_DEVID 0x0013 /* Final ar5212 devid */
|
|
|
-#define AR5212_FPGA 0xf013 /* Emulation board */
|
|
|
-#define AR5212_DEFAULT 0x1113 /* No eeprom HW default */
|
|
|
-
|
|
|
-#define AR5416_DEVID_PCI 0x0023 /* AR5416 PCI (CB/MB) (Owl)*/
|
|
|
-#define AR5416_DEVID_PCIE 0x0024 /* AR5416 PCI-E (XB) (Owl) */
|
|
|
-#define AR5416_DEVID_AR9160_PCI 0x0027 /* AR9160 PCI (Sowl) */
|
|
|
-#define AR5416_AR9100_DEVID 0x000b /* AR9100 (Howl) */
|
|
|
-#define AR5416_DEVID_AR9280_PCI 0x0029 /* PCI (Merlin) */
|
|
|
-#define AR5416_DEVID_AR9280_PCIE 0x002a /* PCIE (Merlin) */
|
|
|
-#define AR5416_DEVID_AR9285_PCIE 0x002b /* PCIE (Kite) */
|
|
|
-#define AR5416_DEVID_AR9285G_PCIE 0x002c /* PCIE (Kite G only) */
|
|
|
-#define AR5416_DEVID_AR9287_PCI 0x002d /* PCI (Kiwi) */
|
|
|
-#define AR5416_DEVID_AR9287_PCIE 0x002e /* PCIE (Kiwi) */
|
|
|
-
|
|
|
-#define AR9300_DEVID_AR9380_PCIE 0x0030 /* PCIE (Osprey) */
|
|
|
-#define AR9300_DEVID_AR9340 0x0031 /* Wasp */
|
|
|
-#define AR9300_DEVID_AR9485_PCIE 0x0032 /* Poseidon */
|
|
|
-#define AR9300_DEVID_AR9580_PCIE 0x0033 /* Peacock */
|
|
|
-#define AR9300_DEVID_AR1111_PCIE 0x0037 /* AR1111 */
|
|
|
-#define AR9300_DEVID_AR946X_PCIE 0x0034 /* Jupiter: 2x2 DB + BT - AR9462 */
|
|
|
-#define AR9300_DEVID_AR955X 0x0039 /* Scorpion */
|
|
|
-#define AR9300_DEVID_AR953X 0x003d /* Honey Bee */
|
|
|
-#define AR9300_DEVID_AR956X 0x003f /* Dragonfly */
|
|
|
-#define AR9300_DEVID_AR956X_PCIE 0x0036 /* Aphrodite: 1x1 DB + BT - AR9564 */
|
|
|
-#define AR9300_DEVID_EMU_PCIE 0xabcd
|
|
|
-
|
|
|
- struct wlan_objmgr_psoc *psoc;
|
|
|
-
|
|
|
- if (!dfs) {
|
|
|
- dfs_err(dfs, WLAN_DEBUG_DFS_ALWAYS, "dfs is NULL");
|
|
|
- return;
|
|
|
- }
|
|
|
-
|
|
|
- psoc = wlan_pdev_get_psoc(dfs->dfs_pdev_obj);
|
|
|
- if (!psoc) {
|
|
|
- dfs_err(dfs, WLAN_DEBUG_DFS_ALWAYS, "psoc is NULL");
|
|
|
- return;
|
|
|
- }
|
|
|
+ qdf_mem_zero(param, sizeof(*param));
|
|
|
+ lmac_dfs_get_thresholds(dfs->dfs_pdev_obj, param);
|
|
|
|
|
|
- if (wlan_objmgr_psoc_get_dev_type(psoc) == WLAN_DEV_OL) {
|
|
|
- /* For offload chip */
|
|
|
- ol_if_dfs_configure(dfs);
|
|
|
- } else {
|
|
|
- uint16_t devid = lmac_get_ah_devid(dfs->dfs_pdev_obj);
|
|
|
- /* For DA chip*/
|
|
|
-
|
|
|
- switch (devid) {
|
|
|
- case AR5212_DEVID_IBM:
|
|
|
- case AR5212_AR2413:
|
|
|
- case AR5212_AR5413:
|
|
|
- case AR5212_AR5424:
|
|
|
- case AR5212_DEVID_FF19:
|
|
|
- devid = AR5212_DEVID;
|
|
|
- case AR5212_AR2417:
|
|
|
- case AR5212_DEVID:
|
|
|
- case AR5212_FPGA:
|
|
|
- case AR5212_DEFAULT:
|
|
|
- dfs_get_radars_for_ar5212(dfs);
|
|
|
- break;
|
|
|
- case AR5416_DEVID_PCI:
|
|
|
- case AR5416_DEVID_PCIE:
|
|
|
- case AR5416_DEVID_AR9160_PCI:
|
|
|
- case AR5416_AR9100_DEVID:
|
|
|
- case AR5416_DEVID_AR9280_PCI:
|
|
|
- case AR5416_DEVID_AR9280_PCIE:
|
|
|
- case AR5416_DEVID_AR9285_PCIE:
|
|
|
- case AR5416_DEVID_AR9285G_PCIE:
|
|
|
- case AR5416_DEVID_AR9287_PCI:
|
|
|
- case AR5416_DEVID_AR9287_PCIE:
|
|
|
- dfs_get_radars_for_ar5416(dfs);
|
|
|
- break;
|
|
|
- case AR9300_DEVID_AR9380_PCIE:
|
|
|
- case AR9300_DEVID_AR9340:
|
|
|
- case AR9300_DEVID_AR9485_PCIE:
|
|
|
- case AR9300_DEVID_AR9580_PCIE:
|
|
|
- case AR9300_DEVID_AR1111_PCIE:
|
|
|
- case AR9300_DEVID_AR946X_PCIE:
|
|
|
- case AR9300_DEVID_AR955X:
|
|
|
- case AR9300_DEVID_AR953X:
|
|
|
- case AR9300_DEVID_AR956X:
|
|
|
- case AR9300_DEVID_AR956X_PCIE:
|
|
|
- case AR9300_DEVID_EMU_PCIE:
|
|
|
- dfs_get_radars_for_ar9300(dfs);
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
+ return 1;
|
|
|
}
|
|
|
|
|
|
-void dfs_send_csa_to_current_chan(struct wlan_dfs *dfs)
|
|
|
+uint16_t dfs_chan2freq(struct dfs_channel *chan)
|
|
|
{
|
|
|
- qdf_timer_stop(&dfs->wlan_dfstesttimer);
|
|
|
- dfs->wlan_dfstest = 1;
|
|
|
- dfs->wlan_dfstest_ieeechan = dfs->dfs_curchan->dfs_ch_ieee;
|
|
|
- dfs->wlan_dfstesttime = 1; /* 1ms */
|
|
|
- qdf_timer_mod(&dfs->wlan_dfstesttimer, dfs->wlan_dfstesttime);
|
|
|
+ if (!chan)
|
|
|
+ return 0;
|
|
|
+
|
|
|
+ return chan == WLAN_CHAN_ANYC ? WLAN_CHAN_ANY : chan->dfs_ch_freq;
|
|
|
}
|