qcacmn: Add filters to the MKKN filter table

The w53 updated pulses should be detected by the DFS algorithm.

- Add new DFS filters to MKKN filter table.
- Introduce duration margin check in confirm radar routine.

Change-Id: Icf3fecb5c6027ba827cac05dbd43a1a55463209b
CRs-Fixed: 2582300
This commit is contained in:
Vignesh U
2019-12-10 13:49:39 +05:30
committed by nshrivas
parent 82382b32e9
commit 49a3bbbe28
2 changed files with 57 additions and 3 deletions

View File

@@ -104,6 +104,19 @@ static struct dfs_pulse dfs_mkkn_radars[] = {
* New filters shall be added to this tables after proper testing
* and verification.
*/
/* 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, 91},
{10, 5, 400, 600, 0, 4, 5, 0, 8, 15, 0, 0, 2, 5, 0, 92},
{10, 5, 600, 800, 0, 4, 5, 0, 8, 15, 0, 0, 2, 5, 0, 93},
{10, 5, 800, 1000, 0, 4, 5, 0, 8, 15, 0, 0, 2, 5, 0, 94},
/* {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, 95},
};
/**

View File

@@ -37,7 +37,8 @@
#define DFS_MAX_FREQ_SPREAD (1375 * 1)
#define DFS_LARGE_PRI_MULTIPLIER 4
#define DFS_W53_DEFAULT_PRI_MULTIPLIER 2
#define DFS_INVALID_PRI_LIMIT 100 /* should we use 135? */
//#define DFS_INVALID_PRI_LIMIT 100 /* should we use 135? */
#define DFS_INVALID_PRI_LIMIT 15 /* should we use 135? */
#define DFS_BIG_SIDX 10000
#define FRAC_PRI_SCORE_ARRAY_SIZE 40
@@ -137,6 +138,28 @@ static void dfs_print_radar_events(struct wlan_dfs *dfs)
dfs->dfs_phyerr_freq_max = 0;
}
/**
* dfs_get_durmargin() - Find duration margin
* @rf: Pointer to dfs_filter structure.
* @durmargin: Duration margin
*/
static inline void dfs_get_durmargin(struct dfs_filter *rf,
uint32_t *durmargin)
{
#define DUR_THRESH 10
#define LOW_MARGIN 4
#define HIGH_MARGIN 6
if (rf->rf_maxdur < DUR_THRESH)
*durmargin = LOW_MARGIN;
else
*durmargin = HIGH_MARGIN;
#undef DUR_THRESH
#undef LOW_MARGIN
#undef HIGH_MARGIN
}
/**
* dfs_confirm_radar() - This function checks for fractional PRI and jitter in
* sidx index to determine if the radar is real or not.
@@ -163,6 +186,12 @@ static int dfs_confirm_radar(struct wlan_dfs *dfs,
unsigned char max_score = 0;
int max_score_index = 0;
uint32_t min_searchdur = 0xFFFFFFFF;
uint32_t max_searchdur = 0x0;
uint32_t durmargin = 0;
uint32_t this_dur;
uint32_t this_deltadur;
pl = dfs->pulses;
OS_MEMZERO(scores, sizeof(scores));
@@ -170,6 +199,8 @@ static int dfs_confirm_radar(struct wlan_dfs *dfs,
pri_margin = dfs_get_pri_margin(dfs, ext_chan_flag,
(rf->rf_patterntype == 1));
dfs_get_durmargin(rf, &durmargin);
/*
* Look for the entry that matches dl_seq_num_second.
@@ -181,6 +212,12 @@ static int dfs_confirm_radar(struct wlan_dfs *dfs,
de = &dl->dl_elems[index];
if (dl->dl_seq_num_second == de->de_seq_num)
target_ts = de->de_ts - de->de_time;
if (de->de_dur < min_searchdur)
min_searchdur = de->de_dur;
if (de->de_dur > max_searchdur)
max_searchdur = de->de_dur;
}
if (dfs->dfs_debug_mask & WLAN_DEBUG_DFS2) {
@@ -226,6 +263,10 @@ static int dfs_confirm_radar(struct wlan_dfs *dfs,
this_diff_ts = pl->pl_elems[next_index].p_time -
pl->pl_elems[current_index].p_time;
this_dur = pl->pl_elems[next_index].p_dur;
this_deltadur = DFS_MIN(DFS_DIFF(this_dur, min_searchdur),
DFS_DIFF(this_dur, max_searchdur));
/* Now update the score for this diff_ts */
for (i = 1; i < FRAC_PRI_SCORE_ARRAY_SIZE; i++) {
search_bin = dl->dl_search_pri / (i + 1);
@@ -242,8 +283,8 @@ static int dfs_confirm_radar(struct wlan_dfs *dfs,
* search_bin +/- margin.
*/
if ((this_diff_ts >= (search_bin - pri_margin)) &&
(this_diff_ts <=
(search_bin + pri_margin))) {
(this_diff_ts <= (search_bin + pri_margin)) &&
(this_deltadur < durmargin)) {
/*increment score */
scores[i]++;
}