]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
ath: use PRI value given by spec for fixed PRI
authorPeter Oh <poh@qca.qualcomm.com>
Thu, 17 Sep 2015 11:29:08 +0000 (14:29 +0300)
committerKalle Valo <kvalo@qca.qualcomm.com>
Sun, 27 Sep 2015 12:50:30 +0000 (15:50 +0300)
PRI value is used as divider when DFS detector analyzes candidate
radar pulses.
If PRI deviation is big from its origin PRI, DFS detector could miss
valid radar reports since HW often misses detecting radar pulses and
causes long interval value of pulses.

For instance from practical results, if runtime PRI is calculated as
1431 for fixed PRI value of 1428 and delta timestamp logs 15719,
the modular remainder will be 1409 and the delta between the remainder
and runtime PRI is 22 that is bigger than PRI tolerance which is 16.
As a result this radar report will be ignored even though it's valid.

By using spec defined PRI for fixed PRI, we can correct this error.

Signed-off-by: Peter Oh <poh@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
drivers/net/wireless/ath/dfs_pattern_detector.c
drivers/net/wireless/ath/dfs_pattern_detector.h
drivers/net/wireless/ath/dfs_pri_detector.c

index 5aa053ab846703bb9d42eb445d0c3491f0f566cf..9d687121b2bfb2f753aa517035b793c33e12f9a1 100644 (file)
 #include "dfs_pri_detector.h"
 #include "ath.h"
 
-/*
- * tolerated deviation of radar time stamp in usecs on both sides
- * TODO: this might need to be HW-dependent
- */
-#define PRI_TOLERANCE  16
-
 /**
  * struct radar_types - contains array of patterns defined for one DFS domain
  * @domain: DFS regulatory domain
index 25a43d632f908dfe72fabd2a2bc6f92f59520a35..92be3530e9b5e4a36538b10594aab5f39a9c2847 100644 (file)
 #include <linux/list.h>
 #include <linux/nl80211.h>
 
+/* tolerated deviation of radar time stamp in usecs on both sides
+ * TODO: this might need to be HW-dependent
+ */
+#define PRI_TOLERANCE  16
+
 /**
  * struct ath_dfs_pool_stats - DFS Statistics for global pools
  */
index cc5c592fc4c007cb7fd0fc8c6c8d05427b274123..05b0464c6b92c35fb7ccf30c66578450e15d4e68 100644 (file)
@@ -25,6 +25,9 @@ struct ath_dfs_pool_stats global_dfs_pool_stats = {};
 
 #define DFS_POOL_STAT_INC(c) (global_dfs_pool_stats.c++)
 #define DFS_POOL_STAT_DEC(c) (global_dfs_pool_stats.c--)
+#define GET_PRI_TO_USE(MIN, MAX, RUNTIME) \
+       (MIN + PRI_TOLERANCE == MAX - PRI_TOLERANCE ? \
+       MIN + PRI_TOLERANCE : RUNTIME)
 
 /**
  * struct pulse_elem - elements in pulse queue
@@ -243,7 +246,8 @@ static bool pseq_handler_create_sequences(struct pri_detector *pde,
                ps.count_falses = 0;
                ps.first_ts = p->ts;
                ps.last_ts = ts;
-               ps.pri = ts - p->ts;
+               ps.pri = GET_PRI_TO_USE(pde->rs->pri_min,
+                       pde->rs->pri_max, ts - p->ts);
                ps.dur = ps.pri * (pde->rs->ppb - 1)
                                + 2 * pde->rs->max_pri_tolerance;