xref: /freebsd/sys/net80211/ieee80211_dfs.h (revision 95ee2897e98f5d444f26ed2334cc7c439f9c16c6)
1b032f27cSSam Leffler /*-
2*4d846d26SWarner Losh  * SPDX-License-Identifier: BSD-2-Clause
3fe267a55SPedro F. Giffuni  *
4b032f27cSSam Leffler  * Copyright (c) 2007-2008 Sam Leffler, Errno Consulting
5b032f27cSSam Leffler  * All rights reserved.
6b032f27cSSam Leffler  *
7b032f27cSSam Leffler  * Redistribution and use in source and binary forms, with or without
8b032f27cSSam Leffler  * modification, are permitted provided that the following conditions
9b032f27cSSam Leffler  * are met:
10b032f27cSSam Leffler  * 1. Redistributions of source code must retain the above copyright
11b032f27cSSam Leffler  *    notice, this list of conditions and the following disclaimer.
12b032f27cSSam Leffler  * 2. Redistributions in binary form must reproduce the above copyright
13b032f27cSSam Leffler  *    notice, this list of conditions and the following disclaimer in the
14b032f27cSSam Leffler  *    documentation and/or other materials provided with the distribution.
15b032f27cSSam Leffler  *
16b032f27cSSam Leffler  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17b032f27cSSam Leffler  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18b032f27cSSam Leffler  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19b032f27cSSam Leffler  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20b032f27cSSam Leffler  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21b032f27cSSam Leffler  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22b032f27cSSam Leffler  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23b032f27cSSam Leffler  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24b032f27cSSam Leffler  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25b032f27cSSam Leffler  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26b032f27cSSam Leffler  */
27b032f27cSSam Leffler #ifndef _NET80211_IEEE80211_DFS_H_
28b032f27cSSam Leffler #define _NET80211_IEEE80211_DFS_H_
29b032f27cSSam Leffler 
30b032f27cSSam Leffler /*
31b032f27cSSam Leffler  * 802.11h/DFS definitions.
32b032f27cSSam Leffler  */
33b032f27cSSam Leffler 
3462f8a13aSAdrian Chadd typedef enum {
3562f8a13aSAdrian Chadd 	DFS_DBG_NONE		= 0,
3662f8a13aSAdrian Chadd 	DFS_DBG_NONOL		= 1,
3762f8a13aSAdrian Chadd 	DFS_DBG_NOCSANOL	= 2
3862f8a13aSAdrian Chadd } dfs_debug_t;
3962f8a13aSAdrian Chadd 
40b032f27cSSam Leffler struct ieee80211_dfs_state {
4131378b1cSSam Leffler 	int		nol_event[IEEE80211_CHAN_MAX];
42b032f27cSSam Leffler 	struct callout	nol_timer;		/* NOL list processing */
43b032f27cSSam Leffler 	struct callout	cac_timer;		/* CAC timer */
44b032f27cSSam Leffler 	struct timeval	lastevent;		/* time of last radar event */
45b032f27cSSam Leffler 	int		cureps;			/* current events/second */
46b032f27cSSam Leffler 	const struct ieee80211_channel *lastchan;/* chan w/ last radar event */
47b032f27cSSam Leffler 	struct ieee80211_channel *newchan;	/* chan selected next */
48b032f27cSSam Leffler };
49b032f27cSSam Leffler 
50b032f27cSSam Leffler void	ieee80211_dfs_attach(struct ieee80211com *);
51b032f27cSSam Leffler void	ieee80211_dfs_detach(struct ieee80211com *);
52b032f27cSSam Leffler 
53b032f27cSSam Leffler void	ieee80211_dfs_reset(struct ieee80211com *);
54b032f27cSSam Leffler 
55b032f27cSSam Leffler void	ieee80211_dfs_cac_start(struct ieee80211vap *);
56b032f27cSSam Leffler void	ieee80211_dfs_cac_stop(struct ieee80211vap *);
57b032f27cSSam Leffler void	ieee80211_dfs_cac_clear(struct ieee80211com *,
58b032f27cSSam Leffler 		const struct ieee80211_channel *);
59b032f27cSSam Leffler 
60b032f27cSSam Leffler void	ieee80211_dfs_notify_radar(struct ieee80211com *,
61b032f27cSSam Leffler 		struct ieee80211_channel *);
62b032f27cSSam Leffler struct ieee80211_channel *ieee80211_dfs_pickchannel(struct ieee80211com *);
63b032f27cSSam Leffler #endif /* _NET80211_IEEE80211_DFS_H_ */
64