162306a36Sopenharmony_ci/*
262306a36Sopenharmony_ci * Copyright (c) 2008-2011 Atheros Communications Inc.
362306a36Sopenharmony_ci * Copyright (c) 2011 Neratec Solutions AG
462306a36Sopenharmony_ci *
562306a36Sopenharmony_ci * Permission to use, copy, modify, and/or distribute this software for any
662306a36Sopenharmony_ci * purpose with or without fee is hereby granted, provided that the above
762306a36Sopenharmony_ci * copyright notice and this permission notice appear in all copies.
862306a36Sopenharmony_ci *
962306a36Sopenharmony_ci * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
1062306a36Sopenharmony_ci * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
1162306a36Sopenharmony_ci * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
1262306a36Sopenharmony_ci * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
1362306a36Sopenharmony_ci * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
1462306a36Sopenharmony_ci * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
1562306a36Sopenharmony_ci * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
1662306a36Sopenharmony_ci */
1762306a36Sopenharmony_ci
1862306a36Sopenharmony_ci
1962306a36Sopenharmony_ci#ifndef ATH9K_DFS_DEBUG_H
2062306a36Sopenharmony_ci#define ATH9K_DFS_DEBUG_H
2162306a36Sopenharmony_ci
2262306a36Sopenharmony_ci#include "hw.h"
2362306a36Sopenharmony_ci
2462306a36Sopenharmony_cistruct ath_softc;
2562306a36Sopenharmony_ci
2662306a36Sopenharmony_ci/**
2762306a36Sopenharmony_ci * struct ath_dfs_stats - DFS Statistics per wiphy
2862306a36Sopenharmony_ci * @pulses_total:     pulses reported by HW
2962306a36Sopenharmony_ci * @pulses_no_dfs:    pulses wrongly reported as DFS
3062306a36Sopenharmony_ci * @pulses_detected:  pulses detected so far
3162306a36Sopenharmony_ci * @datalen_discards: pulses discarded due to invalid datalen
3262306a36Sopenharmony_ci * @rssi_discards:    pulses discarded due to invalid RSSI
3362306a36Sopenharmony_ci * @bwinfo_discards:  pulses discarded due to invalid BW info
3462306a36Sopenharmony_ci * @pri_phy_errors:   pulses reported for primary channel
3562306a36Sopenharmony_ci * @ext_phy_errors:   pulses reported for extension channel
3662306a36Sopenharmony_ci * @dc_phy_errors:    pulses reported for primary + extension channel
3762306a36Sopenharmony_ci * @pulses_processed: pulses forwarded to detector
3862306a36Sopenharmony_ci * @radar_detected:   radars detected
3962306a36Sopenharmony_ci */
4062306a36Sopenharmony_cistruct ath_dfs_stats {
4162306a36Sopenharmony_ci	/* pulse stats */
4262306a36Sopenharmony_ci	u32 pulses_total;
4362306a36Sopenharmony_ci	u32 pulses_no_dfs;
4462306a36Sopenharmony_ci	u32 pulses_detected;
4562306a36Sopenharmony_ci	u32 datalen_discards;
4662306a36Sopenharmony_ci	u32 rssi_discards;
4762306a36Sopenharmony_ci	u32 bwinfo_discards;
4862306a36Sopenharmony_ci	u32 pri_phy_errors;
4962306a36Sopenharmony_ci	u32 ext_phy_errors;
5062306a36Sopenharmony_ci	u32 dc_phy_errors;
5162306a36Sopenharmony_ci	/* pattern detection stats */
5262306a36Sopenharmony_ci	u32 pulses_processed;
5362306a36Sopenharmony_ci	u32 radar_detected;
5462306a36Sopenharmony_ci};
5562306a36Sopenharmony_ci
5662306a36Sopenharmony_ci#if defined(CONFIG_ATH9K_DFS_DEBUGFS)
5762306a36Sopenharmony_ci
5862306a36Sopenharmony_ci#define DFS_STAT_INC(sc, c) (sc->debug.stats.dfs_stats.c++)
5962306a36Sopenharmony_civoid ath9k_dfs_init_debug(struct ath_softc *sc);
6062306a36Sopenharmony_ci
6162306a36Sopenharmony_ciextern struct ath_dfs_pool_stats global_dfs_pool_stats;
6262306a36Sopenharmony_ci
6362306a36Sopenharmony_ci#else
6462306a36Sopenharmony_ci
6562306a36Sopenharmony_ci#define DFS_STAT_INC(sc, c) do { } while (0)
6662306a36Sopenharmony_cistatic inline void ath9k_dfs_init_debug(struct ath_softc *sc) { }
6762306a36Sopenharmony_ci
6862306a36Sopenharmony_ci#endif /* CONFIG_ATH9K_DFS_DEBUGFS */
6962306a36Sopenharmony_ci
7062306a36Sopenharmony_ci#endif /* ATH9K_DFS_DEBUG_H */
71