diff options
author | Janusz Dziedzic <janusz.dziedzic@tieto.com> | 2013-10-14 05:06:04 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2013-10-18 14:03:54 -0400 |
commit | d265214b614aac62cdb8baed7ed3d77494cc9bdc (patch) | |
tree | bb67a739092baf61e7cea155e1c53801bb1cce1d /drivers/net | |
parent | 95a5992e43046104ca92c6fb93a80d140d1aa7ce (diff) |
ath9k: dfs move ath_dfs_pool_stats
Move ath_dfs_pool_stats to dfs_pattern_detector
code to be not specyfic only for ath9k.
Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com>
Reviewed-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/wireless/ath/ath9k/dfs_debug.c | 9 | ||||
-rw-r--r-- | drivers/net/wireless/ath/ath9k/dfs_debug.h | 16 | ||||
-rw-r--r-- | drivers/net/wireless/ath/ath9k/dfs_pattern_detector.c | 7 | ||||
-rw-r--r-- | drivers/net/wireless/ath/ath9k/dfs_pattern_detector.h | 14 | ||||
-rw-r--r-- | drivers/net/wireless/ath/ath9k/dfs_pri_detector.c | 8 | ||||
-rw-r--r-- | drivers/net/wireless/ath/ath9k/dfs_pri_detector.h | 2 |
6 files changed, 35 insertions, 21 deletions
diff --git a/drivers/net/wireless/ath/ath9k/dfs_debug.c b/drivers/net/wireless/ath/ath9k/dfs_debug.c index 821599135d8a..990c37630725 100644 --- a/drivers/net/wireless/ath/ath9k/dfs_debug.c +++ b/drivers/net/wireless/ath/ath9k/dfs_debug.c | |||
@@ -20,16 +20,16 @@ | |||
20 | 20 | ||
21 | #include "ath9k.h" | 21 | #include "ath9k.h" |
22 | #include "dfs_debug.h" | 22 | #include "dfs_debug.h" |
23 | #include "dfs_pattern_detector.h" | ||
23 | 24 | ||
24 | 25 | static struct ath_dfs_pool_stats dfs_pool_stats = { 0 }; | |
25 | struct ath_dfs_pool_stats global_dfs_pool_stats = { 0 }; | ||
26 | 26 | ||
27 | #define ATH9K_DFS_STAT(s, p) \ | 27 | #define ATH9K_DFS_STAT(s, p) \ |
28 | len += scnprintf(buf + len, size - len, "%28s : %10u\n", s, \ | 28 | len += scnprintf(buf + len, size - len, "%28s : %10u\n", s, \ |
29 | sc->debug.stats.dfs_stats.p); | 29 | sc->debug.stats.dfs_stats.p); |
30 | #define ATH9K_DFS_POOL_STAT(s, p) \ | 30 | #define ATH9K_DFS_POOL_STAT(s, p) \ |
31 | len += scnprintf(buf + len, size - len, "%28s : %10u\n", s, \ | 31 | len += scnprintf(buf + len, size - len, "%28s : %10u\n", s, \ |
32 | global_dfs_pool_stats.p); | 32 | dfs_pool_stats.p); |
33 | 33 | ||
34 | static ssize_t read_file_dfs(struct file *file, char __user *user_buf, | 34 | static ssize_t read_file_dfs(struct file *file, char __user *user_buf, |
35 | size_t count, loff_t *ppos) | 35 | size_t count, loff_t *ppos) |
@@ -44,6 +44,9 @@ static ssize_t read_file_dfs(struct file *file, char __user *user_buf, | |||
44 | if (buf == NULL) | 44 | if (buf == NULL) |
45 | return -ENOMEM; | 45 | return -ENOMEM; |
46 | 46 | ||
47 | if (sc->dfs_detector) | ||
48 | dfs_pool_stats = sc->dfs_detector->get_stats(sc->dfs_detector); | ||
49 | |||
47 | len += scnprintf(buf + len, size - len, "DFS support for " | 50 | len += scnprintf(buf + len, size - len, "DFS support for " |
48 | "macVersion = 0x%x, macRev = 0x%x: %s\n", | 51 | "macVersion = 0x%x, macRev = 0x%x: %s\n", |
49 | hw_ver->macVersion, hw_ver->macRev, | 52 | hw_ver->macVersion, hw_ver->macRev, |
diff --git a/drivers/net/wireless/ath/ath9k/dfs_debug.h b/drivers/net/wireless/ath/ath9k/dfs_debug.h index e36810a4b585..0a7ddf4c88c9 100644 --- a/drivers/net/wireless/ath/ath9k/dfs_debug.h +++ b/drivers/net/wireless/ath/ath9k/dfs_debug.h | |||
@@ -51,25 +51,11 @@ struct ath_dfs_stats { | |||
51 | u32 radar_detected; | 51 | u32 radar_detected; |
52 | }; | 52 | }; |
53 | 53 | ||
54 | /** | ||
55 | * struct ath_dfs_pool_stats - DFS Statistics for global pools | ||
56 | */ | ||
57 | struct ath_dfs_pool_stats { | ||
58 | u32 pool_reference; | ||
59 | u32 pulse_allocated; | ||
60 | u32 pulse_alloc_error; | ||
61 | u32 pulse_used; | ||
62 | u32 pseq_allocated; | ||
63 | u32 pseq_alloc_error; | ||
64 | u32 pseq_used; | ||
65 | }; | ||
66 | #if defined(CONFIG_ATH9K_DFS_DEBUGFS) | 54 | #if defined(CONFIG_ATH9K_DFS_DEBUGFS) |
67 | 55 | ||
68 | #define DFS_STAT_INC(sc, c) (sc->debug.stats.dfs_stats.c++) | 56 | #define DFS_STAT_INC(sc, c) (sc->debug.stats.dfs_stats.c++) |
69 | void ath9k_dfs_init_debug(struct ath_softc *sc); | 57 | void ath9k_dfs_init_debug(struct ath_softc *sc); |
70 | 58 | ||
71 | #define DFS_POOL_STAT_INC(c) (global_dfs_pool_stats.c++) | ||
72 | #define DFS_POOL_STAT_DEC(c) (global_dfs_pool_stats.c--) | ||
73 | extern struct ath_dfs_pool_stats global_dfs_pool_stats; | 59 | extern struct ath_dfs_pool_stats global_dfs_pool_stats; |
74 | 60 | ||
75 | #else | 61 | #else |
@@ -77,8 +63,6 @@ extern struct ath_dfs_pool_stats global_dfs_pool_stats; | |||
77 | #define DFS_STAT_INC(sc, c) do { } while (0) | 63 | #define DFS_STAT_INC(sc, c) do { } while (0) |
78 | static inline void ath9k_dfs_init_debug(struct ath_softc *sc) { } | 64 | static inline void ath9k_dfs_init_debug(struct ath_softc *sc) { } |
79 | 65 | ||
80 | #define DFS_POOL_STAT_INC(c) do { } while (0) | ||
81 | #define DFS_POOL_STAT_DEC(c) do { } while (0) | ||
82 | #endif /* CONFIG_ATH9K_DFS_DEBUGFS */ | 66 | #endif /* CONFIG_ATH9K_DFS_DEBUGFS */ |
83 | 67 | ||
84 | #endif /* ATH9K_DFS_DEBUG_H */ | 68 | #endif /* ATH9K_DFS_DEBUG_H */ |
diff --git a/drivers/net/wireless/ath/ath9k/dfs_pattern_detector.c b/drivers/net/wireless/ath/ath9k/dfs_pattern_detector.c index c839a78812d4..b0dcd1b72f31 100644 --- a/drivers/net/wireless/ath/ath9k/dfs_pattern_detector.c +++ b/drivers/net/wireless/ath/ath9k/dfs_pattern_detector.c | |||
@@ -253,6 +253,12 @@ dpd_add_pulse(struct dfs_pattern_detector *dpd, struct pulse_event *event) | |||
253 | return false; | 253 | return false; |
254 | } | 254 | } |
255 | 255 | ||
256 | static struct ath_dfs_pool_stats | ||
257 | dpd_get_stats(struct dfs_pattern_detector *dpd) | ||
258 | { | ||
259 | return global_dfs_pool_stats; | ||
260 | } | ||
261 | |||
256 | static bool dpd_set_domain(struct dfs_pattern_detector *dpd, | 262 | static bool dpd_set_domain(struct dfs_pattern_detector *dpd, |
257 | enum nl80211_dfs_regions region) | 263 | enum nl80211_dfs_regions region) |
258 | { | 264 | { |
@@ -283,6 +289,7 @@ static struct dfs_pattern_detector default_dpd = { | |||
283 | .exit = dpd_exit, | 289 | .exit = dpd_exit, |
284 | .set_dfs_domain = dpd_set_domain, | 290 | .set_dfs_domain = dpd_set_domain, |
285 | .add_pulse = dpd_add_pulse, | 291 | .add_pulse = dpd_add_pulse, |
292 | .get_stats = dpd_get_stats, | ||
286 | .region = NL80211_DFS_UNSET, | 293 | .region = NL80211_DFS_UNSET, |
287 | }; | 294 | }; |
288 | 295 | ||
diff --git a/drivers/net/wireless/ath/ath9k/dfs_pattern_detector.h b/drivers/net/wireless/ath/ath9k/dfs_pattern_detector.h index b09946fed938..9c752977eeff 100644 --- a/drivers/net/wireless/ath/ath9k/dfs_pattern_detector.h +++ b/drivers/net/wireless/ath/ath9k/dfs_pattern_detector.h | |||
@@ -22,6 +22,19 @@ | |||
22 | #include <linux/nl80211.h> | 22 | #include <linux/nl80211.h> |
23 | 23 | ||
24 | /** | 24 | /** |
25 | * struct ath_dfs_pool_stats - DFS Statistics for global pools | ||
26 | */ | ||
27 | struct ath_dfs_pool_stats { | ||
28 | u32 pool_reference; | ||
29 | u32 pulse_allocated; | ||
30 | u32 pulse_alloc_error; | ||
31 | u32 pulse_used; | ||
32 | u32 pseq_allocated; | ||
33 | u32 pseq_alloc_error; | ||
34 | u32 pseq_used; | ||
35 | }; | ||
36 | |||
37 | /** | ||
25 | * struct pulse_event - describing pulses reported by PHY | 38 | * struct pulse_event - describing pulses reported by PHY |
26 | * @ts: pulse time stamp in us | 39 | * @ts: pulse time stamp in us |
27 | * @freq: channel frequency in MHz | 40 | * @freq: channel frequency in MHz |
@@ -77,6 +90,7 @@ struct dfs_pattern_detector { | |||
77 | bool (*add_pulse)(struct dfs_pattern_detector *dpd, | 90 | bool (*add_pulse)(struct dfs_pattern_detector *dpd, |
78 | struct pulse_event *pe); | 91 | struct pulse_event *pe); |
79 | 92 | ||
93 | struct ath_dfs_pool_stats (*get_stats)(struct dfs_pattern_detector *dpd); | ||
80 | enum nl80211_dfs_regions region; | 94 | enum nl80211_dfs_regions region; |
81 | u8 num_radar_types; | 95 | u8 num_radar_types; |
82 | u64 last_pulse_ts; | 96 | u64 last_pulse_ts; |
diff --git a/drivers/net/wireless/ath/ath9k/dfs_pri_detector.c b/drivers/net/wireless/ath/ath9k/dfs_pri_detector.c index c718fc379a10..17b5bf9fd6a1 100644 --- a/drivers/net/wireless/ath/ath9k/dfs_pri_detector.c +++ b/drivers/net/wireless/ath/ath9k/dfs_pri_detector.c | |||
@@ -17,10 +17,14 @@ | |||
17 | #include <linux/slab.h> | 17 | #include <linux/slab.h> |
18 | #include <linux/spinlock.h> | 18 | #include <linux/spinlock.h> |
19 | 19 | ||
20 | #include "ath9k.h" | 20 | #include "../ath.h" |
21 | #include "dfs_pattern_detector.h" | 21 | #include "dfs_pattern_detector.h" |
22 | #include "dfs_pri_detector.h" | 22 | #include "dfs_pri_detector.h" |
23 | #include "dfs_debug.h" | 23 | |
24 | struct ath_dfs_pool_stats global_dfs_pool_stats = {}; | ||
25 | |||
26 | #define DFS_POOL_STAT_INC(c) (global_dfs_pool_stats.c++) | ||
27 | #define DFS_POOL_STAT_DEC(c) (global_dfs_pool_stats.c--) | ||
24 | 28 | ||
25 | /** | 29 | /** |
26 | * struct pulse_elem - elements in pulse queue | 30 | * struct pulse_elem - elements in pulse queue |
diff --git a/drivers/net/wireless/ath/ath9k/dfs_pri_detector.h b/drivers/net/wireless/ath/ath9k/dfs_pri_detector.h index 723962d1abc6..79f0fff4d1e6 100644 --- a/drivers/net/wireless/ath/ath9k/dfs_pri_detector.h +++ b/drivers/net/wireless/ath/ath9k/dfs_pri_detector.h | |||
@@ -19,6 +19,8 @@ | |||
19 | 19 | ||
20 | #include <linux/list.h> | 20 | #include <linux/list.h> |
21 | 21 | ||
22 | extern struct ath_dfs_pool_stats global_dfs_pool_stats; | ||
23 | |||
22 | /** | 24 | /** |
23 | * struct pri_sequence - sequence of pulses matching one PRI | 25 | * struct pri_sequence - sequence of pulses matching one PRI |
24 | * @head: list_head | 26 | * @head: list_head |