Commit d265214b authored by Janusz Dziedzic's avatar Janusz Dziedzic Committed by John W. Linville

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: default avatarJanusz Dziedzic <janusz.dziedzic@tieto.com>
Reviewed-by: default avatarLuis R. Rodriguez <mcgrof@do-not-panic.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 95a5992e
......@@ -20,16 +20,16 @@
#include "ath9k.h"
#include "dfs_debug.h"
#include "dfs_pattern_detector.h"
struct ath_dfs_pool_stats global_dfs_pool_stats = { 0 };
static struct ath_dfs_pool_stats dfs_pool_stats = { 0 };
#define ATH9K_DFS_STAT(s, p) \
len += scnprintf(buf + len, size - len, "%28s : %10u\n", s, \
sc->debug.stats.dfs_stats.p);
#define ATH9K_DFS_POOL_STAT(s, p) \
len += scnprintf(buf + len, size - len, "%28s : %10u\n", s, \
global_dfs_pool_stats.p);
dfs_pool_stats.p);
static ssize_t read_file_dfs(struct file *file, char __user *user_buf,
size_t count, loff_t *ppos)
......@@ -44,6 +44,9 @@ static ssize_t read_file_dfs(struct file *file, char __user *user_buf,
if (buf == NULL)
return -ENOMEM;
if (sc->dfs_detector)
dfs_pool_stats = sc->dfs_detector->get_stats(sc->dfs_detector);
len += scnprintf(buf + len, size - len, "DFS support for "
"macVersion = 0x%x, macRev = 0x%x: %s\n",
hw_ver->macVersion, hw_ver->macRev,
......
......@@ -51,25 +51,11 @@ struct ath_dfs_stats {
u32 radar_detected;
};
/**
* struct ath_dfs_pool_stats - DFS Statistics for global pools
*/
struct ath_dfs_pool_stats {
u32 pool_reference;
u32 pulse_allocated;
u32 pulse_alloc_error;
u32 pulse_used;
u32 pseq_allocated;
u32 pseq_alloc_error;
u32 pseq_used;
};
#if defined(CONFIG_ATH9K_DFS_DEBUGFS)
#define DFS_STAT_INC(sc, c) (sc->debug.stats.dfs_stats.c++)
void ath9k_dfs_init_debug(struct ath_softc *sc);
#define DFS_POOL_STAT_INC(c) (global_dfs_pool_stats.c++)
#define DFS_POOL_STAT_DEC(c) (global_dfs_pool_stats.c--)
extern struct ath_dfs_pool_stats global_dfs_pool_stats;
#else
......@@ -77,8 +63,6 @@ extern struct ath_dfs_pool_stats global_dfs_pool_stats;
#define DFS_STAT_INC(sc, c) do { } while (0)
static inline void ath9k_dfs_init_debug(struct ath_softc *sc) { }
#define DFS_POOL_STAT_INC(c) do { } while (0)
#define DFS_POOL_STAT_DEC(c) do { } while (0)
#endif /* CONFIG_ATH9K_DFS_DEBUGFS */
#endif /* ATH9K_DFS_DEBUG_H */
......@@ -253,6 +253,12 @@ dpd_add_pulse(struct dfs_pattern_detector *dpd, struct pulse_event *event)
return false;
}
static struct ath_dfs_pool_stats
dpd_get_stats(struct dfs_pattern_detector *dpd)
{
return global_dfs_pool_stats;
}
static bool dpd_set_domain(struct dfs_pattern_detector *dpd,
enum nl80211_dfs_regions region)
{
......@@ -283,6 +289,7 @@ static struct dfs_pattern_detector default_dpd = {
.exit = dpd_exit,
.set_dfs_domain = dpd_set_domain,
.add_pulse = dpd_add_pulse,
.get_stats = dpd_get_stats,
.region = NL80211_DFS_UNSET,
};
......
......@@ -21,6 +21,19 @@
#include <linux/list.h>
#include <linux/nl80211.h>
/**
* struct ath_dfs_pool_stats - DFS Statistics for global pools
*/
struct ath_dfs_pool_stats {
u32 pool_reference;
u32 pulse_allocated;
u32 pulse_alloc_error;
u32 pulse_used;
u32 pseq_allocated;
u32 pseq_alloc_error;
u32 pseq_used;
};
/**
* struct pulse_event - describing pulses reported by PHY
* @ts: pulse time stamp in us
......@@ -77,6 +90,7 @@ struct dfs_pattern_detector {
bool (*add_pulse)(struct dfs_pattern_detector *dpd,
struct pulse_event *pe);
struct ath_dfs_pool_stats (*get_stats)(struct dfs_pattern_detector *dpd);
enum nl80211_dfs_regions region;
u8 num_radar_types;
u64 last_pulse_ts;
......
......@@ -17,10 +17,14 @@
#include <linux/slab.h>
#include <linux/spinlock.h>
#include "ath9k.h"
#include "../ath.h"
#include "dfs_pattern_detector.h"
#include "dfs_pri_detector.h"
#include "dfs_debug.h"
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--)
/**
* struct pulse_elem - elements in pulse queue
......
......@@ -19,6 +19,8 @@
#include <linux/list.h>
extern struct ath_dfs_pool_stats global_dfs_pool_stats;
/**
* struct pri_sequence - sequence of pulses matching one PRI
* @head: list_head
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment